Bitfinex.Net is a client library for accessing the Bitfinex REST and Websocket API. All data is mapped to readable models and enum values. Additional features include an implementation for maintaining a client side order book, easy integration with other exchange client libraries and more.


Keywords
API, Bitfinex, Bitfinex.Net, Client, CryptoCurrency, Exchange, bitfinex-api, bitfinex-bot, bitfinex-exchange, bitfinex-net, bitfinex-rest-api, bitfinex-websocket-api, bitfinex-wss, bitfinexnet, cryptocurrencies, cryptocurrency-exchanges, csharp, dotnet
License
MIT
Install
Install-Package Bitfinex.Net -Version 7.2.5

Documentation

.Bitfinex.Net Bitfinex.Net

.NET License

Bitfinex.Net is a strongly typed client library for accessing the Bitfinex REST and Websocket API. All data is mapped to readable models and enum values. Additional features include an implementation for maintaining a client side order book, easy integration with other exchange client libraries and more.

Supported Frameworks

The library is targeting both .NET Standard 2.0 and .NET Standard 2.1 for optimal compatibility

.NET implementation Version Support
.NET Core 2.0 and higher
.NET Framework 4.6.1 and higher
Mono 5.4 and higher
Xamarin.iOS 10.14 and higher
Xamarin.Android 8.0 and higher
UWP 10.0.16299 and higher
Unity 2018.1 and higher

Get the library

Nuget version Nuget downloads

dotnet add package Bitfinex.Net

How to use

REST Endpoints

// Get the ETH/USDT ticker via rest request
var restClient = new BitfinexRestClient();
var tickerResult = await restClient.SpotApi.ExchangeData.GetTickerAsync("tETHUST");
var lastPrice = tickerResult.Data.LastPrice;

Websocket streams

// Subscribe to ETH/USDT ticker updates via the websocket API
var socketClient = new BitfinexSocketClient();
var tickerSubscriptionResult = socketClient.SpotApi.SubscribeToTickerUpdatesAsync("tETHUST", (update) => 
{
  var lastPrice = update.Data.LastPrice;
});

For information on the clients, dependency injection, response processing and more see the Bitfinex.Net documentation, CryptoExchange.Net documentation, or have a look at the examples here or here.

CryptoExchange.Net

Bitfinex.Net is based on the CryptoExchange.Net base library. Other exchange API implementations based on the CryptoExchange.Net base library are available and follow the same logic.

CryptoExchange.Net also allows for easy access to different exchange API's.

Exchange Repository Nuget
Binance JKorf/Binance.Net Nuget version
BingX JKorf/BingX.Net Nuget version
Bitget JKorf/Bitget.Net Nuget version
Bybit JKorf/Bybit.Net Nuget version
CoinEx JKorf/CoinEx.Net Nuget version
CoinGecko JKorf/CoinGecko.Net Nuget version
Huobi/HTX JKorf/Huobi.Net Nuget version
Kraken JKorf/Kraken.Net Nuget version
Kucoin JKorf/Kucoin.Net Nuget version
Mexc JKorf/Mexc.Net Nuget version
OKX JKorf/OKX.Net Nuget version

Discord

Nuget version
A Discord server is available here. Feel free to join for discussion and/or questions around the CryptoExchange.Net and implementation libraries.

Supported functionality

API Supported Location
Rest Public Endpoints βœ“ restClient.SpotApi.ExchangeData
Rest Public Pulse Endpoints X
Calculation Endpoints βœ“ restClient.SpotApi.ExchangeData
Rest Authenticated Endpoints βœ“ restClient.SpotApi.Account / restClient.SpotApi.Trading
Rest Authenticated Pulse Endpoints X
Rest Authenticated Merchant Endpoints X
Websocket Public Channels βœ“ socketClient.SpotApi
Websocket Authenticated Channels βœ“ socketClient.SpotApi
Websocket Authenticated Inputs βœ“ socketClient.SpotApi

Support the project

I develop and maintain this package on my own for free in my spare time, any support is greatly appreciated.

Donate

Make a one time donation in a crypto currency of your choice. If you prefer to donate a currency not listed here please contact me.

Btc: bc1q277a5n54s2l2mzlu778ef7lpkwhjhyvghuv8qf
Eth: 0xcb1b63aCF9fef2755eBf4a0506250074496Ad5b7
USDT (TRX) TKigKeJPXZYyMVDgMyXxMf17MWYia92Rjd

Sponsor

Alternatively, sponsor me on Github using Github Sponsors.

Release notes

  • Version 7.2.5 - 23 Apr 2024

  • Version 7.2.4 - 18 Apr 2024

  • Version 7.2.3 - 03 Apr 2024

    • Updated string comparison for improved performance
    • Removed pre-send symbol validation
  • Version 7.2.2 - 25 Mar 2024

    • Fixed parameter serialization websocket queries
    • Added missing info websocket user data updates
  • Version 7.2.1 - 24 Mar 2024

  • Version 7.2.0 - 16 Mar 2024

  • Version 7.1.0 - 25 Feb 2024

    • Updated CryptoExchange.Net and implemented reworked websocket message handling. For release notes for the CryptoExchange.Net base library see: https://github.com/JKorf/CryptoExchange.Net?tab=readme-ov-file#release-notes
    • Combined multiple private websocket subscriptions into single subscription
    • Fixed issue in DI registration causing http client to not be correctly injected
    • Removed redundant BitfinexRestClient constructor overload
    • Removed UpdateType from BitfinexTradeSimple model in favor of the UpdateType in the DataEvent wrapper
    • Updated some namespaces
  • Version 7.0.5 - 03 Dec 2023

    • Updated CryptoExchange.Net
  • Version 7.0.4 - 24 Oct 2023

    • Updated CryptoExchange.Net
  • Version 7.0.3 - 09 Oct 2023

    • Updated CryptoExchange.Net version
  • Version 7.0.2 - 21 Sep 2023

    • Fixed incorrect url SpotApi.Account.WalletTransferAsync
  • Version 7.0.1 - 19 Sep 2023

    • Fixed socket ticker stream model
  • Version 7.0.0 - 17 Sep 2023

    • Updated all endpoints to V2 API (expect for Account.WithdrawAsync)
    • Updated all parameters and response models
    • Created endpoints for all possible requests for the Configs and Stats endpoints
    • Split the endpoints and subscriptions for trading symbols and funding symbols where necesarry
    • Added Account.GetMovementsDetailsAsync endpoint
    • Added Account.GetLoginHistoryAsync endpoint
    • Added Account.GetApiKeyPermissionsAsync endpoint
    • Added Account.GetAccountChangeLogAsync endpoint
    • Added ExchangeData.GetDerivativesStatusAsync endpoint
    • Added ExchangeData.GetLiquidationsAsync endpoint
    • Added ExchangeData.GetFundingStatisticsAsync endpoint
    • Added Trading.IncreasePositionAsync endpoint
    • Added Trading.GetIncreasePositionInfoAsync endpoint
    • Added Trading.GetPositionSnapshotsAsync endpoint
    • Added SubscribeToLiquidationUpdatesAsync stream
    • Added SubscribeToDerivativesUpdatesAsync stream
    • Added SubmitFundingOfferAsync socket request
    • Added CancelFundingOfferAsync socket request
  • Version 6.0.1 - 25 Aug 2023

    • Updated CryptoExchange.Net
  • Version 6.0.0 - 25 Jun 2023

    • Updated CryptoExchange.Net to version 6.0.0
    • Renamed BitfinexClient to BitfinexRestClient
    • Renamed SpotStreams to SpotApi on the BitfinexSocketClient
    • Updated endpoints to consistently use a base url without any path as basis to make switching environments/base urls clearer
    • Added IBitfinexOrderBookFactory and implementation for creating order books
    • Updated dependency injection register method (AddBitfinex)
  • Version 5.2.0 - 16 Apr 2023

    • Added GetTickerHistoryAsync endpoint
    • Updated socket PlaceOrderAsync parameters
    • Added missing order flag values
  • Version 5.1.2 - 18 Mar 2023

    • Updated CryptoExchange.Net
  • Version 5.1.1 - 14 Feb 2023

    • Updated CryptoExchange.Net
  • Version 5.1.0 - 17 Nov 2022

    • Updated CryptoExchange.Net
  • Version 5.0.16 - 25 Sep 2022

    • Fixed SpotApi.ExchangeData.GetOrderBookAsync() endpoint Bids/Asks being reversed
  • Version 5.0.15 - 18 Jul 2022

    • Updated CryptoExchange.Net
  • Version 5.0.14 - 16 Jul 2022

    • Updated CryptoExchange.Net
  • Version 5.0.13 - 10 Jul 2022

    • Fixed WalletTransferAsync success checking
    • Updated CryptoExchange.Net
  • Version 5.0.12 - 12 Jun 2022

    • Updated CryptoExchange.Net
  • Version 5.0.11 - 24 May 2022

    • Updated CryptoExchange.Net
  • Version 5.0.10 - 22 May 2022

    • Updated CryptoExchange.Net
  • Version 5.0.9 - 08 May 2022

    • Updated CryptoExchange.Net
  • Version 5.0.8 - 01 May 2022

    • Updated CryptoExchange.Net which fixed an timing related issue in the websocket reconnection logic
    • Added seconds representation to KlineInterval enum
    • Added allowed order book levels 1 and 250
  • Version 5.0.7 - 14 Apr 2022

    • Fixed deserialization error in ClosePositionAsync
    • Fixed WalletTransferAsync serialization issue
    • Updated CryptoExchange.Net
  • Version 5.0.6 - 14 Mar 2022

    • Added SubmitFundingAutoRenewAsync endpoint
    • Added GetFundingAutoRenewStatusAsync endpoint
  • Version 5.0.5 - 10 Mar 2022

    • Updated CryptoExchange.Net
  • Version 5.0.4 - 08 Mar 2022

    • Updated CryptoExchange.Net
  • Version 5.0.3 - 01 Mar 2022

    • Updated CryptoExchange.Net improving the websocket reconnection robustness
  • Version 5.0.2 - 27 Feb 2022

    • Updated CryptoExchange.Net
  • Version 5.0.1 - 24 Feb 2022

    • Updated CryptoExchange.Net
  • Version 5.0.0 - 18 Feb 2022

  • Version 4.2.4 - 03 Nov 2021

    • Fixed raw order book stream not accounting for checksum updates
  • Version 4.2.3 - 08 Oct 2021

    • Updated CryptoExchange.Net to fix some socket issues
  • Version 4.2.2 - 06 Oct 2021

    • Updated CryptoExchange.Net, fixing socket issue when calling from .Net Framework
  • Version 4.2.1 - 05 Oct 2021

    • Updated CryptoExchange.Net
  • Version 4.2.0 - 29 Sep 2021

    • Split GetTickerAsync in GetTickerAsync and GetTickersAsync, changed params to IEnumerable
    • Updated CryptoExchange.Net
  • Version 4.1.2 - 22 Sep 2021

    • Fixed nonce provider when running multiple program instances
  • Version 4.1.1 - 21 Sep 2021

    • Fix for nonce provider not working correctly in combination with other exchanges
  • Version 4.1.0 - 20 Sep 2021

    • Added custom nonce provider support
  • Version 4.0.5 - 15 Sep 2021

    • Updated CryptoExchange.Net
  • Version 4.0.4 - 02 Sep 2021

    • Fix for disposing order book closing socket even if there are other connections
  • Version 4.0.3 - 26 Aug 2021

    • Updated CryptoExchange.Net
  • Version 4.0.2 - 24 Aug 2021

    • Updated CryptoExchange.Net, improving websocket and SymbolOrderBook performance
    • Fixes for checksum validation BitfinexSymbolOrderBook
  • Version 4.0.1 - 13 Aug 2021

    • Fix for OperationCancelledException being thrown when closing a socket from a .net framework project
  • Version 4.0.0 - 12 Aug 2021

  • Version 4.0.0-beta3 - 09 Aug 2021

    • Renamed GetTradesForOrderAsync to GetOrderTradesAsync
    • Renamed GetTradesAsync to GetTradeHistoryAsync
    • Renamed GetTradeHistoryAsync to GetUserTradesAsync
    • Renamed GetOrderHistoryAsync to GetOrdersAsync
  • Version 4.0.0-beta2 - 26 Jul 2021

    • Updated CryptoExchange.Net
  • Version 4.0.0-beta1 - 09 Jul 2021

    • Added Async postfix for async methods
    • Updated CryptoExchange.Net
  • Version 3.5.0-beta4 - 07 Jun 2021

    • Fixed IExchangeClient PlaceOrder OrderType
    • Fixed WalletTransferAsync amount parameter serialization
    • Updated CryptoExchange.Net
  • Version 3.5.0-beta3 - 26 May 2021

    • Removed non-async calls
    • Updated to CryptoExchange.Net changes
  • Version 3.5.0-beta2 - 06 mei 2021

    • Updated CryptoExchange.Net
  • Version 3.5.0-beta1 - 30 apr 2021

    • Updated to CryptoExchange.Net 4.0.0-beta1, new websocket implementation