mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-22 15:10:13 +00:00
exchanges: add setTimeWindow boolean to GetKlineRequest param (#1160)
* exchanges: add setTimeWindow boolean to GetKlineRequest params to differentiate between a set time period return from endpoint. * glorious: nits * exchange: conjugation * Update exchanges/exchange.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * glorious: nits and an assortment of differences * exchanges: remove some comments * glorious: nits * cleanup * tests: fix * Update exchanges/hitbtc/hitbtc_wrapper.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update exchanges/kline/kline.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * Update exchanges/kline/kline_test.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * glorious: nits * kline: fix test * rm unused variables * almost: nits * glorious: nits * linter: fix * rm unused variable * Refactored comment in the okex tests to ensure that it accurately reflects the variable name and the issue related to the time window, as requested by GloriousCode. The previous comment did not align with the identifier assigned to the property, which could cause confusion and misunderstanding among other programmers or stakeholders. The updated comment will improve the clarity and readability of the codebase and make it easier to understand the intended purpose of the associated variables. The change was made with the aim of improving the overall quality and maintainability of the code. --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io> Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
This commit is contained in:
@@ -53,7 +53,7 @@ func TestMain(m *testing.M) {
|
||||
|
||||
err = b.UpdateTradablePairs(context.Background(), false)
|
||||
if err != nil {
|
||||
log.Fatal("Bithumb Setup() init error")
|
||||
log.Fatal("Bithumb Setup() init error", err)
|
||||
}
|
||||
|
||||
os.Exit(m.Run())
|
||||
@@ -617,8 +617,8 @@ func TestGetHistoricCandles(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
startTime := time.Now().AddDate(0, 0, -1)
|
||||
_, err = b.GetHistoricCandles(context.Background(), pair, asset.Spot, kline.OneMin, startTime, time.Now())
|
||||
startTime := time.Now().AddDate(0, -2, 0)
|
||||
_, err = b.GetHistoricCandles(context.Background(), pair, asset.Spot, kline.OneDay, startTime, time.Now())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -115,17 +115,22 @@ func (b *Bithumb) SetDefaults() {
|
||||
AutoPairUpdates: true,
|
||||
Kline: kline.ExchangeCapabilitiesEnabled{
|
||||
Intervals: kline.DeployExchangeIntervals(
|
||||
kline.OneMin,
|
||||
kline.ThreeMin,
|
||||
kline.FiveMin,
|
||||
kline.TenMin,
|
||||
kline.ThirtyMin,
|
||||
kline.OneHour,
|
||||
kline.SixHour,
|
||||
kline.TwelveHour,
|
||||
kline.OneDay,
|
||||
kline.IntervalCapacity{Interval: kline.OneMin},
|
||||
kline.IntervalCapacity{Interval: kline.ThreeMin},
|
||||
kline.IntervalCapacity{Interval: kline.FiveMin},
|
||||
kline.IntervalCapacity{Interval: kline.TenMin},
|
||||
kline.IntervalCapacity{Interval: kline.ThirtyMin},
|
||||
kline.IntervalCapacity{Interval: kline.OneHour},
|
||||
// NOTE: The supported time intervals below are returned
|
||||
// offset to the Asia/Seoul time zone. This may lead to
|
||||
// issues with candle quality and conversion as the
|
||||
// intervals may be broken up. Therefore the below intervals
|
||||
// are constructed from hourly candles.
|
||||
// kline.IntervalCapacity{Interval: kline.SixHour},
|
||||
// kline.IntervalCapacity{Interval: kline.TwelveHour},
|
||||
// kline.IntervalCapacity{Interval: kline.OneDay},
|
||||
),
|
||||
ResultLimit: 1500,
|
||||
GlobalResultLimit: 1500,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -784,7 +789,7 @@ func (b *Bithumb) FormatExchangeKlineInterval(in kline.Interval) string {
|
||||
|
||||
// GetHistoricCandles returns candles between a time period for a set time interval
|
||||
func (b *Bithumb) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, start, end time.Time) (*kline.Item, error) {
|
||||
req, err := b.GetKlineRequest(pair, a, interval, start, end)
|
||||
req, err := b.GetKlineRequest(pair, a, interval, start, end, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user