GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - agusalex/ghostfolio-ibkr-sync: Sync Ghostfolio with IBKR

BranchesTags
Open more actions menu

Latest commit

 

History

68 Commits
68 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
.dockerignore
.dockerignore
 
 
.gitignore
.gitignore
 
 
Dockerfile
Dockerfile
 
 
README.md
README.md
 
 
SyncIBKR.py
SyncIBKR.py
 
 
binanceSync.py
binanceSync.py
 
 
entrypoint.sh
entrypoint.sh
 
 
main.py
main.py
 
 
mapping.yaml
mapping.yaml
 
 
pretty_print.py
pretty_print.py
 
 
requirements.txt
requirements.txt
 
 
run.sh
run.sh
 
 

Repository files navigation

Ghostfolio-Sync

Docker Hub package

Sync your Ghostfolio with IBKR ( more to come? Help is always welcome! )

Setup

IBKR

Important: When you configure your Flex Query give it:

  • Account Information: Currency
  • Cash Report: Currency, Ending Cash
  • Trades: Select All (however there is a risk new IBKR fields will cause issues) For dividends, also include:
  • Change in Dividend Accruals: Quantity, Gross Rate, Action ID, Currency, Symbol, ISIN, FIGI, Date, Fee, Code

Follow this guide to configure your Flex Queries in your Interactive Brokers account: https://web.archive.org/web/20251206220120/https://portfellow.com/how-to-configure-ib-import/

Important: If you dont want ghostfolio-sync to sync everything everytime and make it quicker, just set a shorter window for the query. Keep in mind that what was not synced by ghostfolio-sync in that period of time will be lost (ie when the window moves and content was not uploaded to ghostfolio). This can be avoided at the cost of a longer window of time and longer sync

Ghostfolio

  • Take note of your user KEY (generated upon user creation and used to login to Ghostfolio)
  • Run the following on the terminal (replace ghostfol.io with localhost or your host url if you are self-hosting):
curl -X POST -H "Content-Type: application/json" \
	-d '{ "accessToken": "YOUR-USER-KEY-GOES-HERE }' \    
	https://ghostfol.io/api/v1/auth/anonymous
  • Take note of the token {"authToken":"12cd45.... That is your GHOST_TOKEN

Run in Docker

docker run -e IBKR_ACCOUNT_ID=$IBKR_ACCOUNT_ID -e GHOST_TOKEN=YOUR_GHOST_TOKEN -e IBKR_TOKEN=YOUR-IBKR-TOKEN -e IBKR_QUERY=YOUR-IBKR-QUERY agusalex/ghostfolio-sync

In Podman

podman run -e IBKR_ACCOUNT_ID=$IBKR_ACCOUNT_ID -e GHOST_TOKEN=YOUR_GHOST_TOKEN -e IBKR_TOKEN=$IBKR_TOKEN -e IBKR_QUERY=$IBKR_QUERY -e GHOST_HOST=http://$GHOST_URL -e GHOST_CURRENCY=EUR -e GHOST_IBKR_PLATFORM=$IBKR_PLATFORM -v ./mapping.yaml:/usr/app/src/mapping.yaml:Z agusalex/ghostfolio-sync

Symbol mapping

You can specify the symbol mappings in mapping.yaml and you do not need to rebuild the container with the above mount command.

More Options

Envs Mutiple ( Comma-separated ) Description
IBKR_ACCOUNT_ID Yes Your IBKR Account ID (Example: U7649433)
IBKR_TOKEN Yes Your Token
IBKR_QUERY Yes Your Query ID
GHOST_TOKEN Yes The token for your ghostfolio account
GHOST_KEY Yes The key for your ghostfolio account, if this is used you don't need GHOST_TOKEN and vice-versa
GHOST_HOST Yes (optional) Ghostfolio Host, only add if using custom ghostfolio
GHOST_CURRENCY Yes (optional) Ghostfolio Account Currency, only applied if the account doesn't exist
GHOST_IBKR_PLATFORM Yes (optional) For self-hosted, specify the Platform ID
CRON No (optional) To run on a Cron Schedule
OPERATION Yes (optional) SYNCIBKR (default) or DELETEALL (will erase all operations of all accounts)

Configuring / Retrieving Platform ID

If you are using ghostfolio self-hosted option, you need to go into Ghostfolio and add a platform for IBKR.

Then make a request to /account to find the relevant platform ID and store it in the IBKR_PLATFORM env variable

curl "http://10.0.0.2:3333/api/v1/account" \
     -H "Authorization: Bearer $GHOST_TOKEN"

export IBKR_PLATFORM=<PUT PLATFORM ID HERE>

Contributing

  • Feel free to submit any issue or PR's you think necessary
  • If you like the work and want to buy me a coffee you are more than welcome :)

Buy Me A Coffee

About

Sync Ghostfolio with IBKR

Topics

ghostfolioibkrportfolioportfolio-site

Resources

Readme
Activity

Stars

67 stars

Watchers

2 watching

Forks

17 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.