Skip to content

Issue with Limit Order Execution During Backtesting #1338

@mojtabye

Description

@mojtabye

Hi,

First of all, I really appreciate your effort in building this great project.

I’m trying to backtest a strategy that places limit orders at three different prices. From my understanding, I need to use a combination of SimulatedExchange, cassandre.trading.bot.exchange.modes.dry=true, and @Import(TickerFluxMock::class) and this setup almost works.

However, the test runs into an issue when it places limit orders and reaches the following line, waiting for them to be executed:

Link to the line in MarketServiceBacktestingImplementation.java

I’m struggling to understand why, at this point, we expect the number of orders to be equal to the number of trades. Wouldn’t this represent an active order that hasn’t been executed yet?

On a related note, when placing a limit order, how does the simulated exchange handle its execution? In theory, it should mark the order as filled once a candle appears within the price range of the order. Is this the correct understanding, and is this behavior already implemented?

Thank you for your time and for maintaining such a solid framework.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions