etfSector method
The etfSector method is used to get the ETF sectors for a given ETF symbol.
The id
argument is used to specify the ETF id e.g. symbol
// Get ETF sectors for SPY
final client = BavestRestClient(api_key);
final etfSector = client.etfSector('SPY');
Implementation
@override
Future<EtfSector> etfSector(SecurityIdentifier id) async {
const url = '$_baseUrl/etf/sector';
final params = id.toJson();
var response = await _post(url, params);
if (_isSuccess(response)) {
return EtfSector.fromJson(jsonDecode(response!.data));
}
throw Exception("could not receive etf profile for $id");
}