34 lines
864 B
Go
34 lines
864 B
Go
|
|
package coinmarketcap
|
||
|
|
|
||
|
|
// APIResponse represents the top-level CoinMarketCap API response
|
||
|
|
type APIResponse struct {
|
||
|
|
Status Status `json:"status"`
|
||
|
|
Data map[string]CryptoQuote `json:"data"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// Status represents the API response status
|
||
|
|
type Status struct {
|
||
|
|
ErrorCode int `json:"error_code"`
|
||
|
|
ErrorMessage *string `json:"error_message"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// CryptoQuote represents cryptocurrency data with quotes
|
||
|
|
type CryptoQuote struct {
|
||
|
|
Name string `json:"name"`
|
||
|
|
Quote map[string]CurrencyQuote `json:"quote"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// CurrencyQuote represents price quote in a specific currency
|
||
|
|
type CurrencyQuote struct {
|
||
|
|
Price float64 `json:"price"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// RateDTO represents exchange rate data from infrastructure layer
|
||
|
|
type RateDTO struct {
|
||
|
|
FromCode string
|
||
|
|
ToCode string
|
||
|
|
FromName string
|
||
|
|
ToName string
|
||
|
|
Price float64
|
||
|
|
Source string
|
||
|
|
}
|