Marfusios / bitmex-client-websocket

🛠️ C# client for Bitmex websocket API
Apache License 2.0
64 stars 44 forks source link

How to track two symbol prices at once? #13

Closed Jiraiyah closed 5 years ago

Jiraiyah commented 5 years ago

@Marfusios Hi

take a look at the presenter file here : https://gist.github.com/Jiraiyah/79fc30aefdf44da3d1fb60ce5968f258

It's ALMOST a duplicate of yours, now here is the question, I need to track the price of my chosen instrument but at the same time i need to keep track of the xbtusd price all the time.

How should I approach it? does the current observation section read all the instruments on the market or special ones? because if it's tracking all, it would be easy but if not,... then how to do it?

thanks

Marfusios commented 5 years ago

Hello, don't know if I understand you correctly, but there is the first parameter of the request which specifies target pair.

            // subscribes only to selected 'pair'
            await client.Send(new TradesSubscribeRequest(pair));
            await client.Send(new BookSubscribeRequest(pair));

            // subscribes to all pairs
            await client.Send(new TradesSubscribeRequest());
            await client.Send(new BookSubscribeRequest());

You can subscribe to more selected pairs, also there is a Quote stream if you want to display a current price (bid, ask).

            await client.Send(new QuoteSubscribeRequest("XBTUSD"));
            await client.Send(new QuoteSubscribeRequest("ETHUSD"));
            await client.Send(new QuoteSubscribeRequest(pair));