#[non_exhaustive]pub struct GridOrderUpdate {Show 57 fields
pub inst_id: String,
pub algo_id: String,
pub algo_cl_ord_id: String,
pub inst_type: String,
pub algo_ord_type: String,
pub state: String,
pub rebate_trans: Vec<RebateTrans>,
pub trigger_params: Vec<TriggerParam>,
pub max_px: NumberString,
pub min_px: NumberString,
pub grid_num: NumberString,
pub run_type: String,
pub tp_trigger_px: NumberString,
pub sl_trigger_px: NumberString,
pub trade_num: NumberString,
pub arbitrage_num: NumberString,
pub single_amt: NumberString,
pub per_min_profit_rate: NumberString,
pub per_max_profit_rate: NumberString,
pub run_px: NumberString,
pub total_pnl: NumberString,
pub pnl_ratio: NumberString,
pub investment: NumberString,
pub grid_profit: NumberString,
pub float_profit: NumberString,
pub total_annualized_rate: NumberString,
pub annualized_rate: NumberString,
pub cancel_type: String,
pub stop_type: String,
pub active_ord_num: NumberString,
pub tag: String,
pub profit_sharing_ratio: String,
pub copy_type: String,
pub trade_quote_ccy: String,
pub c_time: NumberString,
pub u_time: NumberString,
pub p_time: NumberString,
pub quote_sz: NumberString,
pub base_sz: NumberString,
pub cur_quote_sz: NumberString,
pub cur_base_sz: NumberString,
pub profit: NumberString,
pub stop_result: String,
pub direction: String,
pub base_pos: bool,
pub sz: NumberString,
pub lever: NumberString,
pub actual_lever: NumberString,
pub liq_px: NumberString,
pub ord_frozen: NumberString,
pub avail_eq: NumberString,
pub eq: NumberString,
pub tp_ratio: NumberString,
pub sl_ratio: NumberString,
pub fee: NumberString,
pub funding_fee: NumberString,
pub extra: ExtraFields,
}Expand description
Spot/contract grid-order channel row.
Returned by both grid-orders-spot and grid-orders-contract channels.
Spot-only and contract-only fields default to zero/empty when not present.
OKX docs: https://www.okx.com/docs-v5/en/#trading-bot-websocket-grid-orders-channel
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.inst_id: StringInstrument ID, e.g., BTC-USDT.
algo_id: StringOKX-assigned algo order ID.
algo_cl_ord_id: StringClient-supplied algo order ID.
inst_type: StringInstrument type, e.g., SPOT, SWAP, FUTURES.
algo_ord_type: StringAlgo order type: grid (spot grid) or contract_grid (contract grid).
state: StringCurrent state: starting, running, stopping, stopped.
Contract grid also has no_close_position.
rebate_trans: Vec<RebateTrans>Rebate transfer info.
trigger_params: Vec<TriggerParam>Trigger parameters for start/stop conditions.
max_px: NumberStringUpper price of the grid range.
min_px: NumberStringLower price of the grid range.
grid_num: NumberStringNumber of grid levels.
run_type: StringGrid spacing type: 1 = arithmetic, 2 = geometric.
tp_trigger_px: NumberStringTake-profit trigger price.
sl_trigger_px: NumberStringStop-loss trigger price.
trade_num: NumberStringNumber of trades executed.
arbitrage_num: NumberStringNumber of arbitrage cycles completed.
single_amt: NumberStringInvestment amount per grid.
per_min_profit_rate: NumberStringEstimated minimum profit margin per grid.
per_max_profit_rate: NumberStringEstimated maximum profit margin per grid.
run_px: NumberStringPrice at strategy launch.
total_pnl: NumberStringTotal profit and loss since strategy start.
pnl_ratio: NumberStringP&L ratio since strategy start.
investment: NumberStringAccumulated investment amount.
grid_profit: NumberStringProfit from completed grid cycles.
float_profit: NumberStringUnrealized (floating) P&L.
total_annualized_rate: NumberStringTotal annualized rate of return.
annualized_rate: NumberStringGrid annualized rate of return.
cancel_type: StringAlgo order stop reason code.
0 none, 1 manual, 2 take-profit, 3 stop-loss, 4 risk control,
5 delivery, 6 signal.
stop_type: StringStop type when the strategy ended.
Spot: 1 = sell base, 2 = keep base.
Contract: 1 = market close all, 2 = keep positions.
active_ord_num: NumberStringTotal count of pending sub-orders.
tag: StringOrder tag.
profit_sharing_ratio: StringProfit sharing ratio (empty for non-copy orders).
copy_type: StringCopy order type: 0 normal, 1 copy without sharing, 2 copy with sharing, 3 lead.
trade_quote_ccy: StringQuote currency used for trading.
c_time: NumberStringStrategy creation time (Unix milliseconds).
u_time: NumberStringLast update time (Unix milliseconds).
p_time: NumberStringPush time (Unix milliseconds).
quote_sz: NumberStringQuote currency investment amount (spot only).
base_sz: NumberStringBase currency investment amount (spot only).
cur_quote_sz: NumberStringCurrent quote currency holdings (spot only).
cur_base_sz: NumberStringCurrent base currency holdings (spot only).
profit: NumberStringAvailable profit in quote currency (spot only).
stop_result: StringStop result (spot only): 0 default, 1 sold at market, -1 failed to sell.
direction: StringContract grid type: long, short, or neutral (contract only).
base_pos: boolWhether a position was opened at strategy activation (contract only).
sz: NumberStringUsed margin in USDT (contract only).
lever: NumberStringLeverage (contract only).
actual_lever: NumberStringActual leverage (contract only).
liq_px: NumberStringEstimated liquidation price (contract only).
ord_frozen: NumberStringMargin frozen by pending orders (contract only).
avail_eq: NumberStringAvailable margin (contract only).
eq: NumberStringTotal equity of the strategy account (contract only).
tp_ratio: NumberStringTake-profit ratio, e.g. 0.1 = 10% (contract only).
sl_ratio: NumberStringStop-loss ratio, e.g. 0.1 = 10% (contract only).
fee: NumberStringAccumulated trading fee (contract only).
funding_fee: NumberStringAccumulated funding fee (contract only).
extra: ExtraFieldsUnrecognized fields retained for forward compatibility.
Trait Implementations§
Source§impl Clone for GridOrderUpdate
impl Clone for GridOrderUpdate
Source§fn clone(&self) -> GridOrderUpdate
fn clone(&self) -> GridOrderUpdate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more