- Initialize Python virtual environment
uv sync- Download IBKR Trader Work Station (TWS)
- Make sure to download the "latest" version for synchronous API support
- Download IBKR TWS API
- Make sure to download the "latest" version for synchronous API support
- Instructions for how to unpackage the download is here
- Hint: you don't need to use "sudo" on the super computer
-
Move
IBJtsfolder tosf-traderrepository root -
Run
setup.pyfile forIBJts
- Run the following commands from the root of the
sf-traderrepository
cd IBJts/source/pythonclient
python setup.py install- Test
- Run the following from the root of the
sf-traderrepository - Note: you might need to run it a few times to make sure it works
python sf_trader get-account-valueNote that all configuration for trading is in the config.yml file. This includes a parameter called data-date which should be set to the most recently completed trading day (usually yesterday) for live trading.
- Ensure all data is downloaded:
- To update universe mapping run the following from
sf-data-pipelines-quant:
python pipelines ftse backfill --database production- To backfill barra data run the following from
sf-data-pipelines-quant: - Note that this flow runs every day and should already be up to date.
python pipelines barra backfill --database production
python piplines barra update --database production- Generate portfolios
python sf_trader get-portfolio- Generate trade list (orders)
python sf_trader get-orders- Check portfolio and orders
- At this point if the active risk isn't 5% you should adjust the gamma and repeat steps 2-4 until active risk is about 5%.
python sf_trader get-portfolio-summary
python sf_trader get-orders-summary- Place orders
python sf_trader post-orders- Cancel orders
- If TWS crashes while placing orders run the following to cancel outstanding orders and then repeat step 5. Rinse and repeat until there are no more orders to place.
python sf_trader cancel-orders