box spread utility for interactive brokers
Project description
ibkrbox
Constructs a Box Spread combo order for SPX or ES futures option, only required arguments are amount you want to lend or borrow , and for how many months.
This utility will automatically look up current treasury rates, and add .30 to get the yield rate. This will be used to calculate limit price. rate or limit price can be overridden as needed.
It can also automatically calculate the right strikes and spread, with approximate expiry for given duration. All of these can be overridden as needed.
This utility is easy to install and use with existing IBKR TWS or gateway session. Just make sure to enable API access in the GUI of IBKR TWS or gateway.
Installation
pip install ibkrbox
Usage
ibkrbox -h
1. construct a combo SPX Box Spread lending for 50K, duration 4 months (use "--execute" option to send the order)
ibkrbox -a 50000 -m 4
2. same as above but using Options on ES Futures (use "--execute" option to send the order)
ibkrbox -a 50000 -m 4 --es
3. construct a combo SPX Box Spread borrowing for 50K, duration 4 months (use "--execute" option to send the order)
ibkrbox -a 50000 -m 4 --short
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.