Giter Club home page Giter Club logo

Comments (8)

gary-rowe avatar gary-rowe commented on July 17, 2024

At the moment the code to support the streaming APIs is not as stable as I would like it and there is work to be done to support multi-threaded access to multiple streams. Also, only Mt Gox ticker information is supported on the streaming API.

That said, it would not a large amount of work to implement the depth and order book information. If you are in a position to address this yourself the code required can largely be lifted from the ticker implementation. Patches welcome! :-)

I'm currently maxed out in my spare time so I won't be able to get to this for a week or more at best.

from xchange.

apetersson avatar apetersson commented on July 17, 2024

the issue is not very pressing, so i will revert to polling the orderbook for now. i will most likely address this in a few weeks.

it would also be nice if the library would somehow abstract the necessary reconnection, maybe with a given policy (try max 3 times in 10 seconds or something).

a "living order book" which represents the current order book,self-updating which is able to be queried in a thread-safe manner would be a nice addition that is feasable, for example.

from xchange.

timmolter avatar timmolter commented on July 17, 2024

@apetersson Agreed. That's exactly what we need. If you feel like taking a crack at it when you have time, go for it!

from xchange.

timmolter avatar timmolter commented on July 17, 2024

I'm working on this right now. MtGox also just dropped their socket.io API totally unannounced, and their websocket API seems to have been resurrected out of "deprecated" state.

from xchange.

timmolter avatar timmolter commented on July 17, 2024

done. see: MtGoxWebSocketMarketDataDemo.java

from xchange.

pabx06 avatar pabx06 commented on July 17, 2024

MtGoxWebSocketMarketDataDemo.java used to show volume chnage ie:

OrderBookUpdate: Trade [type=BID, tradableAmount=-0.59999999999999997779553950749686919152736663818359375, tradableIdentifier=BTC, transactionCurrency=USD, price=USD 85.2611, timestamp=Sat Mar 30 16:02:02 CET 2013] @ LimitOrder [limitPrice=USD 85.2611, Order [type=BID, tradableAmount=0, tradableIdentifier=BTC, transactionCurrency=USD, id=]]
OrderBookUpdate: Trade [type=BID, tradableAmount=0, tradableIdentifier=BTC, transactionCurrency=USD, price=USD 65, timestamp=Sat Mar 30 16:02:02 CET 2013] @ LimitOrder [limitPrice=USD 65, Order [type=BID, tradableAmount=1883.7280848, tradableIdentifier=BTC, transactionCurrency=USD, id=]]
OrderBookUpdate: Trade [type=BID, tradableAmount=0.385299039999999981542799787348485551774501800537109375, tradableIdentifier=BTC, transactionCurrency=USD, price=USD 62.5, timestamp=Sat Mar 30 16:02:03 CET 2013] @ LimitOrder [limitPrice=USD 62.5, Order [type=BID, tradableAmount=319.4363696, tradableIdentifier=BTC, transactionCurrency=USD, id=]]
OrderBookUpdate: Trade [type=BID, tradableAmount=-0.200000000000000011102230246251565404236316680908203125, tradableIdentifier=BTC, transactionCurrency=USD, price=USD 82.08899, timestamp=Sat Mar 30 16:02:04 CET 2013] @ LimitOrder [limitPrice=USD 82.08899, Order [type=BID, tradableAmount=0, tradableIdentifier=BTC, transactionCurrency=USD, id=]]
Ticker [tradableIdentifier=BTC, last=USD 91.20999, bid=USD 91.01001, ask=USD 91.20000, high=USD 94.98000, low=USD 85.50000, volume=53800.16986659, timestamp=Sat Mar 30 16:01:57 CET 2013]
OrderBookUpdate: Trade [type=BID, tradableAmount=-0.8000000000000000444089209850062616169452667236328125, tradableIdentifier=BTC, transactionCurrency=USD, price=USD 84.56223, timestamp=Sat Mar 30 16:02:06 CET 2013] @ LimitOrder [limitPrice=USD 84.56223, Order [type=BID, tradableAmount=0, tradableIdentifier=BTC, transactionCurrency=USD, id=]]
OrderBookUpdate: Trade [type=BID, tradableAmount=0, tradableIdentifier=BTC, transactionCurrency=USD, price=USD 62.5, timestamp=Sat Mar 30 16:02:06 CET 2013] @ LimitOrder [limitPrice=USD 62.5, Order [type=BID, tradableAmount=320.51876624, tradableIdentifier=BTC, transactionCurrency=USD, id=]]
OrderBookUpdate: Trade [type=ASK, tradableAmount=1.4899999999999999911182158029987476766109466552734375, tradableIdentifier=BTC, transactionCurrency=USD, price=USD 95.81699, timestamp=Sat Mar 30 16:02:09 CET 2013] @ LimitOrder [limitPrice=USD 95.81699, Order [type=ASK, tradableAmount=1.49, tradableIdentifier=BTC, transactionCurrency=USD, id=]]

but how guy do retrive the curent volume aviable for the best 2 (topmost) bid and best 2 Ask ?

from xchange.

pabx06 avatar pabx06 commented on July 17, 2024

do you need to retrive the full order book using rest API and update the change from streaming ? rest api for MTGOX is 10 sec cached ???? this awful

the orderbook has usefull forgoten params as javadoc : totalVolume

/**

  • NEW: The change in volume at limitPrice
    */

    /**

  • Constructor

  • @param type

  • @param newVolume

  • @param volumeChange

  • @param tradableIdentifier

  • @param totalVolume

  • @param transactionCurrency

  • @param limitPrice

  • @param deltaVolume

  • @param date
    */
    public OrderBookUpdate(OrderType type, BigDecimal newVolume, String tradableIdentifier, String transactionCurrency, Date date, BigMoney limitPrice, BigDecimal deltaVolume) {

from xchange.

timmolter avatar timmolter commented on July 17, 2024

@pabx06 OrderBookUpdate.java has a field called totalVolume, which you can access via getTotalVolume(). You have to write your own logic to grab the top two bid and ask orders off the order book.

As far as getting the order book first via REST and updates following, yes, that's probably the best way to do this. Unfortunately, MtGox caches the data for some interval, so we can never get the exact Orderbook. For most cases this really doesn't matter though.

from xchange.

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.