You are viewing a single comment's thread:
That helps a lot. When Auto flips, do you cancel any open ladder orders and reseed for the new mode, or let the old ones finish while placing a new set? Is there any cooldown or hysteresis so a couple of borderline days donāt cause back-to-back flips? Also curious how you handle slippage and dust on a breakout at the switch, and if the Mongo logs record regime timestamps so we can line up ROI around pivots.
Good questions.
When auto-mode flips (BULL ā BEAR)
Do we cancel old ladder orders?
The bot almost never leaves resting āladderā orders behind in the first place. It uses FOK (fill-or-kill) whenever book depth allows. When it must place a non-FOK order (e.g., thin book), it does a short post-check and cancels if itās still open. so thereās nothing lingering to clean up when a flip happens.
What actually happens on a flip?
The bot marks a pending flip-init and on the next cycle executes exactly one āinitialā trade for the new mode (buy for bull / sell for bear), then sets fresh targets for that mode and stops for that loop. It does not try to force-close the opposite side instantly; it just seeds the new regime and lets targets/logic manage position from there.
Cooldown / hysteresis (avoiding whipsaw)
Duplicate-flip de-dupe: The bot ignores repeat flip flags for a short window so you donāt run the flip-init twice in quick succession.
Reseed cooldown: After a flip-init (or a reseed), it sets a cooldown ā„ the loop interval so it wonāt immediately try to reseed again.
What it doesnāt do: Thereās no long, explicit āmust-stay-in-this-mode for N hours/daysā hysteresis. If your AI source flips back and forth day-to-day, the bot will still follow itājust without double-triggering within the same short window. (If you want stronger hysteresis, we can add a min-hold timer or a banded price filter and I'm thinking about this as we speak)
Slippage & dust at the moment of the switch
Slippage: Your slippage (e.g., 0.2%) is applied as safety on the min-receive / max-pay calculations so the flip-init trade wonāt fail on a breakout.
Depth-aware chunking: The bot sizes to visible book depth: if thereās enough depth it goes FOK (instant or no trade); otherwise it uses a smaller/non-FOK attempt and auto-cancels if still open after a brief delay. Thatās how it avoids getting stranded when price is jumping.
Dust guard: It treats anything below ~10% of the base lot as dust when evaluating whether itās worth seeding/adding, so you donāt write useless micro-fills at the pivot.
Can we line up ROI with regime changes?
Yes. Every order saved to OrderHistory includes:
a mode field (bull/bear) and
a createdAt timestamp.
We can also get timestamps in the control/state collections (e.g., pending flip time, state updatedAt). And your BalanceSnapshots (used by the ROI endpoint) are timestamped.
Put together, we can:
find the flip moment (first order whose mode differs from prior),
or read the flip-init timestamp from control flags,
then compare ROI windows (before vs after) using the snapshot/ROI API.
Your question got me thinking more about anti-whipsaw behavior, if we want to safeguard it more we can add:
a minimum-hold timer (e.g., must stay in the new mode ā„ X hours),
or a 3-step confirm (AI must repeat the same regime thrice (3 times) within Y minutes or hours),
or a price-band hysteresis (require price to exceed a wider band to flip back). Let me know what you think about these last three potentially added safeguards, i'm thinking they could be added pretty easily. Funny thing is I was just thinking about this same thing earlier so an update will probably be in the works on this ASAP.
View more