Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bitgetlimited
GitHub Repository: bitgetlimited/v3-bitget-api-sdk
Path: blob/master/bitget-golang-sdk-api/pkg/client/v2/mixaccountclient.go
518 views
1
package v2
2
3
import (
4
"bitget/internal"
5
"bitget/internal/common"
6
)
7
8
type MixAccountClient struct {
9
BitgetRestClient *common.BitgetRestClient
10
}
11
12
func (p *MixAccountClient) Init() *MixAccountClient {
13
p.BitgetRestClient = new(common.BitgetRestClient).Init()
14
return p
15
}
16
17
func (p *MixAccountClient) Account(params map[string]string) (string, error) {
18
resp, err := p.BitgetRestClient.DoGet("/api/v2/mix/account/account", params)
19
return resp, err
20
}
21
22
func (p *MixAccountClient) Accounts(params map[string]string) (string, error) {
23
resp, err := p.BitgetRestClient.DoGet("/api/v2/mix/account/accounts", params)
24
return resp, err
25
}
26
27
func (p *MixAccountClient) SetLeverage(params map[string]string) (string, error) {
28
postBody, jsonErr := internal.ToJson(params)
29
if jsonErr != nil {
30
return "", jsonErr
31
}
32
resp, err := p.BitgetRestClient.DoPost("/api/v2/mix/account/set-leverage", postBody)
33
return resp, err
34
}
35
36
func (p *MixAccountClient) SetMargin(params map[string]string) (string, error) {
37
postBody, jsonErr := internal.ToJson(params)
38
if jsonErr != nil {
39
return "", jsonErr
40
}
41
resp, err := p.BitgetRestClient.DoPost("/api/v2/mix/account/set-margin", postBody)
42
return resp, err
43
}
44
45
func (p *MixAccountClient) SetMarginMode(params map[string]string) (string, error) {
46
postBody, jsonErr := internal.ToJson(params)
47
if jsonErr != nil {
48
return "", jsonErr
49
}
50
resp, err := p.BitgetRestClient.DoPost("/api/v2/mix/account/set-margin-mode", postBody)
51
return resp, err
52
}
53
54
// position
55
func (p *MixAccountClient) SetPositionMode(params map[string]string) (string, error) {
56
postBody, jsonErr := internal.ToJson(params)
57
if jsonErr != nil {
58
return "", jsonErr
59
}
60
resp, err := p.BitgetRestClient.DoPost("/api/v2/mix/account/set-position-mode", postBody)
61
return resp, err
62
}
63
64
func (p *MixAccountClient) SinglePosition(params map[string]string) (string, error) {
65
resp, err := p.BitgetRestClient.DoGet("/api/v2/mix/position/single-position", params)
66
return resp, err
67
}
68
69
func (p *MixAccountClient) AllPosition(params map[string]string) (string, error) {
70
resp, err := p.BitgetRestClient.DoGet("/api/v2/mix/position/all-position", params)
71
return resp, err
72
}
73
74