diff --git a/src/api/api.ts b/src/api/api.ts index 8f4feff3..70656b0f 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -77,8 +77,7 @@ export interface IBApiCreationOptions { } /** Maximum supported version. */ -export const MAX_SUPPORTED_SERVER_VERSION = - MIN_SERVER_VER.WSH_EVENT_DATA_FILTERS; +export const MAX_SUPPORTED_SERVER_VERSION = MIN_SERVER_VER.BOND_ISSUERID; /** Minimum supported version. */ export const MIN_SERVER_VER_SUPPORTED = 38; diff --git a/src/api/contract/contract.ts b/src/api/contract/contract.ts index 613ac928..7e4b1302 100644 --- a/src/api/contract/contract.ts +++ b/src/api/contract/contract.ts @@ -69,6 +69,16 @@ export interface Contract { /** Identifier of the security type. */ secId?: string; + /** Description of the contract. */ + description?: string; + + /** IssuerId of the contract. */ + issuerId?: string; + + /* + Combo + */ + /** Description of the combo legs. */ comboLegsDescription?: string; diff --git a/src/core/io/decoder.ts b/src/core/io/decoder.ts index 6ec94531..5a2f36f0 100644 --- a/src/core/io/decoder.ts +++ b/src/core/io/decoder.ts @@ -2084,6 +2084,11 @@ export class Decoder { derivativeSecTypes[j] = this.readStr() as SecType; } + if (this.serverVersion >= MIN_SERVER_VER.BOND_ISSUERID) { + contract.description = this.readStr(); + contract.issuerId = this.readStr(); + } + contractDescriptions[i] = { contract: contract, derivativeSecTypes: derivativeSecTypes, diff --git a/src/core/io/encoder.ts b/src/core/io/encoder.ts index 3a022814..36a659c2 100644 --- a/src/core/io/encoder.ts +++ b/src/core/io/encoder.ts @@ -1885,6 +1885,16 @@ function tagValuesToTokens(tagValues: TagValue[]): unknown[] { } } + if (this.serverVersion < MIN_SERVER_VER.BOND_ISSUERID) { + if (contract.issuerId) { + return this.emitError( + "It does not support issuerId parameter in reqContractDetails.", + ErrorCode.UPDATE_TWS, + reqId, + ); + } + } + const version = 8; // send req mkt data msg @@ -1939,6 +1949,9 @@ function tagValuesToTokens(tagValues: TagValue[]): unknown[] { args.push(contract.secId); } + if (this.serverVersion >= MIN_SERVER_VER.BOND_ISSUERID) + args.push(contract.issuerId); + this.sendMsg(args); }