{"id":23427010,"url":"https://github.com/ladislavbohm/cryptocompare-streamer","last_synced_at":"2025-07-19T18:02:22.856Z","repository":{"id":143468015,"uuid":"242498073","full_name":"LadislavBohm/cryptocompare-streamer","owner":"LadislavBohm","description":"C# websocket client for CryptoCompare streaming API ","archived":false,"fork":false,"pushed_at":"2020-03-16T13:52:15.000Z","size":77,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T19:08:13.937Z","etag":null,"topics":["crypto-compare","crypto-compare-socket","crypto-compare-websocket","crypto-socket","crypto-stream","cryptocompare","cryptocompare-socket","cryptocompare-streaming"],"latest_commit_sha":null,"homepage":null,"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/LadislavBohm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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":"2020-02-23T10:36:25.000Z","updated_at":"2021-03-16T04:21:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"b1eb0150-f040-4afe-9117-d1521f8b1826","html_url":"https://github.com/LadislavBohm/cryptocompare-streamer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LadislavBohm%2Fcryptocompare-streamer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LadislavBohm%2Fcryptocompare-streamer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LadislavBohm%2Fcryptocompare-streamer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LadislavBohm%2Fcryptocompare-streamer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LadislavBohm","download_url":"https://codeload.github.com/LadislavBohm/cryptocompare-streamer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248618277,"owners_count":21134200,"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-compare","crypto-compare-socket","crypto-compare-websocket","crypto-socket","crypto-stream","cryptocompare","cryptocompare-socket","cryptocompare-streaming"],"created_at":"2024-12-23T06:16:24.416Z","updated_at":"2025-04-12T19:08:33.162Z","avatar_url":"https://github.com/LadislavBohm.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](cryptocompare-logo.jpg)\n\n# CryptoCompare real-time API client written in C\u0026#35;\n\nHigh-performance C# client with flexible and easy to use API to connect to CryptoCompare streaming (real-time) API. No API key needed. Built on top of .NET Standard 2.1 and [Rx.Net](https://github.com/dotnet/reactive).\n\nCurrently only **trade** stream is available, **current** stream will be implemented shortly.\n\n## Installation\n\n```\nPM\u003e Install-Package CryptoCompare.Streamer\n```\n\n## Features\n\n- Fully async and non-blocking API\n- Subscribe/Unsubscribe to following streams: Trade, Current, Volume\n- Flexible event handling thanks to [Rx.Net](https://github.com/dotnet/reactive) (see examples)\n\n## Examples\n\n### Basic subscription\n\n```csharp\n//don't forget to Dispose socket once work is done!\n//optionally supply different URL or ILogger instance (default is NullLogger)\nusing var client = new CryptoCompareSocketClient();\n\n//handle trades by subscription to OnTrade (same for OnCurrent and OnVolume)\nvar subscription = client.OnTrade.Subscribe(trade =\u003e Console.WriteLine(trade));\n\n//start socket (needs to be called before subscribing)\nawait client.StartAsync();\n\n//TRADE\n\n//use 'sub' format to subscribe\nclient.Subscribe(new TradeSubscription(\"0~Bitfinex~BTC~USD\"));\n//or specify exchange currency pair\nclient.Subscribe(new TradeSubscription(\"Bitfinex\", \"BTC\", \"USD\"));\n//or multiple trade currency pairs\nvar subscriptions = new[] {\"0~Bitfinex~BTC~USD\", \"0~Bittrex~BTC~USD\", \"0~Bitstamp~BTC~USD\"};\nclient.Subscribe(subscriptions.Select(s =\u003e new TradeSubscription(s)));\n\n//VOLUME\n\nclient.Subscribe(new VolumeSubscription(\"BTC\"));\n//or multiple volume currencies\nclient.Subscribe(new[] {\"BTC\", \"ETC\"}.Select(c =\u003e new VolumeSubscription(c)));\n\n//CURRENT\n\nclient.Subscribe(new CurrentSubscription(\"Bitfinex\", \"BTC\", \"USD\"));\n//or multiple exchange currency pairs at once\nvar subscriptions = new[] { \"0~Bitfinex~BTC~USD\", \"0~Bittrex~BTC~USD\", \"0~Bitstamp~BTC~USD\" };\nclient.Subscribe(subscriptions.Select(s =\u003e new CurrentSubscription(s)));\n```\n\n### Unsubscription\n\n```csharp\nvar client = new CryptoCompareSocketClient();\nvar subscription = client.OnTrade.Subscribe(trade =\u003e Console.WriteLine(trade));\nawait client.StartAsync();\nvar subscription = new TradeSubscription(\"0~Bitfinex~BTC~USD\")\nclient.Subscribe(subscription);\n\n//collect for 5 seconds\nawait Task.Delay(5000);\n//dispose subscription basically \"removes\" OnTrade handler\n//does NOT stop socket from collecting the data!\nsubscription.Dispose();\n\n//socket actually stops receiving trades once message is processed\n//if you need to stop receiving immediatelly, remove the handler as shown above\nclient.Unsubscribe(subscription);\n```\n\n### Stream processing\n\nAll streams are based on [Rx.Net](https://github.com/dotnet/reactive) but some simple examples are shown here.\n\n```csharp\n//filter only BUY trades and do not receive more than one every 100ms\nvar subscription = client.OnTrade\n    .Where(t =\u003e t.Type == TradeType.Buy)\n    .Throttle(TimeSpan.FromMilliseconds(100))\n    .Subscribe(trade =\u003e Console.WriteLine(trade));\n\n//buffer trades by 10 and process them in batch\nvar subscription = client.OnTrade\n    .Buffer(10)\n    .Subscribe(trades =\u003e ProcessBatch(trades));\n\n//buffer trades for the last 500ms and process them in batch\nvar subscription = client.OnTrade\n    .Buffer(TimeSpan.FromMilliseconds(500))\n    .Subscribe(trades =\u003e ProcessBatch(trades));\n\n//monitor stream and timeout if no trade is received within 10 seconds\nvar subscription = client.OnTrade\n    .Timeout(TimeSpan.FromSeconds(10))\n    .Subscribe(trade =\u003e Console.WriteLine(trade), (ex) =\u003e\n    {\n        if (ex is TimeoutException)\n        {\n            //reconnect?\n        }\n    });\n```\n\n## To-do\n\n- CCCAGG stream (could use some help in parsing this one)\n- Socket state monitoring\n- Auto-reconnection\n- Code documentation\n- More unit/integration tests\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladislavbohm%2Fcryptocompare-streamer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fladislavbohm%2Fcryptocompare-streamer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladislavbohm%2Fcryptocompare-streamer/lists"}