ferencIOS / CryptoPulse

CryptoPulse: A Swift-based iOS app providing real-time insights and analytics on the top ten cryptocurrencies, designed with SwiftUI and MVI architecture for a seamless user experience.
MIT License
0 stars 0 forks source link

API Exploration #1

Open ferencIOS opened 7 months ago

ferencIOS commented 7 months ago

Explore the CoinGecko API documentation to understand how to fetch the top ten cryptocurrencies by market cap, their details, and historical price data.

ferencIOS commented 7 months ago

Based on CoinGecko API documentation.

Here’s a pseudo-implementation sketch:

// Fetch top ten cryptocurrencies by market cap
func fetchTopCryptocurrencies() {
    let url = URL(string: "https://api.coingecko.com/api/v3/coins/markets?vs_currency=eur&order=market_cap_desc&per_page=10&page=1")
}

// Fetch details for a specific cryptocurrency
func fetchCryptoDetails(id: String) {
    let url = URL(string: "https://api.coingecko.com/api/v3/coins/\(id)")
}

// Fetch historical market data for a cryptocurrency
func fetchHistoricalData(id: String, days: Int) {
    let url = URL(string: "https://api.coingecko.com/api/v3/coins/\(id)/market_chart?vs_currency=eur&days=\(days)")
}