updateActiveOrderPeriodic method

void updateActiveOrderPeriodic({
  1. required String symbol,
  2. String? orderId,
  3. String? orderLinkId,
  4. int? newOrderQuantity,
  5. double? newOrderPrice,
  6. required Duration period,
})

Replace order can modify/amend your active orders periodically. https://bybit-exchange.github.io/docs/inverse/#t-replaceactive

Implementation

void updateActiveOrderPeriodic(
    {required String symbol,
    String? orderId,
    String? orderLinkId,
    int? newOrderQuantity,
    double? newOrderPrice,
    required Duration period}) {
  log.d('ByBitRest.updateActiveOrderPeriodic');
  streamGroup!.add(Stream.periodic(period, (_) {
    return updateActiveOrder(
        symbol: symbol,
        orderId: orderId,
        orderLinkId: orderLinkId,
        newOrderQuantity: newOrderQuantity,
        newOrderPrice: newOrderPrice);
  }).asyncMap((event) async => await event));
}