@@ -409,6 +409,9 @@ Decoder <- R6::R6Class("Decoder",
409409 if (private $ serverVersion > = MIN_SERVER_VER_D_PEG_ORDERS )
410410 order $ discretionaryUpToLimitPrice <- imsg $ pop()
411411
412+ if (private $ serverVersion > = MIN_SERVER_VER_PRICE_MGMT_ALGO )
413+ order $ usePriceMgmtAlgo <- imsg $ pop()
414+
412415 private $ validate(" openOrder" , orderId = order $ orderId ,
413416 contract = contract ,
414417 order = order ,
@@ -1153,6 +1156,194 @@ Decoder <- R6::R6Class("Decoder",
11531156 ORDER_BOUND = function (imsg ) {
11541157
11551158 private $ validate(" orderBound" , imsg $ pop(3L ), no_names = TRUE )
1159+ },
1160+
1161+ COMPLETED_ORDER = function (imsg ) {
1162+
1163+ contract <- Contract
1164+ order <- Order
1165+ orderState <- OrderState
1166+
1167+ contract [c(1L : 8L , 10L : 12L )] <- imsg $ pop(11L )
1168+
1169+ order [c(4L : 9L )] <- imsg $ pop(6L ) # "action" through "tif"
1170+
1171+ order [c(" ocaGroup" ,
1172+ " account" ,
1173+ " openClose" )] <- imsg $ pop(3L )
1174+
1175+ order $ origin <- map_int2enum(" Origin" , imsg $ pop())
1176+
1177+ order [c(" orderRef" ,
1178+ " permId" ,
1179+ " outsideRth" ,
1180+ " hidden" ,
1181+ " discretionaryAmt" ,
1182+ " goodAfterTime" ,
1183+ " faGroup" ,
1184+ " faMethod" ,
1185+ " faPercentage" ,
1186+ " faProfile" )] <- imsg $ pop(10L )
1187+
1188+ if (private $ serverVersion > = MIN_SERVER_VER_MODELS_SUPPORT )
1189+ order $ modelCode <- imsg $ pop()
1190+
1191+ order [c(" goodTillDate" ,
1192+ " rule80A" ,
1193+ " percentOffset" ,
1194+ " settlingFirm" ,
1195+ " shortSaleSlot" ,
1196+ " designatedLocation" ,
1197+ " exemptCode" )] <- imsg $ pop(7L )
1198+
1199+ order [47L : 51L ] <- imsg $ pop(5L ) # "startingPrice" through "stockRangeUpper"
1200+
1201+ order [c(" displaySize" ,
1202+ " sweepToFill" ,
1203+ " allOrNone" ,
1204+ " minQty" ,
1205+ " ocaType" ,
1206+ " triggerMethod" )] <- imsg $ pop(6L )
1207+
1208+ order [54L : 57L ] <- imsg $ pop(4L ) # "volatility" through "deltaNeutralAuxPrice"
1209+
1210+ if (nzchar(order $ deltaNeutralOrderType ))
1211+ order [c(58L , 63L : 65L )] <- imsg $ pop(4L ) # "deltaNeutralConId" through "deltaNeutralDesignatedLocation"
1212+
1213+
1214+ order [c(" continuousUpdate" ,
1215+ " referencePriceType" ,
1216+ " trailStopPrice" ,
1217+ " trailingPercent" )] <- imsg $ pop(4L )
1218+
1219+ contract $ comboLegsDescrip <- imsg $ pop()
1220+
1221+ # ComboLegs
1222+ comboLegsCount <- Validator $ i(imsg $ pop())
1223+
1224+ if (comboLegsCount > 0L ) {
1225+
1226+ contract $ comboLegs <- lapply(seq_len(comboLegsCount ),
1227+ function (i ) {
1228+
1229+ combo <- ComboLeg
1230+
1231+ combo [1L : 8L ] <- imsg $ pop(8L )
1232+
1233+ combo
1234+ })
1235+ }
1236+
1237+ # OrderComboLeg
1238+ orderComboLegsCount <- Validator $ i(imsg $ pop())
1239+
1240+ if (orderComboLegsCount > 0L )
1241+ order $ orderComboLegs <- imsg $ pop(orderComboLegsCount )
1242+
1243+ # SmartComboRouting
1244+ smartComboRoutingParamsCount <- Validator $ i(imsg $ pop())
1245+
1246+ if (smartComboRoutingParamsCount > 0L )
1247+ order $ smartComboRoutingParams <- fold_tagvalue(imsg $ pop(2L * smartComboRoutingParamsCount ))
1248+
1249+
1250+ order [c(" scaleInitLevelSize" ,
1251+ " scaleSubsLevelSize" )] <- imsg $ pop(2L )
1252+
1253+ order $ scalePriceIncrement <- Validator $ n(imsg $ pop())
1254+
1255+ if (! is.na(order $ scalePriceIncrement ) && order $ scalePriceIncrement > 0L )
1256+ order [73L : 79L ] <- imsg $ pop(7L )
1257+
1258+
1259+ order $ hedgeType <- imsg $ pop()
1260+
1261+ if (nzchar(order $ hedgeType ))
1262+ order $ hedgeParam <- imsg $ pop()
1263+
1264+ order [c(" clearingAccount" ,
1265+ " clearingIntent" ,
1266+ " notHeld" )] <- imsg $ pop(3L )
1267+
1268+ # DeltaNeutralContract
1269+ if (Validator $ l(imsg $ pop())) {
1270+
1271+ contract $ deltaNeutralContract <- DeltaNeutralContract
1272+
1273+ contract $ deltaNeutralContract [1L : 3L ] <- imsg $ pop(3L )
1274+ }
1275+
1276+ # AlgoStrategy
1277+ order $ algoStrategy <- imsg $ pop()
1278+
1279+ if (nzchar(order $ algoStrategy )) {
1280+
1281+ algoParamsCount <- Validator $ i(imsg $ pop())
1282+
1283+ if (algoParamsCount > 0L )
1284+ order $ algoParams <- fold_tagvalue(imsg $ pop(2L * algoParamsCount ))
1285+ }
1286+
1287+ order $ solicited <- imsg $ pop()
1288+
1289+ orderState $ status <- imsg $ pop()
1290+
1291+ order [c(" randomizeSize" ,
1292+ " randomizePrice" )] <- imsg $ pop(2L )
1293+
1294+ if (private $ serverVersion > = MIN_SERVER_VER_PEGGED_TO_BENCHMARK ) {
1295+
1296+ if (order $ orderType == " PEG BENCH" )
1297+ order [c(" referenceContractId" ,
1298+ " isPeggedChangeAmountDecrease" ,
1299+ " peggedChangeAmount" ,
1300+ " referenceChangeAmount" ,
1301+ " referenceExchangeId" )] <- imsg $ pop(5L )
1302+
1303+ conditionsSize <- Validator $ i(imsg $ pop())
1304+
1305+ if (conditionsSize > 0L ) {
1306+
1307+ for (i in seq_len(conditionsSize )) {
1308+
1309+ condition <- fCondition(map_int2enum(" Condition" ,
1310+ Validator $ i(imsg $ pop())))
1311+
1312+ condition [- 1L ] <- imsg $ pop(length(condition ) - 1L )
1313+
1314+ order $ conditions [[i ]] <- condition
1315+ }
1316+
1317+ order [c(" conditionsIgnoreRth" ,
1318+ " conditionsCancelOrder" )] <- imsg $ pop(2L )
1319+ }
1320+ }
1321+
1322+ order [c(" trailStopPrice" ,
1323+ " lmtPriceOffset" )] <- imsg $ pop(2L )
1324+
1325+ if (private $ serverVersion > = MIN_SERVER_VER_CASH_QTY )
1326+ order $ cashQty <- imsg $ pop()
1327+
1328+ if (private $ serverVersion > = MIN_SERVER_VER_AUTO_PRICE_FOR_HEDGE )
1329+ order $ dontUseAutoPriceForHedge <- imsg $ pop()
1330+
1331+ if (private $ serverVersion > = MIN_SERVER_VER_ORDER_CONTAINER )
1332+ order $ isOmsContainer <- imsg $ pop()
1333+
1334+ order [122L : 129L ] <- imsg $ pop(8L ) # "autoCancelDate" through "parentPermId"
1335+
1336+ orderState [c(" completedTime" ,
1337+ " completedStatus" )] <- imsg $ pop(2L )
1338+
1339+ private $ validate(" completedOrder" , contract = contract ,
1340+ order = order ,
1341+ orderState = orderState )
1342+ },
1343+
1344+ COMPLETED_ORDERS_END = function (imsg ) {
1345+
1346+ private $ validate(" completedOrdersEnd" )
11561347 }
11571348 )
11581349)
0 commit comments