{"id":23433739,"url":"https://github.com/m4cx/kraken-wsapi-dotnet","last_synced_at":"2025-04-13T01:10:31.292Z","repository":{"id":120837937,"uuid":"168826794","full_name":"m4cx/kraken-wsapi-dotnet","owner":"m4cx","description":"C# / .NET Standard Client for connecting to the public kraken.com WebSocket API","archived":false,"fork":false,"pushed_at":"2022-08-07T11:20:35.000Z","size":2078,"stargazers_count":13,"open_issues_count":4,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T08:38:41.232Z","etag":null,"topics":["crypto-trading","csharp","dotnet-core","dotnet-standard","websockets"],"latest_commit_sha":null,"homepage":"https://m4cx.github.io/kraken-wsapi-dotnet","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/m4cx.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-02T11:54:48.000Z","updated_at":"2022-02-02T22:52:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"8aecadaf-8b71-489a-8179-cc65dd57acd3","html_url":"https://github.com/m4cx/kraken-wsapi-dotnet","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m4cx%2Fkraken-wsapi-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m4cx%2Fkraken-wsapi-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m4cx%2Fkraken-wsapi-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m4cx%2Fkraken-wsapi-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m4cx","download_url":"https://codeload.github.com/m4cx/kraken-wsapi-dotnet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650750,"owners_count":21139681,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crypto-trading","csharp","dotnet-core","dotnet-standard","websockets"],"created_at":"2024-12-23T11:27:16.704Z","updated_at":"2025-04-13T01:10:31.261Z","avatar_url":"https://github.com/m4cx.png","language":"C#","funding_links":["https://www.buymeacoffee.com/rkqS0BIKu","https://www.paypal.me/maikschoeneich"],"categories":[],"sub_categories":[],"readme":"| master                                                                                                                                                                                                                                | develop                                                                                                                                                                                                                                 | nuget                                                                                                               |\n| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |\n| [![Build Status](https://macx.visualstudio.com/kraken-wsapi-dotnet/_apis/build/status/m4cx.kraken-wsapi-dotnet?branchName=master)](https://macx.visualstudio.com/kraken-wsapi-dotnet/_build/latest?definitionId=12\u0026branchName=master) | [![Build Status](https://macx.visualstudio.com/kraken-wsapi-dotnet/_apis/build/status/m4cx.kraken-wsapi-dotnet?branchName=develop)](https://macx.visualstudio.com/kraken-wsapi-dotnet/_build/latest?definitionId=12\u0026branchName=develop) | [![Stable](https://img.shields.io/nuget/v/Kraken.WebSockets.svg)](https://www.nuget.org/packages/Kraken.WebSockets) |\n\n# kraken-wsapi-dotnet\n\nC# / .NET Standard Client for connecting to the public kraken.com WebSocket API\n\n# API Documentation\n\nSee the official documentation fur further information\nhttps://www.kraken.com/features/websocket-api\n\n# Getting started\n\n## Installing it in your project environment\n\nGet the current version from NuGet Gallery using the Package Manager / .NET CLI\n\n```bash\nPM\u003e Install-Package Kraken.WebSockets # Package Manager\n```\n```bash\n\u003e dotnet add package Kraken.WebSockets # .NET CLI\n```\n\nFor detailed information on the installing of pre-release versions please refer to the [NuGet Gallery](https://www.nuget.org/packages/Kraken.WebSockets) itself.\n\n## Create a connection and listen for events\n\nCreating a connection is pretty easy but will also be improved in the future. But for now just do it like this:\n\n```csharp\nvar krakenApi = new KrakenApi()\n    .ConfigureWebsocket(\"wss://ws.kraken.com\");\n\nusing (var client = krakenApi.BuildClient())\n{\n    client.SystemStatusChanged += (sender, e) =\u003e Console.WriteLine($\"System status changed\");\n    client.SubscriptionStatusChanged += (sender, e) =\u003e Console.WriteLine($\"Subscription status changed\"); ;\n    client.TickerReceived += (sender, e) =\u003e Console.WriteLine($\"Ticker received\");\n    client.OhlcReceived += (sender, e) =\u003e Console.WriteLine($\"Ohlc received\");\n    client.TradeReceived += (sender, e) =\u003e Console.WriteLine($\"Trade received\");\n    client.SpreadReceived += (sender, e) =\u003e Console.WriteLine($\"Spread received\");\n    client.BookSnapshotReceived += (sender, e) =\u003e Console.WriteLine($\"BookSnapshot received\");\n    client.BookUpdateReceived += (sender, e) =\u003e Console.WriteLine($\"BookUpdate received\");\n\n    await kraken.ConnectAsync();\n    // Do something with it and keep the connection open\n}\n// closing the using-block the connection will be closed and disposed.\n```\n\nYou can also find a running example in the repository.\n\n## Subscribe to private events\n\nStarting with their version 0.3.0 of the Websocket API kraken.com provides access to sensitive private account information like trades and orders. In order to gain access you need to [authenticate](https://www.kraken.com/features/websocket-api#authentication).\n\nWe support an easy and feasible way to retrieve a token and pass it to the subscription:\n\n```csharp\n\n// Configure the API provider\nvar krakenApi = new KrakenApi()\n    .ConfigureWebsocket(\"wss://ws.kraken.com\")\n    .ConfigureAuthentication(\n        configuration.GetValue\u003cstring\u003e(\"API_URL\"),\n        configuration.GetValue\u003cstring\u003e(\"API_KEY\"),\n        configuration.GetValue\u003cstring\u003e(\"API_SECRET\"));\n\n// retrieve the token\nvar token = await krakenApi.AuthenticationClient.GetWebsocketToken();\n\n// Pass the token to a private subscription\nawait client.SubscribeAsync(new Subscribe(null, new SubscribeOptions(SubscribeOptionNames.OwnTrades, token.Token)));\n\n```\n\n## Attach your logging framework\n\nWith the `Microsoft.Extensions.Logging.Abstractions` in place you are not limited to a specific logging framework. Each logging framework which supports this abstraction layer can be attached to this library. Just to name a few of them:\n\n- log4net\n- Serilog\n- NLog\n- ... and many more\n\nTo enable the logging just call the provided extension method on your `ILoggerFactory` of your application.\n\n```csharp\n// Using the logging from ASP.NET Core MVC\n// Startup.cs\n\nusing Kraken.WebSockets.Logging;\n\n// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.\npublic void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)\n{\n    // ... source omitted\n\n    loggerFactory.AddKrakenWebSockets(); // Enables the configured logging factory for the logs in Kraken.WebSockets\n\n    // ... source omitted\n}\n\n```\n\n# Support\n\nIf you like the stuff I do, please don't hesitate to support my actions by donating me a coffee!\n\n\u003ca class=\"bmc-button\" target=\"_blank\" href=\"https://www.buymeacoffee.com/rkqS0BIKu\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/BMC-btn-logo.svg\" alt=\"Buy me a coffee\"\u003e\u003cspan style=\"margin-left:5px\"\u003eBuy me a coffee\u003c/span\u003e\u003c/a\u003e\u003cbr/\u003e\u003cbr/\u003e\u003ca href=\"https://www.paypal.me/maikschoeneich\"\u003e\u003cimg src=\"https://www.paypalobjects.com/webstatic/de_DE/i/de-pp-logo-100px.png\"/\u003e-Me\u003c/a\u003e\n\n# Analytics\n\n[![](https://codescene.io/projects/5639/status.svg) Get more details at **codescene.io**.](https://codescene.io/projects/5639/jobs/latest-successful/results)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm4cx%2Fkraken-wsapi-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm4cx%2Fkraken-wsapi-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm4cx%2Fkraken-wsapi-dotnet/lists"}