IB -> Google Sheets for real time portfolio read access

Discussion in 'Interactive Brokers' started by thurston, Feb 4, 2020.

  1. thurston

    thurston

    I am trying to find a way to link IB to Google Sheets in real time. But I would like to do it all online / via APIs, i.e. no local client, python library etc, no TWS. No need to trade, just get the portfolio data in real time.

    Here is what I tried already:
    - I have a running Yahoo Finance <-> IB connection, so generally speaking, I can access my portfolio. I would need to write a scraper for IB though
    - I was playing with web flex queries, those work, but the data is only from the previous business day

    Anybody has any recommendation? Maybe also go through a 3rd party?
     
  2. d08

    d08

    API is dependent on TWS/Gateway. You can't do anything without TWS. If you mean scraping the website then that is a terrible idea, it's unreliable and much more complicated in practice than the API. Rethink your requirements.
     
  3. thurston

    thurston

    Sorry I meant (real time) scraper for Yahoo Finance.

    Yes that's what I figured, no real time access without TWS, only delayed FlexQueries.

    My last hope was on a third party plug in or website that could push it through.
     
  4. ZBZB

    ZBZB

     
  5. thurston

    thurston

    Thanks a lot ZBZB, this is a great idea, but unfortunately I own a lot of exotic stuff that is not available via the =GOOGLEFINANCE option. Exotic in my case means options, international funds/stocks etc.
     
  6. Nater

    Nater

    So, I was just searching to see if anyone else has done this yet and came across this thread. I figured it should basically just be hitting IB's REST API using an Apps Script in a Google sheet. Do you see any issue with this?
     
  7. thurston

    thurston

    From my research that would work, you just would need to have a machine running vs. a pure online version. I would appreciate if you could share the script?
     
  8. ZBZB

    ZBZB

    what is wrong with excel?
     
  9. thurston

    thurston

    I just have a lot of other mechanisms already in Google Sheets
     
  10. Nater

    Nater

    Yeah, I was incorrect and you were right, thurston. You need to run a Java gateway application to be able to connect, making Google Sheets incompatible. I think it's pretty bogus, but I'd be interested to know why they've designed their REST API to be accessed this way.

    It seems the most stream lined way of doing this would be to spin up some cloud computing instance (e.g., EC2, or maybe something even more lightweight), and have it host your gateway. Then you can connect to it via Google Sheets by having it forward your requests to the gateway. I'd guess there may be difficulties along the way, and you'd definitely want to make sure it's secure (kind of defeats the purpose of the gateway if it's public), but that could do it in theory.

    I'm shopping around for another broker with a different API now that can allow me to use Google Sheets, but if it seems IB is worth sticking with (I'm not crazy about the idea of moving brokers), I might end up running a gateway like I described above and follow up here.
     
    #10     Jun 8, 2020