This repository has been archived by the owner on Aug 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
position.go
73 lines (67 loc) · 2.68 KB
/
position.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
package kumex
import (
"net/http"
)
// A PositionModel represents a position info.
type PositionModel struct {
Id string `json:"id"`
Symbol string `json:"symbol"`
AutoDeposit bool `json:"autoDeposit"`
MaintMarginReq string `json:"maintMarginReq"`
RiskLimit string `json:"riskLimit"`
RealLeverage string `json:"realLeverage"`
CrossMode bool `json:"crossMode"`
DelevPercentage string `json:"delevPercentage"`
OpeningTimestamp string `json:"openingTimestamp"`
CurrentTimestamp string `json:"currentTimestamp"`
CurrentQty string `json:"currentQty"`
CurrentCost string `json:"currentCost"`
CurrentComm string `json:"currentComm"`
UnrealisedCost string `json:"unrealisedCost"`
RealisedGrossCost string `json:"realisedGrossCost"`
RealisedCost string `json:"realisedCost"`
IsOpen bool `json:"isOpen"`
MarkPrice string `json:"markPrice"`
MarkValue string `json:"markValue"`
PosCost string `json:"posCost"`
PosCross string `json:"posCross"`
PosInit string `json:"posInit"`
PosComm string `json:"posComm"`
PosLoss string `json:"posLoss"`
PosMargin string `json:"posMargin"`
PosMaint string `json:"posMaint"`
MaintMargin string `json:"maintMargin"`
RealisedGrossPnl string `json:"realisedGrossPnl"`
RealisedPnl string `json:"realisedPnl"`
UnrealisedPnl string `json:"unrealisedPnl"`
UnrealisedPnlPcnt string `json:"unrealisedPnlPcnt"`
UnrealisedRoePcnt string `json:"unrealisedRoePcnt"`
AvgEntryPrice string `json:"avgEntryPrice"`
LiquidationPrice string `json:"liquidationPrice"`
BankruptPrice string `json:"bankruptPrice"`
SettleCurrency string `json:"settleCurrency"`
}
// Position Get Position Details.
func (as *ApiService) Position(symbol string) (*ApiResponse, error) {
p := map[string]string{}
if symbol != "" {
p["symbol"] = symbol
}
req := NewRequest(http.MethodGet, "/api/v1/position", p)
return as.Call(req)
}
// Positions Get Position List.
func (as *ApiService) Positions() (*ApiResponse, error) {
req := NewRequest(http.MethodGet, "/api/v1/positions", nil)
return as.Call(req)
}
// AutoDepositStatus Enable/Disable of Auto-Deposit Margin.
func (as *ApiService) AutoDepositStatus(params map[string]string) (*ApiResponse, error) {
req := NewRequest(http.MethodPost, "/api/v1/position/margin/auto-deposit-status", params)
return as.Call(req)
}
// DepositMargin Add Margin Manually.
func (as *ApiService) DepositMargin(params map[string]string) (*ApiResponse, error) {
req := NewRequest(http.MethodPost, "/api/v1/position/margin/deposit-margin", params)
return as.Call(req)
}