meanReversion method
Mean reversion Ranks currencies by how strongly they revert to their mean (crossing frequency + reversion half-life). Growth plan or higher.
Parameters:
currencies- Comma-separated currencies to score, e.g. EUR,GBP. OMIT to rank the liquid set.base_- Base currency to measure against (3-letter ISO 4217). Defaults to USD.from- Window start YYYY-MM-DD (UTC). Defaults to ~2 years beforeto.to- Window end YYYY-MM-DD (UTC). Defaults to today.limit- How many to return (default 10, max 50).cancelToken- ACancelTokenthat can be used to cancel the operationheaders- Can be used to add additional headers to the requestextras- Can be used to add flags to the requestvalidateStatus- AValidateStatuscallback that can be used to determine request success based on the HTTP status of the responseonSendProgress- AProgressCallbackthat can be used to get the send progressonReceiveProgress- AProgressCallbackthat can be used to get the receive progress
Returns a Future containing a Response with a MeanReversionResponse as data
Throws DioException if API call or serialization fails
Implementation
Future<Response<MeanReversionResponse>> meanReversion({
String? currencies,
String? base_,
String? from,
String? to,
num? limit,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/mean-reversion';
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'bearerAuth',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{
if (currencies != null) r'currencies': encodeQueryParameter(_serializers, currencies, const FullType(String)),
if (base_ != null) r'base': encodeQueryParameter(_serializers, base_, const FullType(String)),
if (from != null) r'from': encodeQueryParameter(_serializers, from, const FullType(String)),
if (to != null) r'to': encodeQueryParameter(_serializers, to, const FullType(String)),
if (limit != null) r'limit': encodeQueryParameter(_serializers, limit, const FullType(num)),
};
final _response = await _dio.request<Object>(
_path,
options: _options,
queryParameters: _queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
MeanReversionResponse? _responseData;
try {
final rawResponse = _response.data;
_responseData = rawResponse == null ? null : _serializers.deserialize(
rawResponse,
specifiedType: const FullType(MeanReversionResponse),
) as MeanReversionResponse;
} catch (error, stackTrace) {
throw DioException(
requestOptions: _response.requestOptions,
response: _response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<MeanReversionResponse>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}