Jump to content

Rick

Community Member
  • Posts

    6
  • Joined

  • Last visited

Rick's Achievements

Occasional Contributor

Occasional Contributor (2/10)

2

Reputation

  1. Well, as always with these things, if you beat your head against the wall for long enough you can probably fix it 🤣. I realised that the sample code uses the URI /history/transactions/{transactionType}/{lastPeriod} to access the V1 interface. V2 uses a slightly different URI ... just /history/transactions, with variable parameters passed using the '?' construct. I picked this up from the API Companion app, which helpfully shows the generated GET URIs. Then I had to invent a new V2Transaction type ( since the demo code only supports V1) to persuade JSON to deserialise to result for me. Problem (eventually) solved. I'm still grateful to Andy for responding, and giving me confidence that there are those out there who care. If anyone wants more details on this particular problem, let me know, and I'll try to post some revised code (once I've cleaned it up, of course!).
  2. Thanks for responding Andy. Stepping through the code, the relevant section of the IG sample API code can be precised as var client = new HttpClient(); ... if (conversationContext != null) { if (conversationContext.apiKey != null) { client.DefaultRequestHeaders.Add("X-IG-API-KEY", conversationContext.apiKey); } if (conversationContext.cst != null) { client.DefaultRequestHeaders.Add("CST", conversationContext.cst); } if (conversationContext.xSecurityToken != null) { client.DefaultRequestHeaders.Add("X-SECURITY-TOKEN", conversationContext.xSecurityToken); } client.DefaultRequestHeaders.Add("VERSION", version); } //This only works for version 1 !!! //client.DefaultRequestHeaders.TryAddWithoutValidation("version", version ?? "1"); ... var response = new HttpResponseMessage(); string content = null; switch (method.Method) { case "POST": ... case "GET": var myGetTask = client.GetAsync(_baseUrl + uri); response = myGetTask.Result; break; This returns transaction data quite happily using Version 1 of the interface (but without the additional V2 data), but errors if I try to run it with Version=2 ... Any ideas? Note the comment in the IG code!!! Or could you send me a code sample in VB from your spreadsheet, to see if I can translate into C# (shouldn't be too difficult) ... Rick
  3. I'm trying to access /history/transactions v2 via API, in order to retrieve accurate entry and exit times (not supported in v1). I'm writing in C#, based on the API samples, but they only seem to support v1, and not the v2 documented in the Reference guide. Anyone know how to amend the v1 code to make it support v2 ... the call in sample code is public async Task<IgResponse<TransactionHistoryResponse>> lastTransactionPeriod(string transactionType, string lastPeriod) { return await _igRestService.RestfulService<TransactionHistoryResponse>("/gateway/deal/history/transactions/" + transactionType + "/" + lastPeriod, HttpMethod.Get, "1", _conversationContext); } .. and yes, I did try just changing the "1" to a "2" ... I get an Error 500. Any help most gratefully received! This has been driving me crazy!
  4. Fixed at 21:50 23-Jul ... again from API Companion: "rolloverDetails": null, "newsCode": ".FTSE", "chartCode": "UKX", "country": "GB", "valueOfOnePip": null, "onePipMeans": null, "contractSize": null, "specialInfo": ["MAX KNOCK OUT LEVEL DISTANCE", "DEFAULT KNOCK OUT LEVEL DISTANCE"] }, "dealingRules": { "minStepDistance": { "unit": "POINTS", "value": 5.0 }, "minDealSize": { "unit": "POINTS", "value": 0.5 }, "minControlledRiskStopDistance": { "unit": "POINTS", "value": 8.0 }, "minNormalStopOrLimitDistance": { "unit": "POINTS", "value": 8.0 }, "maxStopOrLimitDistance": { "unit": "PERCENTAGE", "value": 75.0 }, "marketOrderPreference": "AVAILABLE_DEFAULT_OFF", "trailingStopsPreference": "AVAILABLE" },
  5. IG: "Unfortunately, we are experiencing an issue with the Market Data details that are being pulled in the REST API, this is being looked into and a fix is currently in testing. Please bear with us as we look to get this resolved as soon as possible for you"
  6. The REST call for Market Details (/markets/{epic} V2) seems to be returning empty Dealing Rules as of 18-July: they were functioning properly until that point, and give empty details now even using the API Companion (https://labs.ig.com/sample-apps/api-companion/index.html), so I know that it isn't my code. Here's an extract (for FTSE100 DFB) from this afternoon, generated using API Companion ... Any idea what's going on? Rick
×
×
  • Create New...