Copy CSV from Interactive Broker into Google Sheets
- gspread
- gspread_dataframe
- numpy
- pandas
- Login to Client Portal on interactive Brokers
- Go to Reports -> Flex Queries
- Name: Trades
- Under Section-> Tick Executions ->Click Select All -> Click Save
- Under Delivery Configuration
Accounts: Add your account
Models: Optional
Format: CSV
Include header and trailer records?: No
Include column headers?: Yes
Include section code and line descriptor? No
Period: Last 365 days\ - General Configuration
Date Format: yyyyMMdd
Time Format: HHmmss
Date/Time Seperator: ;(semi-colon)
Profit and Loss: Default
Include Canceled Trades?: No
Include Currency Rates? No
Include Audit Trial Fields? Yes
Display Account Alias in Place of Account ID?: Yes/No
Breakout by Day?: No\ - Click Continue -> Save Changes
This program uses gspread.
- Perform the authentication following the instruction in this link: https://gspread.readthedocs.io/en/latest/oauth2.html
- Create a google spreadsheet in your folder for this program.
- In the google spreadsheet, create 2 worksheet named 'data' and 'review'
- Login to Interactive Brokers-> Report -> Flex Queries -> Run the flex query
- Run the Flex Query again once you the Batch Flex Queries is completed.
- Copy the CSV file generated into /data
- Run main.py