public void LoadIGHistoricalData(string epic, string resolution, int pricePoints) { try { var request = new RestRequest($"prices/{epic}/{resolution}/{pricePoints}", Method.GET); var response = HttpIGAccountService.Client.Execute(request); if (response.StatusCode == HttpStatusCode.OK) { HistoricalDataIG = JsonConvert.DeserializeObject <IGHistoricalData>(response.Content); } } catch (Exception) { } }
public decimal[] OhlcListToArray(int size, IGHistoricalData data) { if (size > data.Prices.Count) { size = data.Prices.Count - 1; } decimal[] vs = new decimal[size]; for (int i = 0; i < vs.Length; i++) { vs[i] = Convert.ToDecimal(data.Prices[i].ClosePrice.Ask); } return(vs); }