Fix runner activation and order cancellation

- Change takeProfit2SizePercent from 100% to 80% to leave 5% runner
- Fix cancelAllOrders() to detect trigger orders using orderId > 0
- Trigger orders (TRIGGER_MARKET, TRIGGER_LIMIT) now properly canceled
- Trailing stop will now activate on 5% runner position
This commit is contained in:
mindesbunister
2025-10-29 15:38:47 +01:00
parent fe4d9bc954
commit 344a79a753
3 changed files with 170 additions and 7 deletions

View File

@@ -97,7 +97,7 @@ export const DEFAULT_TRADING_CONFIG: TradingConfig = {
useMarketOrders: true, // Use market orders for reliable fills
confirmationTimeout: 30000, // 30 seconds max wait
takeProfit1SizePercent: 75, // Close 75% at TP1 to lock in profit
takeProfit2SizePercent: 100, // Close remaining 25% at TP2
takeProfit2SizePercent: 80, // Close 80% of remaining 25% at TP2 (leaves 5% as runner)
}
// Supported markets on Drift Protocol