Stale quote protection
Stop new entries when the market data feed goes quiet, so you never act on an old price.
Your price feed can go quiet for a moment. A broker drops the connection, the network stalls, or the data provider skips a beat. When that happens, the last price you see may be old. Acting on an old price is a real risk on a fast market.
Stale quote protection watches how fresh the price feed is for each symbol. When the feed goes quiet past your limit, Lune can block new entries so you do not open a position on a stale price.
This protects entries only. It never blocks exits. You can always close or reduce a position, even when the feed is stale.
How freshness is measured#
Lune tracks the time since the last real price update for the symbol you want to trade. That gap is the quote age. You set a staleness window in seconds. As long as the last update is inside the window, the feed counts as fresh.
When the quote age passes your window, the feed counts as stale. What Lune does next depends on your policy.
The safe default window is short, around 20 seconds. A short window reacts fast to a quiet feed. A longer window tolerates brief gaps but reacts slower. Start short and widen it only if a healthy feed keeps tripping the limit.
Choose a policy#
You pick how strict the check is. There are two options.
Block entriesStrictOptionalWhen the feed is stale or missing, Lune blocks every new entry for that symbol until fresh prices return. Use this when you do not want to open a position on an old price. This is the safest choice for automated entries.
Warn onlyDefaultOptionalLune records the stale feed but still lets entries through. Use this when you want a record of quiet feeds without blocking your trading. This is the default.
Why an entry was blocked#
With the block policy on, a new entry can stop for one of two reasons.
A price did arrive, but it is older than your window. Lune tells you how old the price is and what your limit is. The entry waits until fresh prices return.
No price has arrived at all for that symbol. This is treated as more dangerous than an old price, so the entry is blocked too. This often means the symbol is not subscribed or the feed has not started.
In both cases, the fix is the same. Wait for the feed to recover, or check that the symbol has a live price. Once fresh prices flow again, entries resume on their own.
If entries keep getting blocked on a healthy market, your window may be too short. Widen it a few seconds at a time until normal gaps stop tripping it.
When to use which#
Use Block entries on automated strategies and on fast markets where a stale price can cost you. Use Warn only when you watch the feed yourself and want a record without a hard stop.
Whichever policy you pick, exits stay open. You keep full control to close a position at any time.