This is a Deribit API v2.0.0 C# .Net Core Client Library
This client library let's you connect with the Deribit API using a WebSocket connection.
It is entirely made with asynchronous methods in mind.
All methods and subscriptions found on https://docs.deribit.com are supported.
Usage is quite simple. To obtain the current best bid price you simply do the following:
var client = new DeribitV2Client(DeribitEndpointType.Testnet);
await client.Connect();
var response = await client.PublicGetOrderBook("BTC-PERPETUAL");
var bestBidPrice = response.ResultData.BestBidPrice;
await client.Disconnect();
The library supports authentication via credentials and signature
var authInfo = await client.PublicAuth(new AuthParams
{
GrantType = GrantType.Credentials,
ClientId = "<client id>",
ClientSecret = "<client secret>"
});
var signatureData = CryptoHelper.CreateSignature("<client secret>", "<optional data>");
var authInfo = await client.PublicAuth(new AuthParams
{
GrantType = GrantType.Signature,
ClientId = "<client id>",
Signature = signatureData
});
When authenticated, you can logout like this (this is the only synchroneous method):
client.PrivateLogout();
Note: The server will automatically close the connection when you logout
var success = await client.SubscribeBookChange(new BookChangeSubscriptionParams
{
InstrumentName = "BTC-PERPETUAL",
Interval = "100ms"
}, notification =>
{
//Here you can do something with the received information.
//This callback method is executed everytime a notification for
//this subscription is received.
});