irufus / gdax-java

Java based wrapper for Coinbase Pro (Formerly known as GDAX API and Coinbase Exchange API)
MIT License
177 stars 131 forks source link

Are Channels Implemented in the API? #30

Open verona-rupes opened 6 years ago

verona-rupes commented 6 years ago

I've been reading through the gdax official documentation and they mention that we need to subscribe to channels in order to get updates. I couldn't find any channel subscriptions in the code. Is the WebsocketFeed stream subscribe to a "full channel" ?

https://docs.gdax.com/#channels

robevansuk commented 6 years ago

yes its not implemented yet - I'm attempting to build a full-channel + gui on top. Whilst that is hard to do its relatively simple to subscribe to the messages using the WebsocketFeed. I've attempted this in my own repo here: https://github.com/robevansuk/gdax-java/blob/master/src/main/java/com/coinbase/exchange/api/gui/orderbook/OrderBookView.java

robevansuk commented 6 years ago

almost have a working example now. Essentially you need to process messages in sequential order. Since the websocketfeed relies on TCP based comms you should get all the messages, you just need to process them in the correct order... and timeout if the one you're waiting for next doesn't arrive in a sensible time frame.

robevansuk commented 6 years ago

I have a working example - it will be available soon enough. Next few days or couple of weeks max I'm hoping

robevansuk commented 6 years ago

I've implemented the LiveOrderbook now should be available any day now with any luck

verona-rupes commented 6 years ago

I kinda refactored your code for level2 and ticker channels. It was quick and dirty just to get my bot running. I realized that the connections through org.apache.tomcat.websocket.WsWebSocketContainer keeps disconnecting when using channels. Not sure why. so I switched the socket implementation to TooTallNate/Java-WebSocket. which is a standalone socket implementation and it worked fine.
Edit: l2update and ticker channels don't require authentication.

robevansuk commented 6 years ago

ok - Full LiveOrderbook is available now over at my repo www.github.com/robevansuk/gdax-java. Fully tested and reconnects on timeouts if the message we're waiting for isn't received within 15 seconds.

robevansuk commented 6 years ago

I figure realtime is likely to offer much better algo trading! imaging monitoring the rate of trades coming in, seeing a spike and being able to place a trade instantly. Surely that's going to make/save more than a few %?