Majoka
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Community Tutorials
Store
Posts posted by Majoka
-
-
Hi, I have an API key and it seems to be working. For example, I can run the following command on my Python console and get a result.
results = ig_service.search_markets("bhp")resultsBut when I try to run this, it gives me an exception error: unauthorised.access.to.equity.exception
from trading_ig import IGServicefrom trading_ig.config import configclass config(object😞username = "xx"password = "xx"api_key = "xx"acc_type = "xx"acc_number = "xx"ig_service = IGService(config.username, config.password, config.api_key, config.acc_type)ig_service.create_session()# Fetch close prices for BHP from IG Marketsepic_id = "AA.D.BHP.CASH.IP"resolution = "D"num_points = 10response = ig_service.fetch_historical_prices_by_epic_and_num_points(epic_id, resolution, num_points)close_prices = [float(price["closePrice"]["bid"]) for price in response["prices"]]print(close_prices)open_positions = ig_service.fetch_open_positions()print("open_positions:\n%s" % open_positions)Can you please help?
Another error in fetching data.
in IG Technical Support - Platform and App Help
Posted
Hi, I have also tried the following Python code to extract data.
It gives me the following error message.
Error occurred: <html><head><title>Page Not Found</title><h3>Error 404</h3><h3>Sorry, the requested page is not available.</h3></body></html>
So basically, I am not sure how to extract price data via the API using Python.