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

5 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
  • General Statistics

    • Total Topics
      23,004
    • Total Posts
      95,349
    • Total Members
      43,624
    • Most Online
      7,522
      10/06/21 10:53

    Newest Member
    KeyStat
    Joined 26/09/23 08:23
  • Posts

    • After rallying on Monday, the Nikkei 225 led the Asian session lower overnight, reversing hopes that losses for Japan had been halted. Rising yields across the globe have driven losses in stocks, though US stocks struggled into positive territory at the close yesterday as some of the selling pressure of the past week eased. However, the theme of higher yields is likely to continue to keep pressuring stocks, resulting in more losses in what is often a difficult period of the year for equities anyway. US lawmakers continue efforts to try and find a short-term funding solution that will avoid a government shutdown. Futures point to a weaker open for Europe and the US, with little heavyweight macro data to detract from the focus on higher yields.   
    • EURUSD Elliott Wave Analysis Trading Lounge Day  Chart, 26 September 23 Euro/U.S.Dollar(EURUSD) Day Chart EURUSD Elliott Wave Technical Analysis Function:  Counter Trend Mode: impulsive   Structure: black wave 3 of A Position: Wave A Direction Next Higher Degrees: 4 of A Details: blue  wave 2 of black wave 3  looking completed at 1.07367,now blue wave 3 of black wave 3 in play . Wave Cancel invalid level: 1.07367 The EUR/USD Elliott Wave Analysis on 26 September 23, is conducted on the daily chart of the Euro/U.S. Dollar (EUR/USD) currency pair. The analysis utilizes Elliott Wave theory to provide insights into potential market trends and movements.   The Function identified in this analysis is "Counter Trend," indicating a focus on identifying and interpreting market movements that go against the prevailing trend. In this context, "counter trend" implies that the analysis is geared toward potential reversals or corrections within the market.   The Mode is described as "impulsive," which suggests an anticipation of strong and directional price movement. In this case, the focus is on an impulsive wave sequence within the market, implying the potential for substantial price shifts.   The Market Structure is outlined as "black wave 3 of A." This specifies that the analysis is centered on the development of the third wave within the broader wave structure, emphasizing its significance in the Elliott Wave sequence.   The Position denotes that the analysis is concentrated on "Wave A," suggesting that the entire Wave A structure is of interest in the analysis.   The Direction Next Higher Degrees highlights "4 of A," indicating that the analysis is attentive to the development of the fourth sub-wave within Wave A and its potential impact on the market.   In the Details section, it is mentioned that "blue wave 2" of "black wave 3" is considered completed at the level of 1.07367. The market is now in the phase of "blue wave 3 of black wave 3." The "Wave Cancel invalid level" is specified as 1.07367, serving as a reference point for traders.   In summary, the EUR/USD Elliott Wave Analysis on 26 September 23, suggests that the market is currently in a counter-trend phase with an impulsive movement in progress. The focus is on the development of "blue wave 3 of black wave 3" within the larger Wave A structure. Traders are advised to monitor this sub-wave for potential trading opportunities, while the specified invalid level provides a reference for managing risk within their trading strategies.   Technical Analyst : Malik Awais Source : Tradinglounge.com get trial here!
    • EURUSD Elliott Wave Analysis Trading Lounge 4 Hour  Chart, 26 September 23 Euro/U.S.Dollar(EURUSD) 4 Hour Chart EURUSD Elliott Wave Technical Analysis Function:  Counter Trend Mode: impulsive   Structure: blue wave 3 of 3 Position: black wave 3 Direction Next lower Degrees: blue wave 3 of black wave 3 started Details: blue  wave 2  looking completed at 1.07367,now blue wave 3 in play . Wave Cancel invalid level: 1.07367 The EUR/USD Elliott Wave Analysis on 26 September 23, focuses on the 4-hour chart of the Euro/U.S. Dollar (EUR/USD) currency pair. Employing Elliott Wave theory, the analysis aims to provide insights into potential market trends and movements.   The identified Function in this analysis is "Counter Trend," indicating a focus on identifying and interpreting market movements that are contrary to the prevailing trend. In this context, "counter trend" suggests the analysis is aimed at potential reversals or corrections within the market.   The Mode is described as "impulsive," which suggests that a strong and directional price movement is expected. In this case, the focus is on an impulsive wave sequence within the market.   The Market Structure is outlined as "blue wave 3 of 3." This indicates that the analysis is centered on the development of the third wave within the third larger wave structure, emphasizing its significance within the Elliott Wave sequence.   The Position specifies that the analysis is focused on "black wave 3." This suggests that the third wave within the broader wave structure is a key area of interest in the analysis.   The Direction Next Lower Degrees points to the initiation of "blue wave 3 of black wave 3." This indicates that the analysis is attentive to the development of the third sub-wave within the third wave, highlighting its potential impact on the market.   In the Details section, it is noted that "blue wave 2" is deemed to be completed at 1.07367, and the market is now in the phase of "blue wave 3." The "Wave Cancel invalid level" is specified as 1.07367, providing a reference point for traders.   In summary, the EUR/USD Elliott Wave Analysis on 26 September 23, suggests that the market is in a counter-trend phase, with a strong impulsive movement in progress, specifically   focusing on the development of "blue wave 3 of 3" within the third wave structure. Traders are advised to monitor this sub-wave for potential trading opportunities, keeping in mind the specified invalid level as a reference for risk management.   Technical Analyst : Malik Awais Source : Tradinglounge.com get trial here!  
×
×
  • Create New...
us