If you setup 2 active subscriptions using the same event, but different callbacks, for example:
this.subscriptions.register<OpenOrder[]>(
() => {
this.api.reqOpenOrders();
},
undefined,
[
[EventName.openOrder, this.onOpenOrder],
[EventName.orderStatus, this.onOrderStatus],
[EventName.orderBound, this.onOrderBound],
[EventName.openOrderEnd, this.onOpenOrderEnd],
],
"getOpenOrders", // use same instance id each time, to make sure there is only 1 pending request at time
);
and
this.subscriptions
.register<OpenOrder[]>(
() => {
this.api.reqAllOpenOrders();
},
undefined,
[
[EventName.openOrder, this.onOpenOrder],
[EventName.orderStatus, this.onOrderStatus],
[EventName.orderBound, this.onOrderBound],
[EventName.openOrderEnd, this.onOpenOrderComplete],
],
"getAllOpenOrders", // use same instance id each time, to make sure there is only 1 pending request at time
);
As the subscription registry maintains a Map with the EventName as key and a callback and it's subscriptions as entry:
/** A Map containing the subscription registry, with event name as key. */
private readonly entires = new IBApiNextMap<EventName, RegistryEntry>();
The second callback for the same EventName.openOrderEnd will be ignored (in favour of the first active subscription callback) leading to undesired behaviour.
Hello,
If you setup 2 active subscriptions using the same event, but different callbacks, for example:
and
As the subscription registry maintains a
Map
with theEventName
as key and a callback and it's subscriptions as entry:The second callback for the same
EventName.openOrderEnd
will be ignored (in favour of the first active subscription callback) leading to undesired behaviour.Thanks