Skip to content

Backtest::submit_order ignores OrderRequest.side (always Sell)Β #298

@simongu20070911

Description

@simongu20070911

Summary

In the Rust backtest engine, Backtest::submit_order hard-codes Side::Sell and ignores the side field in OrderRequest. Any buy submitted via submit_order becomes a sell.

Evidence

File: hftbacktest/src/backtest/mod.rs

local.submit_order(
    order.order_id,
    Side::Sell, // ignores order.side
    order.price,
    order.qty,
    order.order_type,
    order.time_in_force,
    self.cur_ts,
)?;

Impact

Critical for users calling Bot::submit_order; buy orders are flipped. submit_buy_order/submit_sell_order are unaffected.

Repro (minimal)

  1. Create an OrderRequest { side: Buy, ... }
  2. Call submit_order
  3. Inspect orders() -> the created order has side == Sell

Expected

submit_order should pass order.side to local.submit_order.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions