use crate::{
Client, Result,
endpoints::EndpointSpec,
responses::{
chart::{StockChartFullBar, StockChartIntradayBar, StockChartLightBar},
crypto::{CryptocurrencyListing, Quote, QuoteShort},
},
};
pub use super::asset_chart::AssetChartQuery;
pub use super::quote::{QuoteQuery, QuoteShortQuery, ShortOnlyQuery};
pub fn cryptocurrency_list() -> EndpointSpec<(), Vec<CryptocurrencyListing>> {
EndpointSpec::get("cryptocurrency-list", "cryptocurrency-list", ())
}
pub fn cryptocurrency_quote(query: QuoteQuery) -> EndpointSpec<QuoteQuery, Vec<Quote>> {
EndpointSpec::get("quote", "quote", query)
}
pub fn cryptocurrency_quote_short(
query: QuoteShortQuery,
) -> EndpointSpec<QuoteShortQuery, Vec<QuoteShort>> {
EndpointSpec::get("quote-short", "quote-short", query)
}
pub fn cryptocurrency_quotes() -> EndpointSpec<ShortOnlyQuery, Vec<QuoteShort>> {
super::quote::cryptocurrency_quotes()
}
pub fn cryptocurrency_chart_light(
query: AssetChartQuery,
) -> EndpointSpec<AssetChartQuery, Vec<StockChartLightBar>> {
super::asset_chart::chart_light(query)
}
pub fn cryptocurrency_chart_full(
query: AssetChartQuery,
) -> EndpointSpec<AssetChartQuery, Vec<StockChartFullBar>> {
super::asset_chart::chart_full(query)
}
pub fn cryptocurrency_chart_one_minute(
query: AssetChartQuery,
) -> EndpointSpec<AssetChartQuery, Vec<StockChartIntradayBar>> {
super::asset_chart::chart_one_minute(query)
}
pub fn cryptocurrency_chart_five_minutes(
query: AssetChartQuery,
) -> EndpointSpec<AssetChartQuery, Vec<StockChartIntradayBar>> {
super::asset_chart::chart_five_minutes(query)
}
pub fn cryptocurrency_chart_one_hour(
query: AssetChartQuery,
) -> EndpointSpec<AssetChartQuery, Vec<StockChartIntradayBar>> {
super::asset_chart::chart_one_hour(query)
}
impl Client {
pub async fn cryptocurrency_list(&self) -> Result<Vec<CryptocurrencyListing>> {
self.execute(&cryptocurrency_list()).await
}
pub async fn cryptocurrency_quote(&self, query: impl Into<QuoteQuery>) -> Result<Vec<Quote>> {
self.execute(&cryptocurrency_quote(query.into())).await
}
pub async fn cryptocurrency_quote_short(
&self,
query: impl Into<QuoteShortQuery>,
) -> Result<Vec<QuoteShort>> {
self.execute(&cryptocurrency_quote_short(query.into()))
.await
}
pub async fn cryptocurrency_chart_light(
&self,
query: impl Into<AssetChartQuery>,
) -> Result<Vec<StockChartLightBar>> {
self.execute(&cryptocurrency_chart_light(query.into()))
.await
}
pub async fn cryptocurrency_chart_full(
&self,
query: impl Into<AssetChartQuery>,
) -> Result<Vec<StockChartFullBar>> {
self.execute(&cryptocurrency_chart_full(query.into())).await
}
pub async fn cryptocurrency_chart_one_minute(
&self,
query: impl Into<AssetChartQuery>,
) -> Result<Vec<StockChartIntradayBar>> {
self.execute(&cryptocurrency_chart_one_minute(query.into()))
.await
}
pub async fn cryptocurrency_chart_five_minutes(
&self,
query: impl Into<AssetChartQuery>,
) -> Result<Vec<StockChartIntradayBar>> {
self.execute(&cryptocurrency_chart_five_minutes(query.into()))
.await
}
pub async fn cryptocurrency_chart_one_hour(
&self,
query: impl Into<AssetChartQuery>,
) -> Result<Vec<StockChartIntradayBar>> {
self.execute(&cryptocurrency_chart_one_hour(query.into()))
.await
}
}