IbEstonia is a converter which takes trade data from Interactive Brokers as an input and creates a tax report which can be easily submitted to Estonian Tax and Customs Board.
It currently supports stocks, options & dividends. See Limitations section for known issues.
NB: This project currently is experimental. It is not meant for production use yet.
- Ruby 2.0+
- Node 8.0+
- Open Interactive Brokers Account Management
- Go to Reports -> Flex Queries
- Create a new Custom Flex Query for each year since account inception
- Query Name: ib-$YEAR
- Date Period: Custom Date Range
- From Date: Beginning of $YEAR
- To Date: End of $YEAR
- Select "Trades", include all fields from "Executions"
- Select "Cash Transactions", include all fields from "Dividends" and "Withholding Tax"
- Select "Financial Instrument Information", include all fields.
- Execute and download all exports
Interactive Brokers flex queries do not provide ISIN numbers for all securities. These however are needed for the dividends report. Stocks & options report has a country field which is also inferred from ISIN number. If you don't care about these limitions (e.g. you fill them manually) then skip this part.
- Start your Trader Workstation
- Open Edit -> Global Configuration -> Api -> Settings
- Check "Enable ActiveX and Socket Clients" (feel free to keep it in Read-Only mode)
- Save
- Run
./start_isin_provider
Create a report using the confirmation data. For example, if you have data for 2015-2017 then run:
./start ib-2015.xml ib-2016.xml ib-2017.xml
- Long positions that have changed to a short position or vice versa are not displayed correctly (e.g. BUY 10 $RP, SELL 20 $RP). However closing a position and opening a new works correctly (e.g. BUY 10 $RP, SELL 10 $RP, SELL 10 $RP).
- Stock splits are not supported
- Option premiums are not included in the stock price
- Unknown: fractional shares may not work
- Unknown: one company acquiring another for money may not work
- Unknown: one company acquiring another for shares may not work
- Dividends: We use dividend report date for both report and tax withheld dates. This might not always be correct.