JKorf / Bybit.Net

A C# .netstandard client library for the Bybit REST and Websocket V5 API focusing on clear usage and models
https://jkorf.github.io/Bybit.Net/
90 stars 64 forks source link

Fix timestamp code #64

Closed VozyakovAV closed 1 year ago

VozyakovAV commented 1 year ago

Hi, if the time is not synchronized on the computer, then I get an error. Please fix timestamp code:

  1. Socket var expireTime = DateTimeConverter.ConvertToMilliseconds(DateTime.UtcNow.AddSeconds(5))!; change to: var expireTime = DateTimeConverter.ConvertToMilliseconds(DateTime.UtcNow.AddDays(1))!;

  2. Rest parameters.Add("timestamp", GetMillisecondTimestamp(apiClient)); change to: parameters.Add("timestamp", DateTimeConverter.ConvertToMilliseconds(GetTimestamp(apiClient).AddMilliseconds(-1000)).Value.ToString(CultureInfo.InvariantCulture));

https://bybit-exchange.github.io/docs/futuresV2/linear/#t-authenticationparameters Please make sure that the timestamp parameter adheres to the following rule: server_time - recv_window <= timestamp < server_time + 1000; server_time stands for Bybit server time, which can be queried via the Server Time endpoint.

JKorf commented 1 year ago

Has been added