forked from adshao/go-binance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exchange_info_service.go
60 lines (53 loc) · 1.66 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
package binance
import (
"context"
"encoding/json"
)
// ExchangeInfoService exchange info service
type ExchangeInfoService struct {
c *Client
}
// Do send request
func (s *ExchangeInfoService) Do(ctx context.Context, opts ...RequestOption) (res *ExchangeInfo, err error) {
r := &request{
method: "GET",
endpoint: "/api/v1/exchangeInfo",
secType: secTypeNone,
}
data, err := s.c.callAPI(ctx, r, opts...)
if err != nil {
return nil, err
}
res = new(ExchangeInfo)
err = json.Unmarshal(data, res)
if err != nil {
return nil, err
}
return res, nil
}
// ExchangeInfo exchange info
type ExchangeInfo struct {
Timezone string `json:"timezone"`
ServerTime int64 `json:"serverTime"`
RateLimits []RateLimit `json:"rateLimits"`
ExchangeFilters []interface{} `json:"exchangeFilters"`
Symbols []Symbol `json:"symbols"`
}
// RateLimit struct
type RateLimit struct {
RateLimitType string `json:"rateLimitType"`
Interval string `json:"interval"`
Limit int64 `json:"limit"`
}
// Symbol market symbol
type Symbol struct {
Symbol string `json:"symbol"`
Status string `json:"status"`
BaseAsset string `json:"baseAsset"`
BaseAssetPrecision int `json:"baseAssetPrecision"`
QuoteAsset string `json:"quoteAsset"`
QuotePrecision int `json:"quotePrecision"`
OrderTypes []string `json:"orderTypes"`
IcebergAllowed bool `json:"icebergAllowed"`
Filters []map[string]interface{} `json:"filters"`
}