Jump to content
  • 2

Rest calls intermittent forbidden responses


svb

Question

Hi,

C# : use combination of REST & streaming. Replicated using WPF example that you can download in labs.

This issue is specific to REST

Every 15 minutes I get 15 min prices for a range of epics. My allowance is fine with +6500 left. 

I keep getting random null responses with "forbidden" status code. Different epics. If I trap null response and then set rest call to execute again, it works. I continue and it carried on with rest of epics, or will do say 10 , return forbidden for 3 and then return fine for epics following that. if I step through each epic, its fine. So seems to be some timing glitch. Tried trapping and adding task.delays and retries, but still null. I have to actually break and step over. Given its not my allowance, are there any quirks with REST calls to cause this? This is example, does some, throws forbidden and then fine for AUDCAD again.

persist 15: 17/03/2021 22:15:01 - CS.D.CADJPY.TODAY.IP
persist 15: 17/03/2021 22:15:01 - CS.D.CADCHF.TODAY.IP
persist 15: 17/03/2021 22:15:01 - CS.D.EURAUD.TODAY.IP
response is null for CS.D.NZDJPY.TODAY.IP 15
response is null for CS.D.NZDUSD.TODAY.IP 15
response is null for CS.D.CHFJPY.TODAY.IP 15
response is null for CS.D.USCGC.TODAY.IP 15
response is null for CC.D.CL.USS.IP 15
persist 15: 17/03/2021 22:15:01 - CS.D.AUDCAD.TODAY.IP

I cannot replicate forbidden status response in REST companion for any epic either, just seems when run via rest client

Thanks

Edited by svb
add note about running in companion
  • Like 2
Link to comment

8 answers to this question

Recommended Posts

  • 0

improved it by making sure rest calls aren't async and also putting 2 second wait before each call (1 second is not enough and I get more forbidden responses). For what I'm doing this is ok-ish, but not great. Given this is the rest client returning this and not my code I'm not sure what's changed i.e account, service validation. If anyone has any ideas that would be much appreciated,

