Skip to content

Commit

Permalink
pkg/exchange: support TimeRangeProvider in bybit
Browse files Browse the repository at this point in the history
  • Loading branch information
bailantaotao committed Oct 27, 2023
1 parent d9474bb commit 1448c05
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/exchange/bybit/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ var (
_ types.ExchangeTradeService = &Exchange{}
_ types.Exchange = &Exchange{}
_ types.ExchangeOrderQueryService = &Exchange{}
_ types.ExchangeTimeRangeProvider = &Exchange{}
)

type Exchange struct {
Expand Down Expand Up @@ -592,6 +593,20 @@ func (e *Exchange) GetAllFeeRates(ctx context.Context) (bybitapi.FeeRates, error
return *feeRates, nil
}

// GetMaxTradeHistoryTimeRange returns a time range of 180 days, which is the maximum supported by the exchange.
//
// see more: QueryTrades
func (e *Exchange) GetMaxTradeHistoryTimeRange() time.Duration {
return 180 * 24 * time.Hour
}

// GetMaxOrderHistoryTimeRange returns 0 since the exchange not supported by time-range-based query
//
// see more: QueryClosedOrders
func (e *Exchange) GetMaxOrderHistoryTimeRange() time.Duration {
return 0
}

func (e *Exchange) NewStream() types.Stream {
return NewStream(e.key, e.secret, e)
}

0 comments on commit 1448c05

Please sign in to comment.