The backend operates on a hierarchical timing model to balance responsiveness with resource efficiency.
- Scope: All users with active
TradeSessions. - Tasks:
- ROI check (if
ROI > TrailingActivationRoiPercent, move toTrailingstatus). - Trailing stop update on exchange.
- Verification of SL/TP existence.
- Stale session cleanup.
- ROI check (if
- Scope: Global market data.
- Tasks:
- Fast-path execution for strong Bayesian ML signals.
- Market data enrichment for the SignalR stream.
- Scope: Sequential per-user execution.
- Tasks:
- Macro analysis (Fear/Greed, BTC.D, FOMC dates).
- Google Gemini 1.5 Pro advisory call.
- Portfolio rebalancing (closing weak positions, opening new grids).
NetTrader uses Game Theory principles for order placement.
The system constructs a Volume Profile from historical klines. It identifies "Liquidity Walls" where significant trading volume has occurred.
- Front-running: Orders are placed 2 ticks ahead of the HVN to ensure execution before the liquidity wall is hit.
- Stop Loss: Hidden 5 ticks behind the nearest strong liquidity wall.
- Take Profit: Placed 2 ticks before the target resistance wall.
Investment is not distributed linearly. More capital is allocated to grid levels near high-volume nodes (higher probability of bounce/support) and less to low-volume areas.
- Leverage-Aware Sizing: Investment amounts are automatically clamped based on user leverage and available balance.
- Dynamic SL/TP: Calculated via Volume Profile with a safety "Hard Stop" at 1.5x the fallback percentage.
- Emergency Stop: Triggered via
/panicor when balance drops below the safety threshold. Immediately cancels all orders and closes positions withreduceOnly: true. - Daily Drawdown: Automatic pause if daily losses exceed the configured percentage.
- Key Isolation: API keys are never decrypted in the API process for display. They are only decrypted in the background worker process at the moment of exchange client instantiation.
- Encrypted Storage: AES-256-CBC with HMAC for integrity.
- Environment Separation: User keys explicitly track the
IsTestnetflag, preventing accidental live trades with testnet credentials.