the wait I added,

 

    foreach (var market in MarketList)
                        {
                            try
                            {
                                Thread.Sleep(2000);

                                response = await igRestApiClient.priceSearchByNumV2(market, "HOUR", "2");

                                if (response != null)

and the results. only 2 had issues this time, even with 2 second wait. with 1 second I get a lot more.

time: 18/03/2021 11:58:01
time: 18/03/2021 11:59:01
time: 18/03/2021 12:00:01
persist 15: 18/03/2021 12:00:01 - CS.D.AUDUSD.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.EURCHF.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.EURGBP.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.EURJPY.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.EURUSD.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.GBPUSD.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.USDCAD.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.USDCHF.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.USDJPY.TODAY.IP
persist 15: 18/03/2021 12:00:01 - IX.D.DOW.DAILY.IP
persist 15: 18/03/2021 12:00:01 - IX.D.NASDAQ.CASH.IP
persist 15: 18/03/2021 12:00:01 - IX.D.SPTRD.DAILY.IP
persist 15: 18/03/2021 12:00:01 - IX.D.DAX.DAILY.IP
persist 15: 18/03/2021 12:00:01 - IX.D.FTSE.DAILY.IP
persist 15: 18/03/2021 12:00:01 - CC.D.DX.USS.IP
persist 15: 18/03/2021 12:00:01 - CS.D.USCSI.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.AUDJPY.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.AUDCHF.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.GBPAUD.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.GBPCAD.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.EURCAD.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.USDMXN.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.GBPJPY.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.CADJPY.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.CADCHF.TODAY.IP
response is null for CS.D.EURAUD.TODAY.IP 15
persist 15: 18/03/2021 12:00:01 - CS.D.NZDJPY.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.NZDUSD.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.CHFJPY.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CS.D.USCGC.TODAY.IP
persist 15: 18/03/2021 12:00:01 - CC.D.CL.USS.IP
persist 15: 18/03/2021 12:00:01 - CS.D.AUDCAD.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.AUDUSD.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.EURCHF.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.EURGBP.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.EURJPY.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.EURUSD.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.GBPUSD.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.USDCAD.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.USDCHF.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.USDJPY.TODAY.IP
persist 60: 18/03/2021 12:00:01 - IX.D.DOW.DAILY.IP
persist 60: 18/03/2021 12:00:01 - IX.D.NASDAQ.CASH.IP
persist 60: 18/03/2021 12:00:01 - IX.D.SPTRD.DAILY.IP
persist 60: 18/03/2021 12:00:01 - IX.D.DAX.DAILY.IP
persist 60: 18/03/2021 12:00:01 - IX.D.FTSE.DAILY.IP
persist 60: 18/03/2021 12:00:01 - CC.D.DX.USS.IP
persist 60: 18/03/2021 12:00:01 - CS.D.USCSI.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.AUDJPY.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.AUDCHF.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.GBPAUD.TODAY.IP
response is null for CS.D.GBPCAD.TODAY.IP 60
persist 60: 18/03/2021 12:00:01 - CS.D.EURCAD.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.USDMXN.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.GBPJPY.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.CADJPY.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.CADCHF.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.EURAUD.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.NZDJPY.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.NZDUSD.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.CHFJPY.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CS.D.USCGC.TODAY.IP
persist 60: 18/03/2021 12:00:01 - CC.D.CL.USS.IP
persist 60: 18/03/2021 12:00:01 - CS.D.AUDCAD.TODAY.IP
time: 18/03/2021 12:03:01

 

Link to comment
  • 0

Thanks for your response, svb. It looks like my problem is indeed an allowance problem but I have been seeing the same intermittent issues as you with various waits/pauses affecting it (I found I needed 2.5 seconds to make a consistent difference).

When I do historical price search from the API companion, all I get back is this: errorCode": "error.public-api.exceeded-account-historical-data-allowance. I can't see that meta data that you reference. Are you able to see this when you use the companion? Are you using a historical price request?

Thanks

Link to comment
  • 0

For what it's worth... I too get forbidden responses from the REST API and I too retry the Price request and then it usually works. In fact, I retry up to 10 times as sometimes it gives me forbidden repeatedly. It can happen getting Navigation Nodes as well as Prices. It isn't allowance and looks to me more like something server-side e.g. bandwidth throttling perhaps? I just retry failed requests in a loop and haven't figured out any proper fix but the retry loop works fine so not a big problem

Link to comment
  • 0

Hello everyone,
I add to the problem, until last week everything was working great. This week the api returns errorCode: null in any type of call. Not only with prices, also obtaining markets, and even opening the session. It seems to me a somewhat dirty solution to retry in all calls, and that increases the operation time of my algorithms, making it unsafe

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
      22,093
    • Total Posts
      92,944
    • Total Members
      42,474
    • Most Online
      7,522
      10/06/21 10:53

    Newest Member
    scobes2
    Joined 17/05/23 10:51
  • Posts

    • The US debt ceiling deal has cleared the first hurdle, with the House of Representatives passing the bill to raise the ceiling. The deal now moves to the Senate, which is also expected to pass the measure, staving off a US default. Stocks in Asia made headway, and futures are pointing higher in Europe and the US. Meanwhile, in China, the Caixin manufacturing PMI sneaked back into expansion territory, allaying some of the fears about a broad slowdown in the Chinese economy. More PMIs next week, along with inflation and trade data, will provide additional insight into the Chinese economy. Expectations for a Fed move in June have dropped back sharply after vice-chair Jefferson said that he favoured 'skipping' a June hike, while softer CPI data in Europe have seen ECB tightening expectations drop too. Further eurozone inflation data is scheduled for today, along with the ADP report (delayed a day due to Memorial Day in the US), weekly jobless claims, the ISM manufacturing PMI and weekly crude oil inventories.   
    • United Parcel Service Inc., Elliott Wave Technical Analysis United Parcel Service Inc., (UPS:NYSE): Daily Chart, 1 June 23, UPS Stock Market Analysis: Looking for further downside into wave {c} to then complete overall correction in wave 2.   UPS Elliott Wave Count: Wave {c} of 2. UPS Technical Indicators: Above 200EMA. UPS Trading Strategy: Looking for further downside into wave {c}, if we were to break north of wave (ii) we could see wave count invalidation.   TradingLounge Analyst: Alessio Barretta Source : Tradinglounge.com get trial here!       United Parcel Service Inc., UPS: 4-hour Chart, 1 June 23 United Parcel Service Inc., Elliott Wave Technical Analysis UPS Stock Market Analysis: Looking for downside into wave (iii) to start unfolding as we seem to be moving lower into wave iii. UPS Elliott Wave count:  Wave  iii of (iii). UPS Technical Indicators: Below all averages. UPS Trading Strategy: Looking for downside to start unfolding fast, otherwise we could be in a leading diagonal in wave (i).
    • Elliott Wave Analysis TradingLounge Daily Chart, 1 June 23,   Binance coin/U.S.dollar(BNBUSD) BNBUSD Elliott Wave Technical Analysis Function: Follow Trend Mode: Motive Structure: Impulse Position: Wave 5 Direction Next higher Degrees: wave (C) of Motive Details: Wave 5 is equal to Wave 1 at the 298.3 level. Wave Cancel invalid level: 220.0 Binance coin/U.S.dollar(BNBUSD)Trading Strategy: There is still a risk that the price will fall further due to The sub-wave within the wave (C) is incomplete. This corresponds to the price being below the MA200 line, so wait for the wave. (C) Done to join the trend again. Binance Coin/U.S.dollar(BNBUSD)Technical Indicators: The price is below the MA200 indicating a downtrend MACD and RSI are Bearish momentum. TradingLounge Analyst: Kittiampon Somboonsod, CEWA Source : Tradinglounge.com get trial here!   Elliott Wave Analysis TradingLounge 4H Chart, 1 June 23,   Binance coin/U.S.dollar(BNBUSD) BNBUSD Elliott Wave Technical Analysis Function: Follow Trend Mode: Motive Structure: Impulse Position: Wave 5 Direction Next higher Degrees: wave (C) of Motive Details: Wave 5 is equal to Wave 1 at the 298.3 level. Wave Cancel invalid level: 220.0 Binance coin/U.S.dollar(BNBUSD)Trading Strategy: There is still a risk that the price will fall further due to The sub-wave within the wave (C) is incomplete. This corresponds to the price being below the MA200 line, so wait for the wave. (C) Done to join the trend again. Binance Coin/U.S.dollar(BNBUSD)Technical Indicators: The price is below the MA200 indicating a downtrend MACD and RSI are Bearish momentum.
×
×
  • Create New...