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:
Ryan O'Hara-Reid
2022-05-06 11:38:59 +10:00
committed by GitHub
parent c6ad429827
commit d735effc8e
24 changed files with 230 additions and 28 deletions

View File

@@ -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")
}
}

View File

@@ -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
}