Code Monkey home page Code Monkey logo

Comments (3)

whitslack avatar whitslack commented on August 12, 2024

There is guidance on this topic in the Implementation Guide. There's no way to (un)subscribe to/from order books in the Event Stream; you're always subscribed to all of them.

Note that the Event Stream will not give you an initial snapshot of the order books. It only provides incremental updates. I'd recommend to connect to the Event Stream first and begin applying the incremental updates to your (initially empty) view, and then subsequently request a snapshot of the order book and merge it into your (possibly nonempty) view. Note that the snapshot could be lagging the stream, so you would want to remember any stream events that didn't match with any order already in your view before you merged the snapshot and replay those events into your view after you merged the snapshot. If done correctly, you'll have a perfectly consistent view of the order book that you can maintain indefinitely.

This is considerably simpler to implement if you use the WebSocket API, which allows you to subscribe to an order book and capture a snapshot of it in one atomic operation.

from api.

npomfret avatar npomfret commented on August 12, 2024

Thanks @whitslack thats very helpful.

I took a look at the example WS code but struggled to understand it. However, I saw the feed in my browsers networking output and figured out what to do, almost.

I can see how to subscribe to the order book feed, but the parameters are confusing. What are the magic numbers for base and counter? And what is tag? And what is watch?

And how do I unsubscribe from a feed?

from api.

whitslack avatar whitslack commented on August 12, 2024

Coinfloor's WebSocket API is documented here. You are specifically asking about the WatchOrders command, which is covered in this section.

The asset codes are enumerated here.

from api.

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.