mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-29 15:10:37 +00:00
exchange/wrapper: add GetServerTime() for exchange analytics (#938)
* exchange/wrapper: add GetServerTime() for exchange analytics * binance: fix linter issue * glorious: nits * glorious: nits rides again * thrasher: nits implement huobi * thrasher: nits add to exchange_wrapper_issues cmd
This commit is contained in:
@@ -570,3 +570,15 @@ func TestUpdateTickers(t *testing.T) {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWrapperGetServerTime(t *testing.T) {
|
||||
t.Parallel()
|
||||
st, err := y.GetServerTime(context.Background(), asset.Spot)
|
||||
if !errors.Is(err, nil) {
|
||||
t.Fatalf("received: '%v' but expected: '%v'", err, nil)
|
||||
}
|
||||
|
||||
if st.IsZero() {
|
||||
t.Fatal("expected a time")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -698,3 +698,12 @@ func (y *Yobit) GetHistoricCandles(ctx context.Context, pair currency.Pair, a as
|
||||
func (y *Yobit) 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
|
||||
}
|
||||
|
||||
// GetServerTime returns the current exchange server time.
|
||||
func (y *Yobit) GetServerTime(ctx context.Context, _ asset.Item) (time.Time, error) {
|
||||
info, err := y.GetInfo(ctx)
|
||||
if err != nil {
|
||||
return time.Time{}, err
|
||||
}
|
||||
return time.Unix(info.ServerTime, 0), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user