exchanges: Remove FTX implementation and fix minor test issues (#1100)

* exchanges: Start removal of FTX

* Get tests happy again

* okx: improve logic and add basic coverage

* Fix linterino

* Round 2 plus rm useless assignment in test

* Fix exchange_wrapper_issues test error

* Fix nitters

* Address nitters
This commit is contained in:
Adrian Gallagher
2023-01-25 16:40:04 +11:00
committed by GitHub
parent 05558aabfb
commit c785ae73a7
57 changed files with 211 additions and 9661 deletions

View File

@@ -237,18 +237,18 @@ func (bi *Binanceus) GetAggregateTrades(ctx context.Context, agg *AggregatedTrad
if agg.FromID != 0 {
params.Set("fromId", strconv.FormatInt(agg.FromID, 10))
}
startTime := time.UnixMilli(int64(agg.StartTime))
endTime := time.UnixMilli(int64(agg.EndTime))
startTime := time.UnixMilli(agg.StartTime)
endTime := time.UnixMilli(agg.EndTime)
if (endTime.UnixNano() - startTime.UnixNano()) >= int64(time.Hour) {
endTime = startTime.Add(time.Minute * 59)
}
if !startTime.IsZero() && startTime.Unix() != 0 {
params.Set("startTime", strconv.Itoa(int(agg.StartTime)))
params.Set("startTime", strconv.FormatInt(agg.StartTime, 10))
}
if !endTime.IsZero() && endTime.Unix() != 0 {
params.Set("endTime", strconv.Itoa(int(agg.EndTime)))
params.Set("endTime", strconv.FormatInt(agg.EndTime, 10))
}
needBatch = needBatch || (!startTime.IsZero() && !endTime.IsZero() && endTime.Sub(startTime) > time.Hour)
if needBatch {
@@ -277,8 +277,8 @@ func (bi *Binanceus) batchAggregateTrades(ctx context.Context, arg *AggregatedTr
// Extend from the default of 500
params.Set("limit", "1000")
}
startTime := time.UnixMilli(int64(arg.StartTime))
endTime := time.UnixMilli(int64(arg.EndTime))
startTime := time.UnixMilli(arg.StartTime)
endTime := time.UnixMilli(arg.EndTime)
var fromID int64
if arg.FromID > 0 {
fromID = arg.FromID
@@ -292,8 +292,8 @@ func (bi *Binanceus) batchAggregateTrades(ctx context.Context, arg *AggregatedTr
// All requests returned empty
return nil, nil
}
params.Set("startTime", strconv.Itoa(int(startTime.UnixMilli())))
params.Set("endTime", strconv.Itoa(int(startTime.Add(increment).UnixMilli())))
params.Set("startTime", strconv.FormatInt(startTime.UnixMilli(), 10))
params.Set("endTime", strconv.FormatInt(startTime.Add(increment).UnixMilli(), 10))
path := common.EncodeURLValues(aggregatedTrades, params)
err := bi.SendHTTPRequest(ctx,
exchange.RestSpotSupplementary, path, spotDefaultRate, &resp)

View File

@@ -129,8 +129,8 @@ type AggregatedTradeRequestParams struct {
// The first trade to retrieve
FromID int64
// The API seems to accept (start and end time) or FromID and no other combinations
StartTime uint64
EndTime uint64
StartTime int64
EndTime int64
// Default 500; max 1000.
Limit int
}

View File

@@ -539,8 +539,8 @@ func (bi *Binanceus) GetHistoricTrades(ctx context.Context, p currency.Pair,
assetType asset.Item, timestampStart, timestampEnd time.Time) ([]trade.Data, error) {
req := AggregatedTradeRequestParams{
Symbol: p,
StartTime: uint64(timestampStart.UnixMilli()),
EndTime: uint64(timestampEnd.UnixMilli()),
StartTime: timestampStart.UnixMilli(),
EndTime: timestampEnd.UnixMilli(),
}
trades, err := bi.GetAggregateTrades(ctx, &req)
if err != nil {