mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-16 15:09:57 +00:00
* gct: phase one context awareness pass * exchanges: context propagation pass * common/requester: force context requirement * gctcli/exchanges: linter fix * rpcserver: fix test using dummy rpc server * backtester: fix comments * grpc: add correct cancel and timeout for commands * rpcserver_test: add comment on dummy server * common: deprecated SendHTTPGetRequest * linter: fix * linter: turn on no context check * apichecker: fix context linter issue * binance: use param context * common: remove checks as this gets executed before main * common: change mutex to RW as clients can be used by multiple go routines. * common: remove init and JIT default client. Unexport global variables and add protection. * common: Add comments * bithumb: after dinner mints fix
95 lines
3.9 KiB
Markdown
95 lines
3.9 KiB
Markdown
# GoCryptoTrader OHLCV support
|
|
|
|
<img src="https://github.com/thrasher-corp/gocryptotrader/blob/master/web/src/assets/page-logo.png?raw=true" width="350px" height="350px" hspace="70">
|
|
|
|
[](https://github.com/thrasher-corp/gocryptotrader/actions/workflows/tests.yml)
|
|
[](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE)
|
|
[](https://godoc.org/github.com/thrasher-corp/gocryptotrader/exchanges)
|
|
[](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master)
|
|
[](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader)
|
|
|
|
This exchanges package is part of the GoCryptoTrader codebase.
|
|
|
|
## This is still in active development
|
|
|
|
You can track ideas, planned features and what's in progress on this Trello board: [https://trello.com/b/ZAhMhpOy/gocryptotrader](https://trello.com/b/ZAhMhpOy/gocryptotrader).
|
|
|
|
Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://join.slack.com/t/gocryptotrader/shared_invite/enQtNTQ5NDAxMjA2Mjc5LTc5ZDE1ZTNiOGM3ZGMyMmY1NTAxYWZhODE0MWM5N2JlZDk1NDU0YTViYzk4NTk3OTRiMDQzNGQ1YTc4YmRlMTk)
|
|
|
|
## Wrapper Methods
|
|
|
|
Candle retrieval is handled by two methods
|
|
|
|
|
|
GetHistoricCandles which makes a single request to the exchange and follows all exchange limitations
|
|
```go
|
|
func (b *base) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error) {
|
|
return kline.Item{}, common.ErrFunctionNotSupported
|
|
}
|
|
```
|
|
|
|
GetHistoricCandlesExtended that will make multiple requests to an exchange if the requested periods are outside exchange limits
|
|
```go
|
|
func (b *base) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error) {
|
|
return kline.Item{}, common.ErrFunctionNotSupported
|
|
}
|
|
```
|
|
|
|
both methods return kline.Item{}
|
|
|
|
```go
|
|
// Item holds all the relevant information for internal kline elements
|
|
type Item struct {
|
|
Exchange string
|
|
Pair currency.Pair
|
|
Asset asset.Item
|
|
Interval Interval
|
|
Candles []Candle
|
|
}
|
|
|
|
// Candle holds historic rate information.
|
|
type Candle struct {
|
|
Time time.Time
|
|
Open float64
|
|
High float64
|
|
Low float64
|
|
Close float64
|
|
Volume float64
|
|
}
|
|
```
|
|
|
|
### DBSeed helper
|
|
|
|
A helper tool [cmd/dbseed](../cmd/dbseed/README.md) has been created for assisting with candle data migration
|
|
|
|
## Exchange status
|
|
| Exchange | Supported |
|
|
|----------------|-------------|
|
|
| Binance | Y |
|
|
| Bitfinex | Y |
|
|
| Bitflyer | |
|
|
| Bithumb | Y |
|
|
| Bitmex | |
|
|
| Bitstamp | Y |
|
|
| BTC Markets | Y |
|
|
| Bittrex | |
|
|
| BTSE | Y |
|
|
| Coinbase Pro | Y |
|
|
| Coinbene | Y |
|
|
| Coinut | |
|
|
| Exmo | |
|
|
| GateIO | Y |
|
|
| Gemini | |
|
|
| HitBTC | Y |
|
|
| Huobi | Y |
|
|
| FTX | Y |
|
|
| itBIT | |
|
|
| Kraken | Y |
|
|
| lBank | Y |
|
|
| Localbitcoins | |
|
|
| Okcoin | Y |
|
|
| Okex | Y |
|
|
| Poloniex | Y |
|
|
| Yobit | |
|
|
| ZB | Y |
|