-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexchanges.go
More file actions
24 lines (21 loc) · 1.46 KB
/
Copy pathexchanges.go
File metadata and controls
24 lines (21 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package coincap
// Exchange contains information about a cryptocurrency exchange.
type Exchange struct {
ID string `json:"exchangeId"` // unique identifier for exchange
Name string `json:"name"` // proper name of exchange
Rank int `json:"rank,string"` // rank in terms of total volume compared to other exchanges
PercentTotalVolume float64 `json:"percentTotalVolume,string"` // perecent of total daily volume in relation to all exchanges
VolumeUSD float64 `json:"volumeUSD,string"` // daily volume represented in USD
TradingPairs int `json:"tradingPairs,string"` // number of trading pairs offered by the exchange
Socket bool `json:"socket"` // Whether or not a trade socket is available on this exchange
URL string `json:"exchangeUrl"` // url of exchange
Updated Timestamp `json:"updated"` // Time since information was last updated
}
// Exchanges returns information about all exchanges currently tracked by CoinCap.
func (c *Client) Exchanges() ([]Exchange, Timestamp, error) {
return request[[]Exchange](c, "exchanges", nil)
}
// ExchangeByID returns exchange data for an exchange with the given unique ID.
func (c *Client) ExchangeByID(id string) (*Exchange, Timestamp, error) {
return request[*Exchange](c, "exchanges/"+id, nil)
}