diff --git a/src/api-next/api-next.ts b/src/api-next/api-next.ts index 0bede87d..3fe22824 100644 --- a/src/api-next/api-next.ts +++ b/src/api-next/api-next.ts @@ -540,13 +540,13 @@ export class IBApiNext { /** * Response to API updateAccountValue control message. * - * @param subscriptions: listeners - * @param account: The IBKR account Id. - * @param tag: the tag of the value. - * @param value: numetical value associated to the tag. - * @param currency: the currency of the value. + * @param subscriptions listeners + * @param account The IBKR account Id. + * @param tag the tag of the value. + * @param value numetical value associated to the tag. + * @param currency the currency of the value. * - * @see [[reqOpenOrders]] + * @see [[reqAccountUpdates]] */ private readonly onUpdateAccountValue = ( subscriptions: Map>, @@ -605,17 +605,17 @@ export class IBApiNext { /** * Response to API updatePortfolio control message. * - * @param subscriptions: listeners - * @param contract: The position's [[Contract]] - * @param pos: The number of units held. - * @param marketPrice: the market price of the contract. - * @param marketValue: the market value of the position. - * @param avgCost: The average cost of the position. - * @param unrealizedPNL: The unrealized PNL of the position. - * @param realizedPNL: The realized PNL of the position. - * @param account: The IBKR account Id. - * - * @see [[reqOpenOrders]] + * @param subscriptions listeners + * @param contract The position's [[Contract]] + * @param pos The number of units held. + * @param marketPrice the market price of the contract. + * @param marketValue the market value of the position. + * @param avgCost The average cost of the position. + * @param unrealizedPNL The unrealized PNL of the position. + * @param realizedPNL The realized PNL of the position. + * @param account The IBKR account Id. + * + * @see [[reqAccountUpdates]] */ private readonly onUpdatePortfolio = ( subscriptions: Map>, @@ -704,10 +704,10 @@ export class IBApiNext { /** * Response to API updateAccountTime control message. * - * @param subscriptions: listeners - * @param timeStamp: the current timestamp + * @param subscriptions listeners + * @param timeStamp the current timestamp * - * @see [[reqOpenOrders]] + * @see [[reqAccountUpdates]] */ private readonly onUpdateAccountTime = ( subscriptions: Map>, @@ -728,10 +728,10 @@ export class IBApiNext { /** * Response to API accountDownloadEnd control message. * - * @param subscriptions: listeners - * @param accountName: the account name + * @param subscriptions listeners + * @param accountName the account name * - * @see [[reqOpenOrders]] + * @see [[reqAccountUpdates]] */ private readonly onAccountDownloadEnd = ( subscriptions: Map>, @@ -1060,17 +1060,17 @@ export class IBApiNext { * @param account Account for which to receive PnL updates. * @param modelCode Specify to request PnL updates for a specific model. */ - getPnL(account: string, model?: string): Observable { + getPnL(account: string, modelCode?: string): Observable { return this.subscriptions .register( (reqId) => { - this.api.reqPnL(reqId, account, model); + this.api.reqPnL(reqId, account, modelCode); }, (reqId) => { this.api.cancelPnL(reqId); }, [[EventName.pnl, this.onPnL]], - `${account}:${model}`, + `${account}:${modelCode}`, ) .pipe(map((v: { all: PnL }) => v.all)); } @@ -2548,11 +2548,11 @@ export class IBApiNext { /** * Feeds in currently open orders. * - * @param subscriptions: listeners - * @param orderId: The order's unique id. - * @param contract: The order's [[Contract]] - * @param order: The currently active [[Order]] - * @param orderState: The order's [[OrderState]] + * @param subscriptions listeners + * @param orderId The order's unique id. + * @param contract The order's [[Contract]] + * @param order The currently active [[Order]] + * @param orderState The order's [[OrderState]] * * @see [[placeOrder]], [[reqAllOpenOrders]], [[reqAutoOpenOrders]] */ @@ -2608,7 +2608,7 @@ export class IBApiNext { /** * Ends the subscription once all openOrders are recieved - * @param subscriptions: listeners + * @param subscriptions listeners */ private readonly onOpenOrderComplete = ( subscriptions: Map>, @@ -2624,10 +2624,10 @@ export class IBApiNext { /** * Response to API bind order control message. * - * @param subscriptions: listeners - * @param orderId: permId (mistake from IB documentation, value is orderId not permId) - * @param apiClientId: API client id. - * @param apiOrderId: API order id. + * @param subscriptions listeners + * @param orderId permId (mistake from IB documentation, value is orderId not permId) + * @param apiClientId API client id. + * @param apiOrderId API order id. * * @see [[reqOpenOrders]] */ @@ -2652,17 +2652,17 @@ export class IBApiNext { /** * Response to API status order control message. * - * @param orderId - * @param status - * @param filled - * @param remaining - * @param avgFillPrice - * @param permId - * @param parentId - * @param lastFillPrice - * @param clientId - * @param whyHeld - * @param mktCapPrice + * @param orderId the order's client id. + * @param status the current status of the order. Possible values: PendingSubmit - indicates that you have transmitted the order, but have not yet received confirmation that it has been accepted by the order destination. PendingCancel - indicates that you have sent a request to cancel the order but have not yet received cancel confirmation from the order destination. At this point, your order is not confirmed canceled. It is not guaranteed that the cancellation will be successful. PreSubmitted - indicates that a simulated order type has been accepted by the IB system and that this order has yet to be elected. The order is held in the IB system until the election criteria are met. At that time the order is transmitted to the order destination as specified . Submitted - indicates that your order has been accepted by the system. ApiCancelled - after an order has been submitted and before it has been acknowledged, an API client client can request its cancelation, producing this state. Cancelled - indicates that the balance of your order has been confirmed canceled by the IB system. This could occur unexpectedly when IB or the destination has rejected your order. Filled - indicates that the order has been completely filled. Market orders executions will not always trigger a Filled status. Inactive - indicates that the order was received by the system but is no longer active because it was rejected or canceled. + * @param filled number of filled positions. + * @param remaining the remnant positions. + * @param avgFillPrice average filling price. + * @param permId the order's permId used by the TWS to identify orders. + * @param parentId parent's id. Used for bracket and auto trailing stop orders. + * @param lastFillPrice price at which the last positions were filled. + * @param clientId API client which submitted the order. + * @param whyHeld this field is used to identify an order held when TWS is trying to locate shares for a short sell. The value used to indicate this is 'locate'. + * @param mktCapPrice If an order has been capped, this indicates the current capped price. Requires TWS 967+ and API v973.04+. Python API specifically requires API v973.06+. * * @see [[reqOpenOrders]] */ @@ -2723,7 +2723,7 @@ export class IBApiNext { /** * Ends the subscription once all openOrders are recieved - * @param subscriptions: listeners + * @param subscriptions listeners */ private readonly onOpenOrderEnd = ( subscriptions: Map>, @@ -2886,10 +2886,11 @@ export class IBApiNext { * Note: API clients cannot cancel individual orders placed by other clients. * Use [[cancelAllOrders]] instead. * - * @param id The order id. + * @param orderId Specify which order should be cancelled by its identifier. + * @param manualOrderCancelTime Specify the time the order should be cancelled. An empty string will cancel the order immediately. */ - cancelOrder(id: number): void { - this.api.cancelOrder(id); + cancelOrder(orderId: number, manualOrderCancelTime?: string): void { + this.api.cancelOrder(orderId, manualOrderCancelTime); } /** diff --git a/src/api/api.ts b/src/api/api.ts index b7800903..34e39ac6 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -365,13 +365,14 @@ export class IBApi extends EventEmitter { * Note: API clients cannot cancel individual orders placed by other clients. * Use [[reqGlobalCancel]] instead. * - * @param id The order's client id. + * @param orderId Specify which order should be cancelled by its identifier. + * @param manualOrderCancelTime Specify the time the order should be cancelled. An empty string will cancel the order immediately. * * @see [[placeOrder]], [[reqGlobalCancel]] */ - cancelOrder(orderId: number): IBApi { + cancelOrder(orderId: number, manualOrderCancelTime?: string): IBApi { this.controller.schedule(() => - this.controller.encoder.cancelOrder(orderId), + this.controller.encoder.cancelOrder(orderId, manualOrderCancelTime), ); return this; } @@ -737,7 +738,7 @@ export class IBApi extends EventEmitter { * Requests event data from the wSH calendar. * * @param reqId The unique request identifier. - * @param conId Contract id of ticker or WshEventData describing wanted events. + * @param wshEventData Contract id (conId) of ticker or WshEventData describing wanted events. * * @see [[reqCancelWshEventData]] */ diff --git a/src/api/order/condition/margin-condition.ts b/src/api/order/condition/margin-condition.ts index c7c86621..cbcc31c6 100644 --- a/src/api/order/condition/margin-condition.ts +++ b/src/api/order/condition/margin-condition.ts @@ -12,12 +12,13 @@ export class MarginCondition implements OperatorCondition { * Create a [[MarginCondition]] object. * * @param percent TODO document + * @param isMore TODO document * @param conjunctionConnection Conjunction connection type. */ constructor( public percent: number, public isMore: boolean, - public conjunctionConnection: ConjunctionConnection + public conjunctionConnection: ConjunctionConnection, ) {} get strValue(): string { diff --git a/src/api/order/condition/percent-change-condition.ts b/src/api/order/condition/percent-change-condition.ts index 82e54b73..bb74975d 100644 --- a/src/api/order/condition/percent-change-condition.ts +++ b/src/api/order/condition/percent-change-condition.ts @@ -14,6 +14,7 @@ export class PercentChangeCondition implements ContractCondition { * @param percent TODO document * @param conId The contract id. * @param exchange The exchange code. + * @param isMore TODO document * @param conjunctionConnection Conjunction connection type. */ constructor( @@ -21,7 +22,7 @@ export class PercentChangeCondition implements ContractCondition { public conId: number, public exchange: string, public isMore: boolean, - public conjunctionConnection: ConjunctionConnection + public conjunctionConnection: ConjunctionConnection, ) {} get strValue(): string { diff --git a/src/api/order/condition/price-condition.ts b/src/api/order/condition/price-condition.ts index 60a7c2bf..dc723cce 100644 --- a/src/api/order/condition/price-condition.ts +++ b/src/api/order/condition/price-condition.ts @@ -12,10 +12,11 @@ export class PriceCondition implements ContractCondition { /** * Create a [[PriceCondition]] object. * - * @param conId The contract id. - * @param exchange The exchange code. * @param price TODO document * @param triggerMethod TODO document + * @param conId The contract id. + * @param exchange The exchange code. + * @param isMore TODO document * @param conjunctionConnection Conjunction connection type. */ constructor( @@ -24,7 +25,7 @@ export class PriceCondition implements ContractCondition { public conId: number, public exchange: string, public isMore: boolean, - public conjunctionConnection: ConjunctionConnection + public conjunctionConnection: ConjunctionConnection, ) {} get strValue(): string { diff --git a/src/api/order/condition/time-condition.ts b/src/api/order/condition/time-condition.ts index f9ed2cb0..0aa66276 100644 --- a/src/api/order/condition/time-condition.ts +++ b/src/api/order/condition/time-condition.ts @@ -12,12 +12,13 @@ export class TimeCondition implements OperatorCondition { * Create a [[TimeCondition]] object. * * @param time Time field used in conditional order logic. Valid format: YYYYMMDD HH:MM:SS. + * @param isMore TODO * @param conjunctionConnection Conjunction connection type. */ constructor( public time: string, public isMore: boolean, - public conjunctionConnection: ConjunctionConnection + public conjunctionConnection: ConjunctionConnection, ) {} get strValue(): string { diff --git a/src/api/order/condition/volume-condition.ts b/src/api/order/condition/volume-condition.ts index cba81e58..ef62f747 100644 --- a/src/api/order/condition/volume-condition.ts +++ b/src/api/order/condition/volume-condition.ts @@ -14,7 +14,7 @@ export class VolumeCondition implements ContractCondition { * @param volume TODO document * @param conId The contract id. * @param exchange The exchange code. - * @param triggerMethod TODO document + * @param isMore TODO document * @param conjunctionConnection Conjunction connection type. */ constructor( @@ -22,7 +22,7 @@ export class VolumeCondition implements ContractCondition { public conId: number, public exchange: string, public isMore: boolean, - public conjunctionConnection: ConjunctionConnection + public conjunctionConnection: ConjunctionConnection, ) {} get strValue(): string { diff --git a/src/core/io/encoder.ts b/src/core/io/encoder.ts index e23eb906..c3777624 100644 --- a/src/core/io/encoder.ts +++ b/src/core/io/encoder.ts @@ -525,7 +525,7 @@ function tagValuesToTokens(tagValues: TagValue[]): unknown[] { /** * Encode a CANCEL_ORDER message to an array of tokens. */ - cancelOrder(id: number, manualCancelOrderTime?: string): void { + cancelOrder(orderId: number, manualCancelOrderTime?: string): void { const version = 1; if ( @@ -535,11 +535,11 @@ function tagValuesToTokens(tagValues: TagValue[]): unknown[] { return this.emitError( "It does not support manual order cancel time attribute", ErrorCode.UPDATE_TWS, - id, + orderId, ); } - const tokens: unknown[] = [OUT_MSG_ID.CANCEL_ORDER, version, id]; + const tokens: unknown[] = [OUT_MSG_ID.CANCEL_ORDER, version, orderId]; if (this.serverVersion >= MIN_SERVER_VER.MANUAL_ORDER_TIME) tokens.push(manualCancelOrderTime);