Listen the pre -Seconde on Ethereum with Binance Net: Problem C Datetime.addsconds
As a fierce trader of cryptocurrency, you, verbally, do not take up the work with the subsidies of the data from the various birzh. However, when it comes to the view of the preying candle on the ethereum with the exaltation of the Api binance.Net, there is a general problem that can make your code unbroken for use. In this state, we will utter in what, where’s the datetime.addsconds' does not work as well as the predatory resolution for the pre -education of this one.
Problem:Datetime.addsconds
When you use the methodDatetime.addsconds’, he adds seconds to the indicative value of the date/time. This can be problematic in the defined walls, especially at the work with the candle on the banks, which are their shadows in the UTC (scardinated universal time).
On Ethereum, the candle, is descended in the perception of the UTC, which indicates that any correction in the time of metque datetime.addseconds' will not bring to the right presentation.
Resolution: UseDatetime.fromTicksor
Datetime.parseexact
To find the pre -preying candle, you need to interfere with the time mark in the object of Datetime. However, the binance net use the mites for your api resources (in the second second), you need to use one of the two pods:
1.
csharp
Var pre-Educating Candle = wait binance.net-api.client.candles.getPrevious (Orders, 0);
Var Previtydate = New Datetime (Premier Candle.dateutc.secondssincepoch / Timespan.Tickpersecond);
-
Datetime.Parseexact
: If you have a time mark utc in the category of the strokes in the formeryyyy-mm-ddthh: mm: ssz
, you can use this method toothethey.
`csharp
Var pre-Educating Candle = wait binance.net-api.client.candles.getPrevious (Orders, 0);
String of the pre -trial Timestamp = preying kandle.timestamp;
Datetime? pre-presenting Date = Datetime.Parseexact (preying titul, "yyyy-mm-ddthh: mm: SSZZ", Null);
Using Datetime.fromTicks
To make a maximum fad, use the following fragment of the code in the running point:
`csharp
ORDERS = AWAIT BINANCE.NET-API.CLIENT.ORGEDER.GETERSASYNC (Orderssymbol, Ordertype, Datetime.now, New Orderinfo {Side.Buy});
Var pre-Educating Candle = wait binance.net-api.client.candles.getPrevious (Orders, 0);
Var Previtydate = New Datetime (Premier Candle.dateutc.secondssincepoch / Timespan.Tickpersecond);
// Using the pre -pretending centers
Using Datetime.Parseexact
For the analysis of the time-meter UTC in the categority of the stroke in the final format (for example, “YYYY-MM-DDTH: MM: SSZ”), you can use the follow-up of the code:
`csharp
ORDERS = AWAIT BINANCE.NET-API.CLIENT.ORGEDER.GETERSASYNC (Orderssymbol, Ordertype, Datetime.now, New Orderinfo {Side.Buy});
String Premortimestamp = Orders [0] .candletim;
Datetime? pre-presenting Date = Datetime.Parseexact (preying titul, "yyyy-mm-ddthh: mm: SSZ", Null);
In the conclusion, at the work with the Binance Net and the preying candle on the etherum Datetime.addsconds' is not a renewed method with a non -lifeline of the mesh and seconds. Uspolza
Datetime.fromTicks, Liber Datetime.Parseexact
, you can preoder this scoring and pre -emptive data on candles.
Do not forget to prove a then analysis and conversion of time meters to work with API, which are their shadows in the UTC.
Leave a Reply