-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
Hello,
I'm trying for the first time you Python IG Market API code with a demo account but it raises
{"accountType":"CFD","accountInfo":{"balance":30000.0,"deposit":0.0,"profitLoss":0.0,"available":30000.0},"currencyIsoCode":"EUR","currencySymbol":"E","currentAccountId":"HIDDEN_DATA","lightstreamerEndpoint":"https://demo-apd.marketdatasystems.com","accounts":[{"accountId":"HIDDEN_DATA","accountName":"Demo-CFD","preferred":true,"accountType":"CFD"}],"clientId":"HIDDEN_DATA","timezoneOffset":1,"hasActiveDemoAccounts":true,"hasActiveLiveAccounts":true,"trailingStopsEnabled":false,"reroutingEnvironment":null,"dealingEnabled":true}
Traceback (most recent call last):
File "main.py", line 10, in <module>
account_info = ig_service.switch_account('HIDDEN_DATA', False)
File "/Users/femto/fx/femtoprojects/python/ig_markets/ig-markets-rest-api-python-library/ig_service.py", line 371, in switch_account
self.set_headers(response.headers, False)
File "/Users/femto/fx/femtoprojects/python/ig_markets/ig-markets-rest-api-python-library/ig_service.py", line 421, in set_headers
self.SECURITY_TOKEN = response_headers['X-SECURITY-TOKEN']
File "/Users/femto/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/requests/structures.py", line 54, in __getitem__
return self._store[key.lower()][1]
KeyError: 'x-security-token'
I did this
try:
self.SECURITY_TOKEN = response_headers['X-SECURITY-TOKEN']
except:
self.SECURITY_TOKEN = None
to fix it
But I don't know if that's risky.
Kind regards
Femto
Metadata
Metadata
Assignees
Labels
No labels