Skip to content

pyrist/trader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trader

CLI program that uses the IBKR Client Portal Gateway a Google Sheet to automatically invest in a given portfolio.

Key files:

Prerequisites

  1. Place the IBKR Client Portal Gateway extracted folder clientportal.gw in the project root (next to trader.py). The script expects a Windows batch at clientportal.gw/bin/run.bat and config at clientportal.gw/root/conf.yaml.
  2. Create a Google Cloud OAuth client and download the credentials file as google-credentials.json into the project root. See https://docs.cloud.google.com/docs/authentication/set-up-adc-local-dev-environment for information.
  3. Create google-sheet-id.json in the project root containing your sheet id, e.g.:
    {"sheet-id":"1NEy3d-eQ_s_aUt4VNxqYHkhbW1Y67ZaRCw-NsZVWBD0"}
  4. Install Python dependencies (google-auth, google-auth-oauthlib, google-api-python-client, requests). Example: pip install google-auth google-auth-oauthlib google-api-python-client requests

Running

  1. Start the script: python trader.py
  2. The script will launch the local IBKR gateway process from clientportal.gw and prompt you to open the login URL. After you log in, press Enter when prompted.
  3. The script will:
  • Read available funds and current positions from IBKR,
  • Write 90% of available funds to the sheet
  • Update positions and validate sheet values by comparing the calculated market values in the sheet with the actual values from IBKR,
  • fetch calculated purchases,
  • then send the order requests to IBKR-

Notes

The first Google login will open a browser and save tokens to token.json for subsequent runs.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages