Paper Trading Expired Contracts #1383
-
{'component': 'ibFuturesContractData', 'instrument_code': 'TOPIX', 'contract_date': '20240600'} Error! Cannot find active contract! Expired? interactive_update_roll_status.py not executed? I have indeed ran interactive_update_roll_status, but the priced contract is not moving forward to 202409 (from 202406). Also the system still believes I am holding 3 positions in the expired contract. Do I need to force the priced contract forward outside of interactive_update_roll_status or manually delete the positions from the database? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
This can mean one of two things: If there is a position break (IB shows no position, but pysystemtrade does), then you would typically create a balance trade via interactive_order_stack to correct it. If there is no position break (IB and pysystemtrade both show a position)... I would not recommend deleting positions from the database. I'm not sure what you mean by forcing the roll, but that sounds risky too. While manual intervention is occasionally necessary, there's a risk of getting yourself into an even worse situation. I would try to use the tools that are available to resolve these issues first. |
Beta Was this translation helpful? Give feedback.
-
Sounds like the step you missed was to change the roll status around the time of the ideal roll date. Nothing happens automatically, you have to take action for instruments where you hold a position. Everything you need to know is in the docs, but they kind of assume you have traded futures manually beforehand. As a contract approaches it's ideal roll date, you need to change the roll status if you hold a position. Force or Force Outright for liquid contracts, Passive or No Open otherwise. Once you no longer hold a position in the expiring contract, then you are able to set to Roll Adjusted - as you would for an instrument where you have no position. I'd recommend running interactive_update_roll_status at least every other day |
Beta Was this translation helpful? Give feedback.
-
Thank you so much for the prompt replies. Next time I will use interactive_order_stack. I did not see that script! I see now it is option 13 in interactive_order_stack and it even includes an explanation! Your choice? 13 |
Beta Was this translation helpful? Give feedback.
This can mean one of two things:
If there is a position break (IB shows no position, but pysystemtrade does), then you would typically create a balance trade via interactive_order_stack to correct it.
If there is no position break (IB and pysystemtrade both show a position)...
I'm not familiar with IB's paper trading, but this can occur in live trading too, when you hold a cash-settled contract until expiry. When this occurs, IB will continue to show the position in the expired contract for a few days (probably waiting for final settlement to occur). Then the position will go away, and you'll be in the same…