Bitmex.NET Build Status NuGet Join the chat at

Wrapper for REST API

Issue reporting

Feel free to report any bugs/issues you may find in the framework. It's all much appreciated!

Quick Start

Install NuGet package Install-Package Bitmex.NET

Create default API service:

First approach, creating default instance

var bitmexAuthorization = new BitmexAuthorization() 
  BitmexEnvironment = Bitmex.NET.Models.BitmexEnvironment.Test,
  Key = "your api key",
  Secret = "your api secret"
var bitmexApiService = BitmexApiService.CreateDefaultApi(bitmexAuthorization);

Another, registering in a DI container (e.g. Unity). Example

Container.RegisterType<IBitmexApiProxy, BitmexApiProxy>();
Container.RegisterType<IBitmexApiService, BitmexApiService>();

var authorization = new BitmexAuthorization
  BitmexEnvironment = Bitmex.NET.Models.BitmexEnvironment.Test,
  Key = "your api key",
  Secret = "your api secret"


place an order Example:

private async void Sell()
  var posOrderParams = OrderPOSTRequestParams.CreateSimpleMarket("XBTUSD", Size, OrderSide.Sell);
  await _bitmexApiService.Execute(BitmexApiUrls.Order.PostOrder, posOrderParams).ContinueWith(ProcessPostOrderResult);


The current lib uses LibLog to provide comprehensive logging for the most popular logging frameworks. Setting Debug logging level in your solution will bring about huge logging output because all the HTTP responses and WebSocket messages will be logged. I would recommend you yo forward the debug level logging from the lib into a separate file, but it's always up to you

    <target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
            layout="${longdate} ${uppercase:${level}} ${message}" />
    <target xsi:type="File" name="bitmexDebug" fileName="${basedir}/logs/${shortdate}bitmexDebug.log"
            layout="${longdate} ${uppercase:${level}} ${message}" />

    <logger name="*" minlevel="Info" writeTo="f" />
    <logger name="Bitmex.NET.*" minlevel="Debug" writeTo="bitmexDebug" />


I haven't implemented and tested all the existing methods yet so that you might want to call BitMEX APIs that haven't been done so far. To make you be able to call all APIs using the existing service I've tried to make the classes extensible. So... To implement your own API method please create your own parameters class (or use existing) deriving it from QueryStringParams (for GET requests) or JsonQueryParams(for POST/PUT/DELETE requests) and a class for requests (or use existing)

private class SomeQueryStringParams : QueryStringParams
  public string Value { get; set; }

private class SomeJsonParams : QueryJsonParams
  public string Symbol { get; set; }

private class AResult
  public string Value { get; set; }

Call it

var result = await bitmexApiService.Execute(new ApiActionAttributes<SomeJsonParams, AResult>("anApiMethod", HttpMethods.POST), new SomeJsonParams(){Symbol = "XBTUSD"});

// if the method returns an array of objects
var result = await bitmexApiService.Execute(new ApiActionAttributes<SomeJsonParams, List<AResult>>("anApiMethod", HttpMethods.POST), new SomeJsonParams(){Symbol = "XBTUSD"});


Please checkout the following documents. During the time I will be adding solutions, best practices, life examples and some other information with peculiarities about Bitmex


Please see example of simple Buy&Sell application here

Integration Tests

You will find a live example for all the implemented APIs within integration tests project here


API was taken from

Wrapper for REST & WebSocket API Info

⭐ Stars 55
🔗 Source Code
🕒 Last Update a year ago
🕒 Created 3 years ago
🐞 Open Issues 5
➗ Star-Issue Ratio 11
😎 Author semashkinvg