@stoqey/ib
Advanced tools
Comparing version 1.3.10 to 1.3.11
@@ -424,3 +424,3 @@ import { Observable, Subject } from "rxjs"; | ||
* @param barSizeSetting the size of the bar: | ||
* - 1 sec | ||
* - 1 secs | ||
* - 5 secs | ||
@@ -463,3 +463,3 @@ * - 15 secs | ||
* @param barSizeSetting the size of the bar: | ||
* - 1 sec | ||
* - 1 secs | ||
* - 5 secs | ||
@@ -466,0 +466,0 @@ * - 15 secs |
@@ -1,14 +0,14 @@ | ||
export { AccountSummaries, AccountSummaryTagName, AccountSummaryTagValues, AccountSummaryValue, AccountSummaryValues, AccountSummariesUpdate, } from "./account/account-summary"; | ||
export { AccountUpdate, AccountUpdatesUpdate, } from "./account/account-update"; | ||
export { AccountSummaries, AccountSummariesUpdate, AccountSummaryTagName, AccountSummaryTagValues, AccountSummaryValue, AccountSummaryValues, } from "./account/account-summary"; | ||
export { AccountUpdate, AccountUpdatesUpdate } from "./account/account-update"; | ||
export { AccountId, ConId, CurrencyCode } from "./common/common-types"; | ||
export { ConnectionState } from "./common/connection-state"; | ||
export { IBApiNextError } from "./common/error"; | ||
export { ItemListUpdate } from "./common/item-list-update"; | ||
export { Logger } from "./common/logger"; | ||
export { ItemListUpdate } from "./common/item-list-update"; | ||
export { ConnectionState } from "./common/connection-state"; | ||
export { ContractDetailsUpdate } from "./contract/contract-details-update"; | ||
export { SecurityDefinitionOptionParameterType } from "./contract/sec-def-opt-param-type"; | ||
export { MarketDataTick, MarketDataTicks, MarketDataUpdate, } from "./market/market-data"; | ||
export { MarketDataType } from "./market/market-data-type"; | ||
export { MarketDataTick, MarketDataTicks, MarketDataUpdate, } from "./market/market-data"; | ||
export { IBApiTickType }; | ||
import { TickType as IBApiTickType } from "../api/market/tickType"; | ||
export { IBApiTickType }; | ||
import { TickType as IBApiNextTickType } from "./market/tick-type"; | ||
@@ -18,7 +18,8 @@ export { IBApiNextTickType }; | ||
export { PnLSingle } from "./pnl/pnl-single"; | ||
export { Position, AccountPositions, AccountPositionsUpdate, } from "./position/position"; | ||
export { OrderBookRow, OrderBookRowPosition, OrderBookRows, OrderBook, OrderBookUpdate, } from "./market-depth/order-book"; | ||
export { AccountPositions, AccountPositionsUpdate, Position, } from "./position/position"; | ||
export { OrderBook, OrderBookRow, OrderBookRowPosition, OrderBookRows, OrderBookUpdate, } from "./market-depth/order-book"; | ||
export { ExecutionDetail } from "./order/execution-detail"; | ||
export { OpenOrder } from "./order/open-order"; | ||
export { OpenOrdersUpdate } from "./order/open-order-update"; | ||
export { ExecutionDetail } from "./order/execution-detail"; | ||
export { MarketScannerItem, MarketScannerItemRank, MarketScannerRows, MarketScannerUpdate, } from "./market-scanner/market-scanner"; | ||
export { IBApiNext, IBApiNextCreationOptions } from "./api-next"; |
@@ -7,3 +7,2 @@ "use strict"; | ||
Object.defineProperty(exports, "ConnectionState", { enumerable: true, get: function () { return connection_state_1.ConnectionState; } }); | ||
// market | ||
var market_data_type_1 = require("./market/market-data-type"); | ||
@@ -10,0 +9,0 @@ Object.defineProperty(exports, "MarketDataType", { enumerable: true, get: function () { return market_data_type_1.MarketDataType; } }); |
@@ -14,207 +14,2 @@ import ContractDetails from "../../api/contract/contractDetails"; | ||
export type MarketScannerUpdate = ItemListUpdate<MarketScannerRows>; | ||
export declare enum LocationCode { | ||
BOND_US = "BOND.US", | ||
EFP = "EFP", | ||
FUT_EU_BELFOX = "FUT.EU.BELFOX", | ||
FUT_EU_FTA = "FUT.EU.FTA", | ||
FUT_EU_IDEM = "FUT.EU.IDEM", | ||
FUT_EU_LIFFE = "FUT.EU.LIFFE", | ||
FUT_EU_MEFFRV = "FUT.EU.MEFFRV", | ||
FUT_EU_MONEP = "FUT.EU.MONEP", | ||
FUT_EU = "FUT.EU", | ||
FUT_HK_HKFE = "FUT.HK.HKFE", | ||
FUT_HK_JAPAN = "FUT.HK.JAPAN", | ||
FUT_HK_KSE = "FUT.HK.KSE", | ||
FUT_HK_NSE = "FUT.HK.NSE", | ||
FUT_HK_OSE_JPN = "FUT.HK.OSE.JPN", | ||
FUT_HK_SGX = "FUT.HK.SGX", | ||
FUT_HK_SNFE = "FUT.HK.SNFE", | ||
FUT_HK_TSE_JPN = "FUT.HK.TSE.JPN", | ||
FUT_HK = "FUT.HK", | ||
FUT_IPE = "FUT.IPE", | ||
FUT_NA_CDE = "FUT.NA.CDE", | ||
FUT_NA = "FUT.NA", | ||
FUT_NYBOT = "FUT.NYBOT", | ||
FUT_NYSELIFFE = "FUT.NYSELIFFE", | ||
FUT_US = "FUT.US", | ||
IND_EU_BELFOX = "IND.EU.BELFOX", | ||
IND_EU_FTA = "IND.EU.FTA", | ||
IND_EU_LIFFE = "IND.EU.LIFFE", | ||
IND_EU_MONEP = "IND.EU.MONEP", | ||
IND_EU = "IND.EU", | ||
IND_HK_HKFE = "IND.HK.HKFE", | ||
IND_HK_JAPAN = "IND.HK.JAPAN", | ||
IND_HK_KSE = "IND.HK.KSE", | ||
IND_HK_NSE = "IND.HK.NSE", | ||
IND_HK_OSE_JPN = "IND.HK.OSE.JPN", | ||
IND_HK_SGX = "IND.HK.SGX", | ||
IND_HK_SNFE = "IND.HK.SNFE", | ||
IND_HK_TSE_JPN = "IND.HK.TSE.JPN", | ||
IND_HK = "IND.HK", | ||
IND_US = "IND.US", | ||
SLB_AQS = "SLB.AQS", | ||
STK_AMEX = "STK.AMEX", | ||
STK_ARCA = "STK.ARCA", | ||
STK_EU_AEB = "STK.EU.AEB", | ||
STK_EU_BM = "STK.EU.BM", | ||
STK_EU_BVME = "STK.EU.BVME", | ||
STK_EU_EBS = "STK.EU.EBS", | ||
STK_EU_IBIS = "STK.EU.IBIS", | ||
STK_EU_IBIS_ETF = "STK.EU.IBIS-ETF", | ||
STK_EU_IBIS_EUSTARS = "STK.EU.IBIS-EUSTARS", | ||
STK_EU_IBIS_NEWX = "STK.EU.IBIS-NEWX", | ||
STK_EU_IBIS_USSTARS = "STK.EU.IBIS-USSTARS", | ||
STK_EU_IBIS_XETRA = "STK.EU.IBIS-XETRA", | ||
STK_EU_LSE = "STK.EU.LSE", | ||
STK_EU_SBF = "STK.EU.SBF", | ||
STK_EU_SBVM = "STK.EU.SBVM", | ||
STK_EU_SFB = "STK.EU.SFB", | ||
STK_EU_SWISS = "STK.EU.SWISS", | ||
STK_EU_VIRTX = "STK.EU.VIRTX", | ||
STK_EU = "STK.EU", | ||
STK_HK_ASX = "STK.HK.ASX", | ||
STK_HK_NSE = "STK.HK.NSE", | ||
STK_HK_SEHK = "STK.HK.SEHK", | ||
STK_HK_SGX = "STK.HK.SGX", | ||
STK_HK_TSE_JPN = "STK.HK.TSE.JPN", | ||
STK_HK = "STK.HK", | ||
STK_NA_CANADA = "STK.NA.CANADA", | ||
STK_NA_TSE = "STK.NA.TSE", | ||
STK_NA_VENTURE = "STK.NA.VENTURE", | ||
STK_NA = "STK.NA", | ||
STK_NASDAQ_NMS = "STK.NASDAQ.NMS", | ||
STK_NASDAQ_SCM = "STK.NASDAQ.SCM", | ||
STK_NASDAQ = "STK.NASDAQ", | ||
STK_NYSE = "STK.NYSE", | ||
STK_OTCBB = "STK.OTCBB", | ||
STK_PINK = "STK.PINK", | ||
STK_US_MAJOR = "STK.US.MAJOR", | ||
STK_US_MINOR = "STK.US.MINOR", | ||
STK_US = "STK.US", | ||
WAR_EU_ALL = "WAR.EU.ALL" | ||
} | ||
export declare enum Instrument { | ||
STK = "STK", | ||
BOND = "BOND", | ||
EFP = "EFP", | ||
FUT_EU = "FUT.EU", | ||
FUT_HK = "FUT.HK", | ||
FUT_NA = "FUT.NA", | ||
FUT_US = "FUT.US", | ||
IND_EU = "IND.EU", | ||
IND_HK = "IND.HK", | ||
IND_US = "IND.US", | ||
PMONITOR = "PMONITOR", | ||
PMONITORM = "PMONITORM", | ||
SLB_US = "SLB.US", | ||
STOCK_EU = "STOCK.EU", | ||
STOCK_HK = "STOCK.HK", | ||
STOCK_NA = "STOCK.NA", | ||
WAR_EU = "WAR.EU" | ||
} | ||
export declare enum ScanCode { | ||
TOP_PERC_GAIN = 0, | ||
TOP_PERC_LOSE = 1, | ||
MOST_ACTIVE = 2, | ||
ALL_SYMBOLS_ASC = 3, | ||
ALL_SYMBOLS_DESC = 4, | ||
BOND_CUSIP_AZ = 5, | ||
BOND_CUSIP_ZA = 6, | ||
FAR_MATURITY_DATE = 7, | ||
HALTED = 8, | ||
HIGH_BOND_ASK_CURRENT_YIELD_ALL = 9, | ||
HIGH_BOND_ASK_YIELD_ALL = 10, | ||
HIGH_BOND_DEBT_2_BOOK_RATIO = 11, | ||
HIGH_BOND_DEBT_2_EQUITY_RATIO = 12, | ||
HIGH_BOND_DEBT_2_TAN_BOOK_RATIO = 13, | ||
HIGH_BOND_EQUITY_2_BOOK_RATIO = 14, | ||
HIGH_BOND_EQUITY_2_TAN_BOOK_RATIO = 15, | ||
HIGH_BOND_NET_ASK_CURRENT_YIELD_ALL = 16, | ||
HIGH_BOND_NET_ASK_YIELD_ALL = 17, | ||
HIGH_BOND_NET_SPREAD_ALL = 18, | ||
HIGH_BOND_SPREAD_ALL = 19, | ||
HIGH_COUPON_RATE = 20, | ||
HIGH_DIVIDEND_YIELD = 21, | ||
HIGH_DIVIDEND_YIELD_IB = 22, | ||
HIGHEST_SLB_BID = 23, | ||
HIGH_GROWTH_RATE = 24, | ||
HIGH_MOODY_RATING_ALL = 25, | ||
HIGH_OPEN_GAP = 26, | ||
HIGH_OPT_IMP_VOLAT = 27, | ||
HIGH_OPT_IMP_VOLAT_OVER_HIST = 28, | ||
HIGH_OPT_OPEN_INTEREST_PUT_CALL_RATIO = 29, | ||
HIGH_OPT_VOLUME_PUT_CALL_RATIO = 30, | ||
HIGH_PE_RATIO = 31, | ||
HIGH_PRICE_2_BOOK_RATIO = 32, | ||
HIGH_PRICE_2_TAN_BOOK_RATIO = 33, | ||
HIGH_QUICK_RATIO = 34, | ||
HIGH_RETURN_ON_EQUITY = 35, | ||
HIGH_SYNTH_BID_REV_NAT_YIELD = 36, | ||
HIGH_VS_13W_HL = 37, | ||
HIGH_VS_26W_HL = 38, | ||
HIGH_VS_52W_HL = 39, | ||
HOT_BY_OPT_VOLUME = 40, | ||
HOT_BY_PRICE = 41, | ||
HOT_BY_PRICE_RANGE = 42, | ||
HOT_BY_VOLUME = 43, | ||
LIMIT_UP_DOWN = 44, | ||
LOW_BOND_BID_CURRENT_YIELD_ALL = 45, | ||
LOW_BOND_BID_YIELD_ALL = 46, | ||
LOW_BOND_DEBT_2_BOOK_RATIO = 47, | ||
LOW_BOND_DEBT_2_EQUITY_RATIO = 48, | ||
LOW_BOND_DEBT_2_TAN_BOOK_RATIO = 49, | ||
LOW_BOND_EQUITY_2_BOOK_RATIO = 50, | ||
LOW_BOND_EQUITY_2_TAN_BOOK_RATIO = 51, | ||
LOW_BOND_NET_BID_CURRENT_YIELD_ALL = 52, | ||
LOW_BOND_NET_BID_YIELD_ALL = 53, | ||
LOW_BOND_NET_SPREAD_ALL = 54, | ||
LOW_BOND_SPREAD_ALL = 55, | ||
LOW_COUPON_RATE = 56, | ||
LOWEST_SLB_ASK = 57, | ||
LOW_GROWTH_RATE = 58, | ||
LOW_MOODY_RATING_ALL = 59, | ||
LOW_OPEN_GAP = 60, | ||
LOW_OPT_IMP_VOLAT = 61, | ||
LOW_OPT_IMP_VOLAT_OVER_HIST = 62, | ||
LOW_OPT_OPEN_INTEREST_PUT_CALL_RATIO = 63, | ||
LOW_OPT_VOLUME_PUT_CALL_RATIO = 64, | ||
LOW_PE_RATIO = 65, | ||
LOW_PRICE_2_BOOK_RATIO = 66, | ||
LOW_PRICE_2_TAN_BOOK_RATIO = 67, | ||
LOW_QUICK_RATIO = 68, | ||
LOW_RETURN_ON_EQUITY = 69, | ||
LOW_SYNTH_ASK_REV_NAT_YIELD = 70, | ||
LOW_VS_13W_HL = 71, | ||
LOW_VS_26W_HL = 72, | ||
LOW_VS_52W_HL = 73, | ||
LOW_WAR_REL_IMP_VOLAT = 74, | ||
MARKET_CAP_USD_ASC = 75, | ||
MARKET_CAP_USD_DESC = 76, | ||
MOST_ACTIVE_AVG_USD = 77, | ||
MOST_ACTIVE_USD = 78, | ||
NEAR_MATURITY_DATE = 79, | ||
NOT_OPEN = 80, | ||
OPT_OPEN_INTEREST_MOST_ACTIVE = 81, | ||
OPT_VOLUME_MOST_ACTIVE = 82, | ||
PMONITOR_AVAIL_CONTRACTS = 83, | ||
PMONITOR_CTT = 84, | ||
PMONITOR_IBOND = 85, | ||
PMONITOR_RFQ = 86, | ||
TOP_OPEN_PERC_GAIN = 87, | ||
TOP_OPEN_PERC_LOSE = 88, | ||
TOP_OPT_IMP_VOLAT_GAIN = 89, | ||
TOP_OPT_IMP_VOLAT_LOSE = 90, | ||
TOP_PRICE_RANGE = 91, | ||
TOP_STOCK_BUY_IMBALANCE_ADV_RATIO = 92, | ||
TOP_STOCK_SELL_IMBALANCE_ADV_RATIO = 93, | ||
TOP_TRADE_COUNT = 94, | ||
TOP_TRADE_RATE = 95, | ||
TOP_VOLUME_RATE = 96, | ||
WSH_NEXT_ANALYST_MEETING = 97, | ||
WSH_NEXT_EARNINGS = 98, | ||
WSH_NEXT_EVENT = 99, | ||
WSH_NEXT_MAJOR_EVENT = 100, | ||
WSH_PREV_ANALYST_MEETING = 101, | ||
WSH_PREV_EARNINGS = 102, | ||
WSH_PREV_EVENT = 103 | ||
} | ||
export { Instrument, LocationCode, ScanCode, } from "../../api/market-scanner/market-scanner"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ScanCode = exports.Instrument = exports.LocationCode = void 0; | ||
var LocationCode; | ||
(function (LocationCode) { | ||
LocationCode["BOND_US"] = "BOND.US"; | ||
LocationCode["EFP"] = "EFP"; | ||
// FUT_ECBOT = "FUT.ECBOT", | ||
LocationCode["FUT_EU_BELFOX"] = "FUT.EU.BELFOX"; | ||
// FUT_EU_DTB = "FUT.EU.DTB", | ||
LocationCode["FUT_EU_FTA"] = "FUT.EU.FTA"; | ||
LocationCode["FUT_EU_IDEM"] = "FUT.EU.IDEM"; | ||
LocationCode["FUT_EU_LIFFE"] = "FUT.EU.LIFFE"; | ||
LocationCode["FUT_EU_MEFFRV"] = "FUT.EU.MEFFRV"; | ||
LocationCode["FUT_EU_MONEP"] = "FUT.EU.MONEP"; | ||
LocationCode["FUT_EU"] = "FUT.EU"; | ||
// FUT_GLOBEX = "FUT.GLOBEX", | ||
LocationCode["FUT_HK_HKFE"] = "FUT.HK.HKFE"; | ||
LocationCode["FUT_HK_JAPAN"] = "FUT.HK.JAPAN"; | ||
LocationCode["FUT_HK_KSE"] = "FUT.HK.KSE"; | ||
LocationCode["FUT_HK_NSE"] = "FUT.HK.NSE"; | ||
LocationCode["FUT_HK_OSE_JPN"] = "FUT.HK.OSE.JPN"; | ||
LocationCode["FUT_HK_SGX"] = "FUT.HK.SGX"; | ||
LocationCode["FUT_HK_SNFE"] = "FUT.HK.SNFE"; | ||
LocationCode["FUT_HK_TSE_JPN"] = "FUT.HK.TSE.JPN"; | ||
LocationCode["FUT_HK"] = "FUT.HK"; | ||
LocationCode["FUT_IPE"] = "FUT.IPE"; | ||
LocationCode["FUT_NA_CDE"] = "FUT.NA.CDE"; | ||
LocationCode["FUT_NA"] = "FUT.NA"; | ||
LocationCode["FUT_NYBOT"] = "FUT.NYBOT"; | ||
// FUT_NYMEX = "FUT.NYMEX", | ||
LocationCode["FUT_NYSELIFFE"] = "FUT.NYSELIFFE"; | ||
LocationCode["FUT_US"] = "FUT.US"; | ||
LocationCode["IND_EU_BELFOX"] = "IND.EU.BELFOX"; | ||
// IND_EU_DTB = "IND.EU.DTB", | ||
LocationCode["IND_EU_FTA"] = "IND.EU.FTA"; | ||
LocationCode["IND_EU_LIFFE"] = "IND.EU.LIFFE"; | ||
LocationCode["IND_EU_MONEP"] = "IND.EU.MONEP"; | ||
LocationCode["IND_EU"] = "IND.EU"; | ||
LocationCode["IND_HK_HKFE"] = "IND.HK.HKFE"; | ||
LocationCode["IND_HK_JAPAN"] = "IND.HK.JAPAN"; | ||
LocationCode["IND_HK_KSE"] = "IND.HK.KSE"; | ||
LocationCode["IND_HK_NSE"] = "IND.HK.NSE"; | ||
LocationCode["IND_HK_OSE_JPN"] = "IND.HK.OSE.JPN"; | ||
LocationCode["IND_HK_SGX"] = "IND.HK.SGX"; | ||
LocationCode["IND_HK_SNFE"] = "IND.HK.SNFE"; | ||
LocationCode["IND_HK_TSE_JPN"] = "IND.HK.TSE.JPN"; | ||
LocationCode["IND_HK"] = "IND.HK"; | ||
LocationCode["IND_US"] = "IND.US"; | ||
LocationCode["SLB_AQS"] = "SLB.AQS"; | ||
LocationCode["STK_AMEX"] = "STK.AMEX"; | ||
LocationCode["STK_ARCA"] = "STK.ARCA"; | ||
LocationCode["STK_EU_AEB"] = "STK.EU.AEB"; | ||
LocationCode["STK_EU_BM"] = "STK.EU.BM"; | ||
LocationCode["STK_EU_BVME"] = "STK.EU.BVME"; | ||
LocationCode["STK_EU_EBS"] = "STK.EU.EBS"; | ||
LocationCode["STK_EU_IBIS"] = "STK.EU.IBIS"; | ||
LocationCode["STK_EU_IBIS_ETF"] = "STK.EU.IBIS-ETF"; | ||
LocationCode["STK_EU_IBIS_EUSTARS"] = "STK.EU.IBIS-EUSTARS"; | ||
LocationCode["STK_EU_IBIS_NEWX"] = "STK.EU.IBIS-NEWX"; | ||
LocationCode["STK_EU_IBIS_USSTARS"] = "STK.EU.IBIS-USSTARS"; | ||
LocationCode["STK_EU_IBIS_XETRA"] = "STK.EU.IBIS-XETRA"; | ||
LocationCode["STK_EU_LSE"] = "STK.EU.LSE"; | ||
LocationCode["STK_EU_SBF"] = "STK.EU.SBF"; | ||
LocationCode["STK_EU_SBVM"] = "STK.EU.SBVM"; | ||
LocationCode["STK_EU_SFB"] = "STK.EU.SFB"; | ||
LocationCode["STK_EU_SWISS"] = "STK.EU.SWISS"; | ||
LocationCode["STK_EU_VIRTX"] = "STK.EU.VIRTX"; | ||
LocationCode["STK_EU"] = "STK.EU"; | ||
LocationCode["STK_HK_ASX"] = "STK.HK.ASX"; | ||
LocationCode["STK_HK_NSE"] = "STK.HK.NSE"; | ||
LocationCode["STK_HK_SEHK"] = "STK.HK.SEHK"; | ||
LocationCode["STK_HK_SGX"] = "STK.HK.SGX"; | ||
LocationCode["STK_HK_TSE_JPN"] = "STK.HK.TSE.JPN"; | ||
LocationCode["STK_HK"] = "STK.HK"; | ||
LocationCode["STK_NA_CANADA"] = "STK.NA.CANADA"; | ||
LocationCode["STK_NA_TSE"] = "STK.NA.TSE"; | ||
LocationCode["STK_NA_VENTURE"] = "STK.NA.VENTURE"; | ||
LocationCode["STK_NA"] = "STK.NA"; | ||
LocationCode["STK_NASDAQ_NMS"] = "STK.NASDAQ.NMS"; | ||
LocationCode["STK_NASDAQ_SCM"] = "STK.NASDAQ.SCM"; | ||
LocationCode["STK_NASDAQ"] = "STK.NASDAQ"; | ||
LocationCode["STK_NYSE"] = "STK.NYSE"; | ||
LocationCode["STK_OTCBB"] = "STK.OTCBB"; | ||
LocationCode["STK_PINK"] = "STK.PINK"; | ||
LocationCode["STK_US_MAJOR"] = "STK.US.MAJOR"; | ||
LocationCode["STK_US_MINOR"] = "STK.US.MINOR"; | ||
LocationCode["STK_US"] = "STK.US"; | ||
LocationCode["WAR_EU_ALL"] = "WAR.EU.ALL"; | ||
})(LocationCode || (exports.LocationCode = LocationCode = {})); | ||
var Instrument; | ||
(function (Instrument) { | ||
Instrument["STK"] = "STK"; | ||
Instrument["BOND"] = "BOND"; | ||
Instrument["EFP"] = "EFP"; | ||
Instrument["FUT_EU"] = "FUT.EU"; | ||
Instrument["FUT_HK"] = "FUT.HK"; | ||
Instrument["FUT_NA"] = "FUT.NA"; | ||
Instrument["FUT_US"] = "FUT.US"; | ||
Instrument["IND_EU"] = "IND.EU"; | ||
Instrument["IND_HK"] = "IND.HK"; | ||
Instrument["IND_US"] = "IND.US"; | ||
Instrument["PMONITOR"] = "PMONITOR"; | ||
Instrument["PMONITORM"] = "PMONITORM"; | ||
Instrument["SLB_US"] = "SLB.US"; | ||
Instrument["STOCK_EU"] = "STOCK.EU"; | ||
Instrument["STOCK_HK"] = "STOCK.HK"; | ||
Instrument["STOCK_NA"] = "STOCK.NA"; | ||
Instrument["WAR_EU"] = "WAR.EU"; | ||
})(Instrument || (exports.Instrument = Instrument = {})); | ||
var ScanCode; | ||
(function (ScanCode) { | ||
ScanCode[ScanCode["TOP_PERC_GAIN"] = 0] = "TOP_PERC_GAIN"; | ||
ScanCode[ScanCode["TOP_PERC_LOSE"] = 1] = "TOP_PERC_LOSE"; | ||
ScanCode[ScanCode["MOST_ACTIVE"] = 2] = "MOST_ACTIVE"; | ||
ScanCode[ScanCode["ALL_SYMBOLS_ASC"] = 3] = "ALL_SYMBOLS_ASC"; | ||
ScanCode[ScanCode["ALL_SYMBOLS_DESC"] = 4] = "ALL_SYMBOLS_DESC"; | ||
ScanCode[ScanCode["BOND_CUSIP_AZ"] = 5] = "BOND_CUSIP_AZ"; | ||
ScanCode[ScanCode["BOND_CUSIP_ZA"] = 6] = "BOND_CUSIP_ZA"; | ||
ScanCode[ScanCode["FAR_MATURITY_DATE"] = 7] = "FAR_MATURITY_DATE"; | ||
ScanCode[ScanCode["HALTED"] = 8] = "HALTED"; | ||
ScanCode[ScanCode["HIGH_BOND_ASK_CURRENT_YIELD_ALL"] = 9] = "HIGH_BOND_ASK_CURRENT_YIELD_ALL"; | ||
ScanCode[ScanCode["HIGH_BOND_ASK_YIELD_ALL"] = 10] = "HIGH_BOND_ASK_YIELD_ALL"; | ||
ScanCode[ScanCode["HIGH_BOND_DEBT_2_BOOK_RATIO"] = 11] = "HIGH_BOND_DEBT_2_BOOK_RATIO"; | ||
ScanCode[ScanCode["HIGH_BOND_DEBT_2_EQUITY_RATIO"] = 12] = "HIGH_BOND_DEBT_2_EQUITY_RATIO"; | ||
ScanCode[ScanCode["HIGH_BOND_DEBT_2_TAN_BOOK_RATIO"] = 13] = "HIGH_BOND_DEBT_2_TAN_BOOK_RATIO"; | ||
ScanCode[ScanCode["HIGH_BOND_EQUITY_2_BOOK_RATIO"] = 14] = "HIGH_BOND_EQUITY_2_BOOK_RATIO"; | ||
ScanCode[ScanCode["HIGH_BOND_EQUITY_2_TAN_BOOK_RATIO"] = 15] = "HIGH_BOND_EQUITY_2_TAN_BOOK_RATIO"; | ||
ScanCode[ScanCode["HIGH_BOND_NET_ASK_CURRENT_YIELD_ALL"] = 16] = "HIGH_BOND_NET_ASK_CURRENT_YIELD_ALL"; | ||
ScanCode[ScanCode["HIGH_BOND_NET_ASK_YIELD_ALL"] = 17] = "HIGH_BOND_NET_ASK_YIELD_ALL"; | ||
ScanCode[ScanCode["HIGH_BOND_NET_SPREAD_ALL"] = 18] = "HIGH_BOND_NET_SPREAD_ALL"; | ||
ScanCode[ScanCode["HIGH_BOND_SPREAD_ALL"] = 19] = "HIGH_BOND_SPREAD_ALL"; | ||
ScanCode[ScanCode["HIGH_COUPON_RATE"] = 20] = "HIGH_COUPON_RATE"; | ||
ScanCode[ScanCode["HIGH_DIVIDEND_YIELD"] = 21] = "HIGH_DIVIDEND_YIELD"; | ||
ScanCode[ScanCode["HIGH_DIVIDEND_YIELD_IB"] = 22] = "HIGH_DIVIDEND_YIELD_IB"; | ||
ScanCode[ScanCode["HIGHEST_SLB_BID"] = 23] = "HIGHEST_SLB_BID"; | ||
ScanCode[ScanCode["HIGH_GROWTH_RATE"] = 24] = "HIGH_GROWTH_RATE"; | ||
ScanCode[ScanCode["HIGH_MOODY_RATING_ALL"] = 25] = "HIGH_MOODY_RATING_ALL"; | ||
ScanCode[ScanCode["HIGH_OPEN_GAP"] = 26] = "HIGH_OPEN_GAP"; | ||
ScanCode[ScanCode["HIGH_OPT_IMP_VOLAT"] = 27] = "HIGH_OPT_IMP_VOLAT"; | ||
ScanCode[ScanCode["HIGH_OPT_IMP_VOLAT_OVER_HIST"] = 28] = "HIGH_OPT_IMP_VOLAT_OVER_HIST"; | ||
ScanCode[ScanCode["HIGH_OPT_OPEN_INTEREST_PUT_CALL_RATIO"] = 29] = "HIGH_OPT_OPEN_INTEREST_PUT_CALL_RATIO"; | ||
ScanCode[ScanCode["HIGH_OPT_VOLUME_PUT_CALL_RATIO"] = 30] = "HIGH_OPT_VOLUME_PUT_CALL_RATIO"; | ||
ScanCode[ScanCode["HIGH_PE_RATIO"] = 31] = "HIGH_PE_RATIO"; | ||
ScanCode[ScanCode["HIGH_PRICE_2_BOOK_RATIO"] = 32] = "HIGH_PRICE_2_BOOK_RATIO"; | ||
ScanCode[ScanCode["HIGH_PRICE_2_TAN_BOOK_RATIO"] = 33] = "HIGH_PRICE_2_TAN_BOOK_RATIO"; | ||
ScanCode[ScanCode["HIGH_QUICK_RATIO"] = 34] = "HIGH_QUICK_RATIO"; | ||
ScanCode[ScanCode["HIGH_RETURN_ON_EQUITY"] = 35] = "HIGH_RETURN_ON_EQUITY"; | ||
ScanCode[ScanCode["HIGH_SYNTH_BID_REV_NAT_YIELD"] = 36] = "HIGH_SYNTH_BID_REV_NAT_YIELD"; | ||
ScanCode[ScanCode["HIGH_VS_13W_HL"] = 37] = "HIGH_VS_13W_HL"; | ||
ScanCode[ScanCode["HIGH_VS_26W_HL"] = 38] = "HIGH_VS_26W_HL"; | ||
ScanCode[ScanCode["HIGH_VS_52W_HL"] = 39] = "HIGH_VS_52W_HL"; | ||
ScanCode[ScanCode["HOT_BY_OPT_VOLUME"] = 40] = "HOT_BY_OPT_VOLUME"; | ||
ScanCode[ScanCode["HOT_BY_PRICE"] = 41] = "HOT_BY_PRICE"; | ||
ScanCode[ScanCode["HOT_BY_PRICE_RANGE"] = 42] = "HOT_BY_PRICE_RANGE"; | ||
ScanCode[ScanCode["HOT_BY_VOLUME"] = 43] = "HOT_BY_VOLUME"; | ||
ScanCode[ScanCode["LIMIT_UP_DOWN"] = 44] = "LIMIT_UP_DOWN"; | ||
ScanCode[ScanCode["LOW_BOND_BID_CURRENT_YIELD_ALL"] = 45] = "LOW_BOND_BID_CURRENT_YIELD_ALL"; | ||
ScanCode[ScanCode["LOW_BOND_BID_YIELD_ALL"] = 46] = "LOW_BOND_BID_YIELD_ALL"; | ||
ScanCode[ScanCode["LOW_BOND_DEBT_2_BOOK_RATIO"] = 47] = "LOW_BOND_DEBT_2_BOOK_RATIO"; | ||
ScanCode[ScanCode["LOW_BOND_DEBT_2_EQUITY_RATIO"] = 48] = "LOW_BOND_DEBT_2_EQUITY_RATIO"; | ||
ScanCode[ScanCode["LOW_BOND_DEBT_2_TAN_BOOK_RATIO"] = 49] = "LOW_BOND_DEBT_2_TAN_BOOK_RATIO"; | ||
ScanCode[ScanCode["LOW_BOND_EQUITY_2_BOOK_RATIO"] = 50] = "LOW_BOND_EQUITY_2_BOOK_RATIO"; | ||
ScanCode[ScanCode["LOW_BOND_EQUITY_2_TAN_BOOK_RATIO"] = 51] = "LOW_BOND_EQUITY_2_TAN_BOOK_RATIO"; | ||
ScanCode[ScanCode["LOW_BOND_NET_BID_CURRENT_YIELD_ALL"] = 52] = "LOW_BOND_NET_BID_CURRENT_YIELD_ALL"; | ||
ScanCode[ScanCode["LOW_BOND_NET_BID_YIELD_ALL"] = 53] = "LOW_BOND_NET_BID_YIELD_ALL"; | ||
ScanCode[ScanCode["LOW_BOND_NET_SPREAD_ALL"] = 54] = "LOW_BOND_NET_SPREAD_ALL"; | ||
ScanCode[ScanCode["LOW_BOND_SPREAD_ALL"] = 55] = "LOW_BOND_SPREAD_ALL"; | ||
ScanCode[ScanCode["LOW_COUPON_RATE"] = 56] = "LOW_COUPON_RATE"; | ||
ScanCode[ScanCode["LOWEST_SLB_ASK"] = 57] = "LOWEST_SLB_ASK"; | ||
ScanCode[ScanCode["LOW_GROWTH_RATE"] = 58] = "LOW_GROWTH_RATE"; | ||
ScanCode[ScanCode["LOW_MOODY_RATING_ALL"] = 59] = "LOW_MOODY_RATING_ALL"; | ||
ScanCode[ScanCode["LOW_OPEN_GAP"] = 60] = "LOW_OPEN_GAP"; | ||
ScanCode[ScanCode["LOW_OPT_IMP_VOLAT"] = 61] = "LOW_OPT_IMP_VOLAT"; | ||
ScanCode[ScanCode["LOW_OPT_IMP_VOLAT_OVER_HIST"] = 62] = "LOW_OPT_IMP_VOLAT_OVER_HIST"; | ||
ScanCode[ScanCode["LOW_OPT_OPEN_INTEREST_PUT_CALL_RATIO"] = 63] = "LOW_OPT_OPEN_INTEREST_PUT_CALL_RATIO"; | ||
ScanCode[ScanCode["LOW_OPT_VOLUME_PUT_CALL_RATIO"] = 64] = "LOW_OPT_VOLUME_PUT_CALL_RATIO"; | ||
ScanCode[ScanCode["LOW_PE_RATIO"] = 65] = "LOW_PE_RATIO"; | ||
ScanCode[ScanCode["LOW_PRICE_2_BOOK_RATIO"] = 66] = "LOW_PRICE_2_BOOK_RATIO"; | ||
ScanCode[ScanCode["LOW_PRICE_2_TAN_BOOK_RATIO"] = 67] = "LOW_PRICE_2_TAN_BOOK_RATIO"; | ||
ScanCode[ScanCode["LOW_QUICK_RATIO"] = 68] = "LOW_QUICK_RATIO"; | ||
ScanCode[ScanCode["LOW_RETURN_ON_EQUITY"] = 69] = "LOW_RETURN_ON_EQUITY"; | ||
ScanCode[ScanCode["LOW_SYNTH_ASK_REV_NAT_YIELD"] = 70] = "LOW_SYNTH_ASK_REV_NAT_YIELD"; | ||
ScanCode[ScanCode["LOW_VS_13W_HL"] = 71] = "LOW_VS_13W_HL"; | ||
ScanCode[ScanCode["LOW_VS_26W_HL"] = 72] = "LOW_VS_26W_HL"; | ||
ScanCode[ScanCode["LOW_VS_52W_HL"] = 73] = "LOW_VS_52W_HL"; | ||
ScanCode[ScanCode["LOW_WAR_REL_IMP_VOLAT"] = 74] = "LOW_WAR_REL_IMP_VOLAT"; | ||
ScanCode[ScanCode["MARKET_CAP_USD_ASC"] = 75] = "MARKET_CAP_USD_ASC"; | ||
ScanCode[ScanCode["MARKET_CAP_USD_DESC"] = 76] = "MARKET_CAP_USD_DESC"; | ||
ScanCode[ScanCode["MOST_ACTIVE_AVG_USD"] = 77] = "MOST_ACTIVE_AVG_USD"; | ||
ScanCode[ScanCode["MOST_ACTIVE_USD"] = 78] = "MOST_ACTIVE_USD"; | ||
ScanCode[ScanCode["NEAR_MATURITY_DATE"] = 79] = "NEAR_MATURITY_DATE"; | ||
ScanCode[ScanCode["NOT_OPEN"] = 80] = "NOT_OPEN"; | ||
ScanCode[ScanCode["OPT_OPEN_INTEREST_MOST_ACTIVE"] = 81] = "OPT_OPEN_INTEREST_MOST_ACTIVE"; | ||
ScanCode[ScanCode["OPT_VOLUME_MOST_ACTIVE"] = 82] = "OPT_VOLUME_MOST_ACTIVE"; | ||
ScanCode[ScanCode["PMONITOR_AVAIL_CONTRACTS"] = 83] = "PMONITOR_AVAIL_CONTRACTS"; | ||
ScanCode[ScanCode["PMONITOR_CTT"] = 84] = "PMONITOR_CTT"; | ||
ScanCode[ScanCode["PMONITOR_IBOND"] = 85] = "PMONITOR_IBOND"; | ||
ScanCode[ScanCode["PMONITOR_RFQ"] = 86] = "PMONITOR_RFQ"; | ||
ScanCode[ScanCode["TOP_OPEN_PERC_GAIN"] = 87] = "TOP_OPEN_PERC_GAIN"; | ||
ScanCode[ScanCode["TOP_OPEN_PERC_LOSE"] = 88] = "TOP_OPEN_PERC_LOSE"; | ||
ScanCode[ScanCode["TOP_OPT_IMP_VOLAT_GAIN"] = 89] = "TOP_OPT_IMP_VOLAT_GAIN"; | ||
ScanCode[ScanCode["TOP_OPT_IMP_VOLAT_LOSE"] = 90] = "TOP_OPT_IMP_VOLAT_LOSE"; | ||
ScanCode[ScanCode["TOP_PRICE_RANGE"] = 91] = "TOP_PRICE_RANGE"; | ||
ScanCode[ScanCode["TOP_STOCK_BUY_IMBALANCE_ADV_RATIO"] = 92] = "TOP_STOCK_BUY_IMBALANCE_ADV_RATIO"; | ||
ScanCode[ScanCode["TOP_STOCK_SELL_IMBALANCE_ADV_RATIO"] = 93] = "TOP_STOCK_SELL_IMBALANCE_ADV_RATIO"; | ||
ScanCode[ScanCode["TOP_TRADE_COUNT"] = 94] = "TOP_TRADE_COUNT"; | ||
ScanCode[ScanCode["TOP_TRADE_RATE"] = 95] = "TOP_TRADE_RATE"; | ||
ScanCode[ScanCode["TOP_VOLUME_RATE"] = 96] = "TOP_VOLUME_RATE"; | ||
ScanCode[ScanCode["WSH_NEXT_ANALYST_MEETING"] = 97] = "WSH_NEXT_ANALYST_MEETING"; | ||
ScanCode[ScanCode["WSH_NEXT_EARNINGS"] = 98] = "WSH_NEXT_EARNINGS"; | ||
ScanCode[ScanCode["WSH_NEXT_EVENT"] = 99] = "WSH_NEXT_EVENT"; | ||
ScanCode[ScanCode["WSH_NEXT_MAJOR_EVENT"] = 100] = "WSH_NEXT_MAJOR_EVENT"; | ||
ScanCode[ScanCode["WSH_PREV_ANALYST_MEETING"] = 101] = "WSH_PREV_ANALYST_MEETING"; | ||
ScanCode[ScanCode["WSH_PREV_EARNINGS"] = 102] = "WSH_PREV_EARNINGS"; | ||
ScanCode[ScanCode["WSH_PREV_EVENT"] = 103] = "WSH_PREV_EVENT"; | ||
})(ScanCode || (exports.ScanCode = ScanCode = {})); | ||
exports.ScanCode = exports.LocationCode = exports.Instrument = void 0; | ||
// for backward compatibility. Type moved to `api` | ||
var market_scanner_1 = require("../../api/market-scanner/market-scanner"); | ||
Object.defineProperty(exports, "Instrument", { enumerable: true, get: function () { return market_scanner_1.Instrument; } }); | ||
Object.defineProperty(exports, "LocationCode", { enumerable: true, get: function () { return market_scanner_1.LocationCode; } }); | ||
Object.defineProperty(exports, "ScanCode", { enumerable: true, get: function () { return market_scanner_1.ScanCode; } }); | ||
//# sourceMappingURL=market-scanner.js.map |
@@ -662,8 +662,11 @@ "use strict"; | ||
* @param endDateTime Request's ending time with format yyyyMMdd HH:mm:ss {TMZ} | ||
* @param durationStr The amount of time for which the data needs to be retrieved: | ||
* - " S (seconds) - " D (days) | ||
* - " W (weeks) - " M (months) | ||
* - " Y (years) | ||
* @param durationStr The amount of time for which the data needs to be retrieved (number space unit). | ||
* Note: min duration is "30 S", available units: | ||
* - S (seconds) | ||
* - D (days) | ||
* - W (weeks) | ||
* - M (months) | ||
* - Y (years) | ||
* @param barSizeSetting the size of the bar: | ||
* - 1 sec | ||
* - 1 secs | ||
* - 5 secs | ||
@@ -670,0 +673,0 @@ * - 15 secs |
@@ -12,6 +12,6 @@ import SecType from "../data/enum/sec-type"; | ||
multiplier: number; | ||
currency: string; | ||
constructor(symbol: string, localSymbol: string, lastTradeDateOrContractMonth: string, exchange: string, multiplier: number, currency: string); | ||
currency?: string; | ||
constructor(symbol: string, localSymbol: string, lastTradeDateOrContractMonth: string, exchange: string, multiplier: number, currency?: string); | ||
secType: SecType; | ||
} | ||
export default Future; |
@@ -20,2 +20,3 @@ "use strict"; | ||
this.secType = sec_type_1.default.FUT; | ||
this.currency = this.currency ?? "USD"; | ||
} | ||
@@ -22,0 +23,0 @@ } |
@@ -8,9 +8,7 @@ import SecType from "../data/enum/sec-type"; | ||
symbol: string; | ||
expiry: string; | ||
currency?: string; | ||
exchange?: string; | ||
multiplier?: number; | ||
constructor(symbol: string, expiry: string, currency?: string, exchange?: string, multiplier?: number); | ||
constructor(symbol: string, currency?: string, exchange?: string); | ||
secType: SecType; | ||
} | ||
export default Index; |
@@ -12,11 +12,9 @@ "use strict"; | ||
class Index { | ||
constructor(symbol, expiry, currency, exchange, multiplier) { | ||
constructor(symbol, currency, exchange) { | ||
this.symbol = symbol; | ||
this.expiry = expiry; | ||
this.currency = currency; | ||
this.exchange = exchange; | ||
this.multiplier = multiplier; | ||
this.secType = sec_type_1.default.IND; | ||
this.currency = this.currency ?? "USD"; | ||
this.exchange = this.exchange ?? "CBOE"; | ||
this.exchange = this.exchange ?? "CME"; | ||
} | ||
@@ -23,0 +21,0 @@ } |
@@ -25,5 +25,5 @@ /** | ||
DAYS_ONE = "1 day", | ||
WEEKS_ONE = "1W", | ||
MONTHS_ONE = "1M" | ||
WEEKS_ONE = "1 week", | ||
MONTHS_ONE = "1 month" | ||
} | ||
export default BarSizeSetting; |
@@ -29,6 +29,6 @@ "use strict"; | ||
BarSizeSetting["DAYS_ONE"] = "1 day"; | ||
BarSizeSetting["WEEKS_ONE"] = "1W"; | ||
BarSizeSetting["MONTHS_ONE"] = "1M"; | ||
BarSizeSetting["WEEKS_ONE"] = "1 week"; | ||
BarSizeSetting["MONTHS_ONE"] = "1 month"; | ||
})(BarSizeSetting || (exports.BarSizeSetting = BarSizeSetting = {})); | ||
exports.default = BarSizeSetting; | ||
//# sourceMappingURL=bar-size-setting.js.map |
@@ -9,2 +9,4 @@ /** | ||
ALREADY_CONNECTED = 501, | ||
/** Requested market data is not subscribed. Delayed market data is not available. */ | ||
REQ_MKT_DATA_NOT_AVAIL = 354, | ||
/** | ||
@@ -11,0 +13,0 @@ * Couldn't connect to TWS. |
@@ -14,2 +14,4 @@ "use strict"; | ||
ErrorCode[ErrorCode["ALREADY_CONNECTED"] = 501] = "ALREADY_CONNECTED"; | ||
/** Requested market data is not subscribed. Delayed market data is not available. */ | ||
ErrorCode[ErrorCode["REQ_MKT_DATA_NOT_AVAIL"] = 354] = "REQ_MKT_DATA_NOT_AVAIL"; | ||
/** | ||
@@ -16,0 +18,0 @@ * Couldn't connect to TWS. |
@@ -223,3 +223,3 @@ "use strict"; | ||
executeDisconnect() { | ||
if (this.socket.connected) { | ||
if (this.socket.status >= socket_1.ConnectionStatus.Connecting) { | ||
this.socket.disconnect(); | ||
@@ -226,0 +226,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { WhatToShow } from "../.."; | ||
import { MarketDataType, WhatToShow } from "../.."; | ||
import { Contract } from "../../api/contract/contract"; | ||
@@ -324,3 +324,3 @@ import WshEventData from "../../api/contract/wsh"; | ||
*/ | ||
reqMarketDataType(marketDataType: number): void; | ||
reqMarketDataType(marketDataType: MarketDataType): void; | ||
/** | ||
@@ -327,0 +327,0 @@ * Encode a REQ_MKT_DATA message. |
@@ -7,2 +7,9 @@ import { IBApiCreationOptions } from "../../api/api"; | ||
*/ | ||
export declare const ConnectionStatus: { | ||
readonly Disconnected: 0; | ||
readonly Disconnecting: 1; | ||
readonly Connecting: 2; | ||
readonly Connected: 3; | ||
}; | ||
export type ConnectionStatus = (typeof ConnectionStatus)[keyof typeof ConnectionStatus]; | ||
/** | ||
@@ -26,4 +33,4 @@ * @internal | ||
private client?; | ||
/** `true` if the TCP socket is connected and [[OUT_MSG_ID.START_API]] has been sent, `false` otherwise. */ | ||
private _connected; | ||
/** `connected` if the TCP socket is connected and [[OUT_MSG_ID.START_API]] has been sent. */ | ||
private _status; | ||
/** The IB API Server version, or 0 if not connected yet. */ | ||
@@ -47,2 +54,4 @@ private _serverVersion; | ||
get connected(): boolean; | ||
/** Returns connection status */ | ||
get status(): ConnectionStatus; | ||
/** Returns the IB API Server version. */ | ||
@@ -49,0 +58,0 @@ get serverVersion(): number; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Socket = void 0; | ||
exports.Socket = exports.ConnectionStatus = void 0; | ||
const net_1 = __importDefault(require("net")); | ||
@@ -33,2 +33,8 @@ const util_1 = require("util"); | ||
// const CONNECT_DELAY = 600; | ||
exports.ConnectionStatus = { | ||
Disconnected: 0, | ||
Disconnecting: 1, | ||
Connecting: 2, | ||
Connected: 3, | ||
}; | ||
/** | ||
@@ -50,4 +56,4 @@ * @internal | ||
this.options = options; | ||
/** `true` if the TCP socket is connected and [[OUT_MSG_ID.START_API]] has been sent, `false` otherwise. */ | ||
this._connected = false; | ||
/** `connected` if the TCP socket is connected and [[OUT_MSG_ID.START_API]] has been sent. */ | ||
this._status = exports.ConnectionStatus.Disconnected; | ||
/** The IB API Server version, or 0 if not connected yet. */ | ||
@@ -76,4 +82,8 @@ this._serverVersion = 0; | ||
get connected() { | ||
return this._connected; | ||
return this._status === exports.ConnectionStatus.Connected; | ||
} | ||
/** Returns connection status */ | ||
get status() { | ||
return this._status; | ||
} | ||
/** Returns the IB API Server version. */ | ||
@@ -105,2 +115,6 @@ get serverVersion() { | ||
connect(clientId) { | ||
// Reject any connect attempt is not disconnected | ||
if (this._status >= exports.ConnectionStatus.Connecting) | ||
return; | ||
this._status = exports.ConnectionStatus.Connecting; | ||
// update client id | ||
@@ -132,2 +146,3 @@ if (clientId !== undefined) { | ||
disconnect() { | ||
this._status = exports.ConnectionStatus.Disconnecting; | ||
// pause controller while connection is down. | ||
@@ -269,3 +284,3 @@ this.controller.pause(); | ||
onServerVersion(tokens) { | ||
this._connected = true; | ||
this._status = exports.ConnectionStatus.Connected; | ||
this._serverVersion = parseInt(tokens[0], 10); | ||
@@ -337,4 +352,4 @@ this._serverConnectionTime = tokens[1]; | ||
onEnd() { | ||
if (this._connected) { | ||
this._connected = false; | ||
if (this._status) { | ||
this._status = exports.ConnectionStatus.Disconnected; | ||
this.controller.emitEvent(event_name_1.EventName.disconnected); | ||
@@ -341,0 +356,0 @@ } |
@@ -44,2 +44,3 @@ /** | ||
export { Stock } from "./api/contract/stock"; | ||
export { WshEventData } from "./api/contract/wsh"; | ||
export { DepthMktDataDescription } from "./api/data/container/depth-mkt-data-description"; | ||
@@ -64,3 +65,3 @@ export { FamilyCode } from "./api/data/container/family-code"; | ||
export { HistoricalTickLast } from "./api/historical/historicalTickLast"; | ||
export { WhatToShow } from "./api/historical/what-to-show"; | ||
export * from "./api/historical/what-to-show"; | ||
export { ScannerSubscription } from "./api/market/scannerSubscription"; | ||
@@ -83,3 +84,3 @@ export { TickByTickDataType } from "./api/market/tickByTickDataType"; | ||
export { OrderType } from "./api/order/enum/orderType"; | ||
export { TimeInForce } from "./api/order/enum/tif"; | ||
export * from "./api/order/enum/tif"; | ||
export { TriggerMethod } from "./api/order/enum/trigger-method"; | ||
@@ -98,2 +99,3 @@ export { Execution, Liquidities } from "./api/order/execution"; | ||
export { ExecutionFilter } from "./api/report/executionFilter"; | ||
export { Instrument, LocationCode, ScanCode, } from "./api/market-scanner/market-scanner"; | ||
export default IBApi; | ||
@@ -100,0 +102,0 @@ export * from "./api-next"; |
@@ -44,3 +44,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TrailingStopOrder = exports.StopLimitOrder = exports.StopOrder = exports.MarketCloseOrder = exports.MarketOrder = exports.LimitOrder = exports.TriggerMethod = exports.TimeInForce = exports.OrderType = exports.OrderStatus = exports.OrderConditionType = exports.OrderAction = exports.ConjunctionConnection = exports.VolumeCondition = exports.TimeCondition = exports.PriceCondition = exports.PercentChangeCondition = exports.MarginCondition = exports.ExecutionCondition = exports.TickByTickDataType = exports.WhatToShow = exports.BarSizeSetting = exports.DurationUnit = exports.SecType = exports.OptionType = exports.OptionExerciseAction = exports.MIN_SERVER_VER = exports.LogLevel = exports.FADataType = exports.EventName = exports.Stock = exports.Option = exports.Index = exports.Future = exports.Forex = exports.FOP = exports.Combo = exports.CFD = exports.ErrorCode = exports.IBApi = void 0; | ||
exports.ScanCode = exports.LocationCode = exports.Instrument = exports.TrailingStopOrder = exports.StopLimitOrder = exports.StopOrder = exports.MarketCloseOrder = exports.MarketOrder = exports.LimitOrder = exports.TriggerMethod = exports.OrderType = exports.OrderStatus = exports.OrderConditionType = exports.OrderAction = exports.ConjunctionConnection = exports.VolumeCondition = exports.TimeCondition = exports.PriceCondition = exports.PercentChangeCondition = exports.MarginCondition = exports.ExecutionCondition = exports.TickByTickDataType = exports.BarSizeSetting = exports.DurationUnit = exports.SecType = exports.OptionType = exports.OptionExerciseAction = exports.MIN_SERVER_VER = exports.LogLevel = exports.FADataType = exports.EventName = exports.WshEventData = exports.Stock = exports.Option = exports.Index = exports.Future = exports.Forex = exports.FOP = exports.Combo = exports.CFD = exports.ErrorCode = exports.IBApi = void 0; | ||
const api_1 = require("./api/api"); | ||
@@ -69,2 +69,4 @@ // export the IB Api class and function argument types | ||
Object.defineProperty(exports, "Stock", { enumerable: true, get: function () { return stock_1.Stock; } }); | ||
var wsh_1 = require("./api/contract/wsh"); | ||
Object.defineProperty(exports, "WshEventData", { enumerable: true, get: function () { return wsh_1.WshEventData; } }); | ||
// export enum types | ||
@@ -90,4 +92,3 @@ var event_name_1 = require("./api/data/enum/event-name"); | ||
Object.defineProperty(exports, "BarSizeSetting", { enumerable: true, get: function () { return bar_size_setting_1.BarSizeSetting; } }); | ||
var what_to_show_1 = require("./api/historical/what-to-show"); | ||
Object.defineProperty(exports, "WhatToShow", { enumerable: true, get: function () { return what_to_show_1.WhatToShow; } }); | ||
__exportStar(require("./api/historical/what-to-show"), exports); | ||
var tickByTickDataType_1 = require("./api/market/tickByTickDataType"); | ||
@@ -118,4 +119,3 @@ Object.defineProperty(exports, "TickByTickDataType", { enumerable: true, get: function () { return tickByTickDataType_1.TickByTickDataType; } }); | ||
Object.defineProperty(exports, "OrderType", { enumerable: true, get: function () { return orderType_1.OrderType; } }); | ||
var tif_1 = require("./api/order/enum/tif"); | ||
Object.defineProperty(exports, "TimeInForce", { enumerable: true, get: function () { return tif_1.TimeInForce; } }); | ||
__exportStar(require("./api/order/enum/tif"), exports); | ||
var trigger_method_1 = require("./api/order/enum/trigger-method"); | ||
@@ -135,2 +135,7 @@ Object.defineProperty(exports, "TriggerMethod", { enumerable: true, get: function () { return trigger_method_1.TriggerMethod; } }); | ||
Object.defineProperty(exports, "TrailingStopOrder", { enumerable: true, get: function () { return trailingStop_1.TrailingStopOrder; } }); | ||
// export market scanner types | ||
var market_scanner_1 = require("./api/market-scanner/market-scanner"); | ||
Object.defineProperty(exports, "Instrument", { enumerable: true, get: function () { return market_scanner_1.Instrument; } }); | ||
Object.defineProperty(exports, "LocationCode", { enumerable: true, get: function () { return market_scanner_1.LocationCode; } }); | ||
Object.defineProperty(exports, "ScanCode", { enumerable: true, get: function () { return market_scanner_1.ScanCode; } }); | ||
// export IBApi as default | ||
@@ -137,0 +142,0 @@ exports.default = api_1.IBApi; |
@@ -31,8 +31,3 @@ "use strict"; | ||
const orderId = 1; | ||
const contract = { | ||
symbol: "AAPL", | ||
exchange: "SMART", | ||
currency: "USD", | ||
secType: __1.SecType.STK, | ||
}; | ||
const contract = new __1.Stock("SPY"); | ||
const order = { | ||
@@ -39,0 +34,0 @@ orderType: __1.OrderType.LMT, |
@@ -64,12 +64,15 @@ "use strict"; | ||
let received = false; | ||
ib.on(__1.EventName.pnl, (reqId, pnl) => { | ||
ib.on(__1.EventName.pnl, (reqId, _pnl) => { | ||
expect(reqId).toEqual(refId); | ||
expect(pnl).toBeTruthy(); | ||
// expect(pnl).toBeTruthy(); | ||
if (!received) { | ||
ib.cancelPnL(reqId); | ||
ib.disconnect(); | ||
done(); | ||
} | ||
received = true; | ||
}).on(__1.EventName.error, (err, code, reqId) => { | ||
}) | ||
.on(__1.EventName.disconnected, () => { | ||
done(); | ||
}) | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
if (reqId == refId) | ||
@@ -102,28 +105,3 @@ done(`[${reqId}] ${err.message} (#${code})`); | ||
}); | ||
it("Test request tick history", (done) => { | ||
const refId = 45; | ||
let isConnected = false; | ||
ib.on(__1.EventName.connected, () => { | ||
isConnected = true; | ||
}) | ||
.on(__1.EventName.historicalTicksLast, (reqId, ticks) => { | ||
expect(ticks.length).toBeGreaterThan(0); | ||
if (isConnected) { | ||
ib.disconnect(); | ||
} | ||
done(); | ||
}) | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
if (reqId == refId) | ||
done(`[${reqId}] ${err.message} (#${code})`); | ||
}); | ||
const contract = { | ||
symbol: "SPY", | ||
exchange: "SMART", | ||
currency: "USD", | ||
secType: __1.SecType.STK, | ||
}; | ||
ib.connect().reqHistoricalTicks(refId, contract, "20210101-16:00:00", null, 1000, __1.WhatToShow.TRADES, 0, true); | ||
}); | ||
}); | ||
//# sourceMappingURL=api.test.js.map |
@@ -10,3 +10,3 @@ "use strict"; | ||
describe("IBApi connection Tests", () => { | ||
jest.setTimeout(10000); | ||
jest.setTimeout(5 * 1000); | ||
let ib; | ||
@@ -13,0 +13,0 @@ const clientId = Math.floor(Math.random() * 32766) + 1; // ensure unique client |
@@ -6,9 +6,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const api_1 = require("../../../api/api"); | ||
const forex_1 = __importDefault(require("../../../api/contract/forex")); | ||
const option_1 = __importDefault(require("../../../api/contract/option")); | ||
const stock_1 = __importDefault(require("../../../api/contract/stock")); | ||
const event_name_1 = require("../../../api/data/enum/event-name"); | ||
const option_type_1 = __importDefault(require("../../../api/data/enum/option-type")); | ||
const sec_type_1 = __importDefault(require("../../../api/data/enum/sec-type")); | ||
/** | ||
* This file implements tests for the [[reqContractDetails]] API entry point. | ||
*/ | ||
const __1 = require("../../.."); | ||
const configuration_1 = __importDefault(require("../../../common/configuration")); | ||
@@ -20,3 +17,3 @@ describe("IBApi reqContractDetails Tests", () => { | ||
beforeEach(() => { | ||
ib = new api_1.IBApi({ | ||
ib = new __1.IBApi({ | ||
host: configuration_1.default.ib_host, | ||
@@ -35,9 +32,9 @@ port: configuration_1.default.ib_port, | ||
const refId = 1; | ||
ib.once(event_name_1.EventName.nextValidId, (_reqId) => { | ||
const contract = new forex_1.default("USD", "EUR"); | ||
ib.once(__1.EventName.nextValidId, (_reqId) => { | ||
const contract = new __1.Forex("USD", "EUR"); | ||
ib.reqContractDetails(refId, contract); | ||
}) | ||
.on(event_name_1.EventName.contractDetails, (reqId, details) => { | ||
.on(__1.EventName.contractDetails, (reqId, details) => { | ||
expect(reqId).toEqual(refId); | ||
expect(details.contract.secType).toEqual(sec_type_1.default.CASH); | ||
expect(details.contract.secType).toEqual(__1.SecType.CASH); | ||
expect(details.contract.symbol).toEqual("EUR"); | ||
@@ -47,3 +44,3 @@ expect(details.contract.currency).toEqual("USD"); | ||
}) | ||
.on(event_name_1.EventName.contractDetailsEnd, (reqId) => { | ||
.on(__1.EventName.contractDetailsEnd, (reqId) => { | ||
expect(reqId).toEqual(refId); | ||
@@ -53,6 +50,6 @@ if (ib) | ||
}) | ||
.on(event_name_1.EventName.disconnected, () => { | ||
.on(__1.EventName.disconnected, () => { | ||
done(); | ||
}) | ||
.on(event_name_1.EventName.error, (err, code, reqId) => { | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
if (reqId == refId) | ||
@@ -65,9 +62,9 @@ done(`[${reqId}] ${err.message} (#${code})`); | ||
const refId = 2; | ||
ib.once(event_name_1.EventName.nextValidId, (_reqId) => { | ||
const contract = new stock_1.default("SPY", "ARCA", "USD"); | ||
ib.once(__1.EventName.nextValidId, (_reqId) => { | ||
const contract = new __1.Stock("SPY", "ARCA", "USD"); | ||
ib.reqContractDetails(refId, contract); | ||
}) | ||
.on(event_name_1.EventName.contractDetails, (reqId, details) => { | ||
.on(__1.EventName.contractDetails, (reqId, details) => { | ||
expect(reqId).toEqual(refId); | ||
expect(details.contract.secType).toEqual(sec_type_1.default.STK); | ||
expect(details.contract.secType).toEqual(__1.SecType.STK); | ||
expect(details.contract.symbol).toEqual("SPY"); | ||
@@ -77,3 +74,3 @@ expect(details.contract.currency).toEqual("USD"); | ||
}) | ||
.on(event_name_1.EventName.contractDetailsEnd, (reqId) => { | ||
.on(__1.EventName.contractDetailsEnd, (reqId) => { | ||
expect(reqId).toEqual(refId); | ||
@@ -83,6 +80,6 @@ if (ib) | ||
}) | ||
.on(event_name_1.EventName.disconnected, () => { | ||
.on(__1.EventName.disconnected, () => { | ||
done(); | ||
}) | ||
.on(event_name_1.EventName.error, (err, code, reqId) => { | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
if (reqId == refId) | ||
@@ -95,9 +92,9 @@ done(`[${reqId}] ${err.message} (#${code})`); | ||
const refId = 3; | ||
ib.once(event_name_1.EventName.nextValidId, (_reqId) => { | ||
const contract = new option_1.default("SPY", "20260116", 440, option_type_1.default.Call); | ||
ib.once(__1.EventName.nextValidId, (_reqId) => { | ||
const contract = new __1.Option("SPY", "20260116", 440, __1.OptionType.Call); | ||
ib.reqContractDetails(refId, contract); | ||
}) | ||
.on(event_name_1.EventName.contractDetails, (reqId, details) => { | ||
.on(__1.EventName.contractDetails, (reqId, details) => { | ||
expect(reqId).toEqual(refId); | ||
expect(details.contract.secType).toEqual(sec_type_1.default.OPT); | ||
expect(details.contract.secType).toEqual(__1.SecType.OPT); | ||
expect(details.contract.symbol).toEqual("SPY"); | ||
@@ -108,3 +105,3 @@ expect(details.contract.currency).toEqual("USD"); | ||
}) | ||
.on(event_name_1.EventName.contractDetailsEnd, (reqId) => { | ||
.on(__1.EventName.contractDetailsEnd, (reqId) => { | ||
expect(reqId).toEqual(refId); | ||
@@ -114,6 +111,6 @@ if (ib) | ||
}) | ||
.on(event_name_1.EventName.disconnected, () => { | ||
.on(__1.EventName.disconnected, () => { | ||
done(); | ||
}) | ||
.on(event_name_1.EventName.error, (err, code, reqId) => { | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
if (reqId == refId) | ||
@@ -124,3 +121,35 @@ done(`[${reqId}] ${err.message} (#${code})`); | ||
}); | ||
test("Option chain", (done) => { | ||
const refId = 4; | ||
let count = 0; | ||
ib.once(__1.EventName.nextValidId, (_reqId) => { | ||
const contract = new __1.Option("SPY", "20260116", 0, __1.OptionType.Call); | ||
ib.reqContractDetails(refId, contract); | ||
}) | ||
.on(__1.EventName.contractDetails, (reqId, details) => { | ||
expect(reqId).toEqual(refId); | ||
expect(details.contract.secType).toEqual(__1.SecType.OPT); | ||
expect(details.contract.symbol).toEqual("SPY"); | ||
expect(details.contract.currency).toEqual("USD"); | ||
expect(details.marketName).toEqual("SPY"); | ||
// console.log(details.contract); | ||
count++; | ||
}) | ||
.on(__1.EventName.contractDetailsEnd, (reqId) => { | ||
expect(reqId).toEqual(refId); | ||
expect(count).toBeGreaterThanOrEqual(92); | ||
// console.log(count); | ||
if (ib) | ||
ib.disconnect(); | ||
}) | ||
.on(__1.EventName.disconnected, () => { | ||
done(); | ||
}) | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
if (reqId == refId) | ||
done(`[${reqId}] ${err.message} (#${code})`); | ||
}); | ||
ib.connect(); | ||
}); | ||
}); | ||
//# sourceMappingURL=contract-details.test.js.map |
@@ -12,3 +12,3 @@ "use strict"; | ||
describe("IBApi Market data Tests", () => { | ||
jest.setTimeout(20000); | ||
jest.setTimeout(15 * 1000); | ||
let ib; | ||
@@ -31,12 +31,35 @@ const clientId = Math.floor(Math.random() * 32766) + 1; // ensure unique client | ||
}); | ||
const IsError = (code) => code !== __1.ErrorCode.REQ_MKT_DATA_NOT_AVAIL && | ||
code !== __1.ErrorCode.DISPLAYING_DELAYED_DATA; | ||
it("Stock market data", (done) => { | ||
const refId = 45; | ||
let received = false; | ||
ib.once(__1.EventName.connected, () => { | ||
const contract = new __1.Stock("AAPL"); | ||
ib.reqMktData(refId, contract, "", true, false); | ||
}) | ||
.on(__1.EventName.tickPrice, (reqId, _field, _value) => { | ||
expect(reqId).toEqual(refId); | ||
if (reqId == refId) | ||
received = true; | ||
// console.log(_field, _value); | ||
}) | ||
.on(__1.EventName.tickSnapshotEnd, (reqId) => { | ||
expect(reqId).toEqual(refId); | ||
if (received) | ||
done(); | ||
else | ||
done("Didn't get any result"); | ||
}) | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
if (IsError(code)) | ||
done(`[${reqId}] ${err.message} (#${code})`); | ||
}); | ||
ib.connect().reqMarketDataType(__1.MarketDataType.DELAYED_FROZEN); | ||
}); | ||
it("SPY market data", (done) => { | ||
const refId = 46; | ||
let received = false; | ||
ib.once(__1.EventName.connected, () => { | ||
const contract = { | ||
symbol: "SPY", | ||
currency: "USD", | ||
secType: __1.SecType.STK, | ||
exchange: "SMART", | ||
}; | ||
const contract = new __1.Stock("SPY"); | ||
ib.reqMktData(refId, contract, "", true, false); | ||
@@ -58,6 +81,6 @@ }) | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
if (reqId == refId) | ||
if (IsError(code)) | ||
done(`[${reqId}] ${err.message} (#${code})`); | ||
}); | ||
ib.connect(); | ||
ib.connect().reqMarketDataType(__1.MarketDataType.DELAYED_FROZEN); | ||
}); | ||
@@ -84,8 +107,86 @@ test("Option market data", (done) => { | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
if (IsError(code)) | ||
done(`[${reqId}] ${err.message} (#${code})`); | ||
}); | ||
ib.connect().reqMarketDataType(__1.MarketDataType.DELAYED_FROZEN); | ||
}); | ||
it("Future market data", (done) => { | ||
const refId = 48; | ||
let received = false; | ||
ib.once(__1.EventName.connected, () => { | ||
const contract = new __1.Future("ES", "ESZ3", "202312", "CME", 50); | ||
ib.reqMktData(refId, contract, "", true, false); | ||
}) | ||
.on(__1.EventName.tickPrice, (reqId, _field, _value) => { | ||
expect(reqId).toEqual(refId); | ||
if (reqId == refId) | ||
received = true; | ||
// console.log(_field, _value); | ||
}) | ||
.on(__1.EventName.tickSnapshotEnd, (reqId) => { | ||
expect(reqId).toEqual(refId); | ||
if (received) | ||
done(); | ||
else | ||
done("Didn't get any result"); | ||
}) | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
if (IsError(code)) | ||
done(`[${reqId}] ${err.message} (#${code})`); | ||
}); | ||
ib.connect(); | ||
ib.connect().reqMarketDataType(__1.MarketDataType.DELAYED_FROZEN); | ||
}); | ||
it("DAX market data", (done) => { | ||
const refId = 49; | ||
let received = false; | ||
ib.once(__1.EventName.connected, () => { | ||
const contract = new __1.Index("DAX", "EUR", "EUREX"); | ||
ib.reqMktData(refId, contract, "", true, false); | ||
}) | ||
.on(__1.EventName.tickPrice, (reqId, _field, _value) => { | ||
expect(reqId).toEqual(refId); | ||
if (reqId == refId) | ||
received = true; | ||
// console.log(_field, _value); | ||
}) | ||
.on(__1.EventName.tickSnapshotEnd, (reqId) => { | ||
expect(reqId).toEqual(refId); | ||
if (received) | ||
done(); | ||
else | ||
done("Didn't get any result"); | ||
}) | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
if (IsError(code)) | ||
done(`[${reqId}] ${err.message} (#${code})`); | ||
}); | ||
ib.connect().reqMarketDataType(__1.MarketDataType.DELAYED_FROZEN); | ||
}); | ||
it("Index market data", (done) => { | ||
const refId = 50; | ||
let received = false; | ||
ib.once(__1.EventName.connected, () => { | ||
const contract = new __1.Index("ES"); | ||
ib.reqMktData(refId, contract, "", true, false); | ||
}) | ||
.on(__1.EventName.tickPrice, (reqId, _field, _value) => { | ||
expect(reqId).toEqual(refId); | ||
if (reqId == refId) | ||
received = true; | ||
// console.log(_field, _value); | ||
}) | ||
.on(__1.EventName.tickSnapshotEnd, (reqId) => { | ||
expect(reqId).toEqual(refId); | ||
if (received) | ||
done(); | ||
else | ||
done("Didn't get any result"); | ||
}) | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
if (IsError(code)) | ||
done(`[${reqId}] ${err.message} (#${code})`); | ||
}); | ||
ib.connect().reqMarketDataType(__1.MarketDataType.DELAYED_FROZEN); | ||
}); | ||
}); | ||
//# sourceMappingURL=market-data.test.js.map |
@@ -6,5 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const market_scanner_1 = require("../../../api-next/market-scanner/market-scanner"); | ||
const api_1 = require("../../../api/api"); | ||
const event_name_1 = require("../../../api/data/enum/event-name"); | ||
const __1 = require("../../.."); | ||
const configuration_1 = __importDefault(require("../../../common/configuration")); | ||
@@ -16,3 +14,3 @@ describe("IBApi market scanner tests", () => { | ||
beforeEach(() => { | ||
ib = new api_1.IBApi({ | ||
ib = new __1.IBApi({ | ||
host: configuration_1.default.ib_host, | ||
@@ -30,3 +28,3 @@ port: configuration_1.default.ib_port, | ||
test("Scanner parameters", (done) => { | ||
ib.on(event_name_1.EventName.scannerParameters, (xml) => { | ||
ib.on(__1.EventName.scannerParameters, (xml) => { | ||
const match = '<?xml version="1.0" encoding="UTF-8"?>'; // eslint-disable-line quotes | ||
@@ -36,6 +34,6 @@ expect(xml.substring(0, match.length)).toEqual(match); | ||
}) | ||
.on(event_name_1.EventName.disconnected, () => { | ||
.on(__1.EventName.disconnected, () => { | ||
done(); | ||
}) | ||
.on(event_name_1.EventName.error, (err, code, reqId) => { | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
if (reqId !== -1) | ||
@@ -48,15 +46,15 @@ done(`[${reqId}] ${err.message} (#${code})`); | ||
const refId = 1; | ||
ib.once(event_name_1.EventName.nextValidId, (_reqId) => { | ||
ib.once(__1.EventName.nextValidId, (_reqId) => { | ||
ib.reqScannerSubscription(refId, { | ||
abovePrice: 1, | ||
scanCode: market_scanner_1.ScanCode.MOST_ACTIVE, | ||
locationCode: market_scanner_1.LocationCode.STK_US, | ||
instrument: market_scanner_1.Instrument.STK, | ||
scanCode: __1.ScanCode.MOST_ACTIVE, | ||
locationCode: __1.LocationCode.STK_US, | ||
instrument: __1.Instrument.STK, | ||
numberOfRows: 20, | ||
}); | ||
}) | ||
.on(event_name_1.EventName.scannerData, (reqId, _rank, _contract, _distance, _benchmark, _projection, _legStr) => { | ||
.on(__1.EventName.scannerData, (reqId, _rank, _contract, _distance, _benchmark, _projection, _legStr) => { | ||
expect(reqId).toEqual(refId); | ||
}) | ||
.on(event_name_1.EventName.scannerDataEnd, (reqId) => { | ||
.on(__1.EventName.scannerDataEnd, (reqId) => { | ||
expect(reqId).toEqual(refId); | ||
@@ -66,6 +64,6 @@ if (ib) | ||
}) | ||
.on(event_name_1.EventName.disconnected, () => { | ||
.on(__1.EventName.disconnected, () => { | ||
done(); | ||
}) | ||
.on(event_name_1.EventName.error, (err, code, reqId) => { | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
if (reqId == refId) | ||
@@ -72,0 +70,0 @@ done(`[${reqId}] ${err.message} (#${code})`); |
@@ -6,4 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const api_1 = require("../../../api/api"); | ||
const event_name_1 = require("../../../api/data/enum/event-name"); | ||
const __1 = require("../../.."); | ||
const configuration_1 = __importDefault(require("../../../common/configuration")); | ||
@@ -15,3 +14,3 @@ describe("IBApi reqMatchingSymbols Tests", () => { | ||
beforeEach(() => { | ||
ib = new api_1.IBApi({ | ||
ib = new __1.IBApi({ | ||
host: configuration_1.default.ib_host, | ||
@@ -30,6 +29,6 @@ port: configuration_1.default.ib_port, | ||
const refId = 1; | ||
ib.once(event_name_1.EventName.nextValidId, (_reqId) => { | ||
ib.once(__1.EventName.nextValidId, (_reqId) => { | ||
ib.reqMatchingSymbols(refId, "SPY"); | ||
}) | ||
.on(event_name_1.EventName.symbolSamples, (reqId, contractDescriptions) => { | ||
.on(__1.EventName.symbolSamples, (reqId, contractDescriptions) => { | ||
expect(reqId).toEqual(refId); | ||
@@ -39,6 +38,6 @@ expect(contractDescriptions[0].contract.symbol).toEqual("SPY"); | ||
}) | ||
.on(event_name_1.EventName.disconnected, () => { | ||
.on(__1.EventName.disconnected, () => { | ||
done(); | ||
}) | ||
.on(event_name_1.EventName.error, (err, code, reqId) => { | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
if (reqId == refId) | ||
@@ -51,6 +50,6 @@ done(`[${reqId}] ${err.message} (#${code})`); | ||
const refId = 2; | ||
ib.once(event_name_1.EventName.nextValidId, (_reqId) => { | ||
ib.once(__1.EventName.nextValidId, (_reqId) => { | ||
ib.reqMatchingSymbols(refId, "META"); | ||
}) | ||
.on(event_name_1.EventName.symbolSamples, (reqId, contractDescriptions) => { | ||
.on(__1.EventName.symbolSamples, (reqId, contractDescriptions) => { | ||
expect(reqId).toEqual(refId); | ||
@@ -60,6 +59,6 @@ expect(contractDescriptions[0].contract.symbol).toEqual("META"); | ||
}) | ||
.on(event_name_1.EventName.disconnected, () => { | ||
.on(__1.EventName.disconnected, () => { | ||
done(); | ||
}) | ||
.on(event_name_1.EventName.error, (err, code, reqId) => { | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
if (reqId == refId) | ||
@@ -72,6 +71,6 @@ done(`[${reqId}] ${err.message} (#${code})`); | ||
const refId = 3; | ||
ib.once(event_name_1.EventName.nextValidId, (_reqId) => { | ||
ib.once(__1.EventName.nextValidId, (_reqId) => { | ||
ib.reqMatchingSymbols(refId, "AMC"); | ||
}) | ||
.on(event_name_1.EventName.symbolSamples, (reqId, contractDescriptions) => { | ||
.on(__1.EventName.symbolSamples, (reqId, contractDescriptions) => { | ||
expect(reqId).toEqual(refId); | ||
@@ -81,6 +80,6 @@ expect(contractDescriptions[0].contract.symbol).toEqual("AMC"); | ||
}) | ||
.on(event_name_1.EventName.disconnected, () => { | ||
.on(__1.EventName.disconnected, () => { | ||
done(); | ||
}) | ||
.on(event_name_1.EventName.error, (err, code, reqId) => { | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
if (reqId == refId) | ||
@@ -87,0 +86,0 @@ done(`[${reqId}] ${err.message} (#${code})`); |
@@ -33,8 +33,3 @@ "use strict"; | ||
let refId; | ||
const contract = { | ||
symbol: "AAPL", | ||
exchange: "SMART", | ||
currency: "USD", | ||
secType: __1.SecType.STK, | ||
}; | ||
const contract = new __1.Stock("SPY"); | ||
const order = { | ||
@@ -41,0 +36,0 @@ orderType: __1.OrderType.LMT, |
@@ -33,8 +33,3 @@ "use strict"; | ||
let refId; | ||
const contract = { | ||
symbol: "AAPL", | ||
exchange: "SMART", | ||
currency: "USD", | ||
secType: __1.SecType.STK, | ||
}; | ||
const contract = new __1.Stock("SPY"); | ||
const order = { | ||
@@ -58,6 +53,6 @@ orderType: __1.OrderType.LMT, | ||
expect(order.totalQuantity).toEqual(2); | ||
if (orderId === refId) { | ||
done(); | ||
} | ||
}) | ||
.on(__1.EventName.openOrderEnd, () => { | ||
done(); | ||
}) | ||
.on(__1.EventName.error, (error, code, reqId, _advancedOrderReject) => { | ||
@@ -83,12 +78,3 @@ if (reqId === -1) { | ||
// buy an Apple call, with a PriceCondition on underlying | ||
const contract = { | ||
symbol: "AAPL", | ||
exchange: "SMART", | ||
currency: "USD", | ||
secType: __1.SecType.OPT, | ||
right: __1.OptionType.Call, | ||
strike: 200, | ||
multiplier: 100, | ||
lastTradeDateOrContractMonth: "20251219", | ||
}; | ||
const contract = new __1.Option("AAPL", "20251219", 200, __1.OptionType.Call); | ||
const priceCondition = new __1.PriceCondition(29, __1.TriggerMethod.Default, 265598, "SMART", true, __1.ConjunctionConnection.OR); | ||
@@ -112,6 +98,6 @@ const order = { | ||
expect(orderId).toEqual(refId); | ||
if (orderId === refId) { | ||
done(); | ||
} | ||
}) | ||
.on(__1.EventName.openOrderEnd, () => { | ||
done(); | ||
}) | ||
.on(__1.EventName.error, (error, code, reqId, _advancedOrderReject) => { | ||
@@ -118,0 +104,0 @@ if (reqId === -1) { |
@@ -6,7 +6,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const api_1 = require("../../../api/api"); | ||
const wsh_1 = __importDefault(require("../../../api/contract/wsh")); | ||
const event_name_1 = require("../../../api/data/enum/event-name"); | ||
const __1 = require("../../.."); | ||
const configuration_1 = __importDefault(require("../../../common/configuration")); | ||
const errorCode_1 = require("../../../common/errorCode"); | ||
const logger_1 = __importDefault(require("../../../common/logger")); | ||
@@ -18,3 +15,3 @@ describe("IBApi Fundamental Data", () => { | ||
beforeEach(() => { | ||
ib = new api_1.IBApi({ | ||
ib = new __1.IBApi({ | ||
host: configuration_1.default.ib_host, | ||
@@ -33,6 +30,6 @@ port: configuration_1.default.ib_port, | ||
const refId = 1; | ||
ib.once(event_name_1.EventName.connected, () => { | ||
ib.once(__1.EventName.connected, () => { | ||
ib.reqWshMetaData(refId); | ||
}) | ||
.on(event_name_1.EventName.wshMetaData, (reqId, dataJson) => { | ||
.on(__1.EventName.wshMetaData, (reqId, dataJson) => { | ||
expect(reqId).toEqual(refId); | ||
@@ -42,8 +39,8 @@ console.log(dataJson); | ||
}) | ||
.on(event_name_1.EventName.disconnected, () => { | ||
.on(__1.EventName.disconnected, () => { | ||
done(); | ||
}) | ||
.on(event_name_1.EventName.error, (err, code, reqId) => { | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
const msg = `[${reqId}] ${err.message} (#${code})`; | ||
if (code == errorCode_1.ErrorCode.NEWS_FEED_NOT_ALLOWED) { | ||
if (code == __1.ErrorCode.NEWS_FEED_NOT_ALLOWED) { | ||
logger_1.default.error(msg); | ||
@@ -60,10 +57,10 @@ done(); | ||
const refId = 2; | ||
ib.once(event_name_1.EventName.connected, () => { | ||
ib.once(__1.EventName.connected, () => { | ||
ib.reqWshEventData(refId, 8314); | ||
}) | ||
.on(event_name_1.EventName.wshEventData, (reqId, dataJson) => { | ||
.on(__1.EventName.wshEventData, (reqId, dataJson) => { | ||
expect(reqId).toEqual(refId); | ||
console.log(dataJson); | ||
}) | ||
.on(event_name_1.EventName.scannerDataEnd, (reqId) => { | ||
.on(__1.EventName.scannerDataEnd, (reqId) => { | ||
expect(reqId).toEqual(refId); | ||
@@ -73,8 +70,8 @@ if (ib) | ||
}) | ||
.on(event_name_1.EventName.disconnected, () => { | ||
.on(__1.EventName.disconnected, () => { | ||
done(); | ||
}) | ||
.on(event_name_1.EventName.error, (err, code, reqId) => { | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
const msg = `[${reqId}] ${err.message} (#${code})`; | ||
if (code == errorCode_1.ErrorCode.NEWS_FEED_NOT_ALLOWED) { | ||
if (code == __1.ErrorCode.NEWS_FEED_NOT_ALLOWED) { | ||
logger_1.default.error(msg); | ||
@@ -91,10 +88,10 @@ done(); | ||
const refId = 3; | ||
ib.once(event_name_1.EventName.connected, () => { | ||
ib.reqWshEventData(refId, new wsh_1.default(8314, false, false, false, "20220511", "", 5)); | ||
ib.once(__1.EventName.connected, () => { | ||
ib.reqWshEventData(refId, new __1.WshEventData(8314, false, false, false, "20220511", "", 5)); | ||
}) | ||
.on(event_name_1.EventName.wshEventData, (reqId, dataJson) => { | ||
.on(__1.EventName.wshEventData, (reqId, dataJson) => { | ||
expect(reqId).toEqual(refId); | ||
console.log(dataJson); | ||
}) | ||
.on(event_name_1.EventName.scannerDataEnd, (reqId) => { | ||
.on(__1.EventName.scannerDataEnd, (reqId) => { | ||
expect(reqId).toEqual(refId); | ||
@@ -104,8 +101,8 @@ if (ib) | ||
}) | ||
.on(event_name_1.EventName.disconnected, () => { | ||
.on(__1.EventName.disconnected, () => { | ||
done(); | ||
}) | ||
.on(event_name_1.EventName.error, (err, code, reqId) => { | ||
.on(__1.EventName.error, (err, code, reqId) => { | ||
const msg = `[${reqId}] ${err.message} (#${code})`; | ||
if (code == errorCode_1.ErrorCode.NEWS_FEED_NOT_ALLOWED) { | ||
if (code == __1.ErrorCode.NEWS_FEED_NOT_ALLOWED) { | ||
logger_1.default.error(msg); | ||
@@ -112,0 +109,0 @@ done(); |
@@ -33,6 +33,6 @@ "use strict"; | ||
error: (err) => { | ||
this.error(`getOpenOrders failed with '${err.error.message}'`); | ||
this.error(`getAutoOpenOrders failed with '${err.error.message}'`); | ||
}, | ||
complete: () => { | ||
console.log("getOpenOrders completed."); | ||
console.log("getAutoOpenOrders completed."); | ||
}, | ||
@@ -39,0 +39,0 @@ }); |
/** | ||
* This App will print IBKR account open orders to console. | ||
* This App will print real-time updates of the IBKR account open orders. | ||
*/ | ||
export {}; |
"use strict"; | ||
/** | ||
* This App will print IBKR account open orders to console. | ||
* This App will print real-time updates of the IBKR account open orders. | ||
*/ | ||
@@ -11,5 +11,5 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
const DESCRIPTION_TEXT = "Prints the account open orders."; | ||
const USAGE_TEXT = "Usage: open-orders.js <options>"; | ||
const OPTION_ARGUMENTS = []; | ||
const EXAMPLE_TEXT = "open-orders.js"; | ||
const USAGE_TEXT = "Usage: open-orders-updates.js <options>"; | ||
const OPTION_ARGUMENTS = [["bind", "auto bind orders"]]; | ||
const EXAMPLE_TEXT = "open-orders-updates.js"; | ||
////////////////////////////////////////////////////////////////////////////// | ||
@@ -27,10 +27,12 @@ // The App code // | ||
super.start(); | ||
this.api | ||
.getAllOpenOrders() | ||
.then((orders) => { | ||
this.printObject(orders); | ||
this.stop(); | ||
}) | ||
.catch((err) => { | ||
this.error(`getAllOpenOrders failed with '${err}'`); | ||
this.subscription$ = this.api.getOpenOrders().subscribe({ | ||
next: (data) => { | ||
this.printObject(data); | ||
}, | ||
error: (err) => { | ||
this.error(`getOpenOrders failed with '${err.error.message}'`); | ||
}, | ||
complete: () => { | ||
console.log("getOpenOrders completed."); | ||
}, | ||
}); | ||
@@ -42,2 +44,4 @@ } | ||
stop() { | ||
console.log("app stopping."); | ||
this.subscription$?.unsubscribe(); | ||
this.exit(); | ||
@@ -44,0 +48,0 @@ } |
{ | ||
"name": "@stoqey/ib", | ||
"version": "1.3.10", | ||
"version": "1.3.11", | ||
"private": false, | ||
@@ -77,10 +77,10 @@ "description": "Interactive Brokers TWS/IB Gateway API client library for Node.js (TS)", | ||
"devDependencies": { | ||
"@types/jest": "^29.5.4", | ||
"@types/jest": "^29.5.5", | ||
"@types/node": "^18.17.15", | ||
"@types/source-map-support": "^0.5.7", | ||
"@typescript-eslint/eslint-plugin": "^6.7.0", | ||
"@typescript-eslint/parser": "^6.7.0", | ||
"@types/source-map-support": "^0.5.8", | ||
"@typescript-eslint/eslint-plugin": "^6.7.4", | ||
"@typescript-eslint/parser": "^6.7.4", | ||
"ajv": "^8.12.0", | ||
"eslint": "^8.49.0", | ||
"eslint-plugin-jest": "^27.2.3", | ||
"eslint": "^8.51.0", | ||
"eslint-plugin-jest": "^27.4.2", | ||
"eslint-plugin-rxjs": "^5.0.3", | ||
@@ -87,0 +87,0 @@ "jest": "^29.7.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1604527
549
26359