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
×
×
  • Create New...
us