Jump to content
  • 0

Access Account via REST API with Python Code


tyken

Question

Hi,

I have created a demo account so I got the username, password and api_key but I can't the python code to access my account?
I would apreciate a full python code very much.

I have tried this code:

from trading_ig import IGService
#from trading_ig.config import config  - If I use this line it says: ImportError: cannot import name 'config' from 'trading_ig.config' 

(/home/moi/anaconda3/lib/python3.9/site-packages/trading_ig/config/__init__.py)


ig_service = IGService(username, password, api_key)


account_info = ig_service.switch_account(acc_number, False) # not necessary
print(account_info)

 

But revecies the error  "KeyError: 'LOGGED_IN'

 

Link to comment

1 answer to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • image.png

  • Posts

    • Stock Market Report S&P 500,  NASDAQ 100,  RUSSELL 2000,  DAX 40,  FTSE 100,  ASX 200. Elliott Wave Technical Analysis Elliott Wave Update: Jobless Claims Thursday. Current Elliott wave ii) correction incomplete but anticipated to finish soon. Concerns of SP500 and Nasdaq being dragged down, risking Wave ii) correction to 5000 and 18,000 respectively. Waiting for potential long trade setup late Thursday or Friday morning. Overall bullish trend intact; aiming to buy new highs to capture upside potential indicated by big tech stocks. Patience is key. Video Chapters 00:00 SP 500 (SPX) 07:04 NASDAQ (NDX) 11:44 Russell 2000 (RUT) 14:26 DAX 40 (DAX) 17:35 FTSE 100 UKX (UK100) 18:33 ASX 200 (XJO) 21:55 End Analyst Peter Mathers TradingLounge™ Australian Financial Services Licence - AFSL 317817 Source: tradinglounge com  
    • Greetings Are their any developments on bringing more share option to IG? We have a few in their such as Nvidia, AMD, Netflix, but very limited for professional and day option traders, Would their be are their any more on the horizon? In addition, can I get clarification that any gains earned is still under the tax free  "gambling / speculation" wrapper ?
    • @KoketsoIGFollowing up endlessly. Any updates yet?
×
×
  • Create New...
us