forked from thrasher-corp/gocryptotrader
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gateio_custom.go
69 lines (59 loc) · 2.1 KB
/
gateio_custom.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
package gateio
// GetMarketInfo returns information about all trading pairs, including
// transaction fee, minimum order quantity, price accuracy and so on
// func (g *Gateio) GetSpotMarketInfo(ctx context.Context) (SpotMarketInfoResponse, error) {
// type response struct {
// Result string `json:"result"`
// Pairs []interface{} `json:"pairs"`
// }
// urlPath := fmt.Sprintf("/%s/%s",
// gateioAPIVersion,
// gateioMarketInfo)
// resp := struct {
// Data [][]string `json:"data"`
// Result string `json:"result"`
// }{}
// var res response
// var result SpotMarketInfoResponse
// if err := g.SendHTTPRequest(ctx, exchange.RestSpotSupplementary, urlPath, &resp); err != nil {
// return result, err
// }
// assetType := asset.Spot
// format, err := g.GetPairFormat(assetType, true)
// if err != nil {
// return result, err
// }
// pairs, err := g.GetEnabledPairs(assetType)
// if err != nil {
// return result, err
// }
// result.Result = res.Result
// for _, v := range res.Pairs {
// item := v.(map[string]interface{})
// for itemk, itemv := range item {
// pairv := itemv.(map[string]interface{})
// item := SpotMarketInfoPairsResponse{}
// item.Symbol, err = currency.NewPairFromFormattedPairs(itemk, pairs, format)
// if err != nil {
// return result, err
// }
// item.DecimalPlaces = pairv["decimal_places"].(float64)
// item.AmountDecimalPlaces = pairv["amount_decimal_places"].(float64)
// item.MinAmount = pairv["min_amount"].(float64)
// item.MinAmountA = pairv["min_amount_a"].(float64)
// item.MinAmountB = pairv["min_amount_b"].(float64)
// item.Fee = pairv["fee"].(float64)
// if trade_disabled := pairv["trade_disabled"].(float64); trade_disabled == 1.0 {
// item.TradeDisabled = true
// }
// if buy_disabled := pairv["buy_disabled"].(float64); buy_disabled == 1.0 {
// item.BuyDisabled = true
// }
// if sell_disabled := pairv["sell_disabled"].(float64); sell_disabled == 1.0 {
// item.SellDisabled = true
// }
// result.Pairs = append(result.Pairs, item)
// }
// }
// return result, nil
// }