Giter Club home page Giter Club logo

Comments (9)

carlosmiei avatar carlosmiei commented on July 21, 2024

Hello @ssemeniuta,
Thanks for letting us know, we will take a look.

from ccxt.

ttodua avatar ttodua commented on July 21, 2024

@carlosmiei this issue might not be directly solvable , because of the frequency of incoming OB updates could be faster than the loop of await .watchOrderBook. so, the solution could be:
A) native ED subscriptions
or
B) handling exceptions in userland to ignore that message
or
C) saving incoming updates in cache (even if there are no clients in this.futures at the given moment) and once the await loopo returns back and re-subscribes into this.futures, then return the new data with respecting cached data

from ccxt.

carlosmiei avatar carlosmiei commented on July 21, 2024

@ttodua I'm not sure exactly how the frequency of incoming updates is related to the checksum validation.

from ccxt.

ttodua avatar ttodua commented on July 21, 2024

@ttodua I'm not sure exactly how the frequency of incoming updates is related to the checksum validation.

because the incoming hash (from exchange side) should match the hash of local orderbook, and if you miss some deltas to be integrated into the local orderbook, then you will end up in different orderbook data, therefore different hash

from ccxt.

carlosmiei avatar carlosmiei commented on July 21, 2024

@ttodua the orderbook is always updated regardless of the "user subscription", you can even call watch_order_book() only once and the orderbook will be updated in the background

from ccxt.

ttodua avatar ttodua commented on July 21, 2024

yes, you're right, what I wanted to interpret is that during frequent updates in bitfinex (if i correctly recall it was bitfinex) on same millisecond I have seen multiple incoming updates, thus when calculating the checksum of current orderbook, it might be still missing the first delta (because the whole handleMessage>handleOrderbook whole cycle can take more than 1 MS) thus, if on same MS there incomes two delta:

  • A
  • B

if B is followed by checksum validation, then A update might not be yet handled (thus missing during checksum).
I just theoretically assume this might be case, can't prove atm..

from ccxt.

ssemeniuta avatar ssemeniuta commented on July 21, 2024

@ttodua Thanks for the feedback. Do I understand correctly that your hypothesis is that book updates are too frequent to be fully processed by the script?

Atm I essentially do B) handling exceptions in userland to ignore that message from your suggestion - I let one script finish, wait for 2-3 minutes, then start the script again. There are periods when my app works for ~2-3 hours without this exception which is fine for now.

from ccxt.

carlosmiei avatar carlosmiei commented on July 21, 2024

@ssemeniuta I don't think that's the root cause for this issue, in the meantime while we debug it can you please try to disable the checksum validation by doing exchange.options['checksum'] = False ?

from ccxt.

ssemeniuta avatar ssemeniuta commented on July 21, 2024

I've modified the above code to

import ccxt.pro
from asyncio import run

print('CCXT Pro version', ccxt.pro.__version__)

params = {"prec": "P0"}
limit = 100

async def main():
    exchange = ccxt.pro.bitfinex2()
    await exchange.load_markets()
    exchange.verbose = False
    exchange.options['checksum'] = False
    symbol = 'AZERO/USDT'
    while True:
        try:
            orderbook = await exchange.watch_order_book(symbol, limit=limit, params=params)
            print(orderbook)
        except Exception as e:
            print(type(e).__name__, str(e))
            break

    await exchange.close()

run(main())

And the exception did not appear after ~24 hours of runtime. Thank you.

from ccxt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.