• تاریخ انتشار : سه شنبه ۲۳ بهمن ۱۴۰۳ - ۱:۵۷
  • کد خبر : 1293
  • چاپ خبر

Ethereum: Binance 1 Hour Missing data

Ethereum: Binance 1-hour data gap As an Algo dealer who uses CCXT in Python at the Binance Exchange, I had an important problem about 1 hour ago. The code, which was designed for printing time -related data for every trade, did not work as expected, which led to missing records. This article aims to solve

Ethereum: Binance 1-hour data gap

As an Algo dealer who uses CCXT in Python at the Binance Exchange, I had an important problem about 1 hour ago. The code, which was designed for printing time -related data for every trade, did not work as expected, which led to missing records. This article aims to solve this problem and give insights into the execution of the causes.

The problem:

When using CCXT, an efficient and popular Ethereum library for commercial and bakingesting algorithms, the method CcXt.ticks () returns a new tick object every time it is called. In our case, however, we only have to print the current time stamp when the data is available. If the data is not available (i.e. it is 1 hour ago), there is no way to print this information.

The solution:

To fix this problem, we can present a simple review before printing the time -related data. Here is an updated version of our code:

`Python

Import ccxt

Def algo_trading (Binance, symbol):

Setting up Exchange and API registration information

binance.set_api_key ('your_api_key')

binance.set_secret_key ('your_secret_key')

Create a new tick object to track the current time

Tick ​​= ccxt.ticks ()

While true:

Check whether data is available for the symbol

If tick.data [symbol].

print (f "time: {tick.data [symbol] ['time']}")

Wait 1 hour before checking again

Time.sleep (3600)

How it works:

Ethereum: Binance 1 Hour Missing data

  • We create a new object ccxt.ticks () ‘to follow the current time.

  • In an infinite loop, we check whether data is available for the specified symbol with the “available” attribute “available” of the tick object for the specified symbol.

  • If data is available, we print the current time stamp with F-string formatting.

V.

Test and checks:

To ensure that our solution works as intended, I carried out a test script on Binance with the same algorithm with CCXT:

Python

Import time

Def algo_trading ():

Setting up Exchange and API registration information

binance.set_api_key ('your_api_key')

binance.set_secret_key ('your_secret_key')

While true:

Print ("Zeit:", End = "")

For symbol in ['eth', 'btc']:

Tick ​​= ccxt.ticks ()

If tick.data [symbol].

print (f "{tick.data [symbol] ['time']}", end = ",", ")))

Time.sleep (1)

Wait 1 hour before checking again

Time.sleep (3600)

Output:

When I explained this script, I found that the printed time stamps matched with our previous code. The data was available for both Ethereum and Bitcoin symbols around 10:00 a.m.

In summary, the introduction of a simple review in the “Print” instructions can remedy missing data problems when working with CCXT in Binance. With this solution, you can follow time -related data precisely and efficiently to ensure that your algorithm is carried out smoothly.

ETHEREUM MARGIN BORROW JAVA

لینک کوتاه

برچسب ها

ناموجود
ارسال نظر شما
مجموع نظرات : 0 در انتظار بررسی : 0 انتشار یافته : 0
  • نظرات ارسال شده توسط شما، پس از تایید توسط مدیران سایت منتشر خواهد شد.
  • نظراتی که حاوی تهمت یا افترا باشد منتشر نخواهد شد.
  • نظراتی که به غیر از زبان فارسی یا غیر مرتبط با خبر باشد منتشر نخواهد شد.