Repository navigation
Expand file tree
/
Copy pathQuotation.cs
More file actions
58 lines (46 loc) · 1.49 KB
/
Copy pathQuotation.cs
File metadata and controls
58 lines (46 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using Newtonsoft.Json;
using RestSharp;
using ShareInvest.Binance.Converters;
using ShareInvest.Binance.Models;
using ShareInvest.Crypto;
using System.Net;
using System.Text;
namespace ShareInvest.Binance;
/// <summary>
/// default Url: https://data-api.binance.vision/api/v3
/// </summary>
/// <param name="baseUrl">
/// https://api.binance.com or
/// https://api-gcp.binance.com or
/// https://api1.binance.com or
/// https://api2.binance.com or
/// https://api3.binance.com or
/// https://api4.binance.com
/// </param>
public partial class Quotation(string? baseUrl = null) : ShareQuotation(string.IsNullOrEmpty(baseUrl) ? "https://data-api.binance.vision/api/v3" : baseUrl)
{
readonly Func<RestResponse, ExchangeInfo?> deserializeContent = res =>
{
return HttpStatusCode.OK != res.StatusCode || string.IsNullOrEmpty(res.Content) ? null :
JsonConvert.DeserializeObject<ExchangeInfo>(res.Content, new JsonSerializerSettings
{
Converters = new[] { new FilterConverter() }
});
};
readonly Func<string[], StringBuilder> makeStrArrQuery = args =>
{
StringBuilder sb = new("[");
for (int index = 0; index < args.Length; index++)
{
sb.Append(args[index]);
if (index == args.Length - 1)
{
sb.Append(']');
break;
}
sb.Append(',');
}
return sb;
};
readonly CancellationTokenSource cts = new();
}