-
Couldn't load subscription status.
- Fork 215
Interface support for trade service (Implemented for bitmex and okcoin/okex) #180
Conversation
|
Anything I can help with this PR? Code review or resolving the conflict? |
|
I am waiting for this PR to merge in order to update the StreamingTradeService with getUserTrades implementation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did you avoid this? WebSocketClientHandler.channelRead0
The GZIP code is for another Exchange, Kraken I think, but Upbit was sending as Binary frames too
} else if (frame instanceof BinaryWebSocketFrame) {
BinaryWebSocketFrame binaryFrame = (BinaryWebSocketFrame) frame;
ByteBuf bf = binaryFrame.content();
byte[] bytes = new byte[bf.capacity()];
bf.readBytes(bytes);
if (bytes[0] == (GZIPInputStream.GZIP_MAGIC & 0x00ff) && bytes[1] == (GZIPInputStream.GZIP_MAGIC & 0xff00) >> 8) { // upbit GZIPInputStream.
GZIPInputStream gzipInputStream = new GZIPInputStream(new ByteArrayInputStream(bytes));
ByteArrayOutputStream result = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length;
while ((length = gzipInputStream.read(buffer)) != -1) {
result.write(buffer, 0, length);
}
handler.onMessage(result.toString());
} else {
handler.onMessage(new String(bytes)); // upbit
}
}
|
OK guys, I'm going to close this but add a reference to the README to say this PR can be used as a start point if anyone wants to add Bitmex/OKEX private channels in the future. |
Add interface support for streaming trade service to get trading order information through WebSocket API.
Implemented the interface for bitmex and okcoin(okex).