forked from ccxt/go-binance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccount_service.go
59 lines (50 loc) · 1.21 KB
/
account_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
package eoptions
import (
"context"
"encoding/json"
"net/http"
)
// AccountService create order
type AccountService struct {
c *Client
}
// Do send request
func (s *AccountService) Do(ctx context.Context, opts ...RequestOption) (res *Account, err error) {
r := &request{
method: http.MethodGet,
endpoint: "/eapi/v1/account",
secType: secTypeSigned,
}
data, _, err := s.c.callAPI(ctx, r, opts...)
if err != nil {
return nil, err
}
res = new(Account)
err = json.Unmarshal(data, res)
if err != nil {
return nil, err
}
return res, nil
}
type Asset struct {
Asset string `json:"asset"`
MarginBalance string `json:"marginBalance"`
Equity string `json:"equity"`
Available string `json:"available"`
Locked string `json:"locked"`
UnrealizedPNL string `json:"unrealizedPNL"`
}
type Greek struct {
Underlying string `json:"underlying"`
Delta string `json:"delta"`
Gamma string `json:"gamma"`
Theta string `json:"theta"`
Vega string `json:"vega"`
}
// Account define create order response
type Account struct {
Asset []*Asset `json:"asset"`
Greek []*Greek `json:"greek"`
RiskLevel string `json:"riskLevel"`
Time uint64 `json:"time"`
}