forked from sangx2/upbit
/
service.go
66 lines (55 loc) · 1.35 KB
/
service.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
package upbit
import (
"github.com/sangx2/upbit/model"
"github.com/sangx2/upbit/model/exchange/service"
)
// GetWalletStatus 입출금 현황
//
// [HEADERS]
//
// Authorization : REQUIRED. Authorization token(JWT)
func (u *Upbit) GetWalletStatus() ([]*service.Wallet, *model.Remaining, error) {
api, e := GetApiInfo(FuncGetWalletStatus)
if e != nil {
return nil, nil, e
}
req, e := u.createRequest(api.Method, BaseURI+api.Url, nil, api.Section)
if e != nil {
return nil, nil, e
}
resp, e := u.do(req, api.Group)
if e != nil {
return nil, nil, e
}
defer resp.Body.Close()
wallets, e := service.WalletsFromJSON(resp.Body)
if e != nil {
return nil, nil, e
}
return wallets, model.RemainingFromHeader(resp.Header), nil
}
// GetApiKeys API 키 리스트 조회
//
// [HEADERS]
//
// Authorization : REQUIRED. Authorization token(JWT)
func (u *Upbit) GetApiKeys() ([]*service.ApiKey, *model.Remaining, error) {
api, e := GetApiInfo(FuncGetApiKeys)
if e != nil {
return nil, nil, e
}
req, e := u.createRequest(api.Method, BaseURI+api.Url, nil, api.Section)
if e != nil {
return nil, nil, e
}
resp, e := u.do(req, api.Group)
if e != nil {
return nil, nil, e
}
defer resp.Body.Close()
apiKeys, e := service.ApiKeysFromJSON(resp.Body)
if e != nil {
return nil, nil, e
}
return apiKeys, model.RemainingFromHeader(resp.Header), nil
}