etfProfile method

  1. @override
Future<EtfProfile> etfProfile(
  1. SecurityIdentifier id
)
override

The etfProfile method is used to get the ETF profile for a given ETF symbol.

The id argument is used to specify the ETF id e.g. symbol.

// Get ETF profile for SPY
final client = BavestRestClient(api_key);
final etfProfile = client.etfProfile('SPY');

Implementation

@override
Future<EtfProfile> etfProfile(SecurityIdentifier id) async {
  const url = '$_baseUrl/etf/profile';
  final params = id.toJson();

  var response = await _post(url, params);
  if (_isSuccess(response)) {
    return EtfProfile.fromJson(jsonDecode(response!.data));
  }

  throw Exception("could not receive etf profile for $id");
}