'Fetch kraken in C# WEB API and return it to client in different structure
I have a problem with returning a Kraken JSON structure back to the client from this URL: https://api.cryptowat.ch/markets/kraken/btcusd/ohlc . Also I need to show the prices in last 60mins in Angular from that JSON URL.
This is my code for now that i have.
using Newtonsoft.Json;
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace btc
{
class Program
{
HttpClient client= new HttpClient();
static async Task Main(string[] args)
{
Program program = new Program();
await program.GetTodoItems();
}
private async Task GetTodoItems()
{
string response = await client.GetStringAsync(
"https://api.cryptowat.ch/markets/kraken/btcusd/ohlc");
Console.WriteLine(response);
Root krakenResult= JsonConvert.DeserializeObject<Root>(response);
var price_data_kraken = krakenResult.result;
Console.WriteLine(price_data_kraken);
}
}
public class Result
{
public List<List<double>> _14400 { get; set; }
public List<List<double>> _180 { get; set; }
public List<List<double>> _1800 { get; set; }
public List<List<double>> _21600 { get; set; }
public List<List<double>> _259200 { get; set; }
public List<List<double>> _300 { get; set; }
public List<List<double>> _3600 { get; set; }
public List<List<double>> _43200 { get; set; }
public List<List<double>> _60 { get; set; }
public List<List<double>> _604800 { get; set; }
public List<List<double>> _604800_Monday { get; set; }
public List<List<double>> _7200 { get; set; }
public List<List<double>> _86400 { get; set; }
public List<List<double>> _900 { get; set; }
}
public class Root
{
public Result result { get; set; }
}
} ```
Please help me.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
