@stoqey/ib 1.3.14 → 1.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/errorCode.d.ts +2 -0
- package/dist/common/errorCode.js +2 -0
- package/dist/common/errorCode.js.map +1 -1
- package/dist/core/io/decoder.js +66 -326
- package/dist/core/io/decoder.js.map +1 -1
- package/dist/core/io/encoder.js +9 -19
- package/dist/core/io/encoder.js.map +1 -1
- package/dist/tests/unit/api/head-timestamp.test.d.ts +1 -0
- package/dist/tests/unit/api/head-timestamp.test.js +51 -0
- package/dist/tests/unit/api/head-timestamp.test.js.map +1 -0
- package/dist/tests/unit/api/histogram-data.test.d.ts +1 -0
- package/dist/tests/unit/api/histogram-data.test.js +52 -0
- package/dist/tests/unit/api/histogram-data.test.js.map +1 -0
- package/dist/tests/unit/api/historical-data.test.js +17 -17
- package/dist/tests/unit/api/historical-data.test.js.map +1 -1
- package/dist/tests/unit/api/market-data.test.js +9 -14
- package/dist/tests/unit/api/market-data.test.js.map +1 -1
- package/dist/tests/unit/api/market-scanner.test.js +5 -2
- package/dist/tests/unit/api/market-scanner.test.js.map +1 -1
- package/dist/tests/unit/api/order/reqAllOpenOrders.test.js +3 -8
- package/dist/tests/unit/api/order/reqAllOpenOrders.test.js.map +1 -1
- package/dist/tests/unit/api/order/reqCompletedOrders.test.d.ts +1 -0
- package/dist/tests/unit/api/order/reqCompletedOrders.test.js +48 -0
- package/dist/tests/unit/api/order/reqCompletedOrders.test.js.map +1 -0
- package/dist/tests/unit/api-next/get-contract-details.test.js +0 -96
- package/dist/tests/unit/api-next/get-contract-details.test.js.map +1 -1
- package/dist/tests/unit/api-next-live/get-contract-details.test.d.ts +4 -0
- package/dist/tests/unit/api-next-live/get-contract-details.test.js +103 -0
- package/dist/tests/unit/api-next-live/get-contract-details.test.js.map +1 -0
- package/dist/tests/unit/{api-next → api-next-live}/subscription-registry.test.js +1 -2
- package/dist/tests/unit/api-next-live/subscription-registry.test.js.map +1 -0
- package/dist/tests/unit/contracts.d.ts +2 -0
- package/dist/tests/unit/contracts.js +4 -2
- package/dist/tests/unit/contracts.js.map +1 -1
- package/package.json +8 -8
- package/dist/tests/unit/api-next/subscription-registry.test.js.map +0 -1
- /package/dist/tests/unit/{api-next → api-next-live}/subscription-registry.test.d.ts +0 -0
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
export declare enum ErrorCode {
|
|
5
5
|
/** Order Canceled - reason: */
|
|
6
6
|
ORDER_CANCELLED = 202,
|
|
7
|
+
/** ou must subscribe for additional permissions to obtain precise results for scanner.Parameter:Most Active,Filter:Price;Real-Time Market Data:Pink Sheets */
|
|
8
|
+
SCANNER_LOW_PRECISION = 492,
|
|
7
9
|
/** Already connected. */
|
|
8
10
|
ALREADY_CONNECTED = 501,
|
|
9
11
|
/** Requested market data is not subscribed. Delayed market data is not available. */
|
package/dist/common/errorCode.js
CHANGED
|
@@ -9,6 +9,8 @@ var ErrorCode;
|
|
|
9
9
|
(function (ErrorCode) {
|
|
10
10
|
/** Order Canceled - reason: */
|
|
11
11
|
ErrorCode[ErrorCode["ORDER_CANCELLED"] = 202] = "ORDER_CANCELLED";
|
|
12
|
+
/** ou must subscribe for additional permissions to obtain precise results for scanner.Parameter:Most Active,Filter:Price;Real-Time Market Data:Pink Sheets */
|
|
13
|
+
ErrorCode[ErrorCode["SCANNER_LOW_PRECISION"] = 492] = "SCANNER_LOW_PRECISION";
|
|
12
14
|
/** Already connected. */
|
|
13
15
|
ErrorCode[ErrorCode["ALREADY_CONNECTED"] = 501] = "ALREADY_CONNECTED";
|
|
14
16
|
/** Requested market data is not subscribed. Delayed market data is not available. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorCode.js","sourceRoot":"","sources":["../../src/common/errorCode.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,gEAAgE;;;AAEhE,IAAY,
|
|
1
|
+
{"version":3,"file":"errorCode.js","sourceRoot":"","sources":["../../src/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AkC,CAAA;IAElC,4CAA4C;IAC5C,uFAAgC,CAAA;IAEhC,0CAA0C;IAC1C,mFAA8B,CAAA;IAE9B,6CAA6C;IAC7C,yFAAiC,CAAA;IAEjC,6CAA6C;IAC7C,uFAAgC,CAAA;IAEhC,4CAA4C;IAC5C,uFAAgC,CAAA;IAEhC,yCAAyC;IACzC,iFAA6B,CAAA;IAE7B,iCAAiC;IACjC,mEAAsB,CAAA;IAEtB,gCAAgC;IAChC,mEAAsB,CAAA;IAEtB,wCAAwC;IACxC,iFAA6B,CAAA;IAE7B,uCAAuC;IACvC,iFAA6B,CAAA;IAE7B,8CAA8C;IAC9C,qFAA+B,CAAA;IAE/B,0CAA0C;IAC1C,iFAA6B,CAAA;IAE7B,yCAAyC;IACzC,iFAA6B,CAAA;IAE7B,8CAA8C;IAC9C,+FAAoC,CAAA;IAEpC,2CAA2C;IAC3C,yFAAiC,CAAA;IAEjC,yCAAyC;IACzC,yFAAiC,CAAA;IAEjC,2CAA2C;IAC3C,2FAAkC,CAAA;IAElC,0CAA0C;IAC1C,2FAAkC,CAAA;IAElC,8BAA8B;IAC9B,+DAAoB,CAAA;IAEpB,sDAAsD;IACtD,+GAA6C,CAAA;IAE7C,8EAA8E;IAC9E,mFAA+B,CAAA;IAE/B,+BAA+B;IAC/B,+EAA6B,CAAA;AAC/B,CAAC,EA9QW,SAAS,yBAAT,SAAS,QA8QpB"}
|
package/dist/core/io/decoder.js
CHANGED
|
@@ -1898,330 +1898,71 @@ class Decoder {
|
|
|
1898
1898
|
const contract = {};
|
|
1899
1899
|
const order = {};
|
|
1900
1900
|
const orderState = {};
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
order.faMethod = this.readStr();
|
|
1967
|
-
order.faPercentage = this.readStr();
|
|
1968
|
-
order.faProfile = this.readStr();
|
|
1969
|
-
}
|
|
1970
|
-
if (this.serverVersion >= min_server_version_1.default.MODELS_SUPPORT) {
|
|
1971
|
-
order.modelCode = this.readStr();
|
|
1972
|
-
}
|
|
1973
|
-
if (this.serverVersion >= 8) {
|
|
1974
|
-
order.goodTillDate = this.readStr();
|
|
1975
|
-
}
|
|
1976
|
-
if (this.serverVersion >= 9) {
|
|
1977
|
-
order.rule80A = this.readStr();
|
|
1978
|
-
order.percentOffset = this.readDoubleOrUndefined();
|
|
1979
|
-
order.settlingFirm = this.readStr();
|
|
1980
|
-
order.shortSaleSlot = this.readInt();
|
|
1981
|
-
order.designatedLocation = this.readStr();
|
|
1982
|
-
if (this.serverVersion == 51) {
|
|
1983
|
-
this.readInt(); // exemptCode
|
|
1984
|
-
}
|
|
1985
|
-
else if (this.serverVersion >= 23) {
|
|
1986
|
-
order.exemptCode = this.readInt();
|
|
1987
|
-
}
|
|
1988
|
-
order.startingPrice = this.readDoubleOrUndefined();
|
|
1989
|
-
order.stockRefPrice = this.readDoubleOrUndefined();
|
|
1990
|
-
order.delta = this.readDoubleOrUndefined();
|
|
1991
|
-
order.stockRangeLower = this.readDoubleOrUndefined();
|
|
1992
|
-
order.stockRangeUpper = this.readDoubleOrUndefined();
|
|
1993
|
-
order.displaySize = this.readInt();
|
|
1994
|
-
order.sweepToFill = this.readBool();
|
|
1995
|
-
order.allOrNone = this.readBool();
|
|
1996
|
-
order.minQty = this.readIntOrUndefined();
|
|
1997
|
-
order.ocaType = this.readInt();
|
|
1998
|
-
}
|
|
1999
|
-
order.triggerMethod = this.serverVersion >= 10 ? this.readInt() : undefined;
|
|
2000
|
-
if (this.serverVersion >= 11) {
|
|
2001
|
-
order.volatility = this.readDoubleOrUndefined();
|
|
2002
|
-
order.volatilityType = this.readInt();
|
|
2003
|
-
if (this.serverVersion == 11) {
|
|
2004
|
-
order.deltaNeutralOrderType = this.readInt() == 0 ? "NONE" : "MKT";
|
|
2005
|
-
}
|
|
2006
|
-
else {
|
|
2007
|
-
order.deltaNeutralOrderType = this.readStr();
|
|
2008
|
-
order.deltaNeutralAuxPrice = this.readDoubleOrUndefined();
|
|
2009
|
-
if (this.serverVersion >= 27 && order.deltaNeutralOrderType !== "") {
|
|
2010
|
-
order.deltaNeutralConId = this.readInt();
|
|
2011
|
-
}
|
|
2012
|
-
if (this.serverVersion >= 31 && order.deltaNeutralOrderType !== "") {
|
|
2013
|
-
order.deltaNeutralShortSale = this.readBool();
|
|
2014
|
-
order.deltaNeutralShortSaleSlot = this.readInt();
|
|
2015
|
-
order.deltaNeutralDesignatedLocation = this.readStr();
|
|
2016
|
-
}
|
|
2017
|
-
}
|
|
2018
|
-
order.continuousUpdate = this.readInt();
|
|
2019
|
-
if (this.serverVersion == 26) {
|
|
2020
|
-
order.stockRangeLower = this.readDouble();
|
|
2021
|
-
order.stockRangeUpper = this.readDouble();
|
|
2022
|
-
}
|
|
2023
|
-
order.referencePriceType = this.readInt();
|
|
2024
|
-
}
|
|
2025
|
-
if (this.serverVersion >= 13) {
|
|
2026
|
-
order.trailStopPrice = this.readDoubleOrUndefined();
|
|
2027
|
-
}
|
|
2028
|
-
if (this.serverVersion >= 30) {
|
|
2029
|
-
order.trailStopPrice = this.readDoubleOrUndefined();
|
|
2030
|
-
}
|
|
2031
|
-
if (this.serverVersion >= 1) {
|
|
2032
|
-
contract.comboLegsDescription = this.readStr();
|
|
2033
|
-
}
|
|
2034
|
-
if (this.serverVersion >= 29) {
|
|
2035
|
-
const comboLegsCount = this.readInt();
|
|
2036
|
-
const comboLegs = new Array(comboLegsCount);
|
|
2037
|
-
for (let i = 0; i < comboLegsCount; i++) {
|
|
2038
|
-
comboLegs[i] = {
|
|
2039
|
-
conId: this.readInt(),
|
|
2040
|
-
ratio: this.readInt(),
|
|
2041
|
-
action: this.readStr(),
|
|
2042
|
-
exchange: this.readStr(),
|
|
2043
|
-
openClose: this.readInt(),
|
|
2044
|
-
shortSaleSlot: this.readInt(),
|
|
2045
|
-
designatedLocation: this.readStr(),
|
|
2046
|
-
exemptCode: this.readInt(),
|
|
2047
|
-
};
|
|
2048
|
-
}
|
|
2049
|
-
contract.comboLegs = comboLegs;
|
|
2050
|
-
const orderComboLegsCount = this.readInt();
|
|
2051
|
-
const orderComboLegs = new Array(orderComboLegsCount);
|
|
2052
|
-
for (let i = 0; i < orderComboLegsCount; i++) {
|
|
2053
|
-
orderComboLegs[i] = { price: this.readDoubleOrUndefined() };
|
|
2054
|
-
}
|
|
2055
|
-
order.orderComboLegs = orderComboLegs;
|
|
2056
|
-
}
|
|
2057
|
-
if (this.serverVersion >= 26) {
|
|
2058
|
-
const smartComboRoutingParamsCount = this.readInt();
|
|
2059
|
-
const smartComboRoutingParams = new Array(smartComboRoutingParamsCount);
|
|
2060
|
-
for (let i = 0; i < smartComboRoutingParamsCount; i++) {
|
|
2061
|
-
smartComboRoutingParams[i] = {
|
|
2062
|
-
tag: this.readStr(),
|
|
2063
|
-
value: this.readStr(),
|
|
2064
|
-
};
|
|
2065
|
-
}
|
|
2066
|
-
order.smartComboRoutingParams = smartComboRoutingParams;
|
|
2067
|
-
}
|
|
2068
|
-
if (this.serverVersion >= 15) {
|
|
2069
|
-
if (this.serverVersion >= 20) {
|
|
2070
|
-
order.scaleInitLevelSize = this.readIntOrUndefined();
|
|
2071
|
-
order.scaleSubsLevelSize = this.readIntOrUndefined();
|
|
2072
|
-
}
|
|
2073
|
-
else {
|
|
2074
|
-
/* notSuppScaleNumComponents = */ this.readIntOrUndefined();
|
|
2075
|
-
order.scaleSubsLevelSize = this.readIntOrUndefined();
|
|
2076
|
-
}
|
|
2077
|
-
order.scalePriceIncrement = this.readDoubleOrUndefined();
|
|
2078
|
-
}
|
|
2079
|
-
if (this.serverVersion >= 28 && order.scalePriceIncrement != undefined) {
|
|
2080
|
-
order.scalePriceAdjustValue = this.readDoubleOrUndefined();
|
|
2081
|
-
order.scalePriceAdjustInterval = this.readIntOrUndefined();
|
|
2082
|
-
order.scaleProfitOffset = this.readDoubleOrUndefined();
|
|
2083
|
-
order.scaleAutoReset = this.readBool();
|
|
2084
|
-
order.scaleInitPosition = this.readIntOrUndefined();
|
|
2085
|
-
order.scaleInitFillQty = this.readIntOrUndefined();
|
|
2086
|
-
order.scaleRandomPercent = this.readBool();
|
|
2087
|
-
}
|
|
2088
|
-
if (this.serverVersion >= 24) {
|
|
2089
|
-
order.hedgeType = this.readStr();
|
|
2090
|
-
if (order.hedgeType !== "") {
|
|
2091
|
-
order.hedgeParam = this.readStr();
|
|
2092
|
-
}
|
|
2093
|
-
}
|
|
2094
|
-
if (this.serverVersion >= 19) {
|
|
2095
|
-
order.clearingAccount = this.readStr();
|
|
2096
|
-
order.clearingIntent = this.readStr();
|
|
2097
|
-
}
|
|
2098
|
-
if (this.serverVersion >= 22) {
|
|
2099
|
-
order.notHeld = this.readBool();
|
|
2100
|
-
}
|
|
2101
|
-
if (this.serverVersion >= 20) {
|
|
2102
|
-
if (this.readBool()) {
|
|
2103
|
-
contract.deltaNeutralContract = {
|
|
2104
|
-
conId: this.readInt(),
|
|
2105
|
-
delta: this.readDouble(),
|
|
2106
|
-
price: this.readDouble(),
|
|
2107
|
-
};
|
|
2108
|
-
}
|
|
2109
|
-
}
|
|
2110
|
-
if (this.serverVersion >= 21) {
|
|
2111
|
-
order.algoStrategy = this.readStr();
|
|
2112
|
-
if (order.algoStrategy !== "") {
|
|
2113
|
-
const algoParamsCount = this.readInt();
|
|
2114
|
-
const allParams = new Array(algoParamsCount);
|
|
2115
|
-
for (let i = 0; i < algoParamsCount; i++) {
|
|
2116
|
-
allParams[i] = { tag: this.readStr(), value: this.readStr() };
|
|
2117
|
-
}
|
|
2118
|
-
order.algoParams = allParams;
|
|
2119
|
-
}
|
|
2120
|
-
}
|
|
2121
|
-
if (this.serverVersion >= 33) {
|
|
2122
|
-
order.solicited = this.readBool();
|
|
2123
|
-
}
|
|
2124
|
-
orderState.status = this.readStr();
|
|
2125
|
-
if (this.serverVersion >= 34) {
|
|
2126
|
-
order.randomizeSize = this.readBool();
|
|
2127
|
-
order.randomizePrice = this.readBool();
|
|
2128
|
-
}
|
|
2129
|
-
if (this.serverVersion >= min_server_version_1.default.PEGGED_TO_BENCHMARK) {
|
|
2130
|
-
if (order.orderType == orderType_1.OrderType.PEG_BENCH) {
|
|
2131
|
-
order.referenceContractId = this.readInt();
|
|
2132
|
-
order.isPeggedChangeAmountDecrease = this.readBool();
|
|
2133
|
-
order.peggedChangeAmount = this.readDouble();
|
|
2134
|
-
order.referenceChangeAmount = this.readDouble();
|
|
2135
|
-
order.referenceExchangeId = this.readStr();
|
|
2136
|
-
}
|
|
2137
|
-
const nConditions = this.readInt();
|
|
2138
|
-
order.conditions = new Array(nConditions);
|
|
2139
|
-
for (let i = 0; i < nConditions; i++) {
|
|
2140
|
-
const type = this.readInt();
|
|
2141
|
-
// OrderCondition
|
|
2142
|
-
const conjunctionConnection = this.readStr()?.toLocaleLowerCase();
|
|
2143
|
-
switch (type) {
|
|
2144
|
-
case order_condition_type_1.OrderConditionType.Execution: {
|
|
2145
|
-
const secType = this.readStr();
|
|
2146
|
-
const exchange = this.readStr();
|
|
2147
|
-
const symbol = this.readStr();
|
|
2148
|
-
order.conditions[i] = new execution_condition_1.default(exchange, secType, symbol, conjunctionConnection);
|
|
2149
|
-
break;
|
|
2150
|
-
}
|
|
2151
|
-
case order_condition_type_1.OrderConditionType.Margin: {
|
|
2152
|
-
// OperatorCondition
|
|
2153
|
-
const isMore = this.readBool();
|
|
2154
|
-
const value = this.readInt();
|
|
2155
|
-
order.conditions[i] = new margin_condition_1.default(value, isMore, conjunctionConnection);
|
|
2156
|
-
break;
|
|
2157
|
-
}
|
|
2158
|
-
case order_condition_type_1.OrderConditionType.PercentChange: {
|
|
2159
|
-
// OperatorCondition
|
|
2160
|
-
const isMore = this.readBool();
|
|
2161
|
-
const value = this.readDouble();
|
|
2162
|
-
// ContractCondition
|
|
2163
|
-
const condId = this.readInt();
|
|
2164
|
-
const exchange = this.readStr();
|
|
2165
|
-
order.conditions[i] = new percent_change_condition_1.default(value, condId, exchange, isMore, conjunctionConnection);
|
|
2166
|
-
break;
|
|
2167
|
-
}
|
|
2168
|
-
case order_condition_type_1.OrderConditionType.Price: {
|
|
2169
|
-
// OperatorCondition
|
|
2170
|
-
const isMore = this.readBool();
|
|
2171
|
-
const value = this.readDouble();
|
|
2172
|
-
// ContractCondition
|
|
2173
|
-
const condId = this.readInt();
|
|
2174
|
-
const exchange = this.readStr();
|
|
2175
|
-
// PriceCondition
|
|
2176
|
-
const triggerMethod = this.readInt();
|
|
2177
|
-
order.conditions[i] = new price_condition_1.default(value, triggerMethod, condId, exchange, isMore, conjunctionConnection);
|
|
2178
|
-
break;
|
|
2179
|
-
}
|
|
2180
|
-
case order_condition_type_1.OrderConditionType.Time: {
|
|
2181
|
-
// OperatorCondition
|
|
2182
|
-
const isMore = this.readBool();
|
|
2183
|
-
const value = this.readStr();
|
|
2184
|
-
order.conditions[i] = new time_condition_1.default(value, isMore, conjunctionConnection);
|
|
2185
|
-
break;
|
|
2186
|
-
}
|
|
2187
|
-
case order_condition_type_1.OrderConditionType.Volume: {
|
|
2188
|
-
// OperatorCondition
|
|
2189
|
-
const isMore = this.readBool();
|
|
2190
|
-
const value = this.readInt();
|
|
2191
|
-
// ContractCondition
|
|
2192
|
-
const condId = this.readInt();
|
|
2193
|
-
const exchange = this.readStr();
|
|
2194
|
-
order.conditions[i] = new volume_condition_1.default(value, condId, exchange, isMore, conjunctionConnection);
|
|
2195
|
-
break;
|
|
2196
|
-
}
|
|
2197
|
-
}
|
|
2198
|
-
}
|
|
2199
|
-
if (order.conditions.length) {
|
|
2200
|
-
order.conditionsIgnoreRth = this.readBool();
|
|
2201
|
-
order.conditionsCancelOrder = this.readBool();
|
|
2202
|
-
}
|
|
2203
|
-
}
|
|
2204
|
-
order.trailStopPrice = this.readDoubleOrUndefined();
|
|
2205
|
-
order.lmtPriceOffset = this.readDoubleOrUndefined();
|
|
2206
|
-
if (this.serverVersion >= min_server_version_1.default.CASH_QTY) {
|
|
2207
|
-
order.cashQty = this.readDoubleOrUndefined();
|
|
2208
|
-
}
|
|
2209
|
-
if (this.serverVersion >= min_server_version_1.default.AUTO_PRICE_FOR_HEDGE) {
|
|
2210
|
-
order.dontUseAutoPriceForHedge = this.readBool();
|
|
2211
|
-
}
|
|
2212
|
-
if (this.serverVersion >= min_server_version_1.default.ORDER_CONTAINER) {
|
|
2213
|
-
order.isOmsContainer = this.readBool();
|
|
2214
|
-
}
|
|
2215
|
-
order.autoCancelDate = this.readStr();
|
|
2216
|
-
order.filledQuantity = this.readDoubleOrUndefined();
|
|
2217
|
-
order.refFuturesConId = this.readInt();
|
|
2218
|
-
order.autoCancelParent = this.readBool();
|
|
2219
|
-
order.shareholder = this.readStr();
|
|
2220
|
-
order.imbalanceOnly = this.readBool();
|
|
2221
|
-
order.routeMarketableToBbo = this.readBool();
|
|
2222
|
-
order.parentPermId = this.readInt();
|
|
2223
|
-
orderState.completedTime = this.readStr();
|
|
2224
|
-
orderState.completedStatus = this.readStr();
|
|
1901
|
+
const orderDecoder = new OrderDecoder(this, contract, order, orderState, Number.MAX_VALUE, this.serverVersion);
|
|
1902
|
+
// read contract fields
|
|
1903
|
+
orderDecoder.readContractFields();
|
|
1904
|
+
// read order fields
|
|
1905
|
+
orderDecoder.readAction();
|
|
1906
|
+
orderDecoder.readTotalQuantity();
|
|
1907
|
+
orderDecoder.readOrderType();
|
|
1908
|
+
orderDecoder.readLmtPrice();
|
|
1909
|
+
orderDecoder.readAuxPrice();
|
|
1910
|
+
orderDecoder.readTIF();
|
|
1911
|
+
orderDecoder.readOcaGroup();
|
|
1912
|
+
orderDecoder.readAccount();
|
|
1913
|
+
orderDecoder.readOpenClose();
|
|
1914
|
+
orderDecoder.readOrigin();
|
|
1915
|
+
orderDecoder.readOrderRef();
|
|
1916
|
+
orderDecoder.readPermId();
|
|
1917
|
+
orderDecoder.readOutsideRth();
|
|
1918
|
+
orderDecoder.readHidden();
|
|
1919
|
+
orderDecoder.readDiscretionaryAmount();
|
|
1920
|
+
orderDecoder.readGoodAfterTime();
|
|
1921
|
+
orderDecoder.readFAParams();
|
|
1922
|
+
orderDecoder.readModelCode();
|
|
1923
|
+
orderDecoder.readGoodTillDate();
|
|
1924
|
+
orderDecoder.readRule80A();
|
|
1925
|
+
orderDecoder.readPercentOffset();
|
|
1926
|
+
orderDecoder.readSettlingFirm();
|
|
1927
|
+
orderDecoder.readShortSaleParams();
|
|
1928
|
+
orderDecoder.readBoxOrderParams();
|
|
1929
|
+
orderDecoder.readPegToStkOrVolOrderParams();
|
|
1930
|
+
orderDecoder.readDisplaySize();
|
|
1931
|
+
orderDecoder.readSweepToFill();
|
|
1932
|
+
orderDecoder.readAllOrNone();
|
|
1933
|
+
orderDecoder.readMinQty();
|
|
1934
|
+
orderDecoder.readOcaType();
|
|
1935
|
+
orderDecoder.readTriggerMethod();
|
|
1936
|
+
orderDecoder.readVolOrderParams(false);
|
|
1937
|
+
orderDecoder.readTrailParams();
|
|
1938
|
+
orderDecoder.readComboLegs();
|
|
1939
|
+
orderDecoder.readSmartComboRoutingParams();
|
|
1940
|
+
orderDecoder.readScaleOrderParams();
|
|
1941
|
+
orderDecoder.readHedgeParams();
|
|
1942
|
+
orderDecoder.readClearingParams();
|
|
1943
|
+
orderDecoder.readNotHeld();
|
|
1944
|
+
orderDecoder.readDeltaNeutral();
|
|
1945
|
+
orderDecoder.readAlgoParams();
|
|
1946
|
+
orderDecoder.readSolicited();
|
|
1947
|
+
orderDecoder.readOrderStatus();
|
|
1948
|
+
orderDecoder.readVolRandomizeFlags();
|
|
1949
|
+
orderDecoder.readPegToBenchParams();
|
|
1950
|
+
orderDecoder.readConditions();
|
|
1951
|
+
orderDecoder.readStopPriceAndLmtPriceOffset();
|
|
1952
|
+
orderDecoder.readCashQty();
|
|
1953
|
+
orderDecoder.readDontUseAutoPriceForHedge();
|
|
1954
|
+
orderDecoder.readIsOmsContainer();
|
|
1955
|
+
orderDecoder.readAutoCancelDate();
|
|
1956
|
+
orderDecoder.readFilledQuantity();
|
|
1957
|
+
orderDecoder.readRefFuturesConId();
|
|
1958
|
+
orderDecoder.readAutoCancelParent();
|
|
1959
|
+
orderDecoder.readShareholder();
|
|
1960
|
+
orderDecoder.readImbalanceOnly();
|
|
1961
|
+
orderDecoder.readRouteMarketableToBbo();
|
|
1962
|
+
orderDecoder.readParentPermId();
|
|
1963
|
+
orderDecoder.readCompletedTime();
|
|
1964
|
+
orderDecoder.readCompletedStatus();
|
|
1965
|
+
orderDecoder.readPegBestPegMidOrderAttributes();
|
|
2225
1966
|
this.emit(event_name_1.EventName.completedOrder, contract, order, orderState);
|
|
2226
1967
|
}
|
|
2227
1968
|
/**
|
|
@@ -2577,8 +2318,7 @@ class OrderDecoder {
|
|
|
2577
2318
|
this.order.faGroup = this.decoder.readStr();
|
|
2578
2319
|
this.order.faMethod = this.decoder.readStr();
|
|
2579
2320
|
this.order.faPercentage = this.decoder.readStr();
|
|
2580
|
-
|
|
2581
|
-
this.order.faProfile = this.decoder.readStr();
|
|
2321
|
+
this.order.faProfile = this.decoder.readStr();
|
|
2582
2322
|
}
|
|
2583
2323
|
}
|
|
2584
2324
|
readModelCode() {
|