Code Monkey home page Code Monkey logo

Comments (3)

cryptochassis avatar cryptochassis commented on July 20, 2024 1

@woonsangcho Thank you for the feedback. Following the steps that you provided, I was able to see the problem (at least on Coinbase which is the exchange that I tried). Based on preliminary investigation, it seems to be a Coinbase server time issue. Here are two things that I noticed:

  1. Enable CCAPI_ENABLE_LOG_DEBUG. This way we could see the raw messages received from Coinbase:
    0x700009e05000: [2021-01-17T04:39:52.522214000Z] {ccapi_market_data_service.h:341} DEBUG received a text message: {"type":"l2update","product_id":"BTC-USD","changes":[["sell","36142.70","0.00000000"]],"time":"2021-01-17T04:39:52.526806Z"} 0x700009e05000: [2021-01-17T04:39:52.522277000Z] {ccapi_market_data_service.h:405} WARN late websocket message: timeReceived = (1610858392,522142000), wsMessage.tp = (1610858392,526806000), wsConnection
    The timeReceived value ultimately came from https://github.com/crypto-chassis/ccapi_cpp/blob/v2.2.8/include/ccapi_cpp/service/ccapi_market_data_service.h#L328. It seems that Coinbase's server does sometimes have time skew.
  2. Coinbase provides an rest endpoint to probe their server time: https://docs.pro.coinbase.com/#time. So using this and trying a couple of times, we could indeed observe something like this: 1610858537.2 {"iso":"2021-01-17T04:42:17.621Z","epoch":1610858537.621} 1610858537.411317 using this script python3 -c 'import time; print(time.time())' && curl https://api.pro.coinbase.com/time && python3 -c 'import time; print(time.time())'. We can see that for this moment Coinbase's server clock was slightly behind ours.
    Let us know if you think the root cause isn't the problem from Coinbase's server but rather it is something else.

from ccapi.

cryptochassis avatar cryptochassis commented on July 20, 2024 1

@woonsangcho

On a different matter, this example is simply streaming live market data. Was there a reason why wsMessage.recapType is SOLICITED rather than NONE? It can also be classified into a normal tick data as you commented inline, or changing the condition to include SOLICITED would be a workaround.

Sorry if it looks confusing. We are trying to follow Bloomberg's convention: blpapi_cpp_3.13.1.1, in fact the inline comments were directly copied from their open-source library's inline comments. To put it straightforward, for our library a recap=SOLICITED message for now only exists in market depth websocket stream and it is always the first message providing a snapshot when we initially subscribed to the exchange. For coinbase, it corresponds to their level2 channel and their message type "snapshot" (https://docs.pro.coinbase.com/#the-level2-channel). But indeed the timestamp might be somewhat confusing because their "snapshot" message doesn't provide a timestamp (though some other exchanges do) and we left it blank (i.e. it became unix zero timestamp) for Coinbase. So we'll make a fix to make sure that the timestamp for a SOLICITED message is well-defined for all the exchanges that we support.

from ccapi.

woonsangcho avatar woonsangcho commented on July 20, 2024

@cryptochassis Thank you for taking your time looking into this, and I appreciate your detailed feedback. I agree with you that the issue is on Coinbase's end.

from ccapi.

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.