forked from pokochi/bitFlyer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trade.go
70 lines (57 loc) · 2.19 KB
/
trade.go
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
65
66
67
68
69
70
package bitFlyer
const (
ME_CHILDORDERS_PATH = "/v1/me/getchildorders"
ME_PARENTORDERS_PATH = "/v1/me/getparentorders"
ME_PARENTORDER_PATH = "/v1/me/getparentorder"
ME_EXECUTIONS_PATH = "/v1/me/getexecutions"
ME_POSITIONS_PATH = "/v1/me/getpositions"
ME_SENDCHILDORDER_PATH = "/v1/me/sendchildorder"
ME_CANCELCHILDORDER_PATH = "/v1/me/cancelchildorder"
ME_CANCELPARENTORDER_PATH = "/v1/me/cancelparentorder"
ME_CANCELALLCHILDORDER_PATH = "/v1/me/cancelallchildorders"
)
type Trade struct {
Lightning
}
func NewTrade(key string, secret string) *Trade {
l := Lightning{key, secret}
return &Trade{l}
}
//注文の一覧を取得
func (t *Trade) GetChildOrders(m map[string]string) (error, string) {
return t.RequestPrivate(GET_METHOD, ME_CHILDORDERS_PATH, m)
}
//親注文の一覧を取得
func (t *Trade) GetParentOrders(m map[string]string) (error, string) {
return t.RequestPrivate(GET_METHOD, ME_PARENTORDERS_PATH, m)
}
//親注文の詳細を取得
func (t *Trade) GetParentOrder(m map[string]string) (error, string) {
return t.RequestPrivate(GET_METHOD, ME_PARENTORDER_PATH, m)
}
//約定の一覧を取得
func (t *Trade) GetExecutions(m map[string]string) (error, string) {
return t.RequestPrivate(GET_METHOD, ME_EXECUTIONS_PATH, m)
}
//建玉の一覧を取得
func (t *Trade) GetPositions(m map[string]string) (error, string) {
return t.RequestPrivate(GET_METHOD, ME_POSITIONS_PATH, m)
}
//新規注文を出す
func (t *Trade) SendChildOrder(m map[string]string) (error, string) {
return t.RequestPrivate(POST_METHOD, ME_SENDCHILDORDER_PATH, m)
}
//注文をキャンセルする
func (t *Trade) CancelChildOrder(m map[string]string) (error, string) {
return t.RequestPrivate(POST_METHOD, ME_CANCELCHILDORDER_PATH, m)
}
//新規の親注文を出す(特殊注文)
//TODO
//親注文をキャンセルする
func (t *Trade) CancelParentOrder(m map[string]string) (error, string) {
return t.RequestPrivate(POST_METHOD, ME_CANCELPARENTORDER_PATH, m)
}
//すべての注文をキャンセルする
func (t *Trade) CancelAllChildOrders(m map[string]string) (error, string) {
return t.RequestPrivate(POST_METHOD, ME_CANCELALLCHILDORDER_PATH, m)
}