Skip to content

Commit

Permalink
Upgrade to server v178 (10.25.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
rylorin committed Sep 21, 2023
1 parent 86d574f commit b43d599
Show file tree
Hide file tree
Showing 14 changed files with 175 additions and 72 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
<div style="display: flex;justify-content:center;">
<img src="https://img.shields.io/github/package-json/v/stoqey/ib"></img>
<img src="https://circleci.com/gh/stoqey/ib.svg?style=svg"></img>
<a href="https://lgtm.com/projects/g/stoqey/ib/context:javascript"><img alt="Language grade: JavaScript" src="https://img.shields.io/lgtm/grade/javascript/g/stoqey/ib.svg?logo=lgtm&logoWidth=18"/></a>
<img src="https://img.shields.io/npm/dt/@stoqey/ib.svg"></img>
</div>
</div>

`@stoqey/ib` is an [Interactive Brokers](http://interactivebrokers.com/) TWS (or IB Gateway) Typescript API client library for [Node.js](http://nodejs.org/). It is a direct port of Interactive Brokers' Java Client Version 9.76 from May 08 2019.
`@stoqey/ib` is an [Interactive Brokers](http://interactivebrokers.com/) TWS (or IB Gateway) Typescript API client library for [Node.js](http://nodejs.org/). It is a direct port of Interactive Brokers' Java Client Version 10.25 ("latest") from Sept 7 2023.

Refer to the [Trader Workstation API](https://interactivebrokers.github.io/tws-api/) for the official documentation and the C#/Java/VB/C++/Python client.

Expand Down Expand Up @@ -117,7 +116,7 @@ ib.on(EventName.error, (err: Error, code: ErrorCode, reqId: number) => {
(account: string, contract: Contract, pos: number, avgCost?: number) => {
console.log(`${account}: ${pos} x ${contract.symbol} @ ${avgCost}`);
positionsCount++;
}
},
)
.once(EventName.positionEnd, () => {
console.log(`Total: ${positionsCount} positions.`);
Expand Down
4 changes: 3 additions & 1 deletion src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ export interface IBApiCreationOptions {
}

/** Maximum supported version. */
export const MAX_SUPPORTED_SERVER_VERSION = MIN_SERVER_VER.BOND_ISSUERID;
export const MAX_SUPPORTED_SERVER_VERSION =
MIN_SERVER_VER.PENDING_PRICE_REVISION;

/** Minimum supported version. */
export const MIN_SERVER_VER_SUPPORTED = 38;
Expand Down Expand Up @@ -2252,6 +2253,7 @@ export declare interface IBApi {
volume: number,
count: number | undefined,
WAP: number,
/** @deprecated */
hasGaps: boolean | undefined,
) => void,
): this;
Expand Down
4 changes: 3 additions & 1 deletion src/api/data/enum/fad-data-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
* Financial Advisor's configuration data types.
*/
export enum FADataType {
NA = 0,

/** Offer traders a way to create a group of accounts and apply a single allocation method to all accounts in the group. */
GROUPS = 1,

/** Let you allocate shares on an account-by-account basis using a predefined calculation value. */
/** @deprecated Let you allocate shares on an account-by-account basis using a predefined calculation value. */
PROFILES = 2,

/** Let you easily identify the accounts by meaningful names rather than account numbers. */
Expand Down
2 changes: 2 additions & 0 deletions src/api/data/enum/min-server-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ export enum MIN_SERVER_VER {
INSTRUMENT_TIMEZONE = 174,
HMDS_MARKET_DATA_IN_SHARES = 175,
BOND_ISSUERID = 176,
FA_PROFILE_DESUPPORT = 177,
PENDING_PRICE_REVISION = 178,
}

export default MIN_SERVER_VER;
15 changes: 15 additions & 0 deletions src/api/market/tickType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,21 @@ export enum TickType {
/** The low price of ETF's Net Asset Value (NAV). */
ETF_NAV_LOW = 99,

/** TBD */
SOCIAL_MARKET_ANALYTICS = 100,

/** Midpoint is calculated based on IPO price range */
ESTIMATED_IPO_MIDPOINT = 101,

/** Final price for IPO */
FINAL_IPO_LAST = 102,

/** TBD */
DELAYED_YIELD_BID = 103,

/** TBD */
DELAYED_YIELD_ASK = 104,

UNKNOWN = 2147483647, // MAX int32
}

Expand Down
18 changes: 18 additions & 0 deletions src/api/order/enum/orderType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,22 @@ export enum OrderType {
PEG_SRF_VOL = "PSV",
}

export const isPegBenchOrder = (orderType: OrderType): boolean => {
if (orderType == OrderType.PEG_BENCH || (orderType as string) == "PEGBENCH")
return true;
else return false;
};

export const isPegBestOrder = (orderType: OrderType): boolean => {
if (orderType == OrderType.PEG_BEST || (orderType as string) == "PEGBEST")
return true;
else return false;
};

export const isPegMidOrder = (orderType: OrderType): boolean => {
if (orderType == OrderType.PEG_MID || (orderType as string) == "PEGMID")
return true;
else return false;
};

export default OrderType;
2 changes: 2 additions & 0 deletions src/api/order/execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export interface Execution {
* Requires TWS 968+ and API v973.05+.
*/
lastLiquidity?: Liquidities;

pendingPriceRevision?: boolean;
}

export default Execution;
2 changes: 1 addition & 1 deletion src/api/order/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export interface Order {
/** The Financial Advisor group the trade will be allocated to. Use an empty string if not applicable. */
faGroup?: string;

/** The Financial Advisor allocation profile the trade will be allocated to. Use an empty string if not applicable. */
/** @deprecated The Financial Advisor allocation profile the trade will be allocated to. Use an empty string if not applicable. */
faProfile?: string;

/** The Financial Advisor allocation method the trade will be allocated to. Use an empty string if not applicable.FaMethod */
Expand Down
3 changes: 3 additions & 0 deletions src/common/errorCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,7 @@ export enum ErrorCode {

/* Requested market data is not subscribed. Displaying delayed market data. */
DISPLAYING_DELAYED_DATA = 10167,

/* News feed is not allowed. */
NEWS_FEED_NOT_ALLOWED = 10276,
}
Loading

0 comments on commit b43d599

Please sign in to comment.