forked from adshao/go-binance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
position_risk.go
46 lines (42 loc) · 1.23 KB
/
position_risk.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
package futures
import (
"context"
"encoding/json"
)
// GetPositionRiskService get account balance
type GetPositionRiskService struct {
c *Client
}
// Do send request
func (s *GetPositionRiskService) Do(ctx context.Context, opts ...RequestOption) (res []*PositionRisk, err error) {
r := &request{
method: "GET",
endpoint: "/fapi/v1/positionRisk",
secType: secTypeSigned,
}
data, err := s.c.callAPI(ctx, r, opts...)
if err != nil {
return []*PositionRisk{}, err
}
res = make([]*PositionRisk, 0)
err = json.Unmarshal(data, &res)
if err != nil {
return []*PositionRisk{}, err
}
return res, nil
}
// PositionRisk define position risk info
type PositionRisk struct {
EntryPrice string `json:"entryPrice"`
MarginType string `json:"marginType"`
IsAutoAddMargin string `json:"isAutoAddMargin"`
IsolatedMargin string `json:"isolatedMargin"`
Leverage string `json:"leverage"`
LiquidationPrice string `json:"liquidationPrice"`
MarkPrice string `json:"markPrice"`
MaxNotionalValue string `json:"maxNotionalValue"`
PositionAmt string `json:"positionAmt"`
Symbol string `json:"symbol"`
UnRealizedProfit string `json:"unRealizedProfit"`
PositionSide string `json:"positionSide"`
}