Skip to content

Commit

Permalink
allow for undefined manualOrderIndicator
Browse files Browse the repository at this point in the history
  • Loading branch information
rylorin committed Nov 16, 2024
1 parent 3fefe16 commit 8f4f78f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,13 +387,13 @@ export class IBApi extends EventEmitter {
orderCancel = {
manualOrderCancelTime: "",
extOperator: "",
manualOrderIndicator: 0,
manualOrderIndicator: undefined,
};
else if (typeof orderCancelParam == "string")
orderCancel = {
manualOrderCancelTime: orderCancelParam,
extOperator: "",
manualOrderIndicator: 0,
manualOrderIndicator: undefined,
};
else orderCancel = orderCancelParam;
this.controller.schedule(() =>
Expand Down Expand Up @@ -883,7 +883,7 @@ export class IBApi extends EventEmitter {
orderCancel || {
manualOrderCancelTime: "",
extOperator: "",
manualOrderIndicator: 0,
manualOrderIndicator: undefined,
},
),
);
Expand Down
14 changes: 7 additions & 7 deletions src/core/io/encoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ function tagValuesToTokens(tagValues: TagValue[]): unknown[] {
cancelOrder(orderId: number, orderCancel: OrderCancel): void {
if (
this.serverVersion < MIN_SERVER_VER.MANUAL_ORDER_TIME &&
orderCancel?.manualOrderCancelTime.length
orderCancel.manualOrderCancelTime.length
) {
return this.emitError(
"It does not support manual order cancel time attribute",
Expand All @@ -546,8 +546,8 @@ function tagValuesToTokens(tagValues: TagValue[]): unknown[] {

if (this.serverVersion < MIN_SERVER_VER.CME_TAGGING_FIELDS) {
if (
(orderCancel?.extOperator && orderCancel?.extOperator != "") ||
orderCancel?.manualOrderIndicator
orderCancel.extOperator?.length ||
orderCancel.manualOrderIndicator != undefined
) {
return this.emitError(
"It does not support ext operator and manual order indicator parameters",
Expand Down Expand Up @@ -581,7 +581,7 @@ function tagValuesToTokens(tagValues: TagValue[]): unknown[] {

if (this.serverVersion >= MIN_SERVER_VER.CME_TAGGING_FIELDS) {
tokens.push(orderCancel.extOperator);
tokens.push(orderCancel.manualOrderIndicator);
tokens.push(orderCancel.manualOrderIndicator ?? Integer_MAX_VALUE);
}

this.sendMsg(tokens);
Expand Down Expand Up @@ -2230,8 +2230,8 @@ function tagValuesToTokens(tagValues: TagValue[]): unknown[] {

if (this.serverVersion < MIN_SERVER_VER.CME_TAGGING_FIELDS) {
if (
(orderCancel?.extOperator && orderCancel?.extOperator != "") ||
orderCancel?.manualOrderIndicator
orderCancel.extOperator?.length ||
orderCancel.manualOrderIndicator != undefined
) {
return this.emitError(
"It does not support ext operator and manual order indicator parameters",
Expand All @@ -2252,7 +2252,7 @@ function tagValuesToTokens(tagValues: TagValue[]): unknown[] {

if (this.serverVersion >= MIN_SERVER_VER.CME_TAGGING_FIELDS) {
tokens.push(orderCancel.extOperator);
tokens.push(orderCancel.manualOrderIndicator);
tokens.push(orderCancel.manualOrderIndicator ?? Integer_MAX_VALUE);
}

this.sendMsg(tokens);
Expand Down

0 comments on commit 8f4f78f

Please sign in to comment.