Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use v3 coinmarketcap web api #3876

Merged
merged 1 commit into from
Jul 27, 2023
Merged

Use v3 coinmarketcap web api #3876

merged 1 commit into from
Jul 27, 2023

Conversation

tspenov
Copy link
Contributor

@tspenov tspenov commented Jul 26, 2023

Changes

Change to use V3 coinmarketcap web api instead of V1 since later is no longer returning data.

V3 api example: https://api.coinmarketcap.com/data-api/v3/cryptocurrency/detail/chart?id=1807&range=1689724800~1689984000

Coinmarketcap V1 web api response:

HTTPoison.get!("https://web-api.coinmarketcap.com/v1.1/cryptocurrency/quotes/historical?convert=USD,BTC&format=chart_crypto_details&id=1807&time_start=1689849600&time_end=1690713600").body |> Jason.decode!
%{
  "data" => %{
    "id" => 1807,
    "is_active" => 1,
    "is_fiat" => 0,
    "name" => "Santiment Network Token",
    "quotes" => [],
    "symbol" => "SAN"
  },
  "status" => %{
    "credit_count" => 0,
    "elapsed" => 560,
    "error_code" => 0,
    "error_message" => nil,
    "notice" => nil,
    "timestamp" => "2023-07-24T19:43:47.426Z"
  }
}
iex([email protected])34> HTTPoison.get!("https://web-api.coinmarketcap.com/v1.1/cryptocurrency/quotes/historical?convert=USD,BTC&format=chart_crypto_details&id=1027&time_start=1689849600&time_end=1690713600").body |> Jason.decode!
%{
  "data" => %{
    "id" => 1027,
    "is_active" => 1,
    "is_fiat" => 0,
    "name" => "Ethereum",
    "quotes" => [],
    "symbol" => "ETH"
  },
  "status" => %{
    "credit_count" => 0,
    "elapsed" => 624,
    "error_code" => 0,
    "error_message" => nil,
    "notice" => nil,
    "timestamp" => "2023-07-24T19:43:35.833Z"
  }
}

Ticket

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have tried to find clearer solution before commenting hard-to-understand parts of code
  • I have added tests that prove my fix is effective or that my feature works

@tspenov tspenov requested a review from IvanIvanoff July 26, 2023 09:44
@tspenov tspenov merged commit c130e88 into master Jul 27, 2023
1 check passed
@delete-merged-branch delete-merged-branch bot deleted the use-v3-coinmarketcap-web-api branch July 27, 2023 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant