Comments (8)
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.
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.
@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.
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.
done. see: MtGoxWebSocketMarketDataDemo.java
from xchange.
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.
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.
@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)
- Support bybit v5 api HOT 13
- Unsupported or unrecognized SSL message HOT 3
- Exchange Hitbtc HOT 2
- Implement xchange-stream for bybit
- KuCoin `token is expired` error when reconnecting after running for 24 hours
- BinanceAccountService assumes futures account when not using sandbox HOT 1
- Bounty for 10-15 XChange connector integration HOT 1
- No stream modules maintainer / reviewer HOT 3
- Support binance portfolio margin 1.5 HOT 4
- Add futures to okx exchange metadata
- Is there a way to add a new currency for newly listed coins without recompiling whole project? HOT 1
- OKX getOpenPositions is inconsistenet
- Incompatibility with Jackson 2.15.x (as used by Spring Boot 3.1.x)
- is okx thread safe? HOT 2
- large backlog of pull requests HOT 34
- BINANCE FUTURE exchangeMetaData, need some advise
- Supporting Coinbase Advanced Trading
- java.lang.NoClassDefFoundError: jakarta/ws/rs/Path HOT 4
- Binance futures URL problem HOT 5
- Add bitcoin as a topic to this repository HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xchange.