static void Main(string[] args) { Task task = Task.Run( async() => { string apiKey = "YOUR_API_KEY"; string apiSecret = "YOUR_API_SECRET"; string baseUrl = "https://beta.bittrex.com/signalr"; var btx = new BittrexWebsocket( baseUrl, CreateCallback("exchange"), CreateCallback("order"), CreateCallback("balance") ); // If we successfully authenticate, we'll be subscribed to the uO and uB events. var isAuthenticated = await btx.Authenticate( apiKey, BittrexWebsocket.CreateSignature(apiSecret, await btx.GetAuthContext(apiKey)) ); // Register for orderbook updates on the BTC-ETH market await btx.SubscribeToExchangeDeltas("BTC-ETH"); }); task.Wait(); Console.WriteLine("Press enter to exit sample..."); Console.ReadLine(); }
static public BittrexWebsocket.BittrexCallback CreateCallback(string name) { // // In a real app, your code would do something useful based on the // information accompanying each event. // return((info) => { Console.WriteLine($"Callback Invoked: {name}"); Console.WriteLine( BittrexWebsocket.Decode(info) ); }); }