fix(strategy): add missing order_type/sub_order_type, condition_orders, and group_tag

- Add --order-type and --sub-order-type as required flags to order strategy create
  (server requires both; omitting them caused every create call to 400)
- Remove --side from strategy create (field no longer exists in the API)
- Make --open-price optional in strategy create (matches API spec)
- Fix --gas-price in strategy create to convert gwei→wei (consistent with swap)
- Add --condition-orders and --sell-ratio-type to swap command for
  take-profit/stop-loss conditions attached after a successful swap
- Add --group-tag (LimitOrder/STMix) to order strategy list
- Add --order-type to order strategy cancel
- Add StrategyConditionOrder interface; extend SwapParams with condition_orders
  and sell_ratio_type; add order_type/sub_order_type to StrategyCreateParams;
  remove side; add order_type to StrategyCancelParams
- Update docs/cli-usage.md: fix strategy create table, add chain fee requirement
  notes (SOL requires priority_fee+tip_fee; BSC requires gas_price), add
  condition_orders example and strategy_order_id response field, add
  TRADING_BOT_UNAVAILABLE error code

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
David Lau
2026-04-02 21:57:45 +08:00
committed by GMGN.AI
co-authored by Claude Sonnet 4.6
parent dd1cb9d2e5
commit 759ab74709
3 changed files with 71 additions and 20 deletions
+13 -2
View File
@@ -85,6 +85,15 @@ export interface SwapParams {
gas_price?: string;
max_fee_per_gas?: string;
max_priority_fee_per_gas?: string;
condition_orders?: StrategyConditionOrder[];
sell_ratio_type?: string;
}
export interface StrategyConditionOrder {
order_type: string; // "profit_stop" | "loss_stop"
side: string; // "sell"
price_scale: string;
sell_ratio: string;
}
export interface StrategyCreateParams {
@@ -92,9 +101,10 @@ export interface StrategyCreateParams {
from_address: string;
base_token: string;
quote_token: string;
side: string;
open_price: string;
order_type: string;
sub_order_type: string;
check_price: string;
open_price?: string;
amount_in?: string;
amount_in_percent?: string;
limit_price_mode?: string;
@@ -118,6 +128,7 @@ export interface StrategyCancelParams {
chain: string;
from_address: string;
order_id: string;
order_type?: string;
close_sell_model?: string;
}