├── .all-contributorsrc
├── .editorconfig
├── .gitattributes
├── .github
├── CODEOWNERS
├── ISSUE_TEMPLATE.md
├── ISSUE_TEMPLATE
│ ├── 1-bug-report.md
│ ├── 2-feature-request.md
│ └── 3-question.md
├── PULL_REQUEST_TEMPLATE.md
└── PULL_REQUEST_TEMPLATE
│ ├── 1-bugfix.md
│ └── 2-feature.md
├── .gitignore
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── CryptoCompare.sln
├── CryptoCompare.targets
├── LICENSE
├── README.md
├── Settings.StyleCop
├── azure-pipelines.yml
├── ci
├── build.yml
└── testfx.yml
├── cryptocompare_logo.png
├── docfx.json
├── docs
├── .nojekyll
├── README.md
├── _coverpage.md
├── _sidebar.md
├── api
│ ├── CryptoCompare.AggregatedData.html
│ ├── CryptoCompare.BaseApiClient.html
│ ├── CryptoCompare.BaseApiResponse.html
│ ├── CryptoCompare.CalculationType.html
│ ├── CryptoCompare.Calls.html
│ ├── CryptoCompare.CandleData.html
│ ├── CryptoCompare.CodeRepository.html
│ ├── CryptoCompare.CoinAggregatedData.html
│ ├── CryptoCompare.CoinFullAggregatedData.html
│ ├── CryptoCompare.CoinFullAggregatedDataDisplay.html
│ ├── CryptoCompare.CoinGeneralInfo.html
│ ├── CryptoCompare.CoinInfo.html
│ ├── CryptoCompare.CoinListResponse.html
│ ├── CryptoCompare.CoinSnapshotData.html
│ ├── CryptoCompare.CoinSnapshotFullData.html
│ ├── CryptoCompare.CoinSnapshotFullResponse.html
│ ├── CryptoCompare.CoinSnapshotResponse.html
│ ├── CryptoCompare.CoinsClient.html
│ ├── CryptoCompare.CryptoCompare.html
│ ├── CryptoCompare.CryptoCompareClient.html
│ ├── CryptoCompare.CryptoCompareException.html
│ ├── CryptoCompare.CryptopianFollower.html
│ ├── CryptoCompare.DateTimeExtensions.html
│ ├── CryptoCompare.ExchangeHistoryData.html
│ ├── CryptoCompare.ExchangeHistoryResponse.html
│ ├── CryptoCompare.ExchangeListResponse.html
│ ├── CryptoCompare.ExchangesClient.html
│ ├── CryptoCompare.Facebook.html
│ ├── CryptoCompare.General.html
│ ├── CryptoCompare.HistoryClient.html
│ ├── CryptoCompare.HistoryDayAverageResponse.html
│ ├── CryptoCompare.HistoryResponse.html
│ ├── CryptoCompare.IApiClient.html
│ ├── CryptoCompare.ICO.html
│ ├── CryptoCompare.ICoinsClient.html
│ ├── CryptoCompare.ICryptoCompareClient.html
│ ├── CryptoCompare.IExchangesClient.html
│ ├── CryptoCompare.IHistoryClient.html
│ ├── CryptoCompare.IMiningClient.html
│ ├── CryptoCompare.INewsClient.html
│ ├── CryptoCompare.IPricesClient.html
│ ├── CryptoCompare.IRateLimitClient.html
│ ├── CryptoCompare.ISocialStatsClient.html
│ ├── CryptoCompare.ISubsClient.html
│ ├── CryptoCompare.ITopListClient.html
│ ├── CryptoCompare.IsoDateTimeWithFormatConverter.html
│ ├── CryptoCompare.MarketCapDisplay.html
│ ├── CryptoCompare.MarketCapRaw.html
│ ├── CryptoCompare.MiningClient.html
│ ├── CryptoCompare.MiningContract.html
│ ├── CryptoCompare.MiningContractsResponse.html
│ ├── CryptoCompare.MiningData.html
│ ├── CryptoCompare.MiningEquipment.html
│ ├── CryptoCompare.MiningEquipmentsResponse.html
│ ├── CryptoCompare.NewsClient.html
│ ├── CryptoCompare.NewsEntity.html
│ ├── CryptoCompare.NewsProvider.html
│ ├── CryptoCompare.PageViewsSplit.html
│ ├── CryptoCompare.Parent.html
│ ├── CryptoCompare.PriceAverageResponse.html
│ ├── CryptoCompare.PriceClient.html
│ ├── CryptoCompare.PriceHistoricalReponse.html
│ ├── CryptoCompare.PriceMultiFullDisplay.html
│ ├── CryptoCompare.PriceMultiFullRaw.html
│ ├── CryptoCompare.PriceMultiFullResponse.html
│ ├── CryptoCompare.PriceMultiResponse.html
│ ├── CryptoCompare.PriceSingleResponse.html
│ ├── CryptoCompare.RateLimitClient.html
│ ├── CryptoCompare.RateLimitResponse.html
│ ├── CryptoCompare.Reddit.html
│ ├── CryptoCompare.Repository.html
│ ├── CryptoCompare.SEO.html
│ ├── CryptoCompare.SimilarItem.html
│ ├── CryptoCompare.SocialStats.html
│ ├── CryptoCompare.SocialStatsClient.html
│ ├── CryptoCompare.SocialStatsResponse.html
│ ├── CryptoCompare.Sub.html
│ ├── CryptoCompare.SubId.html
│ ├── CryptoCompare.SubList.html
│ ├── CryptoCompare.SubListResponse.html
│ ├── CryptoCompare.SubsClient.html
│ ├── CryptoCompare.TopExchangeFullResponse.html
│ ├── CryptoCompare.TopExchangeInfo.html
│ ├── CryptoCompare.TopInfo.html
│ ├── CryptoCompare.TopListClient.html
│ ├── CryptoCompare.TopMarketCapInfo.html
│ ├── CryptoCompare.TopMarketCapResponse.html
│ ├── CryptoCompare.TopResponse.html
│ ├── CryptoCompare.TopVolume24HInfo.html
│ ├── CryptoCompare.TopVolume24HResponse.html
│ ├── CryptoCompare.TopVolumeInfo.html
│ ├── CryptoCompare.TopVolumesResponse.html
│ ├── CryptoCompare.Twitter.html
│ ├── CryptoCompare.Volume24HDisplay.html
│ ├── CryptoCompare.Volume24HRaw.html
│ ├── CryptoCompare.html
│ └── toc.html
├── example.md
├── favicon.ico
├── fonts
│ ├── glyphicons-halflings-regular.eot
│ ├── glyphicons-halflings-regular.svg
│ ├── glyphicons-halflings-regular.ttf
│ ├── glyphicons-halflings-regular.woff
│ └── glyphicons-halflings-regular.woff2
├── historical-data.md
├── index.html
├── index.json
├── logo.svg
├── manifest.json
├── news.md
├── other-infos.md
├── prices.md
├── quickstart.md
├── search-stopwords.json
├── streaming.md
├── styles
│ ├── docfx.css
│ ├── docfx.js
│ ├── docfx.vendor.css
│ ├── docfx.vendor.js
│ ├── lunr.js
│ ├── lunr.min.js
│ ├── main.css
│ ├── main.js
│ └── search-worker.js
├── top-lists.md
└── xrefmap.yml
├── package-lock.json
├── package.json
├── src
└── CryptoCompare
│ ├── Clients
│ ├── BaseApiClient.cs
│ ├── CoinsClient.cs
│ ├── ExchangesClient.cs
│ ├── HistoryClient.cs
│ ├── IApiClient.cs
│ ├── ICoinsClient.cs
│ ├── IExchangesClient.cs
│ ├── IHistoryClient.cs
│ ├── IMiningClient.cs
│ ├── INewsClient.cs
│ ├── IPricesClient.cs
│ ├── IRateLimitsClient.cs
│ ├── ISocialStatsClient.cs
│ ├── ISubsClient.cs
│ ├── ITopsClient.cs
│ ├── MiningClient.cs
│ ├── NewsClient.cs
│ ├── PriceClient.cs
│ ├── RateLimitsClient.cs
│ ├── SocialStatsClient.cs
│ ├── SubsClient.cs
│ └── TopsClient.cs
│ ├── Converters
│ ├── IsoDateTimeWithFormatConverter.cs
│ ├── StringToSubConverter.cs
│ └── UnixTimeConverter.cs
│ ├── Core
│ ├── ApiUrls.cs
│ ├── Constants.cs
│ └── ThottledHttpClientHandler.cs
│ ├── CryptoCompare.csproj
│ ├── CryptoCompare.csproj.DotSettings
│ ├── CryptoCompareClient.cs
│ ├── Exceptions
│ └── CryptoCompareException.cs
│ ├── Extensions
│ ├── DateTimeExtensions.cs
│ ├── EnumerableExtensions.cs
│ └── UriExtensions.cs
│ ├── Helpers
│ ├── Check.cs
│ └── JetbrainsAnnotations.cs
│ ├── ICryptoCompareClient.cs
│ ├── Models
│ └── Responses
│ │ ├── AggregatedData.cs
│ │ ├── BaseApiResponse.cs
│ │ ├── CalculationType.cs
│ │ ├── Calls.cs
│ │ ├── CandleData.cs
│ │ ├── CoinAggregatedData.cs
│ │ ├── CoinFullAggregatedData.cs
│ │ ├── CoinFullAggregatedDataDisplay.cs
│ │ ├── CoinGeneralInfo.cs
│ │ ├── CoinInfo.cs
│ │ ├── CoinListResponse.cs
│ │ ├── CoinSnapshotData.cs
│ │ ├── CoinSnapshotFullData.cs
│ │ ├── CoinSnapshotFullResponse.cs
│ │ ├── CoinSnapshotResponse.cs
│ │ ├── ExchangeHistoryData.cs
│ │ ├── ExchangeHistoryResponse.cs
│ │ ├── ExchangeListResponse.cs
│ │ ├── HistoryDayAverageResponse.cs
│ │ ├── HistoryResponse.cs
│ │ ├── ICO.cs
│ │ ├── MarketCapDisplay.cs
│ │ ├── MarketCapRaw.cs
│ │ ├── MiningContract.cs
│ │ ├── MiningContractsResponse.cs
│ │ ├── MiningData.cs
│ │ ├── MiningEquipment.cs
│ │ ├── MiningEquipmentsResponse.cs
│ │ ├── NewsEntity.cs
│ │ ├── NewsProvider.cs
│ │ ├── PriceAverageResponse.cs
│ │ ├── PriceHistoricalReponse.cs
│ │ ├── PriceMultiFullDisplay.cs
│ │ ├── PriceMultiFullRaw.cs
│ │ ├── PriceMultiFullResponse.cs
│ │ ├── PriceMultiResponse.cs
│ │ ├── PriceSingleResponse.cs
│ │ ├── RateLimitResponse.cs
│ │ ├── SEO.cs
│ │ ├── SocialStatsResponse.cs
│ │ ├── Sub.cs
│ │ ├── SubId.cs
│ │ ├── SubListResponse.cs
│ │ ├── TopExchangeFullResponse.cs
│ │ ├── TopExchangeInfo.cs
│ │ ├── TopInfo.cs
│ │ ├── TopMarketCapInfo.cs
│ │ ├── TopMarketCapsResponse.cs
│ │ ├── TopResponse.cs
│ │ ├── TopVolume24HInfo.cs
│ │ ├── TopVolume24HResponse.cs
│ │ ├── TopVolumeInfo.cs
│ │ ├── TopVolumesResponse.cs
│ │ ├── Volume24HDisplay.cs
│ │ └── Volume24HRaw.cs
│ └── Properties
│ └── AssemblyInfo.cs
├── test
├── CryptoCompare.Tests
│ ├── Converters
│ │ └── UnixTimeConverterTests.cs
│ ├── CryptoCompare.Tests.csproj
│ └── Helpers
│ │ └── CheckTest.cs
└── Cryptocompare.Integration.Tests
│ ├── Clients
│ ├── CoinsClientTests.cs
│ ├── ExchangeClientTests.cs
│ ├── HistoryClientTests.cs
│ ├── MiningClientTests.cs
│ ├── NewsClientTests.cs
│ ├── PriceClientTests.cs
│ ├── RateLimitClientTests.cs
│ ├── SocialStatsClientTests.cs
│ ├── SubsClientTests.cs
│ └── TopListClientTests.cs
│ ├── Core
│ └── ThrottledHttpClientHandlerTests.cs
│ └── Cryptocompare.Integration.Tests.csproj
└── version.json
/.all-contributorsrc:
--------------------------------------------------------------------------------
1 | {
2 | "projectName": "cryptocompare-api",
3 | "projectOwner": "joancaron",
4 | "repoType": "github",
5 | "repoHost": "https://github.com",
6 | "files": [
7 | "README.md"
8 | ],
9 | "imageSize": 100,
10 | "commit": false,
11 | "contributors": [
12 | {
13 | "login": "monsieurleberre",
14 | "name": "monsieurleberre",
15 | "avatar_url": "https://avatars2.githubusercontent.com/u/4638821?v=4",
16 | "profile": "https://github.com/monsieurleberre",
17 | "contributions": [
18 | "code",
19 | "test"
20 | ]
21 | },
22 | {
23 | "login": "stepkillah",
24 | "name": "Anton",
25 | "avatar_url": "https://avatars2.githubusercontent.com/u/10140906?v=4",
26 | "profile": "https://github.com/stepkillah",
27 | "contributions": [
28 | "code",
29 | "test"
30 | ]
31 | },
32 | {
33 | "login": "cohowap",
34 | "name": "cohowap",
35 | "avatar_url": "https://avatars2.githubusercontent.com/u/634931?v=4",
36 | "profile": "https://github.com/cohowap",
37 | "contributions": [
38 | "code",
39 | "test"
40 | ]
41 | }
42 | ]
43 | }
44 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig is awesome:http://EditorConfig.org
2 |
3 | # top-most EditorConfig file
4 | root = true
5 |
6 | # Don't use tabs for indentation.
7 | [*]
8 | indent_style = space
9 | # (Please don't specify an indent_size here; that has too many unintended consequences.)
10 |
11 | # Code files
12 | [*.{cs,csx,vb,vbx}]
13 | indent_size = 4
14 |
15 | # Xml project files
16 | [*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
17 | indent_size = 2
18 |
19 | # Xml config files
20 | [*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
21 | indent_size = 2
22 |
23 | # JSON files
24 | [*.json]
25 | indent_size = 2
26 |
27 | # Dotnet code style settings:
28 | [*.cs]
29 | # Sort using and Import directives with System.* appearing first
30 | dotnet_sort_system_directives_first = true
31 |
32 | # Don't use this. qualifier
33 | dotnet_style_qualification_for_field = true:suggestion
34 | dotnet_style_qualification_for_property = true:suggestion
35 |
36 | # use int x = .. over Int32
37 | dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
38 |
39 | # use int.MaxValue over Int32.MaxValue
40 | dotnet_style_predefined_type_for_member_access = true:suggestion
41 |
42 | # Require var all the time.
43 | csharp_style_var_for_built_in_types = true:suggestion
44 | csharp_style_var_when_type_is_apparent = true:suggestion
45 | csharp_style_var_elsewhere = true:suggestion
46 |
47 | # Disallow throw expressions.
48 | csharp_style_throw_expression = false:suggestion
49 |
50 | # Newline settings
51 | csharp_new_line_before_open_brace = all
52 | csharp_new_line_before_else = true
53 | csharp_new_line_before_catch = true
54 | csharp_new_line_before_finally = true
55 | csharp_new_line_before_members_in_object_initializers = true
56 | csharp_new_line_before_members_in_anonymous_types = true
57 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.doc diff=astextplain
2 | *.DOC diff=astextplain
3 | *.docx diff=astextplain
4 | *.DOCX diff=astextplain
5 | *.dot diff=astextplain
6 | *.DOT diff=astextplain
7 | *.pdf diff=astextplain
8 | *.PDF diff=astextplain
9 | *.rtf diff=astextplain
10 | *.RTF diff=astextplain
11 |
12 | *.jpg binary
13 | *.png binary
14 | *.gif binary
15 |
16 | *.cs text=auto diff=csharp
17 | *.vb text=auto
18 | *.resx text=auto
19 | *.c text=auto
20 | *.cpp text=auto
21 | *.cxx text=auto
22 | *.h text=auto
23 | *.hxx text=auto
24 | *.py text=auto
25 | *.rb text=auto
26 | *.java text=auto
27 | *.html text=auto
28 | *.htm text=auto
29 | *.css text=auto
30 | *.scss text=auto
31 | *.sass text=auto
32 | *.less text=auto
33 | *.js text=auto
34 | *.lisp text=auto
35 | *.clj text=auto
36 | *.sql text=auto
37 | *.php text=auto
38 | *.lua text=auto
39 | *.m text=auto
40 | *.asm text=auto
41 | *.erl text=auto
42 | *.fs text=auto
43 | *.fsx text=auto
44 | *.hs text=auto
45 |
46 | *.csproj text=auto
47 | *.vbproj text=auto
48 | *.fsproj text=auto
49 | *.dbproj text=auto
50 | *.sln text=auto eol=crlf
51 |
52 | *.sh eol=lf
53 |
--------------------------------------------------------------------------------
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # This file lists the code owners that should be added to pull requests
2 | # See https://help.github.com/articles/about-codeowners/ for details.
3 | * @joancaron
4 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
6 |
7 | **Choose one:** is this a 🐞 bug report or 🙋 feature request?
8 |
9 | ### 🤔 Expected Behavior
10 |
11 |
12 |
13 |
14 |
15 | ### 😯 Current Behavior
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | ### 💁 Possible Solution
24 |
25 |
26 |
27 |
28 |
29 | ### 🔦 Context
30 |
31 |
32 |
33 |
34 |
35 | ### 💻 Code Sample
36 |
37 |
38 |
39 | ### 🌍 Your Environment
40 |
41 |
42 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/1-bug-report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "🐛 Bug report"
3 | about: Report a bug in this project
4 | ---
5 |
6 | # 🐛 Bug report
7 |
8 |
13 |
14 | ## 🤔 Expected Behavior
15 |
16 |
17 |
18 | ## 😯 Current Behavior
19 |
20 |
21 |
22 |
23 |
24 | ## 🔬 Steps to Reproduce
25 |
26 |
27 |
28 | 1. First step
29 | 2. Second step
30 |
31 | ## 💁 Possible Solution
32 |
33 |
34 |
35 | ## 🔦 Context
36 |
37 |
38 |
39 |
40 |
41 | ## 💻 Code Sample
42 |
43 |
44 |
45 | ## 🌍 Your Environment
46 |
47 |
48 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/2-feature-request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: "✨ Feature request"
3 | about: Suggest a feature for this project
4 | ---
5 |
10 |
11 | # ✨ Feature request
12 |
13 | ## 📝 Description
14 |
15 |
16 |
17 | ### Describe the solution you'd like
18 |
19 |
20 |
21 | ### Describe alternatives you've considered
22 |
23 |
24 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/3-question.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: ❔ Question
3 | about: Have any questions regarding how this project works?
4 | ---
5 |
6 |
11 |
12 | # ❔ Question
13 |
14 |
15 |
16 | ## 🔦 Context
17 |
18 |
19 |
20 |
21 |
22 | ## 💻 Code Sample
23 |
24 |
25 |
26 | ## 🌍 Your Environment
27 |
28 |
29 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
6 |
7 | # ↪️ Pull Request
8 |
9 |
13 |
14 | ## 💻 Examples
15 |
16 |
17 |
18 | ## 🚨 Test instructions
19 |
20 |
21 |
22 | ## 💥 Does this PR introduce a breaking change?
23 |
24 |
25 |
26 | - [ ] Yes
27 | - [ ] No
28 |
29 | ## ✔️ PR Todo
30 |
31 | - [ ] My code follows the code style of this project.
32 | - [ ] My change requires a change to the documentation.
33 | - [ ] I have updated the documentation accordingly.
34 | - [ ] I have read the [CONTRIBUTING.md](../../CONTRIBUTING.md) document.
35 | - [ ] I have added tests to cover my changes.
36 | - [ ] All new and existing tests passed.
37 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE/1-bugfix.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: 🐛 Bug Fix
3 | about: Did you fix something that did not work as expected?
4 | ---
5 |
6 |
11 |
12 | # 🐛 bug fix
13 |
14 |
15 |
16 | ## 🤔 Tell Us What Goes Wrong
17 |
18 |
19 |
20 | ## 💁 Your Solution
21 |
22 |
23 |
24 | ## 🚨 Test instructions
25 |
26 |
27 |
28 | ## 🌍 Your Environment
29 |
30 |
31 |
32 | ## 💥 Does this PR introduce a breaking change?
33 |
34 |
35 |
36 | - [ ] Yes
37 | - [ ] No
38 |
39 | ## ✔️ PR Todo
40 |
41 | - [ ] My code follows the code style of this project.
42 | - [ ] My change requires a change to the documentation.
43 | - [ ] I have updated the documentation accordingly.
44 | - [ ] I have read the [CONTRIBUTING.md](../../CONTRIBUTING.md) document.
45 | - [ ] I have added tests to cover my changes.
46 | - [ ] All new and existing tests passed.
47 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE/2-feature.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: ✨ New Feature
3 | about: Do you want to add something to this project?
4 | ---
5 |
6 |
11 |
12 | # ✨ New Feature
13 |
14 |
18 |
19 | ## 💻 Examples
20 |
21 |
22 |
23 | ## 🚨 Test instructions
24 |
25 |
26 |
27 | ## 💥 Does this PR introduce a breaking change?
28 |
29 |
30 |
31 | - [ ] Yes
32 | - [ ] No
33 |
34 | ## ✔️ PR Todo
35 |
36 | - [ ] My code follows the code style of this project.
37 | - [ ] My change requires a change to the documentation.
38 | - [ ] I have updated the documentation accordingly.
39 | - [ ] I have read the [CONTRIBUTING.md](../../CONTRIBUTING.md) document.
40 | - [ ] I have added tests to cover my changes.
41 | - [ ] All new and existing tests passed.
42 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.suo
8 | *.user
9 | *.userosscache
10 | *.sln.docstates
11 |
12 | # User-specific files (MonoDevelop/Xamarin Studio)
13 | *.userprefs
14 |
15 | # Build results
16 | [Dd]ebug/
17 | [Dd]ebugPublic/
18 | [Rr]elease/
19 | [Rr]eleases/
20 | x64/
21 | x86/
22 | bld/
23 | [Bb]in/
24 | [Oo]bj/
25 | [Ll]og/
26 |
27 | # Visual Studio 2015 cache/options directory
28 | .vs/
29 | # Uncomment if you have tasks that create the project's static files in wwwroot
30 | #wwwroot/
31 |
32 | # MSTest test Results
33 | [Tt]est[Rr]esult*/
34 | [Bb]uild[Ll]og.*
35 |
36 | # NUNIT
37 | *.VisualState.xml
38 | TestResult.xml
39 |
40 | # Build Results of an ATL Project
41 | [Dd]ebugPS/
42 | [Rr]eleasePS/
43 | dlldata.c
44 |
45 | # .NET Core
46 | project.lock.json
47 | project.fragment.lock.json
48 | artifacts/
49 | **/Properties/launchSettings.json
50 |
51 | *_i.c
52 | *_p.c
53 | *_i.h
54 | *.ilk
55 | *.meta
56 | *.obj
57 | *.pch
58 | *.pdb
59 | *.pgc
60 | *.pgd
61 | *.rsp
62 | *.sbr
63 | *.tlb
64 | *.tli
65 | *.tlh
66 | *.tmp
67 | *.tmp_proj
68 | *.log
69 | *.vspscc
70 | *.vssscc
71 | .builds
72 | *.pidb
73 | *.svclog
74 | *.scc
75 |
76 | # Chutzpah Test files
77 | _Chutzpah*
78 |
79 | # Visual C++ cache files
80 | ipch/
81 | *.aps
82 | *.ncb
83 | *.opendb
84 | *.opensdf
85 | *.sdf
86 | *.cachefile
87 | *.VC.db
88 | *.VC.VC.opendb
89 |
90 | # Visual Studio profiler
91 | *.psess
92 | *.vsp
93 | *.vspx
94 | *.sap
95 |
96 | # TFS 2012 Local Workspace
97 | $tf/
98 |
99 | # Guidance Automation Toolkit
100 | *.gpState
101 |
102 | # ReSharper is a .NET coding add-in
103 | _ReSharper*/
104 | *.[Rr]e[Ss]harper
105 | *.DotSettings.user
106 |
107 | # JustCode is a .NET coding add-in
108 | .JustCode
109 |
110 | # TeamCity is a build add-in
111 | _TeamCity*
112 |
113 | # DotCover is a Code Coverage Tool
114 | *.dotCover
115 |
116 | # Visual Studio code coverage results
117 | *.coverage
118 | *.coveragexml
119 |
120 | # NCrunch
121 | _NCrunch_*
122 | .*crunch*.local.xml
123 | nCrunchTemp_*
124 | *.ncrunchsolution
125 |
126 | # MightyMoose
127 | *.mm.*
128 | AutoTest.Net/
129 |
130 | # Web workbench (sass)
131 | .sass-cache/
132 |
133 | # Installshield output folder
134 | [Ee]xpress/
135 |
136 | # DocProject is a documentation generator add-in
137 | DocProject/buildhelp/
138 | DocProject/Help/*.HxT
139 | DocProject/Help/*.HxC
140 | DocProject/Help/*.hhc
141 | DocProject/Help/*.hhk
142 | DocProject/Help/*.hhp
143 | DocProject/Help/Html2
144 | DocProject/Help/html
145 |
146 | # Click-Once directory
147 | publish/
148 |
149 | # Publish Web Output
150 | *.[Pp]ublish.xml
151 | *.azurePubxml
152 | # TODO: Comment the next line if you want to checkin your web deploy settings
153 | # but database connection strings (with potential passwords) will be unencrypted
154 | *.pubxml
155 | *.publishproj
156 |
157 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
158 | # checkin your Azure Web App publish settings, but sensitive information contained
159 | # in these scripts will be unencrypted
160 | PublishScripts/
161 |
162 | # NuGet Packages
163 | *.nupkg
164 | # The packages folder can be ignored because of Package Restore
165 | **/packages/*
166 | # except build/, which is used as an MSBuild target.
167 | !**/packages/build/
168 | # Uncomment if necessary however generally it will be regenerated when needed
169 | #!**/packages/repositories.config
170 | # NuGet v3's project.json files produces more ignorable files
171 | *.nuget.props
172 | *.nuget.targets
173 |
174 | # Microsoft Azure Build Output
175 | csx/
176 | *.build.csdef
177 |
178 | # Microsoft Azure Emulator
179 | ecf/
180 | rcf/
181 |
182 | # Windows Store app package directories and files
183 | AppPackages/
184 | BundleArtifacts/
185 | Package.StoreAssociation.xml
186 | _pkginfo.txt
187 |
188 | # Visual Studio cache files
189 | # files ending in .cache can be ignored
190 | *.[Cc]ache
191 | # but keep track of directories ending in .cache
192 | !*.[Cc]ache/
193 |
194 | # Others
195 | ClientBin/
196 | ~$*
197 | *~
198 | *.dbmdl
199 | *.dbproj.schemaview
200 | *.jfm
201 | *.pfx
202 | *.publishsettings
203 | orleans.codegen.cs
204 |
205 | # Since there are multiple workflows, uncomment next line to ignore bower_components
206 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
207 | #bower_components/
208 |
209 | # RIA/Silverlight projects
210 | Generated_Code/
211 |
212 | # Backup & report files from converting an old project file
213 | # to a newer Visual Studio version. Backup files are not needed,
214 | # because we have git ;-)
215 | _UpgradeReport_Files/
216 | Backup*/
217 | UpgradeLog*.XML
218 | UpgradeLog*.htm
219 |
220 | # SQL Server files
221 | *.mdf
222 | *.ldf
223 | *.ndf
224 |
225 | # Business Intelligence projects
226 | *.rdl.data
227 | *.bim.layout
228 | *.bim_*.settings
229 |
230 | # Microsoft Fakes
231 | FakesAssemblies/
232 |
233 | # GhostDoc plugin setting file
234 | *.GhostDoc.xml
235 |
236 | # Node.js Tools for Visual Studio
237 | .ntvs_analysis.dat
238 | node_modules/
239 |
240 | # Typescript v1 declaration files
241 | typings/
242 |
243 | # Visual Studio 6 build log
244 | *.plg
245 |
246 | # Visual Studio 6 workspace options file
247 | *.opt
248 |
249 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
250 | *.vbw
251 |
252 | # Visual Studio LightSwitch build output
253 | **/*.HTMLClient/GeneratedArtifacts
254 | **/*.DesktopClient/GeneratedArtifacts
255 | **/*.DesktopClient/ModelManifest.xml
256 | **/*.Server/GeneratedArtifacts
257 | **/*.Server/ModelManifest.xml
258 | _Pvt_Extensions
259 |
260 | # Paket dependency manager
261 | .paket/paket.exe
262 | paket-files/
263 |
264 | # FAKE - F# Make
265 | .fake/
266 |
267 | # JetBrains Rider
268 | .idea/
269 | *.sln.iml
270 |
271 | # CodeRush
272 | .cr/
273 |
274 | # Python Tools for Visual Studio (PTVS)
275 | __pycache__/
276 | *.pyc
277 |
278 | # Cake - Uncomment if you are using it
279 | # tools/**
280 | # !tools/packages.config
281 |
282 | # Telerik's JustMock configuration file
283 | *.jmconfig
284 |
285 | # BizTalk build output
286 | *.btp.cs
287 | *.btm.cs
288 | *.odx.cs
289 | *.xsd.cs
290 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 |
3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4 |
5 |
6 | # [1.4.0](https://github.com/joancaron/cryptocompare-api/compare/v1.3.2...v1.4.0) (2019-02-16)
7 |
8 |
9 | ### Features
10 |
11 | * Add missing properties for CoinFullAggregatedDataDisplay object ([a12693c](https://github.com/joancaron/cryptocompare-api/commit/a12693c)), closes [#41](https://github.com/joancaron/cryptocompare-api/issues/41)
12 | * Throttle via handler ([#37](https://github.com/joancaron/cryptocompare-api/issues/37)) ([f10fdc5](https://github.com/joancaron/cryptocompare-api/commit/f10fdc5))
13 |
14 |
15 |
16 |
17 | ## [1.3.2](https://github.com/joancaron/cryptocompare-api/compare/v1.3.1...v1.3.2) (2018-12-15)
18 |
19 |
20 | ### Bug Fixes
21 |
22 | * **build:** Fix Triggers ([80e1177](https://github.com/joancaron/cryptocompare-api/commit/80e1177))
23 |
24 |
25 |
26 |
27 | ## [1.3.1](https://github.com/joancaron/cryptocompare-api/compare/v1.3.0...v1.3.1) (2018-12-15)
28 |
29 |
30 | ### Bug Fixes
31 |
32 | * **build:** Remove PR filter ([a5c211f](https://github.com/joancaron/cryptocompare-api/commit/a5c211f))
33 |
34 |
35 |
36 |
37 | # [1.3.0](https://github.com/joancaron/cryptocompare-api/compare/v1.2.0...v1.3.0) (2018-12-15)
38 |
39 |
40 | ### Features
41 |
42 | * Support for top volume on last 24h endpoint ([#34](https://github.com/joancaron/cryptocompare-api/issues/34)) ([1738e82](https://github.com/joancaron/cryptocompare-api/commit/1738e82))
43 |
44 |
45 |
46 |
47 | # [1.2.0](https://github.com/joancaron/cryptocompare-api/compare/1.1.0+66411c...1.2.0) (2018-12-11)
48 |
49 |
50 | ### Features
51 |
52 | * Enable Sourcelink ([494ba5a](https://github.com/joancaron/cryptocompare-api/commit/494ba5a))
53 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, sex characteristics, gender identity and expression,
9 | level of experience, education, socio-economic status, nationality, personal
10 | appearance, race, religion, or sexual identity and orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | * The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | * Trolling, insulting/derogatory comments, and personal or political attacks
28 | * Public or private harassment
29 | * Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | * Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or
41 | reject comments, commits, code, wiki edits, issues, and other contributions
42 | that are not aligned to this Code of Conduct, or to ban temporarily or
43 | permanently any contributor for other behaviors that they deem inappropriate,
44 | threatening, offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project team at joan@caron.work. All
59 | complaints will be reviewed and investigated and will result in a response that
60 | is deemed necessary and appropriate to the circumstances. The project team is
61 | obligated to maintain confidentiality with regard to the reporter of an incident.
62 | Further details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72 |
73 | [homepage]: https://www.contributor-covenant.org
74 |
75 | For answers to common questions about this code of conduct, see
76 | https://www.contributor-covenant.org/faq
77 |
78 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to cryptocompare-api project
2 |
3 | We would love for you to contribute to cryptocompare-api project and help make it even better than it is today! As a contributor, here are the guidelines we would like you to follow.
4 |
5 | ## Code of Conduct
6 |
7 | Help us keep cryptocompare-api open and inclusive. Please read and follow our [Code of Conduct](https://github.com/joancaron/cryptocompare-api/blob/master/CODE_OF_CONDUCT.md)
8 |
9 | ## Found a Bug?
10 | If you find a bug in the source code, you can help us by
11 | [submitting an issue](https://github.com/joancaron/cryptocompare-api/issues) to our GitHub Repository. Even better, you can
12 | [submit a Pull Request](https://github.com/joancaron/cryptocompare-api/pulls) with a fix.
13 |
14 | ## Missing a Feature?
15 | You can *request* a new feature by [submitting an issue](https://github.com/joancaron/cryptocompare-api/issues) to our GitHub
16 | Repository. If you would like to *implement* a new feature, please submit an issue with
17 | a proposal for your work first, to be sure that we can use it.
18 | Please consider what kind of change it is:
19 |
20 | * For a **Major Feature**, first open an issue and outline your proposal so that it can be
21 | discussed. This will also allow us to better coordinate our efforts, prevent duplication of work,
22 | and help you to craft the change so that it is successfully accepted into the project.
23 | * **Small Features** can be crafted and directly [submitted as a Pull Request](https://github.com/joancaron/cryptocompare-api/pulls).
24 |
25 | ## Submitting a Pull Request (PR)
26 | Before you submit your Pull Request (PR) consider the following guidelines:
27 |
28 | 1. Search [GitHub](https://github.com/joancaron/cryptocompare-api/pulls) for an open or closed PR
29 | that relates to your submission. You don't want to duplicate effort.
30 | 1. Be sure that an issue describes the problem you're fixing, or documents the design for the feature you'd like to add.
31 | Discussing the design up front helps to ensure that we're ready to accept your work.
32 | 1. Fork the repo.
33 | 1. Make your changes in a new git branch:
34 |
35 | ```shell
36 | git checkout -b my-fix-branch master
37 | ```
38 |
39 | 1. Create your patch, **including appropriate test cases**.
40 | 1. Follow our Coding Rules.
41 | 1. Run the full test suite and ensure that all tests pass.
42 | 1. Commit your changes using a descriptive commit message that follows
43 | ["Conventional commits" conventions](https://www.conventionalcommits.org). Adherence to these conventions
44 | is necessary because release notes are automatically generated from these messages.
45 |
46 | ```shell
47 | git commit -a
48 | ```
49 | Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files.
50 |
51 | 1. Push your branch to GitHub:
52 |
53 | ```shell
54 | git push origin my-fix-branch
55 | ```
56 |
57 | 1. In GitHub, send a pull request to `master`.
58 | * If we suggest changes then:
59 | * Make the required updates.
60 | * Re-run the Angular test suites to ensure tests are still passing.
61 | * Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
62 |
63 | ```shell
64 | git rebase master -i
65 | git push -f
66 | ```
67 |
68 | That's it! Thank you for your contribution!
69 |
70 | #### After your pull request is merged
71 |
72 | After your pull request is merged, you can safely delete your branch and pull the changes
73 | from the main (upstream) repository:
74 |
75 | * Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
76 |
77 | ```shell
78 | git push origin --delete my-fix-branch
79 | ```
80 |
81 | * Check out the master branch:
82 |
83 | ```shell
84 | git checkout master -f
85 | ```
86 |
87 | * Delete the local branch:
88 |
89 | ```shell
90 | git branch -D my-fix-branch
91 | ```
92 |
93 | * Update your master with the latest upstream version:
94 |
95 | ```shell
96 | git pull --ff upstream master
97 | ```
98 |
99 | ## Coding Rules
100 | To ensure consistency throughout the source code, keep these rules in mind as you are working:
101 |
102 | * All features or bug fixes **must be tested** by one or more specs (unit-tests).
103 | * We follow [Microsoft's Framework Design Guidelines](https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/)
104 |
--------------------------------------------------------------------------------
/CryptoCompare.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27004.2008
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CryptoCompare", "src\CryptoCompare\CryptoCompare.csproj", "{74DE4A18-AFE5-485F-A205-5C38CA3BD0BB}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B4B8ECDB-63A4-431A-8313-2D90142033C1}"
9 | ProjectSection(SolutionItems) = preProject
10 | .editorconfig = .editorconfig
11 | .gitattributes = .gitattributes
12 | .gitignore = .gitignore
13 | appveyor.yml = appveyor.yml
14 | build.ps1 = build.ps1
15 | CryptoCompare.targets = CryptoCompare.targets
16 | LICENSE = LICENSE
17 | README.md = README.md
18 | Settings.StyleCop = Settings.StyleCop
19 | EndProjectSection
20 | EndProject
21 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{CAAC477E-7487-42CB-9DEB-AE8860A3B03F}"
22 | EndProject
23 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CryptoCompare.Tests", "test\CryptoCompare.Tests\CryptoCompare.Tests.csproj", "{E352A047-C22D-4AB6-9737-47700656B4C4}"
24 | EndProject
25 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Src", "Src", "{5849F63C-8D5B-424A-BAB5-4A43A3A0A915}"
26 | EndProject
27 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cryptocompare.Integration.Tests", "test\Cryptocompare.Integration.Tests\Cryptocompare.Integration.Tests.csproj", "{02014F73-1002-4970-AA85-7CBB1D2B8276}"
28 | EndProject
29 | Global
30 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
31 | Debug|Any CPU = Debug|Any CPU
32 | Release|Any CPU = Release|Any CPU
33 | EndGlobalSection
34 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
35 | {74DE4A18-AFE5-485F-A205-5C38CA3BD0BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
36 | {74DE4A18-AFE5-485F-A205-5C38CA3BD0BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
37 | {74DE4A18-AFE5-485F-A205-5C38CA3BD0BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
38 | {74DE4A18-AFE5-485F-A205-5C38CA3BD0BB}.Release|Any CPU.Build.0 = Release|Any CPU
39 | {E352A047-C22D-4AB6-9737-47700656B4C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
40 | {E352A047-C22D-4AB6-9737-47700656B4C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
41 | {E352A047-C22D-4AB6-9737-47700656B4C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
42 | {E352A047-C22D-4AB6-9737-47700656B4C4}.Release|Any CPU.Build.0 = Release|Any CPU
43 | {02014F73-1002-4970-AA85-7CBB1D2B8276}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
44 | {02014F73-1002-4970-AA85-7CBB1D2B8276}.Debug|Any CPU.Build.0 = Debug|Any CPU
45 | {02014F73-1002-4970-AA85-7CBB1D2B8276}.Release|Any CPU.ActiveCfg = Release|Any CPU
46 | {02014F73-1002-4970-AA85-7CBB1D2B8276}.Release|Any CPU.Build.0 = Release|Any CPU
47 | EndGlobalSection
48 | GlobalSection(SolutionProperties) = preSolution
49 | HideSolutionNode = FALSE
50 | EndGlobalSection
51 | GlobalSection(NestedProjects) = preSolution
52 | {74DE4A18-AFE5-485F-A205-5C38CA3BD0BB} = {5849F63C-8D5B-424A-BAB5-4A43A3A0A915}
53 | {E352A047-C22D-4AB6-9737-47700656B4C4} = {CAAC477E-7487-42CB-9DEB-AE8860A3B03F}
54 | {02014F73-1002-4970-AA85-7CBB1D2B8276} = {CAAC477E-7487-42CB-9DEB-AE8860A3B03F}
55 | EndGlobalSection
56 | GlobalSection(ExtensibilityGlobals) = postSolution
57 | SolutionGuid = {3F131DCD-33E4-47BA-8829-65E49F744112}
58 | EndGlobalSection
59 | EndGlobal
60 |
--------------------------------------------------------------------------------
/CryptoCompare.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 | Joan Caron
4 | 0.0.6
5 | true
6 | git
7 | https://github.com/joancaron/cryptocompare-api
8 | https://github.com/joancaron/cryptocompare-api
9 | https://raw.githubusercontent.com/joancaron/cryptocompare-api/master/cryptocompare_logo.png
10 | cryptocompare-api;cryptocurrency;bitcoin;dotnet-core;dotnet-standard;dotnet;async;cryptocurrencies;cryptocompare
11 | http://opensource.org/licenses/apache-2.0
12 | Copyright Joan Caron 2018
13 |
14 | true
15 | true
16 | $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # cryptocompare-api
2 |
3 | [](https://dev.azure.com/joan-caron-oss/cryptocompare-api/_build/latest?definitionId=1)
4 | [](https://www.codacy.com/app/joancaron/cryptocompare-api?utm_source=github.com&utm_medium=referral&utm_content=joancaron/cryptocompare-api&utm_campaign=badger)
5 | [](https://www.nuget.org/packages/CryptoCompare/)
6 |
7 | 
8 |
9 | An async-based CryptoCompare API client library for .NET and .NET Core
10 |
11 | ## Supported platforms
12 |
13 | * .NET Core 1.0
14 | * .NET Framework 4.5
15 | * Mono 4.6
16 | * Xamarin.iOS 10.0
17 | * Xamarin.Android 7.0
18 | * Universal Windows Platform 10
19 | * Windows 8.0
20 | * Windows Phone 8.1
21 |
22 | ## Installation
23 | This CryptoCompare api wrapper library is available on NuGet
24 |
25 | Package manager
26 | ````
27 | Install-Package CryptoCompare
28 | ````
29 |
30 | .NET CLI
31 | ````
32 | dotnet add package CryptoCompare
33 | ````
34 |
35 | Paket CLI
36 | ````
37 | paket add CryptoCompare
38 | ````
39 |
40 |
41 |
42 |
43 |
44 | ## Basic usage
45 | ````csharp
46 | // Using ctor
47 | var client = new CryptoCompareClient();
48 | var eth = await client.Coins.SnapshotFullAsync(7605);
49 | Console.WriteLine(eth.Data.General.Name);
50 |
51 | // Using Singleton
52 | var btc = await CryptoCompareClient.Instance.Coins.SnapshotFullAsync(1182);
53 | Console.WriteLine(eth.Data.General.Name);
54 | ````
55 |
56 | ## Contributors
57 |
58 |
59 |
60 | | [
monsieurleberre](https://github.com/monsieurleberre)
[💻](https://github.com/joancaron/cryptocompare-api/commits?author=monsieurleberre "Code") [⚠️](https://github.com/joancaron/cryptocompare-api/commits?author=monsieurleberre "Tests") | [
Anton](https://github.com/stepkillah)
[💻](https://github.com/joancaron/cryptocompare-api/commits?author=stepkillah "Code") [⚠️](https://github.com/joancaron/cryptocompare-api/commits?author=stepkillah "Tests") | [
cohowap](https://github.com/cohowap)
[💻](https://github.com/joancaron/cryptocompare-api/commits?author=cohowap "Code") [⚠️](https://github.com/joancaron/cryptocompare-api/commits?author=cohowap "Tests") |
61 | | :---: | :---: | :---: |
62 |
63 |
64 | ## License
65 |
66 | [](https://opensource.org/licenses/Apache-2.0)
67 |
68 |
69 |
70 | [](https://app.fossa.io/projects/git%2Bgithub.com%2Fjoancaron%2Fcryptocompare-api?ref=badge_large)
71 |
--------------------------------------------------------------------------------
/azure-pipelines.yml:
--------------------------------------------------------------------------------
1 | trigger:
2 | - master
3 | - refs/tags/*
4 | - release/*
5 |
6 | pr:
7 | - master
8 | - release/*
9 |
10 | variables:
11 | TreatWarningsAsErrors: true
12 | DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
13 | BuildConfiguration: Release
14 | BuildPlatform: Any CPU
15 |
16 | jobs:
17 | - job: macOS
18 | pool: Hosted macOS
19 | steps:
20 | - template: ci/testfx.yml
21 |
22 | - job: Linux
23 | pool: Hosted Ubuntu 1604
24 | steps:
25 | - template: ci/testfx.yml
26 |
27 | - job: Windows
28 | pool: Hosted VS2017
29 | steps:
30 | - template: ci/build.yml
31 |
--------------------------------------------------------------------------------
/ci/build.yml:
--------------------------------------------------------------------------------
1 | steps:
2 | - powershell: |
3 | $manifest = Get-Content .\package.json | Out-String | ConvertFrom-Json
4 |
5 | $canBePacked = '$(Build.SourceBranch)'.StartsWith("refs/tags/v") -and '$(Build.Reason)' -ne 'PullRequest' -and '$(System.PullRequest.IsFork)' -ne $true
6 |
7 | Write-Host 'Can be Packed'
8 | Write-Host $canBePacked
9 |
10 | Write-Host 'Source branch'
11 | Write-Host '$(Build.SourceBranch)'.StartsWith("refs/tags/v")
12 |
13 | Write-Host 'Reason'
14 | Write-Host '$(Build.Reason)' -ne 'PullRequest'
15 |
16 | Write-Host 'Forked'
17 | Write-Host '$(System.PullRequest.IsFork)' -ne $true
18 |
19 | if ($canBePacked) {
20 | $version = $manifest.version
21 | }else{
22 | $version = $manifest.version + '+' + $Env:BUILD_SOURCEVERSION.Substring(0, 6)
23 | }
24 |
25 | Write-Host "##vso[task.setvariable variable=canBePacked]$canBePacked"
26 | Write-Host "##vso[build.updatebuildnumber]$version"
27 | displayName: Set variables
28 |
29 | - task: DotNetCoreCLI@2
30 | displayName: Build
31 | inputs:
32 | projects: '**/*.csproj'
33 | arguments: '-c $(BuildConfiguration)'
34 |
35 | - task: DotNetCoreCLI@2
36 | displayName: Test
37 | inputs:
38 | command: test
39 | projects: '**/*[Tt]ests/*.csproj'
40 | arguments: '-c $(BuildConfiguration) --no-build --no-restore'
41 | publishTestResults: true
42 |
43 | - task: CopyFiles@2
44 | displayName: 'Copy binaries to artifacts directory'
45 | inputs:
46 | Contents: '**\bin\**'
47 | TargetFolder: '$(build.artifactstagingdirectory)\binaries'
48 | CleanTargetFolder: true
49 | OverWrite: true
50 | flattenFolders: true
51 | condition: and(succeeded(), eq(variables['canBePacked'], true))
52 |
53 | - task: DotNetCoreCLI@2
54 | displayName: Pack
55 | inputs:
56 | command: pack
57 | packagesToPack: 'src/**/*.csproj'
58 | packDirectory: '$(build.artifactstagingdirectory)\packages'
59 | nobuild: true
60 | versioningScheme: byEnvVar
61 | versionEnvVar: 'BUILD_BUILDNUMBER'
62 | condition: and(succeeded(), eq(variables['canBePacked'], true))
63 |
64 | - task: PublishBuildArtifacts@1
65 | displayName: 'Publish NuGet Artifacts'
66 | inputs:
67 | PathtoPublish: '$(build.artifactstagingdirectory)\packages'
68 | ArtifactName: Packages
69 | condition: and(succeeded(), eq(variables['canBePacked'], true))
70 |
71 | - task: PublishBuildArtifacts@1
72 | displayName: 'Publish binaries'
73 | inputs:
74 | ArtifactName: Binaries
75 | condition: and(succeeded(), eq(variables['canBePacked'], true))
76 |
--------------------------------------------------------------------------------
/ci/testfx.yml:
--------------------------------------------------------------------------------
1 | steps:
2 | - task: DotNetCoreCLI@2
3 | displayName: Build
4 | inputs:
5 | projects: 'src/**/*.csproj'
6 | arguments: '-c $(BuildConfiguration) -f netstandard2.0'
7 |
8 | - task: DotNetCoreCLI@2
9 | displayName: Test
10 | inputs:
11 | command: test
12 | projects: 'test/**/*[Tt]ests/*.csproj'
13 | arguments: '-c $(BuildConfiguration) -f netcoreapp2.1'
14 | publishTestResults: true
15 |
--------------------------------------------------------------------------------
/cryptocompare_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joancaron/cryptocompare-api/97a8fde03522a1230215a44c3a09adbb9bb2cad9/cryptocompare_logo.png
--------------------------------------------------------------------------------
/docfx.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": [
3 | {
4 | "src": [
5 | {
6 | "files": [ "**/*.csproj" ],
7 | "exclude": [ "**/bin/**", "**/obj/**" ],
8 | "src": "src"
9 | }
10 | ],
11 | "dest": "obj/api",
12 | "disableGitFeatures": false,
13 | "disableDefaultFilter": false,
14 | "properties": { "TargetFramework": "netstandard2.0" }
15 | }
16 | ],
17 | "build": {
18 | "content": [
19 | {
20 | "files": [ "**/*.yml" ],
21 | "src": "obj/api",
22 | "dest": "api"
23 | }
24 | ],
25 | "globalMetadata": {
26 | "_appTitle": "CryptoCompare C# client",
27 | "_enableSearch": true
28 | },
29 | "markdownEngineName": "markdig",
30 | "dest": "docs",
31 | "xrefService": [ "https://xref.docs.microsoft.com/query?uid={uid}" ]
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/docs/.nojekyll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joancaron/cryptocompare-api/97a8fde03522a1230215a44c3a09adbb9bb2cad9/docs/.nojekyll
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
1 | # cryptocompare-api
2 |
3 | [](https://dev.azure.com/joan-caron-oss/cryptocompare-api/_build/latest?definitionId=1)
4 | [](https://www.codacy.com/app/joancaron/cryptocompare-api?utm_source=github.com&utm_medium=referral&utm_content=joancaron/cryptocompare-api&utm_campaign=badger)
5 | [](https://www.nuget.org/packages/CryptoCompare/)
6 |
7 | 
8 |
9 | An async-based CryptoCompare API client library for .NET and .NET Core
10 |
11 | ## Supported platforms
12 |
13 | * .NET Core 1.0
14 | * .NET Framework 4.5
15 | * Mono 4.6
16 | * Xamarin.iOS 10.0
17 | * Xamarin.Android 7.0
18 | * Universal Windows Platform 10
19 | * Windows 8.0
20 | * Windows Phone 8.1
21 |
22 | ## Installation
23 | This CryptoCompare api wrapper library is available on NuGet
24 |
25 | Package manager
26 | ````
27 | Install-Package CryptoCompare
28 | ````
29 |
30 | .NET CLI
31 | ````
32 | dotnet add package CryptoCompare
33 | ````
34 |
35 | Paket CLI
36 | ````
37 | paket add CryptoCompare
38 | ````
39 |
40 |
41 |
42 |
43 |
44 | ## Basic usage
45 | ````csharp
46 | // Using ctor
47 | var client = new CryptoCompareClient();
48 | var eth = await client.Coins.SnapshotFullAsync(7605);
49 | Console.WriteLine(eth.Data.General.Name);
50 |
51 | // Using Singleton
52 | var btc = await CryptoCompareClient.Instance.Coins.SnapshotFullAsync(1182);
53 | Console.WriteLine(eth.Data.General.Name);
54 | ````
55 |
56 | ## Contributors
57 |
58 |
59 |
60 | | [
monsieurleberre](https://github.com/monsieurleberre)
[💻](https://github.com/joancaron/cryptocompare-api/commits?author=monsieurleberre "Code") [⚠️](https://github.com/joancaron/cryptocompare-api/commits?author=monsieurleberre "Tests") | [
Anton](https://github.com/stepkillah)
[💻](https://github.com/joancaron/cryptocompare-api/commits?author=stepkillah "Code") [⚠️](https://github.com/joancaron/cryptocompare-api/commits?author=stepkillah "Tests") | [
cohowap](https://github.com/cohowap)
[💻](https://github.com/joancaron/cryptocompare-api/commits?author=cohowap "Code") [⚠️](https://github.com/joancaron/cryptocompare-api/commits?author=cohowap "Tests") |
61 | | :---: | :---: | :---: |
62 |
63 |
64 | ## License
65 |
66 | [](https://opensource.org/licenses/Apache-2.0)
67 |
68 |
69 |
70 | [](https://app.fossa.io/projects/git%2Bgithub.com%2Fjoancaron%2Fcryptocompare-api?ref=badge_large)
71 |
--------------------------------------------------------------------------------
/docs/_coverpage.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | # C# client
4 |
5 | > An async-based CryptoCompare API client library for .NET and .NET Core
6 |
7 | [GitHub](https://github.com/joancaron/cryptocompare-api/)
8 | [Get Started](#cryptocompare-api)
9 |
10 | 
--------------------------------------------------------------------------------
/docs/_sidebar.md:
--------------------------------------------------------------------------------
1 | - Getting started
2 |
3 | - [Quick start](quickstart.md)
4 | - [Example](example.md)
5 |
6 | - Methods
7 |
8 | - [Prices](prices.md)
9 | - [Historical data](historical-data.md)
10 | - [Top lists](top-lists.md)
11 | - [Streaming](streaming.md)
12 | - [News](news.md)
13 | - [Other infos](other-infos.md)
14 |
15 | - Metas
16 | - [Changelog](changelog.md)
17 | - [Contributing](contributing.md)
18 | - [Code of conduct](code-of-conduct.md)
19 |
--------------------------------------------------------------------------------
/docs/api/CryptoCompare.CalculationType.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Enum CalculationType
9 | | CryptoCompare C# client
10 |
11 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
52 |
53 |
60 |
61 |
71 |
72 |
73 |
79 |
80 |
81 |
82 |
83 |
84 | Enum CalculationType
85 |
86 |
87 |
88 |
89 | Assembly: CryptoCompare.dll
90 | Syntax
91 |
92 |
public enum CalculationType
93 |
94 | Fields
95 |
96 |
97 |
98 |
99 | Name |
100 | Description |
101 |
102 |
103 |
104 |
105 | Close |
106 | The day close price.
107 | |
108 |
109 |
110 | HourVWAP |
111 | HourVWAP of hourly price
112 | |
113 |
114 |
115 | MidHighLow |
116 | The average between the 24 H high and low.
117 | |
118 |
119 |
120 | VolFVolT |
121 | The total volume to / the total volume from.
122 | |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
140 |
141 |
142 |
143 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
--------------------------------------------------------------------------------
/docs/api/CryptoCompare.IExchangesClient.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Interface IExchangesClient
9 | | CryptoCompare C# client
10 |
11 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
52 |
53 |
60 |
61 |
71 |
72 |
73 |
79 |
80 |
81 |
82 |
83 |
84 | Interface IExchangesClient
85 |
86 | Interface for exchanges api client.
87 |
88 |
89 |
90 |
Inherited Members
91 |
94 |
97 |
98 |
99 | Assembly: CryptoCompare.dll
100 | Syntax
101 |
102 |
public interface IExchangesClient : IApiClient
103 |
104 | Methods
105 |
106 |
107 |
108 |
109 | ListAsync()
110 | all the exchanges that CryptoCompare has integrated with..
111 |
112 |
113 | Declaration
114 |
115 |
Task<ExchangeListResponse> ListAsync()
116 |
117 | Returns
118 |
119 |
120 |
121 | Type |
122 | Description |
123 |
124 |
125 |
126 |
127 | Task<ExchangeListResponse> |
128 | |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
146 |
147 |
148 |
149 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
--------------------------------------------------------------------------------
/docs/api/CryptoCompare.IRateLimitClient.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Interface IRateLimitClient
9 | | CryptoCompare C# client
10 |
11 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
52 |
53 |
60 |
61 |
71 |
72 |
73 |
79 |
80 |
81 |
82 |
83 |
84 | Interface IRateLimitClient
85 |
86 | Interface of api client for cryptocompare api calls rate limits.
87 |
88 |
89 |
90 |
Inherited Members
91 |
94 |
97 |
98 |
99 | Assembly: CryptoCompare.dll
100 | Syntax
101 |
102 |
public interface IRateLimitClient : IApiClient
103 |
104 | Methods
105 |
106 |
107 |
108 |
109 | CurrentHourAsync()
110 | Gets the rate limits left for you on the histo, price and news paths in the current hour..
111 |
112 |
113 | Declaration
114 |
115 |
Task<RateLimitResponse> CurrentHourAsync()
116 |
117 | Returns
118 |
119 |
120 |
121 | Type |
122 | Description |
123 |
124 |
125 |
126 |
127 | Task<RateLimitResponse> |
128 | |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
146 |
147 |
148 |
149 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
--------------------------------------------------------------------------------
/docs/api/CryptoCompare.ISocialStatsClient.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Interface ISocialStatsClient
9 | | CryptoCompare C# client
10 |
11 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
52 |
53 |
60 |
61 |
71 |
72 |
73 |
79 |
80 |
81 |
82 |
83 |
84 | Interface ISocialStatsClient
85 |
86 |
87 |
88 |
89 | Assembly: CryptoCompare.dll
90 | Syntax
91 |
92 |
public interface ISocialStatsClient
93 |
94 | Methods
95 |
96 |
97 |
98 |
99 | StatsAsync(Int32)
100 | Get all the available social stats for a coin.
101 |
102 |
103 | Declaration
104 |
105 |
Task<SocialStatsResponse> StatsAsync(int id)
106 |
107 | Parameters
108 |
109 |
110 |
111 | Type |
112 | Name |
113 | Description |
114 |
115 |
116 |
117 |
118 | Int32 |
119 | id |
120 | coin id.
121 | |
122 |
123 |
124 |
125 | Returns
126 |
127 |
128 |
129 | Type |
130 | Description |
131 |
132 |
133 |
134 |
135 | Task<SocialStatsResponse> |
136 | An asynchronous result that yields an object containing the social stats.
137 | |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
155 |
156 |
157 |
158 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
--------------------------------------------------------------------------------
/docs/api/CryptoCompare.SubId.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Enum SubId
9 | | CryptoCompare C# client
10 |
11 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
52 |
53 |
60 |
61 |
71 |
72 |
73 |
79 |
80 |
81 |
82 |
83 |
84 | Enum SubId
85 |
86 |
87 |
88 |
89 | Assembly: CryptoCompare.dll
90 | Syntax
91 |
92 |
public enum SubId
93 |
94 | Fields
95 |
96 |
97 |
98 |
99 | Name |
100 | Description |
101 |
102 |
103 |
104 |
105 | Current |
106 | Latest quote update of a currency pair from a specific exchange.
107 | |
108 |
109 |
110 | CurrentAgg |
111 | Quote update aggregated over the last 24 hours of a currency pair from a specific exchange.
112 | |
113 |
114 |
115 | Trade |
116 | Trade level data on a currency pair from a specific exchange.
117 | |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
135 |
136 |
137 |
138 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
--------------------------------------------------------------------------------
/docs/example.md:
--------------------------------------------------------------------------------
1 | # Example
--------------------------------------------------------------------------------
/docs/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joancaron/cryptocompare-api/97a8fde03522a1230215a44c3a09adbb9bb2cad9/docs/favicon.ico
--------------------------------------------------------------------------------
/docs/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joancaron/cryptocompare-api/97a8fde03522a1230215a44c3a09adbb9bb2cad9/docs/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/docs/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joancaron/cryptocompare-api/97a8fde03522a1230215a44c3a09adbb9bb2cad9/docs/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/docs/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joancaron/cryptocompare-api/97a8fde03522a1230215a44c3a09adbb9bb2cad9/docs/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/docs/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joancaron/cryptocompare-api/97a8fde03522a1230215a44c3a09adbb9bb2cad9/docs/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/docs/historical-data.md:
--------------------------------------------------------------------------------
1 | # Historical data
2 |
3 | ## Daily OHLCV
4 | ## Hourly OHLCV
5 | ## Minute OHLCV
6 | ## Day OHLCV for a timestamp
7 | ## Day Average Price
8 | ## Daily Exchange Volume
9 | ## Hourly Exchange Volume
10 |
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | cryptocompare-api - An async-based CryptoCompare API client library for
7 | .NET and .NET Core
8 |
9 |
10 |
14 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/docs/logo.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
22 |
--------------------------------------------------------------------------------
/docs/news.md:
--------------------------------------------------------------------------------
1 | # News
2 |
3 | ## Latest News Articles
4 | ## List News Feeds
5 | ## News Article Categories
6 | ## List News Feeds and Categories
7 |
--------------------------------------------------------------------------------
/docs/other-infos.md:
--------------------------------------------------------------------------------
1 | # Other infos
2 |
3 | ## Rate limit
4 | ## Rate limit hour
5 | ## All the Exchanges and Trading Pairs
6 | ## Display CCCAGG constituent exchanges
7 | ## All the Coins
8 |
--------------------------------------------------------------------------------
/docs/prices.md:
--------------------------------------------------------------------------------
1 | # Prices
2 |
3 | ## Single Sympbol Price
4 | ## Multiple Symbols Price
5 | ## Multiple Symbols Full Data
6 | ## Generate Custom Average
7 |
--------------------------------------------------------------------------------
/docs/quickstart.md:
--------------------------------------------------------------------------------
1 | # Quickstart
--------------------------------------------------------------------------------
/docs/search-stopwords.json:
--------------------------------------------------------------------------------
1 | [
2 | "a",
3 | "able",
4 | "about",
5 | "across",
6 | "after",
7 | "all",
8 | "almost",
9 | "also",
10 | "am",
11 | "among",
12 | "an",
13 | "and",
14 | "any",
15 | "are",
16 | "as",
17 | "at",
18 | "be",
19 | "because",
20 | "been",
21 | "but",
22 | "by",
23 | "can",
24 | "cannot",
25 | "could",
26 | "dear",
27 | "did",
28 | "do",
29 | "does",
30 | "either",
31 | "else",
32 | "ever",
33 | "every",
34 | "for",
35 | "from",
36 | "get",
37 | "got",
38 | "had",
39 | "has",
40 | "have",
41 | "he",
42 | "her",
43 | "hers",
44 | "him",
45 | "his",
46 | "how",
47 | "however",
48 | "i",
49 | "if",
50 | "in",
51 | "into",
52 | "is",
53 | "it",
54 | "its",
55 | "just",
56 | "least",
57 | "let",
58 | "like",
59 | "likely",
60 | "may",
61 | "me",
62 | "might",
63 | "most",
64 | "must",
65 | "my",
66 | "neither",
67 | "no",
68 | "nor",
69 | "not",
70 | "of",
71 | "off",
72 | "often",
73 | "on",
74 | "only",
75 | "or",
76 | "other",
77 | "our",
78 | "own",
79 | "rather",
80 | "said",
81 | "say",
82 | "says",
83 | "she",
84 | "should",
85 | "since",
86 | "so",
87 | "some",
88 | "than",
89 | "that",
90 | "the",
91 | "their",
92 | "them",
93 | "then",
94 | "there",
95 | "these",
96 | "they",
97 | "this",
98 | "tis",
99 | "to",
100 | "too",
101 | "twas",
102 | "us",
103 | "wants",
104 | "was",
105 | "we",
106 | "were",
107 | "what",
108 | "when",
109 | "where",
110 | "which",
111 | "while",
112 | "who",
113 | "whom",
114 | "why",
115 | "will",
116 | "with",
117 | "would",
118 | "yet",
119 | "you",
120 | "your"
121 | ]
122 |
--------------------------------------------------------------------------------
/docs/streaming.md:
--------------------------------------------------------------------------------
1 | # Streaming
2 |
3 | ## Toplist by 24H Volume Subscriptions
4 | ## Toplist by Market Cap Subscriptions
5 | ## Subs By Pair
6 | ## Subs Watchlist
7 | ## Coins General Info
8 |
--------------------------------------------------------------------------------
/docs/styles/main.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joancaron/cryptocompare-api/97a8fde03522a1230215a44c3a09adbb9bb2cad9/docs/styles/main.css
--------------------------------------------------------------------------------
/docs/styles/main.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.
2 |
--------------------------------------------------------------------------------
/docs/styles/search-worker.js:
--------------------------------------------------------------------------------
1 | (function () {
2 | importScripts('lunr.min.js');
3 |
4 | var lunrIndex;
5 |
6 | var stopWords = null;
7 | var searchData = {};
8 |
9 | lunr.tokenizer.seperator = /[\s\-\.]+/;
10 |
11 | var stopWordsRequest = new XMLHttpRequest();
12 | stopWordsRequest.open('GET', '../search-stopwords.json');
13 | stopWordsRequest.onload = function () {
14 | if (this.status != 200) {
15 | return;
16 | }
17 | stopWords = JSON.parse(this.responseText);
18 | buildIndex();
19 | }
20 | stopWordsRequest.send();
21 |
22 | var searchDataRequest = new XMLHttpRequest();
23 |
24 | searchDataRequest.open('GET', '../index.json');
25 | searchDataRequest.onload = function () {
26 | if (this.status != 200) {
27 | return;
28 | }
29 | searchData = JSON.parse(this.responseText);
30 |
31 | buildIndex();
32 |
33 | postMessage({ e: 'index-ready' });
34 | }
35 | searchDataRequest.send();
36 |
37 | onmessage = function (oEvent) {
38 | var q = oEvent.data.q;
39 | var hits = lunrIndex.search(q);
40 | var results = [];
41 | hits.forEach(function (hit) {
42 | var item = searchData[hit.ref];
43 | results.push({ 'href': item.href, 'title': item.title, 'keywords': item.keywords });
44 | });
45 | postMessage({ e: 'query-ready', q: q, d: results });
46 | }
47 |
48 | function buildIndex() {
49 | if (stopWords !== null && !isEmpty(searchData)) {
50 | lunrIndex = lunr(function () {
51 | this.pipeline.remove(lunr.stopWordFilter);
52 | this.ref('href');
53 | this.field('title', { boost: 50 });
54 | this.field('keywords', { boost: 20 });
55 |
56 | for (var prop in searchData) {
57 | if (searchData.hasOwnProperty(prop)) {
58 | this.add(searchData[prop]);
59 | }
60 | }
61 |
62 | var docfxStopWordFilter = lunr.generateStopWordFilter(stopWords);
63 | lunr.Pipeline.registerFunction(docfxStopWordFilter, 'docfxStopWordFilter');
64 | this.pipeline.add(docfxStopWordFilter);
65 | this.searchPipeline.add(docfxStopWordFilter);
66 | });
67 | }
68 | }
69 |
70 | function isEmpty(obj) {
71 | if(!obj) return true;
72 |
73 | for (var prop in obj) {
74 | if (obj.hasOwnProperty(prop))
75 | return false;
76 | }
77 |
78 | return true;
79 | }
80 | })();
81 |
--------------------------------------------------------------------------------
/docs/top-lists.md:
--------------------------------------------------------------------------------
1 | # Top lists
2 |
3 | ## Toplist 24H Volume Full Data
4 | ## Toplist Market Cap Full Data
5 | ## Top Exchanges Volume Data by Pair
6 | ## Top Exchanges Full Data By Pair
7 | ## Toplist by Pair Volume
8 | ## Toplist of Trading Pairs
9 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cryptocompare-api",
3 | "version": "1.4.0",
4 | "description": "An async-based CryptoCompare API client library for .NET and .NET Core",
5 | "scripts": {
6 | "commit": "git-cz",
7 | "dry-release": "standard-version --dry-run",
8 | "release": "standard-version",
9 | "docs": "docsify serve docs",
10 | "contributors:add": "all-contributors add",
11 | "contributors:generate": "all-contributors generate"
12 | },
13 | "repository": {
14 | "type": "git",
15 | "url": "git+https://github.com/joancaron/cryptocompare-api.git"
16 | },
17 | "author": "Joan Caron",
18 | "license": "MIT",
19 | "bugs": {
20 | "url": "https://github.com/joancaron/cryptocompare-api/issues"
21 | },
22 | "homepage": "https://github.com/joancaron/cryptocompare-api#readme",
23 | "devDependencies": {
24 | "all-contributors-cli": "^5.4.1",
25 | "commitizen": "^3.0.4",
26 | "cz-conventional-changelog": "^2.1.0",
27 | "docsify-cli": "^4.3.0",
28 | "standard-version": "4.2.0"
29 | },
30 | "config": {
31 | "commitizen": {
32 | "path": "./node_modules/cz-conventional-changelog"
33 | }
34 | },
35 | "files": [
36 | "docs"
37 | ]
38 | }
39 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Clients/BaseApiClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 | using System.Threading.Tasks;
4 |
5 | using JetBrains.Annotations;
6 |
7 | using Newtonsoft.Json;
8 |
9 | namespace CryptoCompare
10 | {
11 | ///
12 | /// A base API client.
13 | ///
14 | public abstract class BaseApiClient : IApiClient
15 | {
16 | private readonly HttpClient _httpClient;
17 |
18 | ///
19 | /// Initializes a new instance of the CryptoCompare.Clients.BaseApiClient class.
20 | ///
21 | /// The HTTP client. This cannot be null.
22 | protected BaseApiClient([NotNull] HttpClient httpClient)
23 | {
24 | Check.NotNull(httpClient, nameof(httpClient));
25 | this._httpClient = httpClient;
26 | }
27 |
28 | ///
29 | /// Sends an api request asynchronously usin GET method.
30 | ///
31 | /// Type of the API response.
32 | /// The resource uri path.
33 | ///
34 | /// The asynchronous result that yields the asynchronous.
35 | ///
36 | ///
37 | public Task GetAsync(Uri resourceUri) =>
38 | this.SendRequestAsync(HttpMethod.Get, resourceUri);
39 |
40 | ///
41 | /// Sends an api request asynchronously.
42 | ///
43 | /// Thrown when a CryptoCompare api error occurs.
44 | /// Type of the API response.
45 | /// The HttpMethod
46 | /// The resource uri path
47 | ///
48 | /// The asynchronous result that yields a TApiResponse.
49 | ///
50 | public async Task SendRequestAsync(HttpMethod httpMethod, [NotNull] Uri resourceUri)
51 | {
52 | Check.NotNull(resourceUri, nameof(resourceUri));
53 |
54 | var response = await this._httpClient.SendAsync(new HttpRequestMessage(httpMethod, resourceUri))
55 | .ConfigureAwait(false);
56 |
57 | response.EnsureSuccessStatusCode();
58 |
59 | var jsonResponse = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
60 |
61 | try
62 | {
63 | var apiResponseObject = JsonConvert.DeserializeObject(jsonResponse);
64 |
65 | var baseApiResponse = apiResponseObject as BaseApiResponse;
66 | if (baseApiResponse != null && !baseApiResponse.IsSuccessfulResponse)
67 | {
68 | throw new CryptoCompareException(baseApiResponse);
69 | }
70 |
71 | return apiResponseObject;
72 | }
73 | catch (JsonSerializationException jsonSerializationException)
74 | {
75 | var apiErrorResponse = JsonConvert.DeserializeObject(jsonResponse);
76 | throw new CryptoCompareException(apiErrorResponse, jsonSerializationException);
77 | }
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Clients/CoinsClient.cs:
--------------------------------------------------------------------------------
1 | using System.Net.Http;
2 | using System.Threading.Tasks;
3 |
4 | using JetBrains.Annotations;
5 |
6 | namespace CryptoCompare
7 | {
8 | ///
9 | /// The coins client. Gets general info for all the coins available on the website.
10 | ///
11 | ///
12 | public class CoinsClient : BaseApiClient, ICoinsClient
13 | {
14 | ///
15 | /// Initializes a new instance of the CryptoCompare.Clients.CoinsClient class.
16 | ///
17 | /// The HTTP client. This cannot be null.
18 | public CoinsClient([NotNull] HttpClient httpClient)
19 | : base(httpClient)
20 | {
21 | }
22 |
23 | ///
24 | /// Returns all the coins that CryptoCompare has added to the website.
25 | ///
26 | ///
27 | public async Task ListAsync()
28 | {
29 | return await this.GetAsync(ApiUrls.AllCoins()).ConfigureAwait(false);
30 | }
31 |
32 | ///
33 | /// Gets data for a currency pair. It returns general block explorer information,
34 | /// aggregated data and individual data for each exchange available.
35 | ///
36 | /// The symbol of the currency you want to get that for.
37 | /// The symbol of the currency that data will be in.
38 | ///
39 | public async Task SnapshotAsync([NotNull] string fromSymbol, [NotNull] string toSymbol)
40 | {
41 | Check.NotNull(toSymbol, nameof(toSymbol));
42 | Check.NotNull(fromSymbol, nameof(fromSymbol));
43 | return await this.GetAsync(ApiUrls.CoinSnapshot(fromSymbol, toSymbol))
44 | .ConfigureAwait(false);
45 | }
46 |
47 | ///
48 | /// Get the general, subs (used to connect to the streamer and to figure out what exchanges we have data for and what are the exact coin pairs of the coin)
49 | /// and the aggregated prices for all pairs available..
50 | ///
51 | /// The id of the coin you want data for.
52 | ///
53 | /// The asynchronous result that yields a full CoinSnapshot.
54 | ///
55 | public async Task SnapshotFullAsync(int id)
56 | {
57 | return await this.GetAsync(ApiUrls.CoinSnapshotFull(id)).ConfigureAwait(false);
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Clients/ExchangesClient.cs:
--------------------------------------------------------------------------------
1 | using System.Net.Http;
2 | using System.Threading.Tasks;
3 |
4 | using JetBrains.Annotations;
5 |
6 | namespace CryptoCompare
7 | {
8 | ///
9 | /// The exchanges api client.
10 | ///
11 | ///
12 | ///
13 | public class ExchangesClient : BaseApiClient, IExchangesClient
14 | {
15 | ///
16 | /// Initializes a new instance of the CryptoCompare.Clients.ExchangesClient class.
17 | ///
18 | /// The HTTP client. This cannot be null.
19 | public ExchangesClient([NotNull] HttpClient httpClient)
20 | : base(httpClient)
21 | {
22 | }
23 |
24 | ///
25 | /// all the exchanges that CryptoCompare has integrated with.
26 | ///
27 | ///
28 | public async Task ListAsync()
29 | {
30 | return await this.GetAsync(ApiUrls.AllExchanges()).ConfigureAwait(false);
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Clients/IApiClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 | using System.Threading.Tasks;
4 |
5 | using JetBrains.Annotations;
6 |
7 | namespace CryptoCompare
8 | {
9 | public interface IApiClient
10 | {
11 | ///
12 | /// Sends an api request asynchronously usin GET method.
13 | ///
14 | /// The resource uri path.
15 | ///
16 | /// The asynchronous result that yields the asynchronous.
17 | ///
18 | Task GetAsync([NotNull] Uri resourceUri);
19 |
20 | ///
21 | /// Sends an api request asynchronously.
22 | ///
23 | /// Thrown when a CryptoCompare api error occurs.
24 | /// Type of the API response.
25 | /// The HttpMethod
26 | /// The resource uri path
27 | ///
28 | /// The asynchronous result that yields a TApiResponse.
29 | ///
30 | Task SendRequestAsync(HttpMethod httpMethod, [NotNull] Uri resourceUri);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Clients/ICoinsClient.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace CryptoCompare
4 | {
5 | ///
6 | /// Coins api client. Gets general info for all the coins available on the website.
7 | ///
8 | public interface ICoinsClient : IApiClient
9 | {
10 | ///
11 | /// Returns all the coins that CryptoCompare has added to the website.
12 | ///
13 | Task ListAsync();
14 |
15 | ///
16 | /// Gets data for a currency pair.
17 | /// It returns general block explorer information, aggregated data and individual data for each exchange available.
18 | ///
19 | /// The symbol of the currency you want to get that for.
20 | /// The symbol of the currency that data will be in.
21 | Task SnapshotAsync(string fromSymbol, string toSymbol);
22 |
23 | ///
24 | /// Get the general, subs (used to connect to the streamer and to figure out what exchanges we have data for and what are the exact coin pairs of the coin)
25 | /// and the aggregated prices for all pairs available..
26 | ///
27 | /// The id of the coin you want data for.
28 | ///
29 | /// The asynchronous result that yields a full CoinSnapshot.
30 | ///
31 | Task SnapshotFullAsync(int id);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Clients/IExchangesClient.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace CryptoCompare
4 | {
5 | ///
6 | /// Interface for exchanges api client.
7 | ///
8 | public interface IExchangesClient : IApiClient
9 | {
10 | ///
11 | /// all the exchanges that CryptoCompare has integrated with..
12 | ///
13 | Task ListAsync();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Clients/IMiningClient.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace CryptoCompare
4 | {
5 | public interface IMiningClient : IApiClient
6 | {
7 | ///
8 | /// Returns all the mining contracts.
9 | ///
10 | ///
11 | /// The asynchronous result that yields a MiningContractsResponse.
12 | ///
13 | Task ContractsAsync();
14 |
15 | ///
16 | /// Used to get all the mining equipment available on the website.
17 | ///
18 | ///
19 | /// The asynchronous result that yields a MiningEquipmentsResponse.
20 | ///
21 | Task EquipmentsAsync();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Clients/INewsClient.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading.Tasks;
3 |
4 | namespace CryptoCompare
5 | {
6 | public interface INewsClient
7 | {
8 | ///
9 | /// Return all news providers.
10 | ///
11 | ///
12 | Task> NewsProviders();
13 | ///
14 | /// Get all news
15 | ///
16 | /// Language - EN,PT etc.
17 | /// Timestamp
18 | /// Feeds - for news
19 | /// if true cryptocompare will sign request
20 | ///
21 | Task> News(string lang = null, long? lTs = null, string[] feeds = null,
22 | bool? sign = null);
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Clients/IPricesClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Threading.Tasks;
4 |
5 | namespace CryptoCompare
6 | {
7 | public interface IPricesClient : IApiClient
8 | {
9 | /////
10 | ///// Compute the current trading info (price, vol, open, high, low etc) of the requested pair as a volume weighted average based on the exchanges requested.
11 | /////
12 | ///// from symbol.
13 | ///// to symbol.
14 | ///// List of names of the exchanges.
15 | ///// (Optional) If set to false, it will try to get values without
16 | ///// using any conversion at all (defaultVal:true)
17 | Task GenerateCustomAverageAsync(
18 | string fromSymbol,
19 | string toSymbol,
20 | IEnumerable markets,
21 | bool? tryConversion = null);
22 |
23 | ///
24 | /// Same as single API path but with multiple from symbols.
25 | ///
26 | /// from symbols.
27 | /// to symbols.
28 | /// (Optional) If set to false, it will try to get values without
29 | /// using any conversion at all (defaultVal:true)
30 | /// (Optional) Exchange name defult => CCCAGG.
31 | Task MultipleSymbolsPriceAsync(
32 | IEnumerable fromSymbols,
33 | IEnumerable toSymbols,
34 | bool? tryConversion = null,
35 | string exchangeName = null);
36 |
37 | ///
38 | /// Get all the current trading info (price, vol, open, high, low etc) of any list of cryptocurrencies in any other currency that you need.
39 | /// If the crypto does not trade directly into the toSymbol requested, BTC will be used for conversion.
40 | /// This API also returns Display values for all the fields.
41 | /// If the oposite pair trades we invert it (eg.: BTC-XMR).
42 | ///
43 | /// from symbols.
44 | /// to symbols.
45 | /// (Optional) If set to false, it will try to get values without
46 | /// using any conversion at all (defaultVal:true)
47 | /// (Optional) Exchange name default => CCCAGG.
48 | Task MultipleSymbolFullDataAsync(
49 | IEnumerable fromSymbols,
50 | IEnumerable toSymbols,
51 | bool? tryConversion = null,
52 | string exchangeName = null);
53 |
54 | ///
55 | /// Get the current price of any cryptocurrency in any other currency that you need.
56 | /// If the crypto does not trade directly into the toSymbol requested, BTC will be used for conversion.
57 | /// If the oposite pair trades we invert it (eg.: BTC-XMR).
58 | ///
59 | /// from symbol.
60 | /// to symbols.
61 | /// If set to false, it will try to get values without using any conversion at all (defaultVal:true)
62 | /// Exchange name default => CCCAGG
63 | Task SingleSymbolPriceAsync(
64 | string fromSymbol,
65 | IEnumerable toSymbols,
66 | bool? tryConversion = null,
67 | string exchangeName = null);
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Clients/IRateLimitsClient.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace CryptoCompare
4 | {
5 | ///
6 | /// Interface of api client for cryptocompare api calls rate limits.
7 | ///
8 | public interface IRateLimitClient : IApiClient
9 | {
10 | ///
11 | /// Gets the rate limits left for you on the histo, price and news paths in the current hour..
12 | ///
13 | Task CurrentHourAsync();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Clients/ISocialStatsClient.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using JetBrains.Annotations;
3 |
4 | namespace CryptoCompare
5 | {
6 | public interface ISocialStatsClient
7 | {
8 | ///
9 | /// Get all the available social stats for a coin.
10 | ///
11 | /// coin id.
12 | ///
13 | /// An asynchronous result that yields an object containing the social stats.
14 | ///
15 | Task StatsAsync([NotNull] int id);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Clients/ISubsClient.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading.Tasks;
3 |
4 | namespace CryptoCompare
5 | {
6 | public interface ISubsClient : IApiClient
7 | {
8 | ///
9 | /// Get all the available streamer subscription channels for the requested pairs.
10 | ///
11 | /// from symbol.
12 | /// to symbols.
13 | ///
14 | /// An asynchronous result that yields the list of subs.
15 | ///
16 | Task ListAsync(string fromSymbol, IEnumerable toSymbols);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Clients/ITopsClient.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | using JetBrains.Annotations;
4 |
5 | namespace CryptoCompare
6 | {
7 | public interface ITopListClient : IApiClient
8 | {
9 | ///
10 | /// Get top exchanges by volume for a currency pair.
11 | /// The number of exchanges you get is the minimum of the limit you set (default 5) and the total number of exchanges available.
12 | ///
13 | /// from symbol.
14 | /// to symbol.
15 | /// (Optional) The limit.
16 | ///
17 | /// An asynchronous result that yields a TopResponse.
18 | ///
19 | Task ExchangesVolumeDataByPairAsync([NotNull] string fromSymbol, [NotNull] string toSymbol, int? limit = null);
20 |
21 | ///
22 | /// Get top pairs by volume for a currency (always uses our aggregated data).
23 | /// The number of pairs you get is the minimum of the limit you set (default 5) and the total number of pairs available.
24 | ///
25 | /// from symbol.
26 | /// (Optional) The limit.
27 | ///
28 | /// An asynchronous result that yields a TopResponse.
29 | ///
30 | Task TradingPairsAsync([NotNull] string fromSymbol, int? limit = null);
31 |
32 | ///
33 | /// Get top coins by volume for the to currency. It returns volume24hto and total supply (where available).
34 | /// The number of coins you get is the minimum of the limit you set (default 50) and the total number of coins available.
35 | ///
36 | /// to symbol.
37 | /// (Optional) The limit.
38 | ///
39 | /// An asynchronous result that yields a TopVolumesResponse.
40 | ///
41 | Task ByPairVolumeAsync([NotNull] string toSymbol, int? limit = null);
42 |
43 | ///
44 | /// Get top exchanges by volume for a currency pair plus the full CCCAGG data.
45 | /// The number of exchanges you get is the minimum of the limit you set (default 5) and the total number of exchanges available.
46 | ///
47 | /// The cryptocurrency symbol of interest
48 | /// The currency symbol to convert into
49 | /// (Optional)The number of data points to return.
50 | Task ExchangesFullDataByPairAsync([NotNull] string fromSymbol, [NotNull] string toSymbol, int? limit = null);
51 |
52 | ///
53 | /// Get top coins by market cap expressed in a given currency.
54 | ///
55 | /// The symbol of the currency into which the market cap are expressed.
56 | /// (Optional)The number currencies to return, default is 10.
57 | /// (Optional)The pagination for the request.
58 | /// (Optional)If set to true, the server will sign the requests, this is useful for usage in smart contracts.
59 | ///
60 | /// The asynchronous result that yields a TopMarketCapResponse.
61 | ///
62 | Task CoinFullDataByMarketCap([NotNull] string toSymbol, int? limit = null, int? page = null, bool? sign = null);
63 |
64 | ///
65 | /// Get full data for the top coins ordered by their total volume across all markets in the last 24 hours as expressed in a given currency.
66 | ///
67 | /// The symbol of the currency into which the market cap are expressed.
68 | /// (Optional)The number currencies to return, default is 10.
69 | /// (Optional)The pagination for the request.
70 | /// (Optional)If set to true, the server will sign the requests, this is useful for usage in smart contracts.
71 | ///
72 | /// The asynchronous result that yields a TopVolume24HResponse.
73 | ///
74 | Task CoinFullDataBy24HVolume(string toSymbol, int? limit = null, int? page = null, bool? sign = null);
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Clients/MiningClient.cs:
--------------------------------------------------------------------------------
1 | using System.Net.Http;
2 | using System.Threading.Tasks;
3 |
4 | using JetBrains.Annotations;
5 |
6 | namespace CryptoCompare
7 | {
8 | public class MiningClient : BaseApiClient, IMiningClient
9 | {
10 | ///
11 | /// Initializes a new instance of the CryptoCompare.MiningClient class.
12 | ///
13 | /// The HTTP client. This cannot be null.
14 | public MiningClient([NotNull] HttpClient httpClient)
15 | : base(httpClient)
16 | {
17 | }
18 |
19 | ///
20 | /// Returns all the mining contracts.
21 | ///
22 | ///
23 | /// The asynchronous result that yields a MiningContractsResponse.
24 | ///
25 | public async Task ContractsAsync() =>
26 | await this.GetAsync(ApiUrls.MiningContracts());
27 |
28 | ///
29 | /// Used to get all the mining equipment available on the website.
30 | ///
31 | ///
32 | /// The asynchronous result that yields a MiningEquipmentsResponse.
33 | ///
34 | public async Task EquipmentsAsync() =>
35 | await this.GetAsync(ApiUrls.MiningEquipments());
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Clients/NewsClient.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Net.Http;
3 | using System.Threading.Tasks;
4 |
5 | using JetBrains.Annotations;
6 |
7 | namespace CryptoCompare
8 | {
9 | public class NewsClient : BaseApiClient, INewsClient
10 | {
11 | public NewsClient([NotNull] HttpClient httpClient)
12 | : base(httpClient)
13 | {
14 | }
15 |
16 | public async Task> News(
17 | string lang = null,
18 | long? lTs = null,
19 | string[] feeds = null,
20 | bool? sign = null)
21 | {
22 | return await this.GetAsync>(ApiUrls.News(lang, lTs, feeds, sign)).ConfigureAwait(false);
23 | }
24 |
25 | public async Task> NewsProviders()
26 | {
27 | return await this.GetAsync>(ApiUrls.NewsProviders()).ConfigureAwait(false);
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Clients/PriceClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Net.Http;
4 | using System.Threading.Tasks;
5 |
6 | using JetBrains.Annotations;
7 |
8 | namespace CryptoCompare
9 | {
10 | public class PriceClient : BaseApiClient, IPricesClient
11 | {
12 | ///
13 | /// Initializes a new instance of the CryptoCompare.PriceClient class.
14 | ///
15 | /// The HTTP client. This cannot be null.
16 | public PriceClient([NotNull] HttpClient httpClient)
17 | : base(httpClient)
18 | {
19 | }
20 |
21 | ///
22 | /// Compute the current trading info (price, vol, open, high, low etc) of the requested pair as a volume weighted average based on the exchanges requested.
23 | ///
24 | /// from symbol.
25 | /// to symbol.
26 | /// List of names of the exchanges.
27 | /// (Optional) If set to false, it will try to get values without
28 | /// using any conversion at all (defaultVal:true)
29 | ///
30 | /// An asynchronous result that yields the average.
31 | ///
32 | ///
33 | public async Task GenerateCustomAverageAsync(
34 | [NotNull] string fromSymbol,
35 | [NotNull] string toSymbol,
36 | [NotNull] IEnumerable markets,
37 | bool? tryConversion = null)
38 | {
39 | Check.NotNullOrWhiteSpace(fromSymbol, nameof(fromSymbol));
40 | Check.NotNullOrWhiteSpace(toSymbol, nameof(toSymbol));
41 | Check.NotEmpty(markets, nameof(markets));
42 |
43 | return await this.GetAsync(
44 | ApiUrls.PriceAverage(fromSymbol, toSymbol, markets, tryConversion)).ConfigureAwait(false);
45 | }
46 |
47 | ///
48 | /// Same as single API path but with multiple from symbols.
49 | ///
50 | /// from symbols.
51 | /// to symbols.
52 | /// (Optional) If set to false, it will try to get values without
53 | /// using any conversion at all (defaultVal:true)
54 | /// (Optional) Exchange name defult => CCCAGG.
55 | ///
56 | public async Task MultipleSymbolsPriceAsync(
57 | [NotNull] IEnumerable fromSymbols,
58 | [NotNull] IEnumerable toSymbols,
59 | bool? tryConversion = null,
60 | string exchangeName = null)
61 | {
62 | Check.NotEmpty(toSymbols, nameof(toSymbols));
63 | Check.NotEmpty(fromSymbols, nameof(fromSymbols));
64 |
65 | return await this.GetAsync(
66 | ApiUrls.PriceMulti(fromSymbols, toSymbols, tryConversion, exchangeName)).ConfigureAwait(false);
67 | }
68 |
69 | ///
70 | /// Get all the current trading info (price, vol, open, high, low etc) of any list of cryptocurrencies in any other currency that you need.
71 | /// If the crypto does not trade directly into the toSymbol requested, BTC will be used for conversion.
72 | /// This API also returns Display values for all the fields.
73 | /// If the oposite pair trades we invert it (eg.: BTC-XMR).
74 | ///
75 | /// from symbols.
76 | /// to symbols.
77 | /// (Optional) If set to false, it will try to get values without
78 | /// using any conversion at all (defaultVal:true)
79 | /// (Optional) Exchange name default => CCCAGG.
80 | ///
81 | /// An asynchronous result that yields the multi full.
82 | ///
83 | ///
84 | public async Task MultipleSymbolFullDataAsync(
85 | IEnumerable fromSymbols,
86 | IEnumerable toSymbols,
87 | bool? tryConversion = null,
88 | string exchangeName = null)
89 | {
90 | Check.NotEmpty(toSymbols, nameof(toSymbols));
91 | Check.NotEmpty(fromSymbols, nameof(fromSymbols));
92 |
93 | return await this.GetAsync(
94 | ApiUrls.PriceMultiFull(fromSymbols, toSymbols, tryConversion, exchangeName))
95 | .ConfigureAwait(false);
96 | }
97 |
98 | ///
99 | /// Get the current price of any cryptocurrency in any other currency that you need.
100 | /// If the crypto does not trade directly into the toSymbol requested, BTC will be
101 | /// used for conversion. If the oposite pair trades we invert it (eg.: BTC-XMR).
102 | ///
103 | /// from symbol.
104 | /// to symbols.
105 | ///
106 | /// Exchange name default = CCC
107 | ///
108 | public async Task SingleSymbolPriceAsync(
109 | [NotNull] string fromSymbol,
110 | [NotNull] IEnumerable toSymbols,
111 | bool? tryConversion = null,
112 | string exchangeName = null)
113 | {
114 | Check.NotNull(fromSymbol, nameof(fromSymbol));
115 | Check.NotEmpty(toSymbols, nameof(toSymbols));
116 |
117 | return await this.GetAsync(
118 | ApiUrls.PriceSingle(fromSymbol, toSymbols, tryConversion, exchangeName)).ConfigureAwait(false);
119 | }
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Clients/RateLimitsClient.cs:
--------------------------------------------------------------------------------
1 | using System.Net.Http;
2 | using System.Threading.Tasks;
3 |
4 | using JetBrains.Annotations;
5 |
6 | namespace CryptoCompare
7 | {
8 | ///
9 | /// Api client for cryptocompare api calls rate limits.
10 | ///
11 | ///
12 | ///
13 | public class RateLimitClient : BaseApiClient, IRateLimitClient
14 | {
15 | ///
16 | /// Initializes a new instance of the CryptoCompare.Clients.RateLimitsClient class.
17 | ///
18 | /// The HTTP client. This cannot be null.
19 | public RateLimitClient([NotNull] HttpClient httpClient)
20 | : base(httpClient)
21 | {
22 | }
23 |
24 | ///
25 | /// Gets the rate limits left for you on the histo, price and news paths in the
26 | /// current hour.
27 | ///
28 | ///
29 | public async Task CurrentHourAsync()
30 | {
31 | return await this.GetAsync(ApiUrls.RateLimitsByHour()).ConfigureAwait(false);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Clients/SocialStatsClient.cs:
--------------------------------------------------------------------------------
1 | using System.Net.Http;
2 | using System.Threading.Tasks;
3 |
4 | using JetBrains.Annotations;
5 |
6 | namespace CryptoCompare
7 | {
8 | public class SocialStatsClient : BaseApiClient, ISocialStatsClient
9 | {
10 | ///
11 | /// Initializes a new instance of the CryptoCompare.SocialClient class.
12 | ///
13 | /// The HTTP client. This cannot be null.
14 | public SocialStatsClient([NotNull] HttpClient httpClient)
15 | : base(httpClient)
16 | {
17 | }
18 |
19 | ///
20 | /// Get all the available social stats for a coin.
21 | ///
22 | /// coin id.
23 | ///
24 | /// An asynchronous result that yields an object containing the social stats.
25 | ///
26 | ///
27 | public async Task StatsAsync([NotNull] int id)
28 | {
29 | Check.NotNull(id, nameof(id));
30 | return await this.GetAsync(ApiUrls.SocialStats(id))
31 | .ConfigureAwait(false);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Clients/SubsClient.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Net.Http;
3 | using System.Threading.Tasks;
4 |
5 | using JetBrains.Annotations;
6 |
7 | namespace CryptoCompare
8 | {
9 | public class SubsClient : BaseApiClient, ISubsClient
10 | {
11 | ///
12 | /// Initializes a new instance of the CryptoCompare.SubsClient class.
13 | ///
14 | /// The HTTP client. This cannot be null.
15 | public SubsClient([NotNull] HttpClient httpClient)
16 | : base(httpClient)
17 | {
18 | }
19 |
20 | ///
21 | /// Get all the available streamer subscription channels for the requested pairs.
22 | ///
23 | /// from symbol.
24 | /// to symbols.
25 | ///
26 | /// An asynchronous result that yields the list of subs.
27 | ///
28 | ///
29 | public async Task ListAsync(
30 | [NotNull] string fromSymbol,
31 | [NotNull] IEnumerable toSymbols)
32 | {
33 | Check.NotEmpty(toSymbols, nameof(toSymbols));
34 | Check.NotNull(fromSymbol, nameof(fromSymbol));
35 | return await this.GetAsync(ApiUrls.SubsList(fromSymbol, toSymbols)).ConfigureAwait(false);
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Converters/IsoDateTimeWithFormatConverter.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json.Converters;
2 |
3 | namespace CryptoCompare
4 | {
5 | public class IsoDateTimeWithFormatConverter : IsoDateTimeConverter
6 | {
7 | public IsoDateTimeWithFormatConverter(string format)
8 | {
9 | this.DateTimeFormat = format;
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Converters/StringToSubConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | using Newtonsoft.Json;
6 | using Newtonsoft.Json.Linq;
7 |
8 | namespace CryptoCompare
9 | {
10 | internal class StringToSubConverter : JsonConverter
11 | {
12 | ///
13 | /// Determines whether this instance can convert the specified object type.
14 | ///
15 | /// Type of the object.
16 | ///
17 | /// true if this instance can convert the specified object type; otherwise,
18 | /// false.
19 | ///
20 | ///
21 | public override bool CanConvert(Type objectType)
22 | {
23 | return objectType == typeof(IReadOnlyList) || objectType == typeof(Sub);
24 | }
25 |
26 | ///
27 | /// Reads the JSON representation of the object.
28 | ///
29 | /// The to read from.
30 | /// Type of the object.
31 | /// The existing value of object being read.
32 | /// The calling serializer.
33 | ///
34 | /// The object value.
35 | ///
36 | ///
37 | public override object ReadJson(
38 | JsonReader reader,
39 | Type objectType,
40 | object existingValue,
41 | JsonSerializer serializer)
42 | {
43 | if (reader.TokenType == JsonToken.String)
44 | {
45 | return this.GetTokenFromString(reader.Value.ToString());
46 | }
47 |
48 | if (reader.TokenType == JsonToken.StartArray)
49 | {
50 | var tokens = JArray.Load(reader);
51 | if (tokens?.HasValues ?? false)
52 | {
53 | return tokens.Values().Select(token => this.GetTokenFromString(token.ToString())).ToList();
54 | }
55 | }
56 |
57 | return null;
58 | }
59 |
60 | ///
61 | /// Writes the JSON representation of the object.
62 | ///
63 | /// The to write to.
64 | /// The value.
65 | /// The calling serializer.
66 | ///
67 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
68 | {
69 | throw new NotImplementedException();
70 | }
71 |
72 | private Sub GetTokenFromString(string token)
73 | {
74 | var values = token.Split('~');
75 | if (values.Length == 4)
76 | {
77 | Enum.TryParse(values.ElementAtOrDefault(0), out SubId subId);
78 | return new Sub(
79 | values.ElementAtOrDefault(1),
80 | values.ElementAtOrDefault(2),
81 | subId,
82 | values.ElementAtOrDefault(3));
83 | }
84 | return default(Sub);
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Converters/UnixTimeConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Newtonsoft.Json;
4 |
5 | namespace CryptoCompare
6 | {
7 | internal class UnixTimeConverter : JsonConverter
8 | {
9 | public override bool CanConvert(Type objectType)
10 | {
11 | return objectType == typeof(DateTime) || objectType == typeof(DateTime?)
12 | || objectType == typeof(DateTimeOffset)
13 | || objectType == typeof(DateTimeOffset?);
14 | }
15 |
16 | public override object ReadJson(
17 | JsonReader reader,
18 | Type objectType,
19 | object existingValue,
20 | JsonSerializer serializer)
21 | {
22 | if (string.IsNullOrWhiteSpace(reader.Value?.ToString()))
23 | {
24 | return null;
25 | }
26 |
27 | return Convert.ToInt64(reader.Value).FromUnixTime();
28 | }
29 |
30 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
31 | {
32 | if (DateTimeOffset.TryParse(value?.ToString(), out var date))
33 | {
34 | writer.WriteValue(date.ToUnixTime());
35 | }
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Core/Constants.cs:
--------------------------------------------------------------------------------
1 | namespace CryptoCompare
2 | {
3 | internal static class Constants
4 | {
5 | public const string ResponseErrorStatus = "Error";
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Core/ThottledHttpClientHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 |
6 | namespace CryptoCompare
7 | {
8 | public class ThottledHttpClientHandler : HttpClientHandler
9 | {
10 | private readonly SemaphoreSlim _semaphore;
11 | private readonly int _millisecondsDelay;
12 |
13 | ///
14 | /// An with a throttle to limit the maximum rate at which queries are sent.
15 | ///
16 | /// The number of milliseconds to wait between calls to the base method.
17 | /// The millisecondsDelay argument is less than or equal to 0.
18 | public ThottledHttpClientHandler(int millisecondsDelay)
19 | {
20 | if (millisecondsDelay <= 0) { throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); }
21 |
22 | _millisecondsDelay = millisecondsDelay;
23 | _semaphore = new SemaphoreSlim(1, 1);
24 | }
25 |
26 | protected override async Task SendAsync(HttpRequestMessage requestMessage, CancellationToken cancellationToken)
27 | {
28 | Check.NotNull(requestMessage, nameof(requestMessage));
29 |
30 | await _semaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
31 | try
32 | {
33 | return await base.SendAsync(requestMessage, cancellationToken);
34 | }
35 | finally
36 | {
37 | await Task.Delay(_millisecondsDelay, cancellationToken).ConfigureAwait(false);
38 | _semaphore.Release(1);
39 | }
40 | }
41 |
42 | ///
43 | protected override void Dispose(bool disposing)
44 | {
45 | if (disposing)
46 | {
47 | this._semaphore?.Dispose();
48 | }
49 |
50 | base.Dispose(disposing);
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/CryptoCompare/CryptoCompare.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | CryptoCompare
7 | CryptoCompare
8 | CryptoCompare
9 | CryptoCompare
10 | An async-based CryptoCompare API client library for .NET and .NET Core
11 | netstandard1.1;netstandard1.3;net45;netstandard2.0
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/CryptoCompare/CryptoCompare.csproj.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
3 | True
4 | True
5 | True
6 | True
7 | True
8 | True
9 | True
10 | True
--------------------------------------------------------------------------------
/src/CryptoCompare/CryptoCompareClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 | using System.Net.Http.Headers;
4 |
5 | using JetBrains.Annotations;
6 |
7 | namespace CryptoCompare
8 | {
9 | ///
10 | /// CryptoCompare api client.
11 | ///
12 | ///
13 | public class CryptoCompareClient : ICryptoCompareClient
14 | {
15 | private static readonly Lazy Lazy =
16 | new Lazy(() => new CryptoCompareClient());
17 |
18 | private readonly HttpClient _httpClient;
19 |
20 | private bool _isDisposed;
21 |
22 | ///
23 | /// Initializes a new instance of the CryptoCompare.CryptoCompareClient class.
24 | ///
25 | /// Custom HTTP client handler. Can be used to define proxy settigs
26 | /// The api key from cryptocompare
27 | public CryptoCompareClient([NotNull] HttpClientHandler httpClientHandler, string apiKey = null)
28 | {
29 | Check.NotNull(httpClientHandler, nameof(httpClientHandler));
30 | this._httpClient = new HttpClient(httpClientHandler, true);
31 |
32 | if (!string.IsNullOrWhiteSpace(apiKey))
33 | {
34 | this.SetApiKey(apiKey);
35 | }
36 | }
37 |
38 | ///
39 | /// Initializes a new instance of the CryptoCompare.CryptoCompareClient class.
40 | ///
41 | /// /// Delay imposed between each queries to avoid exceeding CryptoCompare's maximum number of requests per second.
42 | public CryptoCompareClient(string apiKey = null, int throttleDelayMs = 0)
43 | : this(
44 | throttleDelayMs <= 0 ? new HttpClientHandler() : new ThottledHttpClientHandler(throttleDelayMs),
45 | apiKey)
46 | {
47 | }
48 |
49 | public void SetApiKey(string apiKey)
50 | {
51 | Check.NotNullOrWhiteSpace(apiKey, nameof(apiKey));
52 | this._httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Apikey", apiKey);
53 | }
54 |
55 | ///
56 | /// Gets a Singleton instance of CryptoCompare api client.
57 | ///
58 | ///
59 | /// The instance.
60 | ///
61 | public static CryptoCompareClient Instance => Lazy.Value;
62 |
63 | ///
64 | /// Gets the client for coins related api endpoints.
65 | ///
66 | ///
67 | public ICoinsClient Coins => new CoinsClient(this._httpClient);
68 |
69 | ///
70 | /// Gets the client for exchanges related api endpoints.
71 | ///
72 | ///
73 | public IExchangesClient Exchanges => new ExchangesClient(this._httpClient);
74 |
75 | ///
76 | /// Gets the api client for market history.
77 | ///
78 | ///
79 | public IHistoryClient History => new HistoryClient(this._httpClient);
80 |
81 | ///
82 | /// Gets the api client for "mining" endpoints.
83 | ///
84 | ///
85 | /// The mining client.
86 | ///
87 | ///
88 | public IMiningClient Mining => new MiningClient(this._httpClient);
89 |
90 | ///
91 | /// Gets the api client for news endpoints.
92 | ///
93 | ///
94 | public INewsClient News => new NewsClient(this._httpClient);
95 |
96 | ///
97 | /// Gets the api client for cryptocurrency prices.
98 | ///
99 | ///
100 | public IPricesClient Prices => new PriceClient(this._httpClient);
101 |
102 | ///
103 | /// Gets or sets the client for api calls rate limits.
104 | ///
105 | ///
106 | public IRateLimitClient RateLimits => new RateLimitClient(this._httpClient);
107 |
108 | ///
109 | /// Gets the api client for "social" endpoints.
110 | ///
111 | ///
112 | public ISocialStatsClient SocialStats => new SocialStatsClient(this._httpClient);
113 |
114 | ///
115 | /// The subs.
116 | ///
117 | public ISubsClient Subs => new SubsClient(this._httpClient);
118 |
119 | ///
120 | /// Gets the api client for "tops" endpoints.
121 | ///
122 | ///
123 | public ITopListClient Tops => new TopListClient(this._httpClient);
124 |
125 | ///
126 | /// Performs application-defined tasks associated with freeing, releasing, or
127 | /// resetting unmanaged resources.
128 | ///
129 | ///
130 | public void Dispose() => this.Dispose(true);
131 |
132 | ///
133 | /// Performs application-defined tasks associated with freeing, releasing, or
134 | /// resetting unmanaged resources.
135 | ///
136 | /// True to release both managed and unmanaged resources; false to
137 | /// release only unmanaged resources.
138 | internal virtual void Dispose(bool disposing)
139 | {
140 | if (!this._isDisposed)
141 | {
142 | if (disposing)
143 | {
144 | this._httpClient?.Dispose();
145 | }
146 | this._isDisposed = true;
147 | }
148 | }
149 | }
150 | }
151 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Exceptions/CryptoCompareException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 |
4 | namespace CryptoCompare
5 | {
6 | ///
7 | /// Global Exception for signalling cryptocompare api errors.
8 | ///
9 | ///
10 | public class CryptoCompareException : HttpRequestException
11 | {
12 | ///
13 | /// Initializes a new instance of the CryptoCompare.Exceptions.CryptoCompareException
14 | /// class.
15 | ///
16 | /// Reason of api failure.
17 | public CryptoCompareException(BaseApiResponse apiResponse)
18 | : base(FormatErrorMessage(apiResponse))
19 | {
20 | }
21 |
22 | ///
23 | /// Initializes a new instance of the CryptoCompare.Exceptions.CryptoCompareException
24 | /// class.
25 | ///
26 | /// Reason of api failure.
27 | /// The inner exception.
28 | public CryptoCompareException(BaseApiResponse apiResponse, Exception innerException)
29 | : base(FormatErrorMessage(apiResponse), innerException)
30 | {
31 | }
32 |
33 | private static string FormatErrorMessage(BaseApiResponse apiResponse)
34 | {
35 | var reason = string.Empty;
36 |
37 | if (apiResponse != null)
38 | {
39 | reason =
40 | $"{apiResponse.StatusType} : {apiResponse.StatusMessage} {apiResponse.ErrorsSummary} {apiResponse.Path}";
41 | }
42 |
43 | return reason;
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Extensions/DateTimeExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace CryptoCompare
4 | {
5 | public static class DateTimeExtensions
6 | {
7 | private static readonly DateTimeOffset epoch = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero);
8 |
9 | ///
10 | /// Convert a Unix tick to a with UTC offset
11 | ///
12 | /// UTC tick
13 | public static DateTimeOffset FromUnixTime(this long unixTime)
14 | {
15 | return epoch.AddSeconds(unixTime);
16 | }
17 |
18 | ///
19 | /// Convert with UTC offset to a Unix tick
20 | ///
21 | /// Date Time with UTC offset
22 | public static long ToUnixTime(this DateTimeOffset date)
23 | {
24 | return Convert.ToInt64((date.ToUniversalTime() - epoch).TotalSeconds);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Extensions/EnumerableExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | using JetBrains.Annotations;
4 |
5 | namespace CryptoCompare
6 | {
7 | internal static class EnumerableExtensions
8 | {
9 | public static string ToJoinedList([NotNull] this IEnumerable list)
10 | {
11 | Check.NotEmpty(list, nameof(list));
12 | return string.Join(",", list);
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Extensions/UriExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | using JetBrains.Annotations;
6 |
7 | namespace CryptoCompare
8 | {
9 | ///
10 | /// Extensions for uris.
11 | ///
12 | internal static class UriExtensions
13 | {
14 | ///
15 | /// Merge a dictionary of values with an existing
16 | ///
17 | /// Original request Uri
18 | /// Collection of key-value pairs
19 | /// Updated request Uri
20 | public static Uri ApplyParameters([NotNull] this Uri uri, IDictionary parameters)
21 | {
22 | Check.NotNull(uri, nameof(uri));
23 |
24 | if (parameters == null || !parameters.Any())
25 | {
26 | return uri;
27 | }
28 |
29 | // to prevent values being persisted across requests
30 | // use a temporary dictionary which combines new and existing parameters
31 | IDictionary p = new Dictionary(parameters);
32 |
33 | var hasQueryString = uri.OriginalString.IndexOf("?", StringComparison.Ordinal);
34 |
35 | var uriWithoutQuery =
36 | hasQueryString == -1 ? uri.ToString() : uri.OriginalString.Substring(0, hasQueryString);
37 |
38 | string queryString;
39 | if (uri.IsAbsoluteUri)
40 | {
41 | queryString = uri.Query;
42 | }
43 | else
44 | {
45 | queryString = hasQueryString == -1 ? "" : uri.OriginalString.Substring(hasQueryString);
46 | }
47 |
48 | var values = queryString.Replace("?", "").Split(new[] { '&' }, StringSplitOptions.RemoveEmptyEntries);
49 |
50 | var existingParameters = values.ToDictionary(
51 | key => key.Substring(0, key.IndexOf('=')),
52 | value => value.Substring(value.IndexOf('=') + 1));
53 |
54 | foreach (var existing in existingParameters)
55 | {
56 | if (!p.ContainsKey(existing.Key))
57 | {
58 | p.Add(existing);
59 | }
60 | }
61 |
62 | var query = string.Join(
63 | "&",
64 | p.Where(param => !string.IsNullOrWhiteSpace(param.Value))
65 | .Select(kvp => kvp.Key + "=" + Uri.EscapeDataString(kvp.Value)));
66 | if (uri.IsAbsoluteUri)
67 | {
68 | var uriBuilder = new UriBuilder(uri)
69 | {
70 | Query = query
71 | };
72 | return uriBuilder.Uri;
73 | }
74 |
75 | return new Uri(uriWithoutQuery + "?" + query, UriKind.Relative);
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Helpers/Check.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 |
6 | using JetBrains.Annotations;
7 |
8 | namespace CryptoCompare
9 | {
10 | ///
11 | /// Null checking utilities.
12 | ///
13 | [DebuggerStepThrough]
14 | internal static class Check
15 | {
16 | ///
17 | /// Checks null enmerable.
18 | ///
19 | /// Thrown when one or more arguments have unsupported or
20 | /// illegal values.
21 | /// Generic type parameter.
22 | /// The value.
23 | /// Name of the parameter. This cannot be null.
24 | [ContractAnnotation("value:null => halt")]
25 | public static IEnumerable NotEmpty(
26 | IEnumerable value,
27 | [InvokerParameterName] [NotNull] string parameterName)
28 | {
29 | NotNull(value, parameterName);
30 |
31 | if (!value.Any())
32 | {
33 | NotNullOrWhiteSpace(parameterName, nameof(parameterName));
34 | throw new ArgumentException(parameterName);
35 | }
36 |
37 | return value;
38 | }
39 |
40 | ///
41 | /// Checks null arguments.
42 | ///
43 | /// Thrown when one or more required arguments are null.
44 | /// Generic type parameter.
45 | /// The value.
46 | /// Name of the parameter. This cannot be null.
47 | ///
48 | /// Checked object.
49 | ///
50 | [ContractAnnotation("value:null => halt")]
51 | public static T NotNull(T value, [InvokerParameterName] [NotNull] string parameterName)
52 | {
53 | if (ReferenceEquals(value, null))
54 | {
55 | NotNullOrWhiteSpace(parameterName, nameof(parameterName));
56 | throw new ArgumentNullException(parameterName);
57 | }
58 | return value;
59 | }
60 |
61 | ///
62 | /// Checks null or white space string arguments.
63 | ///
64 | /// Thrown when one or more required arguments are null.
65 | /// The value.
66 | /// Name of the parameter. This cannot be null.
67 | ///
68 | /// Checked object.
69 | ///
70 | [ContractAnnotation("value:null => halt")]
71 | public static string NotNullOrWhiteSpace(string value, [InvokerParameterName] [NotNull] string parameterName)
72 | {
73 | if (string.IsNullOrWhiteSpace(value))
74 | {
75 | NotNullOrWhiteSpace(parameterName, nameof(parameterName));
76 | throw new ArgumentNullException(parameterName);
77 | }
78 | return value;
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/src/CryptoCompare/ICryptoCompareClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace CryptoCompare
4 | {
5 | ///
6 | /// Interface for cryptocompare api client.
7 | ///
8 | public interface ICryptoCompareClient : IDisposable
9 | {
10 | ///
11 | /// Gets the api client for coins related api endpoints.
12 | ///
13 | ICoinsClient Coins { get; }
14 |
15 | ///
16 | /// Gets the client for exchanges related api endpoints.
17 | ///
18 | IExchangesClient Exchanges { get; }
19 |
20 | ///
21 | /// Gets the api client for market history.
22 | ///
23 | IHistoryClient History { get; }
24 |
25 | ///
26 | /// Gets the api client for "mining" endpoints.
27 | ///
28 | IMiningClient Mining { get; }
29 |
30 | ///
31 | /// Gets the api client for news endpoints.
32 | ///
33 | INewsClient News { get; }
34 |
35 | ///
36 | /// Gets the api client for cryptocurrency prices.
37 | ///
38 | IPricesClient Prices { get; }
39 |
40 | ///
41 | /// Gets the api client for api calls rate limits.
42 | ///
43 | IRateLimitClient RateLimits { get; }
44 |
45 | ///
46 | /// Gets the api client for "social stats" endpoints.
47 | ///
48 | ISocialStatsClient SocialStats { get; }
49 |
50 | ///
51 | /// Gets the api client for subs endpoints.
52 | ///
53 | ISubsClient Subs { get; }
54 |
55 | ///
56 | /// Gets the api client for "tops" endpoints.
57 | ///
58 | ITopListClient Tops { get; }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/AggregatedData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Newtonsoft.Json;
4 |
5 | namespace CryptoCompare
6 | {
7 | public class AggregatedData
8 | {
9 | [JsonProperty("FLAGS")]
10 | public string Flags { get; set; }
11 |
12 | [JsonProperty("FROMSYMBOL")]
13 | public string FromSymbol { get; set; }
14 |
15 | [JsonProperty("HIGH24HOUR")]
16 | public double? High24Hour { get; set; }
17 |
18 | [JsonProperty("LASTTRADEID")]
19 | public string LastTradeId { get; set; }
20 |
21 | [JsonConverter(typeof(UnixTimeConverter))]
22 | [JsonProperty("LASTUPDATE")]
23 | public DateTimeOffset LastUpdate { get; set; }
24 |
25 | [JsonProperty("LASTVOLUME")]
26 | public double? LastVolume { get; set; }
27 |
28 | [JsonProperty("LASTVOLUMETO")]
29 | public double? LastVolumeTo { get; set; }
30 |
31 | [JsonProperty("LOW24HOUR")]
32 | public double? Low24Hour { get; set; }
33 |
34 | [JsonProperty("MARKET")]
35 | public string Market { get; set; }
36 |
37 | [JsonProperty("OPEN24HOUR")]
38 | public double? Open24Hour { get; set; }
39 |
40 | [JsonProperty("PRICE")]
41 | public double? Price { get; set; }
42 |
43 | [JsonProperty("TOSYMBOL")]
44 | public string ToSymbol { get; set; }
45 |
46 | [JsonProperty("TYPE")]
47 | public string Type { get; set; }
48 |
49 | [JsonProperty("VOLUME24HOUR")]
50 | public double? Volume24Hour { get; set; }
51 |
52 | [JsonProperty("VOLUME24HOURTO")]
53 | public double? Volume24HourTo { get; set; }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/BaseApiResponse.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Newtonsoft.Json;
4 |
5 | namespace CryptoCompare
6 | {
7 | ///
8 | /// A base API response.
9 | /// CryptoCompare don't use status code for errors. They use a status reported into "Response" property
10 | ///
11 | public class BaseApiResponse
12 | {
13 | ///
14 | /// Gets or sets the errors summary.
15 | ///
16 | public string ErrorsSummary { get; set; }
17 |
18 | ///
19 | /// Gets or sets a value indicating whether this is a successful response.
20 | ///
21 | ///
22 | /// True if this is a successful response, false if not.
23 | ///
24 | public bool IsSuccessfulResponse => !string.Equals(
25 | this.Status,
26 | Constants.ResponseErrorStatus,
27 | StringComparison.OrdinalIgnoreCase);
28 |
29 | ///
30 | /// Gets or sets the full pathname of the resource called.
31 | ///
32 | public string Path { get; set; }
33 |
34 | ///
35 | /// Gets or sets the response status.
36 | ///
37 | [JsonProperty("Response")]
38 | public string Status { get; set; }
39 |
40 | ///
41 | /// Gets or sets the message.
42 | ///
43 | [JsonProperty("Message")]
44 | public string StatusMessage { get; set; }
45 |
46 | ///
47 | /// Gets or sets the type of the status.
48 | ///
49 | [JsonProperty("Type")]
50 | public int StatusType { get; set; }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/CalculationType.cs:
--------------------------------------------------------------------------------
1 | namespace CryptoCompare
2 | {
3 | public enum CalculationType
4 | {
5 | ///
6 | /// HourVWAP of hourly price
7 | ///
8 | HourVWAP,
9 |
10 | ///
11 | /// The day close price.
12 | ///
13 | Close,
14 |
15 | ///
16 | /// The average between the 24 H high and low.
17 | ///
18 | MidHighLow,
19 |
20 | ///
21 | /// The total volume to / the total volume from.
22 | ///
23 | VolFVolT
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/Calls.cs:
--------------------------------------------------------------------------------
1 | namespace CryptoCompare
2 | {
3 | ///
4 | /// Api calls.
5 | ///
6 | public class Calls
7 | {
8 | ///
9 | /// Calls to history apis.
10 | ///
11 | public int Histo { get; set; }
12 |
13 | ///
14 | /// Calls to news api.
15 | ///
16 | public int News { get; set; }
17 |
18 | ///
19 | /// Calls to price apis.
20 | ///
21 | public int Price { get; set; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/CandleData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Newtonsoft.Json;
4 |
5 | namespace CryptoCompare
6 | {
7 | public class CandleData
8 | {
9 | public decimal Close { get; set; }
10 |
11 | public decimal High { get; set; }
12 |
13 | public decimal Low { get; set; }
14 |
15 | public decimal Open { get; set; }
16 |
17 | [JsonConverter(typeof(UnixTimeConverter))]
18 | public DateTimeOffset Time { get; set; }
19 |
20 | public decimal VolumeFrom { get; set; }
21 |
22 | public decimal VolumeTo { get; set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/CoinAggregatedData.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace CryptoCompare
4 | {
5 | public class CoinAggregatedData : AggregatedData
6 | {
7 | [JsonProperty("HIGHDAY")]
8 | public double? HighDay { get; set; }
9 |
10 | [JsonProperty("LASTMARKET")]
11 | public string LastMarket { get; set; }
12 |
13 | [JsonProperty("LOWDAY")]
14 | public double? LowDay { get; set; }
15 |
16 | [JsonProperty("OPENDAY")]
17 | public double? OpenDay { get; set; }
18 |
19 | [JsonProperty("VOLUMEDAY")]
20 | public double? VolumeDay { get; set; }
21 |
22 | [JsonProperty("VOLUMEDAYTO")]
23 | public double? VolumeDayTo { get; set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/CoinFullAggregatedData.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace CryptoCompare
4 | {
5 | public class CoinFullAggregatedData : CoinAggregatedData
6 | {
7 | [JsonProperty("CHANGE24HOUR")]
8 | public decimal? Change24Hour { get; set; }
9 |
10 | [JsonProperty("CHANGEDAY")]
11 | public decimal? ChangeDay { get; set; }
12 |
13 | [JsonProperty("CHANGEPCT24HOUR")]
14 | public decimal? ChangePCT24Hour { get; set; }
15 |
16 | [JsonProperty("CHANGEPCTDAY")]
17 | public decimal? ChangePCTDay { get; set; }
18 |
19 | [JsonProperty("MKTCAP")]
20 | public decimal? MarketCap { get; set; }
21 |
22 | [JsonProperty("TOTALVOLUME24H")]
23 | public decimal? TotalVolume24H { get; set; }
24 |
25 | [JsonProperty("TOTALVOLUME24HTO")]
26 | public decimal? TotalVolume24HTo { get; set; }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/CoinFullAggregatedDataDisplay.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace CryptoCompare
4 | {
5 | public class CoinFullAggregatedDataDisplay
6 | {
7 | [JsonProperty("CHANGE24HOUR")]
8 | public string Change24Hour { get; set; }
9 |
10 | [JsonProperty("CHANGEDAY")]
11 | public string ChangeDay { get; set; }
12 |
13 | [JsonProperty("CHANGEPCT24HOUR")]
14 | public string ChangePCT24Hour { get; set; }
15 |
16 | [JsonProperty("CHANGEPCTDAY")]
17 | public string ChangePCTDay { get; set; }
18 |
19 | [JsonProperty("FROMSYMBOL")]
20 | public string FromSymbol { get; set; }
21 |
22 | [JsonProperty("HIGH24HOUR")]
23 | public string High24Hour { get; set; }
24 |
25 | [JsonProperty("HIGHDAY")]
26 | public string HighDay { get; set; }
27 |
28 | [JsonProperty("LASTMARKET")]
29 | public string LastMarket { get; set; }
30 |
31 | [JsonProperty("LASTTRADEID")]
32 | public string LastTradeId { get; set; }
33 |
34 | [JsonProperty("LASTUPDATE")]
35 | public string LastUpdate { get; set; }
36 |
37 | [JsonProperty("LASTVOLUME")]
38 | public string LastVolume { get; set; }
39 |
40 | [JsonProperty("LASTVOLUMETO")]
41 | public string LastVolumeTo { get; set; }
42 |
43 | [JsonProperty("LOW24HOUR")]
44 | public string Low24Hour { get; set; }
45 |
46 | [JsonProperty("LOWDAY")]
47 | public string LowDay { get; set; }
48 |
49 | [JsonProperty("MARKET")]
50 | public string Market { get; set; }
51 |
52 | [JsonProperty("MKTCAP")]
53 | public string MarketCap { get; set; }
54 |
55 | [JsonProperty("OPEN24HOUR")]
56 | public string Open24Hour { get; set; }
57 |
58 | [JsonProperty("OPENDAY")]
59 | public string OpenDay { get; set; }
60 |
61 | [JsonProperty("PRICE")]
62 | public string Price { get; set; }
63 |
64 | [JsonProperty("SUPPLY")]
65 | public string Supply { get; set; }
66 |
67 | [JsonProperty("TOSYMBOL")]
68 | public string ToSymbol { get; set; }
69 |
70 | [JsonProperty("TOTALVOLUME24H")]
71 | public string TotalVolume24H { get; set; }
72 |
73 | [JsonProperty("TOTALVOLUME24HTO")]
74 | public string TotalVolume24HTo { get; set; }
75 |
76 | [JsonProperty("VOLUME24HOUR")]
77 | public string Volume24Hour { get; set; }
78 |
79 | [JsonProperty("VOLUME24HOURTO")]
80 | public string Volume24HourTo { get; set; }
81 |
82 | [JsonProperty("VOLUMEDAY")]
83 | public string VolumeDay { get; set; }
84 |
85 | [JsonProperty("VOLUMEDAYTO")]
86 | public string VolumeDayTo { get; set; }
87 |
88 | [JsonProperty("VOLUMEHOUR")]
89 | public string VolumeHour { get; set; }
90 |
91 | [JsonProperty("VOLUMEHOURTO")]
92 | public string VolumeHourTo { get; set; }
93 |
94 | [JsonProperty("OPENHOUR")]
95 | public string OpenHour { get; set; }
96 |
97 | [JsonProperty("OPENHOURTO")]
98 | public string OpenHourTo { get; set; }
99 |
100 | [JsonProperty("IMAGEURL")]
101 | public string ImageUrl { get; set; }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/CoinGeneralInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Newtonsoft.Json;
4 |
5 | namespace CryptoCompare
6 | {
7 | public class CoinGeneralInfo
8 | {
9 | public string AffiliateUrl { get; set; }
10 |
11 | public string Algorithm { get; set; }
12 |
13 | public string BaseAngularUrl { get; set; }
14 |
15 | public long? BlockNumber { get; set; }
16 |
17 | public long? BlockReward { get; set; }
18 |
19 | public string BlockRewardReduction { get; set; }
20 |
21 | public long? BlockTime { get; set; }
22 |
23 | public string DangerTop { get; set; }
24 |
25 | public string Description { get; set; }
26 |
27 | public string DifficultyAdjustment { get; set; }
28 |
29 | public string DocumentType { get; set; }
30 |
31 | public string Features { get; set; }
32 |
33 | public string H1Text { get; set; }
34 |
35 | public string Id { get; set; }
36 |
37 | public string ImageUrl { get; set; }
38 |
39 | public string InfoTop { get; set; }
40 |
41 | [JsonConverter(typeof(UnixTimeConverter))]
42 | public DateTimeOffset? LastBlockExplorerUpdateTS { get; set; }
43 |
44 | public string Name { get; set; }
45 |
46 | public double? NetHashesPerSecond { get; set; }
47 |
48 | public double? PreviousTotalCoinsMined { get; set; }
49 |
50 | public string ProofType { get; set; }
51 |
52 | [JsonConverter(typeof(IsoDateTimeWithFormatConverter), "dd/MM/yyyy")]
53 | public DateTime? StartDate { get; set; }
54 |
55 | public string Symbol { get; set; }
56 |
57 | public string Technology { get; set; }
58 |
59 | public double? TotalCoinsMined { get; set; }
60 |
61 | public string TotalCoinSupply { get; set; }
62 |
63 | public string Twitter { get; set; }
64 |
65 | public string Url { get; set; }
66 |
67 | public string WarningTop { get; set; }
68 |
69 | public string Website { get; set; }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/CoinInfo.cs:
--------------------------------------------------------------------------------
1 | namespace CryptoCompare
2 | {
3 | ///
4 | /// Information about the coin. (Coin list endpoint)
5 | ///
6 | public class CoinInfo
7 | {
8 | ///
9 | /// Gets or sets the algorithm of the coin.
10 | ///
11 | public string Algorithm { get; set; }
12 |
13 | ///
14 | /// Gets or sets the name of the coin.
15 | ///
16 | public string CoinName { get; set; }
17 |
18 | ///
19 | /// Gets or sets the full name of the coins.
20 | ///
21 | public string FullName { get; set; }
22 |
23 | ///
24 | /// Gets or sets the number of fully premined coins.
25 | ///
26 | ///
27 | /// The fully premined.
28 | ///
29 | public string FullyPremined { get; set; }
30 |
31 | ///
32 | /// Gets or sets the internal id, this is used in other calls.
33 | ///
34 | public string Id { get; set; }
35 |
36 | ///
37 | /// Gets or sets he logo image of the coin.
38 | ///
39 | public string ImageUrl { get; set; }
40 |
41 | ///
42 | /// Gets or sets the coin name.
43 | ///
44 | public string Name { get; set; }
45 |
46 | ///
47 | /// Gets or sets the pre-mined value.
48 | ///
49 | public string PreMinedValue { get; set; }
50 |
51 | ///
52 | /// Gets or sets the proof type.
53 | ///
54 | public string ProofType { get; set; }
55 |
56 | ///
57 | /// Gets the sort order.
58 | ///
59 | public int SortOrder { get; set; }
60 |
61 | ///
62 | /// Gets or sets a value indicating whether the coin is sponsored.
63 | ///
64 | public bool Sponsored { get; set; }
65 |
66 | ///
67 | /// Gets or sets the symbol.
68 | ///
69 | public string Symbol { get; set; }
70 |
71 | ///
72 | /// Gets or sets the smart contract address.
73 | ///
74 | public string SmartContractAddress { get; set; }
75 |
76 | ///
77 | /// Gets or sets the total number of freed coins.
78 | ///
79 | public string TotalCoinsFreeFloat { get; set; }
80 |
81 | ///
82 | /// Gets or sets the total number of supplied coins.
83 | ///
84 | public string TotalCoinSupply { get; set; }
85 |
86 | ///
87 | /// Gets or sets the url of the coin on cryptocompare.
88 | ///
89 | public string Url { get; set; }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/CoinListResponse.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | using Newtonsoft.Json;
4 |
5 | namespace CryptoCompare
6 | {
7 | ///
8 | /// List of coins.
9 | ///
10 | ///
11 | public class CoinListResponse : BaseApiResponse
12 | {
13 | public string BaseImageUrl { get; set; }
14 |
15 | public string BaseLinkUrl { get; set; }
16 |
17 | ///
18 | /// Gets or sets the coins data.
19 | ///
20 | [JsonProperty("Data")]
21 | public IReadOnlyDictionary Coins { get; set; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/CoinSnapshotData.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace CryptoCompare
4 | {
5 | public class CoinSnapshotData
6 | {
7 | public CoinAggregatedData AggregatedData { get; set; }
8 |
9 | public string Algorithm { get; set; }
10 |
11 | public long? BlockNumber { get; set; }
12 |
13 | public double? BlockReward { get; set; }
14 |
15 | public IReadOnlyList Exchanges { get; set; }
16 |
17 | public double? NetHashesPerSecond { get; set; }
18 |
19 | public string ProofType { get; set; }
20 |
21 | public long TotalCoinsMined { get; set; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/CoinSnapshotFullData.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | using Newtonsoft.Json;
4 |
5 | namespace CryptoCompare
6 | {
7 | public class CoinSnapshotFullData
8 | {
9 | public CoinGeneralInfo General { get; set; }
10 |
11 | public ICO ICO { get; set; }
12 |
13 | public SEO SEO { get; set; }
14 |
15 | public IReadOnlyList StreamerDataRaw { get; set; }
16 |
17 | [JsonConverter(typeof(StringToSubConverter))]
18 | public IReadOnlyList Subs { get; set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/CoinSnapshotFullResponse.cs:
--------------------------------------------------------------------------------
1 | namespace CryptoCompare
2 | {
3 | public class CoinSnapshotFullResponse : BaseApiResponse
4 | {
5 | public CoinSnapshotFullData Data { get; set; }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/CoinSnapshotResponse.cs:
--------------------------------------------------------------------------------
1 | namespace CryptoCompare
2 | {
3 | public class CoinSnapshotResponse : BaseApiResponse
4 | {
5 | public CoinSnapshotData Data { get; set; }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/ExchangeHistoryData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Newtonsoft.Json;
4 |
5 | namespace CryptoCompare
6 | {
7 | public class ExchangeHistoryData
8 | {
9 | [JsonConverter(typeof(UnixTimeConverter))]
10 | public DateTimeOffset Time { get; set; }
11 |
12 | public decimal Volume { get; set; }
13 | }
14 | }
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/ExchangeHistoryResponse.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace CryptoCompare
4 | {
5 | public class ExchangeHistoryResponse : BaseApiResponse
6 | {
7 | public IReadOnlyList Data { get; set; }
8 | }
9 | }
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/ExchangeListResponse.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.ObjectModel;
3 |
4 | namespace CryptoCompare
5 | {
6 | public class ExchangeListResponse : ReadOnlyDictionary>>
7 | {
8 | public ExchangeListResponse(IDictionary>> dictionary)
9 | : base(dictionary)
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/HistoryDayAverageResponse.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.ObjectModel;
3 |
4 | namespace CryptoCompare
5 | {
6 | ///
7 | /// A history day average response.
8 | /// TODO: replace ReadOnlyDictionary<string, object> by ReadOnlyDictionary<string, decimal>
9 | ///
10 | ///
11 | public class HistoryDayAverageResponse : ReadOnlyDictionary
12 | {
13 | public HistoryDayAverageResponse(IDictionary dictionary)
14 | : base(dictionary)
15 | {
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/HistoryResponse.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace CryptoCompare
4 | {
5 | public class HistoryResponse : BaseApiResponse
6 | {
7 | public IReadOnlyList Data { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/ICO.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Newtonsoft.Json;
4 |
5 | namespace CryptoCompare
6 | {
7 | public class ICO
8 | {
9 | public string Blog { get; set; }
10 |
11 | public string BlogLink { get; set; }
12 |
13 | [JsonConverter(typeof(UnixTimeConverter))]
14 | public DateTimeOffset Date { get; set; }
15 |
16 | public string Description { get; set; }
17 |
18 | [JsonConverter(typeof(UnixTimeConverter))]
19 | public DateTimeOffset EndDate { get; set; }
20 |
21 | public string Features { get; set; }
22 |
23 | public string FundingCap { get; set; }
24 |
25 | public string FundingTarget { get; set; }
26 |
27 | public string FundsRaisedList { get; set; }
28 |
29 | public string FundsRaisedUSD { get; set; }
30 |
31 | public string ICOTokenSupply { get; set; }
32 |
33 | public string Jurisdiction { get; set; }
34 |
35 | public string LegalAdvisers { get; set; }
36 |
37 | public string LegalForm { get; set; }
38 |
39 | public string PaymentMethod { get; set; }
40 |
41 | public string PublicPortfolioId { get; set; }
42 |
43 | public string PublicPortfolioUrl { get; set; }
44 |
45 | public string SecurityAuditCompany { get; set; }
46 |
47 | public string StartPrice { get; set; }
48 |
49 | public string StartPriceCurrency { get; set; }
50 |
51 | public string Status { get; set; }
52 |
53 | public string TokenPercentageForInvestors { get; set; }
54 |
55 | public string TokenReserveSplit { get; set; }
56 |
57 | public string TokenSupplyPostICO { get; set; }
58 |
59 | public string TokenType { get; set; }
60 |
61 | public string Website { get; set; }
62 |
63 | public string WebsiteLink { get; set; }
64 |
65 | public string WhitePaper { get; set; }
66 |
67 | public string WhitePaperLink { get; set; }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/MarketCapDisplay.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.ObjectModel;
3 |
4 | namespace CryptoCompare
5 | {
6 | public class MarketCapDisplay : ReadOnlyDictionary
7 | {
8 | public MarketCapDisplay(IDictionary dictionary)
9 | : base(dictionary)
10 | {
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/MarketCapRaw.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.ObjectModel;
3 |
4 | namespace CryptoCompare
5 | {
6 | public class MarketCapRaw : ReadOnlyDictionary
7 | {
8 | public MarketCapRaw(IDictionary dictionary)
9 | : base(dictionary)
10 | {
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/MiningContract.cs:
--------------------------------------------------------------------------------
1 | namespace CryptoCompare
2 | {
3 | public class MiningContract : MiningData
4 | {
5 | public string ContractLength { get; set; }
6 |
7 | public string FeePercentage { get; set; }
8 |
9 | public double FeeValue { get; set; }
10 |
11 | public string FeeValueCurrency { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/MiningContractsResponse.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace CryptoCompare
4 | {
5 | public class MiningContractsResponse : BaseApiResponse
6 | {
7 | public IReadOnlyDictionary MiningData { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/MiningData.cs:
--------------------------------------------------------------------------------
1 | namespace CryptoCompare
2 | {
3 | public class MiningData
4 | {
5 | public string AffiliateUrl { get; set; }
6 |
7 | public string Algorithm { get; set; }
8 |
9 | public string Company { get; set; }
10 |
11 | public double Cost { get; set; }
12 |
13 | public string CurrenciesAvailable { get; set; }
14 |
15 | public string CurrenciesAvailableLogo { get; set; }
16 |
17 | public string CurrenciesAvailableName { get; set; }
18 |
19 | public string Currency { get; set; }
20 |
21 | public string HashesPerSecond { get; set; }
22 |
23 | public string Id { get; set; }
24 |
25 | public string LogoUrl { get; set; }
26 |
27 | public string Name { get; set; }
28 |
29 | public string ParentId { get; set; }
30 |
31 | public bool Recommended { get; set; }
32 |
33 | public bool Sponsored { get; set; }
34 |
35 | public string Url { get; set; }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/MiningEquipment.cs:
--------------------------------------------------------------------------------
1 | namespace CryptoCompare
2 | {
3 | public class MiningEquipment : MiningData
4 | {
5 | public string EquipmentType { get; set; }
6 |
7 | public string PowerConsumption { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/MiningEquipmentsResponse.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace CryptoCompare
4 | {
5 | public class MiningEquipmentsResponse : BaseApiResponse
6 | {
7 | public IReadOnlyDictionary MiningData { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/NewsEntity.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace CryptoCompare
4 | {
5 | public class NewsEntity
6 | {
7 | [JsonProperty("id")]
8 | public long Id { get; set; }
9 | [JsonProperty("guid")]
10 | public string Guid { get; set; }
11 | [JsonProperty("published_on")]
12 | public long PublishDateUnix { get; set; }
13 | [JsonProperty("imageurl")]
14 | public string ImageUrl { get; set; }
15 | [JsonProperty("title")]
16 | public string Title { get; set; }
17 | [JsonProperty("url")]
18 | public string Url { get; set; }
19 | [JsonProperty("source")]
20 | public string Source { get; set; }
21 | [JsonProperty("body")]
22 | public string Body { get; set; }
23 | [JsonProperty("tags")]
24 | public string TagsString { get; set; }
25 | [JsonProperty("lang")]
26 | public string Lang { get; set; }
27 | [JsonProperty("source_info")]
28 | public NewsProvider SourceInfo { get; set; }
29 |
30 | }
31 |
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/NewsProvider.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace CryptoCompare
4 | {
5 | public class NewsProvider
6 | {
7 | [JsonProperty("key")]
8 | public string Key { get; set; }
9 | [JsonProperty("img")]
10 | public string ImageUrl { get; set; }
11 | [JsonProperty("lang")]
12 | public string Lang { get; set; }
13 | [JsonProperty("name")]
14 | public string Name { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/PriceAverageResponse.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace CryptoCompare
4 | {
5 | public class PriceAverageResponse
6 | {
7 | [JsonProperty("DISPLAY")]
8 | public CoinFullAggregatedDataDisplay Display { get; set; }
9 |
10 | [JsonProperty("RAW")]
11 | public CoinFullAggregatedData Raw { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/PriceHistoricalReponse.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.ObjectModel;
3 |
4 | namespace CryptoCompare
5 | {
6 | public class PriceHistoricalReponse : ReadOnlyDictionary>
7 | {
8 | public PriceHistoricalReponse(IDictionary> dictionary)
9 | : base(dictionary)
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/PriceMultiFullDisplay.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.ObjectModel;
3 |
4 | namespace CryptoCompare
5 | {
6 | public class
7 | PriceMultiFullDisplay : ReadOnlyDictionary>
8 | {
9 | public PriceMultiFullDisplay(
10 | IDictionary> dictionary)
11 | : base(dictionary)
12 | {
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/PriceMultiFullRaw.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.ObjectModel;
3 |
4 | namespace CryptoCompare
5 | {
6 | public class PriceMultiFullRaw : ReadOnlyDictionary>
7 | {
8 | public PriceMultiFullRaw(IDictionary> dictionary)
9 | : base(dictionary)
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/PriceMultiFullResponse.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace CryptoCompare
4 | {
5 | public class PriceMultiFullResponse
6 | {
7 | [JsonProperty("DISPLAY")]
8 | public PriceMultiFullDisplay Display { get; set; }
9 |
10 | [JsonProperty("RAW")]
11 | public PriceMultiFullRaw Raw { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/PriceMultiResponse.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.ObjectModel;
3 |
4 | namespace CryptoCompare
5 | {
6 | public class PriceMultiResponse : ReadOnlyDictionary>
7 | {
8 | public PriceMultiResponse(IDictionary> dictionary)
9 | : base(dictionary)
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/PriceSingleResponse.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.ObjectModel;
3 |
4 | namespace CryptoCompare
5 | {
6 | public class PriceSingleResponse : ReadOnlyDictionary
7 | {
8 | public PriceSingleResponse(IDictionary dictionary)
9 | : base(dictionary)
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/RateLimitResponse.cs:
--------------------------------------------------------------------------------
1 | namespace CryptoCompare
2 | {
3 | ///
4 | /// A rate limit.
5 | ///
6 | ///
7 | public class RateLimitResponse : BaseApiResponse
8 | {
9 | ///
10 | /// Gets or sets the calls left.
11 | ///
12 | public Calls CallsLeft { get; set; }
13 |
14 | ///
15 | /// Gets or sets the calls made.
16 | ///
17 | public Calls CallsMade { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/SEO.cs:
--------------------------------------------------------------------------------
1 | namespace CryptoCompare
2 | {
3 | public class SEO
4 | {
5 | public string BaseImageUrl { get; set; }
6 |
7 | public string BaseUrl { get; set; }
8 |
9 | public int OgImageHeight { get; set; }
10 |
11 | public string OgImageUrl { get; set; }
12 |
13 | public int OgImageWidth { get; set; }
14 |
15 | public string PageDescription { get; set; }
16 |
17 | public string PageTitle { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/Sub.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using JetBrains.Annotations;
4 |
5 | namespace CryptoCompare
6 | {
7 | public struct Sub : IEquatable
8 | {
9 | public bool Equals(Sub other) => string.Equals(this.Exchange, other.Exchange)
10 | && string.Equals(this.FromSymbol, other.FromSymbol)
11 | && this.SubId == other.SubId
12 | && string.Equals(this.ToSymbol, other.ToSymbol);
13 |
14 | public override bool Equals(object obj)
15 | {
16 | if (ReferenceEquals(null, obj))
17 | {
18 | return false;
19 | }
20 | return obj is Sub sub && this.Equals(sub);
21 | }
22 |
23 | public override int GetHashCode()
24 | {
25 | unchecked
26 | {
27 | var hashCode = this.Exchange.GetHashCode();
28 | hashCode = (hashCode * 397) ^ this.FromSymbol.GetHashCode();
29 | hashCode = (hashCode * 397) ^ (int)this.SubId;
30 | hashCode = (hashCode * 397) ^ this.ToSymbol.GetHashCode();
31 | return hashCode;
32 | }
33 | }
34 |
35 | public Sub([NotNull] string exchange, [NotNull] string fromSymbol, SubId subId, [NotNull] string toSymbol)
36 | {
37 | Check.NotNullOrWhiteSpace(exchange, nameof(exchange));
38 | Check.NotNullOrWhiteSpace(fromSymbol, nameof(fromSymbol));
39 | Check.NotNullOrWhiteSpace(toSymbol, nameof(toSymbol));
40 | this.Exchange = exchange;
41 | this.FromSymbol = fromSymbol;
42 | this.SubId = subId;
43 | this.ToSymbol = toSymbol;
44 | }
45 |
46 | public string Exchange { get; }
47 |
48 | public string FromSymbol { get; }
49 |
50 | public SubId SubId { get; }
51 |
52 | public string ToSymbol { get; }
53 |
54 | public override string ToString()
55 | {
56 | return $"{this.SubId:D}~{this.Exchange}~{this.FromSymbol}~{this.ToSymbol}";
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/SubId.cs:
--------------------------------------------------------------------------------
1 | namespace CryptoCompare
2 | {
3 | public enum SubId
4 | {
5 | ///
6 | /// Trade level data on a currency pair from a specific exchange.
7 | ///
8 | Trade = 0,
9 |
10 | ///
11 | /// Latest quote update of a currency pair from a specific exchange.
12 | ///
13 | Current = 2,
14 |
15 | ///
16 | /// Quote update aggregated over the last 24 hours of a currency pair from a specific exchange.
17 | ///
18 | CurrentAgg = 5
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/SubListResponse.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.ObjectModel;
3 |
4 | using Newtonsoft.Json;
5 |
6 | namespace CryptoCompare
7 | {
8 | public class SubListResponse : ReadOnlyDictionary
9 | {
10 | public SubListResponse(IDictionary dictionary)
11 | : base(dictionary)
12 | {
13 | }
14 | }
15 |
16 | public class SubList
17 | {
18 | [JsonConverter(typeof(StringToSubConverter))]
19 | public IReadOnlyList Current { get; set; }
20 |
21 | [JsonConverter(typeof(StringToSubConverter))]
22 | public Sub CurrentAgg { get; set; }
23 |
24 | [JsonConverter(typeof(StringToSubConverter))]
25 | public IReadOnlyList Trades { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/TopExchangeFullResponse.cs:
--------------------------------------------------------------------------------
1 | namespace CryptoCompare
2 | {
3 | public class TopExchangeFullResponse : BaseApiResponse
4 | {
5 | public TopExchangeInfo Data { get; set; }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/TopExchangeInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace CryptoCompare
4 | {
5 | public class TopExchangeInfo
6 | {
7 | public CoinInfo CoinInfo { get; set; }
8 |
9 | public AggregatedData AggregatedData { get; set; }
10 |
11 | public IEnumerable Exchanges { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/TopInfo.cs:
--------------------------------------------------------------------------------
1 | namespace CryptoCompare
2 | {
3 | public class TopInfo
4 | {
5 | public string Exchange { get; set; }
6 |
7 | public string FromSymbol { get; set; }
8 |
9 | public string ToSymbol { get; set; }
10 |
11 | public decimal Volume24H { get; set; }
12 |
13 | public decimal Volume24HTo { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/TopMarketCapInfo.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace CryptoCompare
4 | {
5 | public class TopMarketCapInfo
6 | {
7 | public CoinInfo CoinInfo { get; set; }
8 |
9 | [JsonProperty("DISPLAY")]
10 | public MarketCapDisplay Display { get; set; }
11 |
12 | [JsonProperty("RAW")]
13 | public MarketCapRaw Raw { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/TopMarketCapsResponse.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | using Newtonsoft.Json;
4 |
5 | namespace CryptoCompare
6 | {
7 | public class TopMarketCapResponse : BaseApiResponse
8 | {
9 | public IReadOnlyList Data { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/TopResponse.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace CryptoCompare
4 | {
5 | public class TopResponse : BaseApiResponse
6 | {
7 | public IReadOnlyList Data { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/TopVolume24HInfo.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace CryptoCompare
4 | {
5 | public class TopVolume24HInfo
6 | {
7 | public CoinInfo CoinInfo { get; set; }
8 |
9 | [JsonProperty("DISPLAY")]
10 | public Volume24HDisplay Display { get; set; }
11 |
12 | [JsonProperty("RAW")]
13 | public Volume24HRaw Raw { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/TopVolume24HResponse.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | using Newtonsoft.Json;
4 |
5 | namespace CryptoCompare
6 | {
7 | public class TopVolume24HResponse : BaseApiResponse
8 | {
9 | public IReadOnlyList Data { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/TopVolumeInfo.cs:
--------------------------------------------------------------------------------
1 | namespace CryptoCompare
2 | {
3 | public class TopVolumeInfo
4 | {
5 | public string Fullname { get; set; }
6 |
7 | public string Id { get; set; }
8 |
9 | public string Name { get; set; }
10 |
11 | public decimal Supply { get; set; }
12 |
13 | public string Symbol { get; set; }
14 |
15 | public decimal Volume24HourTo { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/TopVolumesResponse.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace CryptoCompare
4 | {
5 | public class TopVolumesResponse : BaseApiResponse
6 | {
7 | public IReadOnlyList Data { get; set; }
8 |
9 | public string VolSymbol { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/Volume24HDisplay.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.ObjectModel;
3 |
4 | namespace CryptoCompare
5 | {
6 | public class Volume24HDisplay : ReadOnlyDictionary
7 | {
8 | public Volume24HDisplay(IDictionary dictionary)
9 | : base(dictionary)
10 | {
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/CryptoCompare/Models/Responses/Volume24HRaw.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.ObjectModel;
3 |
4 | namespace CryptoCompare
5 | {
6 | public class Volume24HRaw : ReadOnlyDictionary
7 | {
8 | public Volume24HRaw(IDictionary dictionary)
9 | : base(dictionary)
10 | {
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/CryptoCompare/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 |
3 | [assembly: InternalsVisibleTo("CryptoCompare.Tests")]
4 | [assembly: InternalsVisibleTo("CryptoCompare.WebSocket.Tests")]
5 |
--------------------------------------------------------------------------------
/test/CryptoCompare.Tests/Converters/UnixTimeConverterTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | using Xunit;
5 |
6 | namespace CryptoCompare.Tests.Converters
7 | {
8 | public class UnixTimeConverterTests
9 | {
10 | ///
11 | /// Should serialize candle data.
12 | ///
13 | ///
14 | /// Test for https://github.com/joancaron/cryptocompare-api/issues/11
15 | ///
16 | [Fact]
17 | public async Task ShouldSerializeCandleData()
18 | {
19 | var date = new DateTimeOffset(2018, 6, 15, 0, 0, 0, new TimeSpan(0, 0, 0));
20 | var unix = date.ToUnixTime();
21 | var hist = await CryptoCompareClient.Instance.History.HourlyAsync("BTC", "USD", 2, "Coinbase", date);
22 | var json = Newtonsoft.Json.JsonConvert.SerializeObject(hist);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/test/CryptoCompare.Tests/CryptoCompare.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.1
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | all
14 | runtime; build; native; contentfiles; analyzers
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/test/CryptoCompare.Tests/Helpers/CheckTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | using Xunit;
5 |
6 | namespace CryptoCompare.Tests.Helpers
7 | {
8 | public class CheckTest
9 | {
10 | public static string Blah = nameof(Blah);
11 |
12 | ///
13 | /// NotNullOrWhiteSpace should not throw ArgumentNullException when string is not null.
14 | ///
15 | [Fact]
16 | public void NotNullOrWhiteSpaceShouldNotThrowArgumentNullExceptionWhenStringIsNotNull()
17 | {
18 | Check.NotNullOrWhiteSpace(Blah, Blah);
19 | }
20 |
21 | ///
22 | /// NotNullOrWhiteSpace should throw ArgumentNullException when string is null or empty or whitespace.
23 | ///
24 | [Theory]
25 | [InlineData(null)]
26 | [InlineData("")]
27 | [InlineData(" ")]
28 | public void NotNullOrWhiteSpaceShouldThrowArgumentNullExceptionWhenStringIsNullOrEmptyOrWhitespace(string value)
29 | {
30 | var exception = Assert.Throws(() => Check.NotNullOrWhiteSpace(value, Blah));
31 | Assert.Equal(exception.ParamName, Blah);
32 | }
33 |
34 | ///
35 | /// NotNull should not throw ArgumentNullException when object is not null.
36 | ///
37 | [Fact]
38 | public void NotNullShouldNotThrowArgumentNullExceptionWhenObjectIsNotNull()
39 | {
40 | Check.NotNull(1, Blah);
41 | }
42 |
43 | ///
44 | /// NotNull should throw ArgumentNullException when object is null.
45 | ///
46 | [Fact]
47 | public void NotNullShouldThrowArgumentNullExceptionWhenObjectIsNull()
48 | {
49 | var exception = Assert.Throws(() => Check.NotNull(null, Blah));
50 | Assert.Equal(exception.ParamName, Blah);
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/test/Cryptocompare.Integration.Tests/Clients/CoinsClientTests.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using System.Threading.Tasks;
3 |
4 | using CryptoCompare;
5 |
6 | using Xunit;
7 |
8 | namespace Cryptocompare.Integration.Tests.Clients
9 | {
10 | public class CoinsClientTests
11 | {
12 | [Fact]
13 | public async Task CanCallListEndpoint()
14 | {
15 | var result = await CryptoCompareClient.Instance.Coins.ListAsync();
16 | Assert.NotNull(result);
17 | }
18 |
19 | [Fact]
20 | public async Task CanCallListEndpointAndRetrieveSmartContractAddresses()
21 | {
22 | var result = await CryptoCompareClient.Instance.Coins.ListAsync();
23 | Assert.NotNull(result);
24 | var foundSmartContractTokens = result.Coins.Any(c => c.Value.SmartContractAddress.StartsWith("0x"));
25 | Assert.True(foundSmartContractTokens);
26 | }
27 |
28 | [Fact]
29 | public async Task CanCallSnapshotEndpoint()
30 | {
31 | var result = await CryptoCompareClient.Instance.Coins.SnapshotAsync("BTC", "USD");
32 | Assert.NotNull(result);
33 | }
34 |
35 | [Fact]
36 | public async Task CanCallSnapshotFullEndpoint()
37 | {
38 | var result = await CryptoCompareClient.Instance.Coins.SnapshotFullAsync(1182);
39 | Assert.NotNull(result);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/test/Cryptocompare.Integration.Tests/Clients/ExchangeClientTests.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | using CryptoCompare;
4 |
5 | using Xunit;
6 |
7 | namespace Cryptocompare.Integration.Tests.Clients
8 | {
9 | public class ExchangeClientTests
10 | {
11 | [Fact]
12 | public async Task CanCallExchangeListEndpoint()
13 | {
14 | var result = await CryptoCompareClient.Instance.Exchanges.ListAsync();
15 | Assert.NotNull(result);
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/test/Cryptocompare.Integration.Tests/Clients/HistoryClientTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 |
4 | using CryptoCompare;
5 |
6 | using Xunit;
7 |
8 | namespace Cryptocompare.Integration.Tests.Clients
9 | {
10 | public class HistoryClientTests
11 | {
12 | [Fact]
13 | public async Task CanCallDayAveragePriceEndpoint()
14 | {
15 | var result = await CryptoCompareClient.Instance.History.DayAveragePriceAsync("BTC", "USD");
16 | Assert.NotNull(result);
17 | }
18 |
19 | [Fact]
20 | public async Task CanCallExchangeDailyEndpoint()
21 | {
22 | var result = await CryptoCompareClient.Instance.History.ExchangeDailyAsync("BTC");
23 | Assert.NotNull(result);
24 | }
25 |
26 | [Fact]
27 | public async Task CanCallExchangeHourlyEndpoint()
28 | {
29 | var result = await CryptoCompareClient.Instance.History.ExchangeHourlyAsync("BTC");
30 | Assert.NotNull(result);
31 | }
32 |
33 | [Fact]
34 | public async Task CanCallHistoricalDailyEndpoint()
35 | {
36 | var result = await CryptoCompareClient.Instance.History.DailyAsync("BTC", "USD", 10, allData: true);
37 | Assert.NotNull(result);
38 | }
39 |
40 | [Fact]
41 | public async Task CanCallHistoricalForTimestampEndpoint()
42 | {
43 | var result = await CryptoCompareClient.Instance.History.HistoricalForTimestampAsync(
44 | "BTC",
45 | new[] { "USD" },
46 | DateTimeOffset.Now.AddDays(-1));
47 | Assert.NotNull(result);
48 | }
49 |
50 | [Fact]
51 | public async Task CanCallHistoricalHourlyEndpoint()
52 | {
53 | var result = await CryptoCompareClient.Instance.History.HourlyAsync("BTC", "USD", 10);
54 | Assert.NotNull(result);
55 | }
56 |
57 | [Fact]
58 | public async Task CanCallHistoricalMinutelyEndpoint()
59 | {
60 | var result = await CryptoCompareClient.Instance.History.MinutelyAsync("BTC", "USD", 10);
61 | Assert.NotNull(result);
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/test/Cryptocompare.Integration.Tests/Clients/MiningClientTests.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | using CryptoCompare;
4 |
5 | using Xunit;
6 |
7 | namespace Cryptocompare.Integration.Tests.Clients
8 | {
9 | public class MiningClientTests
10 | {
11 | [Fact]
12 | public async Task CanCallMiningContractsEndpoint()
13 | {
14 | var result = await CryptoCompareClient.Instance.Mining.ContractsAsync();
15 | Assert.NotNull(result);
16 | }
17 |
18 | [Fact]
19 | public async Task CanCallMiningEquipmentsEndpoint()
20 | {
21 | var result = await CryptoCompareClient.Instance.Mining.EquipmentsAsync();
22 | Assert.NotNull(result);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/test/Cryptocompare.Integration.Tests/Clients/NewsClientTests.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | using CryptoCompare;
4 |
5 | using Xunit;
6 |
7 | namespace Cryptocompare.Integration.Tests.Clients
8 | {
9 | public class NewsClientTests
10 | {
11 | [Fact]
12 | public async Task CanCallNewsListEndpoint()
13 | {
14 | var result = await CryptoCompareClient.Instance.News.News();
15 | Assert.NotNull(result);
16 | }
17 |
18 | [Fact]
19 | public async Task CanCallNewsProvidersListEndpoint()
20 | {
21 | var result = await CryptoCompareClient.Instance.News.NewsProviders();
22 | Assert.NotNull(result);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/test/Cryptocompare.Integration.Tests/Clients/PriceClientTests.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | using CryptoCompare;
4 |
5 | using Xunit;
6 |
7 | namespace Cryptocompare.Integration.Tests.Clients
8 | {
9 | public class PriceClientTests
10 | {
11 | [Fact]
12 | public async Task CanCallSingleSymbolPriceEndpoint()
13 | {
14 | var result = await CryptoCompareClient.Instance.Prices.SingleSymbolPriceAsync("BTC", new[] { "USD", "JPY", "EUR" });
15 | Assert.NotNull(result);
16 | }
17 |
18 | [Fact]
19 | public async Task CanCallMultipleSymbolFullDataEndpoint()
20 | {
21 | var result = await CryptoCompareClient.Instance.Prices.MultipleSymbolFullDataAsync(new[] { "BTC", "ETH" }, new[] { "USD", "EUR" });
22 | Assert.NotNull(result);
23 | }
24 |
25 | [Fact]
26 | public async Task CanCallMultipleSymbolPriceEndpoint()
27 | {
28 | var result = await CryptoCompareClient.Instance.Prices.MultipleSymbolsPriceAsync(new[] { "BTC", "ETH" }, new[] { "USD", "EUR" });
29 | Assert.NotNull(result);
30 | }
31 |
32 | [Fact]
33 | public async Task CanCallGenerateCustomAverageEndpoint()
34 | {
35 | var result = await CryptoCompareClient.Instance.Prices.GenerateCustomAverageAsync("BTC", "USD", new[] { "Kraken" });
36 | Assert.NotNull(result);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/test/Cryptocompare.Integration.Tests/Clients/RateLimitClientTests.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | using CryptoCompare;
4 |
5 | using Xunit;
6 |
7 | namespace Cryptocompare.Integration.Tests.Clients
8 | {
9 | public class RateLimitClientTests
10 | {
11 | [Fact]
12 | public async Task CanCallRateLimitsCurrentHourEndpoint()
13 | {
14 | var result = await CryptoCompareClient.Instance.RateLimits.CurrentHourAsync();
15 | Assert.NotNull(result);
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/test/Cryptocompare.Integration.Tests/Clients/SocialStatsClientTests.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | using CryptoCompare;
4 |
5 | using Xunit;
6 |
7 | namespace Cryptocompare.Integration.Tests.Clients
8 | {
9 | public class SocialStatsClientTests
10 | {
11 | [Fact]
12 | public async Task CanCallSocialStatsEndpoint()
13 | {
14 | var result = await CryptoCompareClient.Instance.SocialStats.StatsAsync(1182);
15 | Assert.NotNull(result);
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/test/Cryptocompare.Integration.Tests/Clients/SubsClientTests.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | using CryptoCompare;
4 |
5 | using Xunit;
6 |
7 | namespace Cryptocompare.Integration.Tests.Clients
8 | {
9 | public class SubsClientTests
10 | {
11 | [Fact]
12 | public async Task CanCallSocialStatsEndpoint()
13 | {
14 | var result = await CryptoCompareClient.Instance.Subs.ListAsync("BTC", new[] { "USD" });
15 | Assert.NotNull(result);
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/test/Cryptocompare.Integration.Tests/Clients/TopListClientTests.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | using CryptoCompare;
4 |
5 | using Xunit;
6 |
7 | namespace Cryptocompare.Integration.Tests.Clients
8 | {
9 | public class TopListClientTests
10 | {
11 | [Fact]
12 | public async Task CanCallTopListByPairVolumeEndpoint()
13 | {
14 | var result = await CryptoCompareClient.Instance.Tops.ByPairVolumeAsync("BTC");
15 | Assert.NotNull(result);
16 | }
17 |
18 | [Fact]
19 | public async Task CanCallTopListExchangesFullDataByPairEndpoint()
20 | {
21 | var result = await CryptoCompareClient.Instance.Tops.ExchangesFullDataByPairAsync("BTC", "USD");
22 | Assert.NotNull(result);
23 | }
24 |
25 | [Fact]
26 | public async Task CanCallTopListExchangesVolumeDataByPairEndpoint()
27 | {
28 | var result = await CryptoCompareClient.Instance.Tops.ExchangesVolumeDataByPairAsync("BTC", "USD");
29 | Assert.NotNull(result);
30 | }
31 |
32 | [Fact]
33 | public async Task CanCallTopListTradingPairsEndpoint()
34 | {
35 | var result = await CryptoCompareClient.Instance.Tops.TradingPairsAsync("BTC");
36 | Assert.NotNull(result);
37 | }
38 |
39 | [Fact]
40 | public async Task CanCallTopListCoinFullDataByMarketCap()
41 | {
42 | var result = await CryptoCompareClient.Instance.Tops.CoinFullDataByMarketCap("EUR", 20);
43 | Assert.NotNull(result);
44 | }
45 |
46 | [Fact]
47 | public async Task CanCallTopListCoinFullDataBy24HVolume()
48 | {
49 | var result = await CryptoCompareClient.Instance.Tops.CoinFullDataBy24HVolume("EUR", 20);
50 | Assert.NotNull(result);
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/test/Cryptocompare.Integration.Tests/Core/ThrottledHttpClientHandlerTests.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.Linq;
3 | using System.Threading.Tasks;
4 |
5 | using CryptoCompare;
6 |
7 | using Xunit;
8 |
9 | namespace Cryptocompare.Integration.Tests.Clients
10 | {
11 | public class ThrottledHttpClientHandlerTests
12 | {
13 | [Fact]
14 | public async Task WaitsBetweenQueries()
15 | {
16 | var throttleDelayMs = 200;
17 | var queriesCount = 5;
18 |
19 | var client = new CryptoCompareClient(throttleDelayMs: throttleDelayMs);
20 |
21 | var stopWatch = new Stopwatch();
22 | stopWatch.Start();
23 |
24 | await Task.WhenAll(Enumerable.Repeat("start", queriesCount)
25 | .Select(async _ => await client.RateLimits.CurrentHourAsync()));
26 |
27 |
28 | stopWatch.Stop();
29 |
30 | var minExpectedElapsedTime = queriesCount * throttleDelayMs;
31 | Assert.True(stopWatch.ElapsedMilliseconds > minExpectedElapsedTime, $"Elapsed time should have been greater than {minExpectedElapsedTime}ms, but was {stopWatch.ElapsedMilliseconds}ms.");
32 | }
33 |
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/test/Cryptocompare.Integration.Tests/Cryptocompare.Integration.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.1
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 | all
13 | runtime; build; native; contentfiles; analyzers
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/version.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3 | "version": "1.1",
4 | "publicReleaseRefSpec": [
5 | "^refs/heads/master$",
6 | "^refs/heads/develop$"
7 | ],
8 | "nugetPackageVersion":{
9 | "semVer": 2
10 | },
11 | "cloudBuild": {
12 | "buildNumber": {
13 | "enabled": true
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------