diff --git a/trader.go b/trader.go index 1d79936..e968714 100644 --- a/trader.go +++ b/trader.go @@ -47,7 +47,7 @@ type ArbPosition struct { LastScaleAt time.Time // when we last scaled in StartedAt time.Time ExitedAt time.Time - Status string // "open", "closed" + Status string // "entering", "open", "closed" RealizedPnl float64 ErrorLog string @@ -311,7 +311,7 @@ func (t *Trader) executeEntry(opp *ArbOpportunity, store *PriceStore, notifier * Coin: opp.Coin, AmountUSD: t.cfg.TradeAmountUSD, StartedAt: time.Now(), - Status: "open", + Status: "entering", // prevent checkExit/checkScaleIn during leg placement ScaleLevels: 0, } @@ -361,6 +361,7 @@ func (t *Trader) executeEntry(opp *ArbOpportunity, store *PriceStore, notifier * } pos.LastScaleAt = time.Now() + pos.Status = "open" // both legs placed, ready for Tick/exit logic log.Printf("[Trader] %s: Opened %s | Long %s @ %.2f Short %s @ %.2f | $%.0f", pos.Coin, pos.Direction, pos.LongLeg.Exchange, pos.LongLeg.EntryPrice,