forked from Kucoin/kucoin-futures-go-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
transfer.go
122 lines (109 loc) · 4.05 KB
/
transfer.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
package kumex
import (
"encoding/json"
"math/big"
"net/http"
)
// A TransferOutModel represents a transfer out record.
type TransferOutModel struct {
ApplyId string `json:"applyId"`
}
// TransferOut Transfer Funds to KuCoin-Main Account.
// Deprecated
func (as *ApiService) TransferOut(bizNo, amount string) (*ApiResponse, error) {
p := map[string]string{
"bizNo": bizNo,
"amount": amount,
}
req := NewRequest(http.MethodPost, "/api/v1/transfer-out", p)
return as.Call(req)
}
type TransferOutV2Model struct {
ApplyId string `json:"applyId"`
}
// TransferOutV2 Transfer Funds to KuCoin-Main Account.
func (as *ApiService) TransferOutV2(bizNo, amount, currency string) (*ApiResponse, error) {
p := map[string]string{
"bizNo": bizNo,
"amount": amount,
"currency": currency,
}
req := NewRequest(http.MethodPost, "/api/v2/transfer-out", p)
return as.Call(req)
}
// A TransferModel represents a transfer record.
type TransferModel struct {
ApplyId string `json:"applyId"`
Currency string `json:"currency"`
Status string `json:"status"`
Amount string `json:"amount"`
Reason string `json:"reason"`
Offset int64 `json:"offset"`
CreatedAt int64 `json:"createdAt"`
}
// A TransfersModel represents a transfer list.
type TransfersModel []*TransferModel
// TransferList returns a list of deposit.
func (as *ApiService) TransferList(params map[string]string, pagination *PaginationParam) (*ApiResponse, error) {
pagination.ReadParam(params)
req := NewRequest(http.MethodGet, "/api/v1/transfer-list", params)
return as.Call(req)
}
// CancelTransferModel represents the result of CancelWithdrawal().
type CancelTransferModel struct {
ApplyId string `json:"applyId"`
}
// CancelTransfer Cancel Transfer-Out Request.
// Deprecated
func (as *ApiService) CancelTransfer(applyId string) (*ApiResponse, error) {
p := map[string]string{
"applyId": applyId,
}
req := NewRequest(http.MethodDelete, "/api/v1/cancel/transfer-out", p)
return as.Call(req)
}
// TransferOutV3 The amount to be transferred will be deducted from the KuCoin Futures Account.
// Please ensure that you have sufficient funds in your KuCoin Futures Account, or the transfer will fail.
// Once the transfer arrives your KuCoin-Main Account, the endpoint will respond and return the applyId.
// This ID could be used to cancel the transfer request.
func (as *ApiService) TransferOutV3(currency, recAccountType, amount string) (*ApiResponse, error) {
p := map[string]string{
"currency": currency,
"recAccountType": recAccountType,
"amount": amount,
}
req := NewRequest(http.MethodPost, "/api/v3/transfer-out", p)
return as.Call(req)
}
type TransferOutV3Res struct {
ApplyId string `json:"applyId"`
BizNo string `json:"bizNo"`
PayAccountType string `json:"payAccountType"`
PayTag string `json:"payTag"`
Remark string `json:"remark"`
RecAccountType string `json:"recAccountType"`
RecTag string `json:"recTag"`
RecRemark string `json:"recRemark"`
RecSystem string `json:"recSystem"`
Status string `json:"status"`
Currency string `json:"currency"`
Amount string `json:"amount"`
Fee string `json:"fee"`
Sn big.Int `json:"sn"`
Reason string `json:"reason"`
CreatedAt json.Number `json:"createdAt"`
UpdatedAt json.Number `json:"updatedAt"`
}
// TransferIn The amount to be transferred will be deducted from the KuCoin Futures Account.
// Please ensure that you have sufficient funds in your KuCoin Futures Account, or the transfer will fail.
// Once the transfer arrives your KuCoin-Main Account, the endpoint will respond and return the applyId.
// This ID could be used to cancel the transfer request.
func (as *ApiService) TransferIn(currency, payAccountType, amount string) (*ApiResponse, error) {
p := map[string]string{
"currency": currency,
"payAccountType": payAccountType,
"amount": amount,
}
req := NewRequest(http.MethodPost, "/api/v1/transfer-in", p)
return as.Call(req)
}