-
Notifications
You must be signed in to change notification settings - Fork 3
/
exchange_info_service.go
86 lines (76 loc) · 2.78 KB
/
exchange_info_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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package phemex
import (
"context"
"encoding/json"
"errors"
)
// ExchangeProductsService exchange info service
type ExchangeProductsService struct {
c *Client
}
// Do send request
func (s *ExchangeProductsService) Do(ctx context.Context, opts ...RequestOption) (res *ExchangeProductsServiceResponse, err error) {
r := &request{
method: "GET",
endpoint: "/exchange/public/cfg/v2/products",
secType: secTypeNone,
}
data, err := s.c.callAPI(ctx, r, opts...)
if err != nil {
return nil, err
}
resp := new(BaseResponse)
resp.Data = &ExchangeProductsServiceResponse{}
err = json.Unmarshal(data, resp)
if err != nil {
return nil, err
}
if resp.Data == nil {
return nil, errors.New("Null response")
}
return resp.Data.(*ExchangeProductsServiceResponse), nil
}
type ExchangeProductsServiceResponse struct {
Currencies []ExchangeCurrency `json:"currencies"`
Products []ExchangeProduct `json:"products"`
RiskLimits []ExchangeRiskLimit `json:"riskLimitsV2"`
Leverages []ExchangeLeverage `json:"leverages"`
}
type ExchangeCurrency struct {
}
type ExchangeRiskLimit struct{}
type ExchangeLeverage struct{}
type ExchangeProduct struct {
Symbol string `json:"symbol"`
Code int64 `json:"code"`
DisplaySymbol string `json:"displaySymbol"`
IndexSymbol string `json:"indexSymbol"`
MarkSymbol string `json:"markSymbol"`
FundingRateSymbol string `json:"fundingRateSymbol"`
FundingRate8HSymbol string `json:"fundingRate8hSymbol"`
ContractUnderlyingAssets string `json:"contractUnderlyingAssets"`
SettleCurrency string `json:"settleCurrency"`
QuoteCurrency string `json:"quoteCurrency"`
ContractSize float64 `json:"contractSize"`
LotSize int64 `json:"lotSize"`
TickSize float64 `json:"tickSize"`
PriceScale int64 `json:"priceScale"`
RatioScale int64 `json:"ratioScale"`
PricePrecision int64 `json:"pricePrecision"`
MinPriceEp int64 `json:"minPriceEp"`
MaxPriceEp int64 `json:"maxPriceEp"`
MaxOrderQty int64 `json:"maxOrderQty"`
Type string `json:"type"`
Status string `json:"status"`
TipOrderQty int64 `json:"tipOrderQty"`
Description string `json:"description"`
//PerpetualV2
//QtyPrecision int `json:"qtyPrecision"`
//QtyStepSize float64 `json:"qtyStepSize"`
//MinPriceRp float64 `json:"minPriceRp"`
//MaxPriceRp float64 `json:"maxPriceRp"`
//MinOrderValueRv float64 `json:"minOrderValueRv"`
//MaxOrderQtyRq float64 `json:"maxOrderQtyRq"`
//BaseCurrency string `json:"baseCurrency"`
//TipOrderQtyRq float64 `json:"tipOrderQtyRq"`
}