GithubHelp home page GithubHelp logo

Comments (5)

x-zho14 avatar x-zho14 commented on June 12, 2024 1

Well, it is different for futures. There is timestamp for futures api.
https://binance-docs.github.io/apidocs/futures/en/#individual-symbol-book-ticker-streams

{ "e":"bookTicker", // event type "u":400900217, // order book updateId "E": 1568014460893, // event time "T": 1568014460891, // transaction time "s":"BNBUSDT", // symbol "b":"25.35190000", // best bid price "B":"31.21000000", // best bid qty "a":"25.36520000", // best ask price "A":"40.66000000" // best ask qty }

from nautilus_trader.

cjdsellers avatar cjdsellers commented on June 12, 2024

Hi @x-zho14

Good catch, looks like this is a bug in the parsing:

    def parse_to_quote_tick(
        self,
        instrument_id: InstrumentId,
        ts_init: int,
    ) -> QuoteTick:
        return QuoteTick(
            instrument_id=instrument_id,
            bid_price=Price.from_str(self.b),
            ask_price=Price.from_str(self.a),
            bid_size=Quantity.from_str(self.B),
            ask_size=Quantity.from_str(self.A),
            ts_event=ts_init,  # <---
            ts_init=ts_init,
        )

from nautilus_trader.

cjdsellers avatar cjdsellers commented on June 12, 2024

I think I can see why it was done this way though, looks like for this websocket message there isn't a timestamp for the individual events - so we'll have to parse something else.

{
  "u":400900217,     // order book updateId
  "s":"BNBUSDT",     // symbol
  "b":"25.35190000", // best bid price
  "B":"31.21000000", // best bid qty
  "a":"25.36520000", // best ask price
  "A":"40.66000000"  // best ask qty
}

https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-book-ticker-streams

from nautilus_trader.

x-zho14 avatar x-zho14 commented on June 12, 2024

The code I run is on binance-futures. Thanks a lot for your reply!

from nautilus_trader.

cjdsellers avatar cjdsellers commented on June 12, 2024

Now fixed on develop branch from 2f08599.

We're capturing that T event time now (scaled up from milliseconds to nanoseconds), just for Binance Futures.
I don't have a great solution for Spot right now, so that will continue use the ts_init.

from nautilus_trader.

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.