Skip to content

BYUSilverFund/sf-trader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

111 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Silver Fund Trading Repository

Setup

  1. Initialize Python virtual environment
uv sync
  1. Download IBKR Trader Work Station (TWS)
  • Make sure to download the "latest" version for synchronous API support
  1. 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
  1. Move IBJts folder to sf-trader repository root

  2. Run setup.py file for IBJts

  • Run the following commands from the root of the sf-trader repository
cd IBJts/source/pythonclient
python setup.py install
  1. Test
  • Run the following from the root of the sf-trader repository
  • Note: you might need to run it a few times to make sure it works
python sf_trader get-account-value

Trading

Note 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.

  1. 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
  1. Generate portfolios
python sf_trader get-portfolio
  1. Generate trade list (orders)
python sf_trader get-orders
  1. 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
  1. Place orders
python sf_trader post-orders
  1. 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

About

Algorithmic trade execution application for BYU Silver Fund Quant Team.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages