- This is not an official C# SDK of Finnhub. This is a personal project aimed to contribute to the open-source community.
- .NET CLI:
dotnet add package FinnhubDotNet
- Or search FinnhubDotNet in Visual Studio using NugetPackageManager.
- Or download the ./FinnhubDotNet folder and build the class library locally.
namespace Test {
internal class Program {
static async Task Main(string[] args) {
string yourKey = "";
var ws = new FinnhubDotNet.Websocket.FinnhubStreamingClient(yourKey);
await ws.ConnectAsync();
await ws.SubscribeTradeAsync("BINANCE:BTCUSDT");
await ws.SubscribeTradeAsync("BINANCE:ETHUSDT");
ws.tradeUpdate += (trades) => {
foreach (var trade in trades) {
Console.WriteLine(trade);
}
};
while (true) {
await Task.Delay(5000);
}
}
}
}
- Efficient data handling: The data receiving logic is implemented with a pipe and a two-thread producer-consumer pattern, minimizing memory overheads and ensuring low latency.
- Minimalistic interfaces.