hftbacktest icon indicating copy to clipboard operation
hftbacktest copied to clipboard

Issue of submitting multiple orders repeatedly in IOC mode

Open 0xdaduck opened this issue 1 year ago • 2 comments

When testing my strategy, I found that there was an error in submitting multiple orders when opening a position. When printing the order details, I found that exch_timestamp was always 0. Is this a bug, or is there a problem with my data? In addition, I want to know whether the time unit in ConstantLatency is nanoseconds or something else? I am using the rust version 0.3.2.

0/Order { qty: 0.36029544226265536, leaves_qty: 0.36029544226265536, price_tick: 277550, tick_size: 0.01, side: Buy, time_in_force: IOC, exch_timestamp: 0, status: None, local_timestamp: 1724490016927000000, req: New, exec_price_tick: 0, exec_qty: 0.0, order_id: 0, maker: false, order_type: Limit }
0/Order { qty: 0.36029544226265536, leaves_qty: 0.36029544226265536, price_tick: 277550, tick_size: 0.01, side: Buy, time_in_force: IOC, exch_timestamp: 0, status: None, local_timestamp: 1724490016927000000, req: New, exec_price_tick: 0, exec_qty: 0.0, order_id: 0, maker: false, order_type: Limit }
1/Order { qty: 0.36029544226265536, leaves_qty: 0.36029544226265536, price_tick: 277550, tick_size: 0.01, side: Buy, time_in_force: IOC, exch_timestamp: 0, status: None, local_timestamp: 1724490017027000000, req: New, exec_price_tick: 0, exec_qty: 0.0, order_id: 1, maker: false, order_type: Limit }
2/Order { qty: 0.7205908845253107, leaves_qty: 0.7205908845253107, price_tick: 278331, tick_size: 0.01, side: Sell, time_in_force: IOC, exch_timestamp: 0, status: None, local_timestamp: 1724490017127000000, req: New, exec_price_tick: 0, exec_qty: 0.0, order_id: 2, maker: false, order_type: Limit }

0xdaduck avatar Aug 25 '24 16:08 0xdaduck

Please see the document. NoPartialFillExchange and PartialFillExchange The supported order types and time-in-force options vary depending on the exchange model. IOC and FOK are only supported in the PartialFillExchange.

However, liquidity-taking orders may show greater discrepancies, as they have a higher chance of causing market impact, which isn't modeled and is very difficult to simulate accurately in the backtester.

nkaz001 avatar Aug 26 '24 11:08 nkaz001

This has been added 126ccee3382a5132a650a9cd3c9e1a76ff86108d

nkaz001 avatar Aug 27 '24 14:08 nkaz001

Thanks for your help. Have a nice day

0xdaduck avatar Oct 21 '24 14:10 0xdaduck