profile method

The profile method is used to get the profile for a given stock symbol. Market capitalisation is adjusted by the specified currency and is NOT in million. The zip code, isin and city can be empty.

The id argument is used to specify the stock id.

// Get profile for Apple
final client = BavestRestClient(api_key);
final profile = client.profile(SecurityIdentifier(symbol: "AAPL"));

Implementation

@override
Future<CompanyProfile> profile(SecurityIdentifier id) async {
  const url = '$_baseUrl/stock/profile';
  final params = id.toJson();
  final response = await _post(url, params);
  if (_isSuccess(response)) {
    return CompanyProfile.fromJson(jsonDecode(response!.data));
  }

  throw Exception('Failed to get profile for $id');
}