-
Notifications
You must be signed in to change notification settings - Fork 0
/
BLL.cs
64 lines (46 loc) · 1.76 KB
/
BLL.cs
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
59
60
61
62
63
64
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ApiDemo
{
public class BLL
{
static string urlOrder = "/v4/order";
static string urlOpen_order = "/v4/open-order";
static string urlCancelBatchOrder = "/v4/batch-order";
static string uriBalance = "/v4/balance";
public static string Order(string symbol, string side, string type, string timeInForce, string bizType, double price, double quantity)
{
StringBuilder data = new StringBuilder();
data.Append("{\"symbol\":\"" + symbol + "\",");
data.Append("\"side\":\"" + side + "\",");
data.Append("\"type\":\"" + type + "\",");
data.Append("\"timeInForce\":\"" + timeInForce + "\",");
data.Append("\"bizType\":\"" + bizType + "\",");
data.Append("\"price\":" + price + ",");
data.Append("\"quantity\":" + quantity + "}");
return HttpHelper.Post(urlOrder, data.ToString()).Json;
}
public static string GetOpenOrder()
{
return HttpHelper.Get(urlOpen_order, null).Json;
}
public static string GetBalance(string symbol)
{
string param = "currency="+symbol;
return HttpHelper.Get(uriBalance, param).Json;
}
public static string DeleteOrder(string id)
{
string urlDelete = urlOrder + "/" + id;
return HttpHelper.Delete(urlDelete).Json;
}
public static string CancelOrders(string orderIds)
{
string parm = "{\"orderIds\":" + orderIds + "}";
return HttpHelper.Delete(urlCancelBatchOrder, parm).Json;
}
}
}