Skip to content

kiddoneal/bitfinex-client-websocket

 
 

Repository files navigation

Logo

Bitfinex websocket API version 2.0 client Build Status NuGet version

This is a C# implementation of the Bitfinex websocket API version 2.0 (BETA) found here:

https://bitfinex.readme.io/v2/docs

License:

Apache License 2.0

Features

  • instalation via NuGet (Bitfinex.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 = BitfinexValues.ApiWebsocketUrl;

using (var communicator = new BitfinexWebsocketCommunicator(url))
{
    using (var client = new BitfinexWebsocketClient(communicator))
    {
        client.Streams.InfoStream.Subscribe(info =>
        {
            Log.Information($"Info received, reconnection happened, resubscribing to streams");
            
            await client.Send(new PingRequest() {Cid = 123456});
            //await client.Send(new TickerSubscribeRequest("BTC/USD"));
        });

        client.Streams.PongStream.Subscribe(pong =>
        {
            Console.WriteLine($"Pong received! Id: {pong.Cid}") // Pong received! Id: 123456
            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
Channel subscribing
Channel unsubscribing
Ticker
Trades
Books
Raw books
Candles
AUTHENTICATED Covered
Account info
Orders
Positions
Trades
Funding
Wallets
Balance
Notifications
AUTHENTICATED - INPUT Covered
New order
Cancel order
Cancel order multi
Calc

Pull Requests are welcome!

Donations gratefully accepted.

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

About

C# client for Bitfinex websocket API version 2.0

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%