Jump to content
  • 0

Error message : Exception: unauthorised.access.to.equity.exception


Majoka

Question

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")
results

But when I try to run this, it gives me an exception error: unauthorised.access.to.equity.exception

from trading_ig import IGService
from trading_ig.config import config
 
class 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 Markets
epic_id = "AA.D.BHP.CASH.IP"
resolution = "D"
num_points = 10
 
response = 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?
Link to comment

6 answers to this question

Recommended Posts

  • 0
On 14/06/2023 at 14:02, bug-or-feature said:

Your Epic is wrong, it should be "AA.D.BHP.DAILY.IP".

If you are new to the Python library, or to the IG REST API, it would be a good idea to use the IG API companion at first. It is much harder to make mistakes with the companion

Have you tried "AA.D.BHP.DAILY.IP" on the companion? I've got the same error message.

 

I remember there was very old thread saying IG does not support equity history price over APIs. Looks still the case now.

Edited by calabashsis
Link to comment
  • 0
On 15/07/2023 at 23:49, calabashsis said:

Have you tried "AA.D.BHP.DAILY.IP" on the companion? I've got the same error message.

 

I remember there was very old thread saying IG does not support equity history price over APIs. Looks still the case now.

Yes, and it works fine for both the market info and historic price endpoints:

https://demo-api.ig.com/gateway/deal/markets/AA.D.BHP.DAILY.IP

https://demo-api.ig.com/gateway/deal/prices/AA.D.BHP.DAILY.IP?resolution=DAY&max=10

 

Link to comment
  • 0
11 hours ago, bug-or-feature said:

Hi, 

  Thanks for the reply. But this is really weird:

  • market info DOES work, on the IG API companion page (the endpoints string displayed at the top of the page, under 'URL' section).
  • However, if I try "Historic Price Search" from the left pane of the page, I've got the same error code as below:
    • "errorCode": "unauthorised.access.to.equity.exception"
  •   Again, I've got identical endpoints as yours, showing at the top 'URL' field :

  

   I've tried Python version of IG REST API too (trading-ig). Exactly same behaviour.

 

  I really don't think IG offer access to Equities via the APIs  (including historic data) - however, anywhere we can confirm this???

 

 

Edited by calabashsis
Link to comment
  • 0
Quote

I really don't think IG offer access to Equities via the APIs  (including historic data) - however, anywhere we can confirm this???

You cannot use the APIs with share dealing, ISA or SIPP accounts. The APIs only work with spread betting and CFD accounts.

You can use the APIs to trade equities (and view historic prices) with spread betting or CFD accounts.

Link to comment

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

    • ASX: AMCOR PLC – AMC Elliott Elliott Wave Technical Analysis TradingLounge (1D Chart)   Greetings, Our Elliott Wave analysis today updates the Australian Stock Exchange (ASX) with AMCOR PLC – AMC. We see that AMC is about to continue pushing higher with the 3-grey wave of (3)-orange.   ASX: AMCOR PLC – AMC Elliott Wave Technical Analysis   ASX: AMCOR PLC – AMC 1D Chart (Semilog Scale) Analysis Function: Major trend (Intermediate degree, orange) Mode: Motive   Structure: Impulse Position: Wave ((iii))-navy of Wave 3-grey of Wave (3)-orange Details: The short-term outlook shows that wave ((ii))-navy looks like it has just ended and wave ((iii))-navy is opening to push higher. Invalidation point: 14.79   ASX: AMCOR PLC – AMC Elliott Wave Technical Analysis TradingLounge (4- Hour Chart) ASX: AMCOR PLC – AMC Elliott Wave Technical Analysis ASX: AMCOR PLC – AMC 4-Hour Chart Analysis Function: Major trend (Minuette degree, orange) Mode: Motive Structure: Impulse Position: Wave (i)-orange of Wave ((iii))-navy of Wave 3-grey Details: The shorter-term outlook shows that wave (i)-orange is unfolding and will soon complete, followed by wave (ii)-orange opening to push slightly lower, and then wave (iii) -orange back to push higher, aiming for a target at around 16.13. Invalidation point: 14.79   Conclusion:   Our analysis, forecast of contextual trends, and short-term outlook for ASX: AMCOR PLC – AMC aim to provide readers with insights into the current market trends and how to capitalize on them effectively. We offer specific price points that act as validation or invalidation signals for our wave count, enhancing the confidence in our perspective. By combining these factors, we strive to offer readers the most objective and professional perspective on market trends.   Technical Analyst: Hua (Shane) Cuong, CEWA-M (Master’s Designation). Source : Tradinglounge.com get trial here!  
    • Elliott Wave Analysis TradingLounge Daily Chart, Ripple/ U.S. dollar(XRPUSD) XRPUSD Elliott Wave Technical Analysis  Function: Counter Trend Mode: Corrective Structure: Triangle Position: Wave E Direction Next higher Degrees: wave 4 of Impulse Wave Cancel invalid level: 0.486 Details: Movement within the triangle pattern before the price Declines again in Wave 5. Ripple/ U.S. dollar(XRPUSD)Trading Strategy: Decreasing wave ((E)), which is the last wave in the Triangle pattern before prices re-enter the uptrend. So wait for the correction to complete to join the trend again. Ripple/ U.S. dollar(XRPUSD)Technical Indicators: The price is below the MA200 indicating a downtrend, The Wave Oscillator is a Bearish Momentum.   Elliott Wave Analysis TradingLounge H4 Chart, Ripple/ U.S. dollar(XRPUSD) XRPUSD Elliott Wave Technical Analysis  Function: Counter Trend Mode: Corrective Structure: Triangle Position: Wave E Direction Next higher Degrees: wave 4 of Impulse Wave Cancel invalid level: 0.486 Details: Movement within the triangle pattern before the price Declines again in Wave 5. Ripple/ U.S. dollar(XRPUSD)Trading Strategy: Decreasing wave ((E)), which is the last wave in the Triangle pattern before prices re-enter the uptrend. So wait for the correction to complete to join the trend again. Ripple/ U.S. dollar(XRPUSD)Technical Indicators: The price is below the MA200 indicating a downtrend, The Wave Oscillator is a Bearish Momentum.   Technical Analyst : Kittiampon Somboonsod Source : Tradinglounge.com get trial here!  
    • @KoketsoIG Thanks. How soon can we expect an update on the release date? It's been a couple of years with the same update: "we are currently waiting for the product team." We just want to make sure to have a rough estimate.
×
×
  • Create New...
us