CCob / bittrex4j

Java library for accessing the Bittrex Web API's and Web Sockets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Real time fills

szd116 opened this issue · comments

First of all, thank you for the great project, it makes our life much easier and please keep up the good work!
quick question, Is there a good way to get real time fills for my account ? the example provided on the first page listen to fills across the entire market by the symbol, and then I may have to loop through all the fills to find my order, so is there a good way to listen for fills just for my account ? Thanks.

bittrexExchange.connectToWebSocket(() -> {
		bittrexExchange.subscribeToExchangeDeltas("BTC-ETH", null);
		bittrexExchange.subscribeToExchangeDeltas("BTC-BCC", null);
		bittrexExchange.subscribeToMarketSummaries(null);
	});

bittrexExchange.onUpdateExchangeState(updateExchangeState -> {
double volume = Arrays.stream(updateExchangeState.getFills()).mapToDouble(Fill::getQuantity).sum();

		System.out.println(
				String.format("N: %d, %02f volume across %d fill(s) for %s", updateExchangeState.getNounce(),
						volume, updateExchangeState.getFills().length, updateExchangeState.getMarketName()));
	});

Addition, the fills don't return an orderID, how do I know if my order gets filled without checking on the order status ?

Bittrex have just added Account based web socket notifications, the ones you get from subscribeToExchange delats are public ones. I have been adding the additional functionality but not release it yet. Give 1.0.9-SNAPSHOT a try. You'll need to add the sonatype repos to you project first though.

See the updated RealTimeFills sample of develop here

bittrexExchange.onOrderStateChange(orderDelta -> {

Cool, Thanks CCob, I just want to make sure that I'm not missing out on some key points.

No problem. I'll close this issue for now. Aiming to get 1.0.9 released within the next week which will include the new onOrderStateChange and onBalanceStateChange events on the websocket