Skip to content

Commit

Permalink
evaluate staleness in isOffMarket
Browse files Browse the repository at this point in the history
  • Loading branch information
guibescos committed Dec 12, 2024
1 parent 87ae684 commit a13a439
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/limonade/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,13 @@ async function run() {
const priceInputMint = priceStore[order.state.inputMint.toString()];
const priceOutputMint = priceStore[order.state.outputMint.toString()];

if (!priceInputMint || !priceOutputMint) {
const now = Date.now();
if (
!priceInputMint ||
!priceOutputMint ||
now - priceInputMint.publishTime * 1000 > argv.priceStalenessThreshold ||
now - priceOutputMint.publishTime * 1000 > argv.priceStalenessThreshold
) {
// If we don't have price info, we will not consider it off-market
return false;
} else {
Expand Down Expand Up @@ -281,6 +287,7 @@ async function run() {
encoding: "hex",
parsed: true,
ignoreInvalidPriceIds: true,
allowUnordered: true,
}
);

Expand Down

0 comments on commit a13a439

Please sign in to comment.