listDerivatives method
Future<CoinGeckoResult<List<Derivative> > >
listDerivatives({
- String includeTickers = DerivativeTickersFilter.unexpired,
List all derivative tickers.
includeTickers
filters tickers by expiration.
Use DerivativeTickersFilter enumeration as values.
Default is DerivativeTickersFilter.unexpired.
Query path: /derivatives
Implementation
Future<CoinGeckoResult<List<Derivative>>> listDerivatives({
String includeTickers = DerivativeTickersFilter.unexpired,
}) async {
final response = await _client.dio.get(
'/derivatives',
queryParameters: {
'include_tickers': includeTickers,
},
);
if (response.statusCode == 200) {
final data = Convert.toList(response.data, []);
final list = data.map((e) => Derivative.fromJson(e)).toList();
return CoinGeckoResult(list);
} else {
return CoinGeckoResult(
[],
errorCode: response.statusCode ?? null,
errorMessage: '${response.statusMessage} - ${response.data.toString()}',
isError: true,
);
}
}