ipos method

  1. @override
Future<Ipo> ipos()
override

The ipos endpoint returns upcoming initial public offerings (IPOs) and their expected release dates.

// Get ipos
final client = BavestRestClient(api_key);
final ipos = client.ipos();

Implementation

@override
Future<Ipo> ipos() async {
  final DateTime c = DateTime.now();

  var from = c.subtract(const Duration(days: 30)).millisecondsSinceEpoch;
  var to = c.millisecondsSinceEpoch;

  from = from ~/ 1000;
  to = to ~/ 1000;

  const url = '$_baseUrl/calender/ipo';
  var params = {"from": from, "to": to};

  var response = await _post(url, params);

  if (_isSuccess(response)) {
    return Ipo.fromJson(jsonDecode(response!.data));
  }

  throw Exception("could not fetch API");
}