Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 1.18 KB

README.md

File metadata and controls

33 lines (23 loc) · 1.18 KB

PoloniexWebSocketsApi

A C# wrapper for the Poloniex WebSockets api

NuGet package

This package is available on NuGet.org under the name PoloniexWebSocketsApi.

Usage example

Check this JavaScript file for api reference.

static async Task Main(string[] args)
{
    PoloniexChannel poloniexChannel = new PoloniexChannel();
    
    poloniexChannel.MessageArrived += OnMessageArrived;
    
    await poloniexChannel.ConnectAsync();
    
    await poloniexChannel.SendAsync(new PoloniexCommand() { Channel = 1001, Command = PoloniexCommandType.Subscribe });
    await poloniexChannel.SendAsync(new PoloniexCommand() { Channel = 1002, Command = PoloniexCommandType.Subscribe });
    await poloniexChannel.SendAsync(new PoloniexCommand() { Channel = 1003, Command = PoloniexCommandType.Subscribe });
    await poloniexChannel.SendAsync(new PoloniexCommand() { Channel = TickerSymbol.BTC_XMR, Command = PoloniexCommandType.Subscribe });

    Console.ReadLine();
}

private static void OnMessageArrived(JsonSerializer serializer, object message)
{
    Console.WriteLine(message);
}