mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-06 07:26:47 +00:00
exchanges: Initial context propagation (#744)
* 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
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -14,12 +15,12 @@ import (
|
||||
)
|
||||
|
||||
// LoadData retrieves data from a GoCryptoTrader exchange wrapper which calls the exchange's API
|
||||
func LoadData(dataType int64, startDate, endDate time.Time, interval time.Duration, exch exchange.IBotExchange, fPair currency.Pair, a asset.Item) (*kline.Item, error) {
|
||||
func LoadData(ctx context.Context, dataType int64, startDate, endDate time.Time, interval time.Duration, exch exchange.IBotExchange, fPair currency.Pair, a asset.Item) (*kline.Item, error) {
|
||||
var candles kline.Item
|
||||
var err error
|
||||
switch dataType {
|
||||
case common.DataCandle:
|
||||
candles, err = exch.GetHistoricCandlesExtended(
|
||||
candles, err = exch.GetHistoricCandlesExtended(ctx,
|
||||
fPair,
|
||||
a,
|
||||
startDate,
|
||||
@@ -30,7 +31,7 @@ func LoadData(dataType int64, startDate, endDate time.Time, interval time.Durati
|
||||
}
|
||||
case common.DataTrade:
|
||||
var trades []trade.Data
|
||||
trades, err = exch.GetHistoricTrades(
|
||||
trades, err = exch.GetHistoricTrades(ctx,
|
||||
fPair,
|
||||
a,
|
||||
startDate,
|
||||
|
||||
Reference in New Issue
Block a user