You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when running a strategy in backtest, the "get_last_price()" method returns the candle-open price (this is good!). However, when submitting a market order, the fill price is being set to the candle-close price, which could be far away in time/price depending on the data and settings used. This is causing BackTest Profit and Loss calculations and other metrics to be very different from actual live paper trading results on occasions where orders are placed on large candles.
In some simple paper trading cases I've run, the market orders are usually filled very close to the "get_last_price()" value and I think that Lumibit Backtest should be updated to match this behavior. Additionally, this same delay seems to occur in "some" limit and stoploss orders depending on whether the trigger price occurs with in the body of the candle vs the wick of the candle.
When triggered in the body region, fill price is waiting for the close price to execute.
When triggered in the wick region, fill price is set immediately to the trigger price
Limit Order Use Case 1:
AAPL stock
Open: $100
Close: $110
High: $115
Low: $95
Limit: $90 for a sell
Meaning “I want to sell aapl, but I want at least $90”
Backtest Fill Price = $110
Ideal Fill Price = $100
Limit Order Use Case 2:
AAPL stock
Open: $100
Close: $110
High: $115
Low: $95
Limit: $112 for a sell
Backtest Fill Price = $112
Ideal Fill Price = $112
In short, why would Lumibot trigger "instantly" when filling in a wick but "wait until the close" to fill in the body?
Things to fix:
Market order should fill at/near "get_last_price()" (aka candle open)
Limit/Stop orders should fill at the trigger price in both body and wick candle regions
The text was updated successfully, but these errors were encountered:
Currently, when running a strategy in backtest, the "get_last_price()" method returns the candle-open price (this is good!). However, when submitting a market order, the fill price is being set to the candle-close price, which could be far away in time/price depending on the data and settings used. This is causing BackTest Profit and Loss calculations and other metrics to be very different from actual live paper trading results on occasions where orders are placed on large candles.
In some simple paper trading cases I've run, the market orders are usually filled very close to the "get_last_price()" value and I think that Lumibit Backtest should be updated to match this behavior. Additionally, this same delay seems to occur in "some" limit and stoploss orders depending on whether the trigger price occurs with in the body of the candle vs the wick of the candle.
body
region, fill price is waiting for theclose price
to execute.wick
region, fill price is set immediately to thetrigger price
Limit Order Use Case 1:
Backtest Fill Price = $110
Ideal Fill Price = $100
Limit Order Use Case 2:
Backtest Fill Price = $112
Ideal Fill Price = $112
In short, why would Lumibot trigger "instantly" when filling in a wick but "wait until the close" to fill in the body?
Things to fix:
The text was updated successfully, but these errors were encountered: