Bitmex.NET
1.0.1.26810
See the version list below for details.
dotnet add package Bitmex.NET --version 1.0.1.26810
NuGet\Install-Package Bitmex.NET -Version 1.0.1.26810
<PackageReference Include="Bitmex.NET" Version="1.0.1.26810" />
paket add Bitmex.NET --version 1.0.1.26810
#r "nuget: Bitmex.NET, 1.0.1.26810"
// Install Bitmex.NET as a Cake Addin #addin nuget:?package=Bitmex.NET&version=1.0.1.26810 // Install Bitmex.NET as a Cake Tool #tool nuget:?package=Bitmex.NET&version=1.0.1.26810
Bitmex.NET
Wrapper for BitMEX.com REST API
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).
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"
};
Container.RegisterInstance<IBitmexAuthorization>(authorization);
place an order :
private async void Sell()
{
var posOrderParams = OrderPOSTRequestParams.CreateSimpleMarket("XBTUSD", Size, OrderSide.Sell);
await _bitmexApiService.Execute(BitmexApiUrls.Order.PostOrder, posOrderParams).ContinueWith(ProcessPostOrderResult);
}
Extensibility
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
{
[DisplayName("val")]
public string Value { get; set; }
}
private class SomeJsonParams : QueryJsonParams
{
[JsonProperty("symbol")]
public string Symbol { get; set; }
}
private class AResult
{
[JsonProperty("value")]
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"});
Progress
The following methods were implemented and covered with the
Method | REST API Method | |
---|---|---|
GET | execution | |
GET | execution/tradeHistory | |
GET | instrument | |
GET | instrument/active | |
GET | instrument/activeAndIndices | |
GET | instrument/activeIntervals | |
GET | instrument/compositeIndex | |
GET | instrument/indices | |
GET | order | |
PUT | order | |
POST | order | |
DELETE | order | |
DELETE | order/all | |
PUT | order/bulk | |
POST | order/bulk | |
POST | order/cancelAllAfter | |
POST | order/closePosition | |
GET | orderBook/L2 | yes |
GET | position | yes |
POST | position/isolate | |
POST | position/leverage | |
POST | position/riskLimit | |
POST | position/transferMargin | |
GET | quote | |
GET | quote/bucketed | |
GET | trade | |
GET | trade/bucketed |
Examples
Please see example of simple Buy&Sell application
Integration Tests
You will find a live example for all the implemented APIs within integration tests project
Other
API was taken from
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
- Newtonsoft.Json (>= 11.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.99 | 6,876 | 6/21/2019 |
2.0.84 | 1,455 | 3/31/2019 |
2.0.82 | 2,203 | 11/26/2018 |
2.0.79 | 797 | 11/19/2018 |
2.0.70 | 791 | 11/13/2018 |
2.0.67 | 952 | 10/29/2018 |
2.0.66 | 747 | 10/26/2018 |
2.0.65 | 1,295 | 9/2/2018 |
2.0.64 | 958 | 8/26/2018 |
2.0.58 | 957 | 8/5/2018 |
2.0.43 | 911 | 7/22/2018 |
2.0.41 | 895 | 7/21/2018 |
2.0.39 | 1,001 | 7/19/2018 |
2.0.30 | 917 | 7/18/2018 |
2.0.27 | 881 | 7/18/2018 |
2.0.24 | 846 | 7/4/2018 |
2.0.2.8524 | 997 | 5/24/2018 |
1.0.3.26546 | 1,008 | 5/13/2018 |
1.0.2.25211 | 1,014 | 4/30/2018 |
1.0.1.26810 | 1,011 | 3/21/2018 |
1.0.0.32297 | 1,037 | 3/20/2018 |
Initial release with built-in the most important API to implement a bot