Skip to content

LasseLegarth/bitmex-client-websocket

 
 

Repository files navigation

Logo

Bitmex websocket API client Build Status NuGet version

This is a C# implementation of the Bitmex websocket API found here:

https://www.bitmex.com/app/wsAPI

License:

Apache License 2.0

Features

  • instalation via NuGet (Bitmex.Client.Websocket)
  • public and authenticated API
  • targeting .NET Standard 2.0 (.NET Core, Linux/MacOS compatible)
  • reactive extensions (Rx.NET)
  • integrated logging (Serilog)

Usage

var exitEvent = new ManualResetEvent(false);
var url = Bitmex.ApiWebsocketUrl;

using (var communicator = new BitmexWebsocketCommunicator(url))
{
    using (var client = new BitmexWebsocketClient(communicator))
    {
        client.Streams.InfoStream.Subscribe(info =>
        {
            Console.WriteLine($"Info received, reconnection happened.")
            client.Send(new PingRequest()).Wait();
        });

        client.Streams.PongStream.Subscribe(pong =>
        {
            Console.WriteLine($"Pong received!")
            exitEvent.Set();
        });

        await communicator.Start();

        exitEvent.WaitOne(TimeSpan.FromSeconds(30));
    }
}

More usage examples:

  • integration tests (link)
  • console sample (link)

API coverage

PUBLIC Covered
Info
Ping-Pong
Errors
Subscribe
Unsubscribe
Announcement
Chat
Connected
Funding
Instrument
Insurance
Liquidation
Orderbook L2
Orderbook L10
Public notifications
Quote
Quote bin 1m
Quote bin 5m
Quote bin 1h
Quote bin 1d
Settlement
Trade
Trade bin 1m
Trade bin 5m
Trade bin 1h
Trade bin 1d
AUTHENTICATED Covered
Affilate
Execution
Order
Margin
Position
Private notifications
Transact
Wallet

Pull Requests are welcome!

Available for help

I do consulting, please don't hesitate to contact me if you have a custom solution you would like me to implement (web, m@mkotas.cz)

Donations gratefully accepted.

  • Donate with Bitcoin
  • Donate with Litecoin
  • Donate with Ethereum

About

C# client for Bitmex websocket API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%