Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
Search
braket order failed
Jeff Han
in some cases, the take profit order failed to be accepted
the braket order is as following: parent order:? limit? buy/sell with 1 minute timed auto cancel child orders:?? 1 stp order and 1 lmt order in this case, the profit taker lmt was rejected, and hoving over the 'i', it says 'Rejected by system, parent Id is cancelled', and I have verified that it is NOT a partialy fill, the prent order are? filled in full. one of the child orders was accepted, in this case the stoploss order. can someone help me explain what is going on? Thanks Jeff |
¿ªÔÆÌåÓýYour images are too small to read. ? The information returned by the API in the openOrder(), orderStatus() and errMsg() callbacks should help you determine what¡¯s wrong. ? ? From: [email protected] <[email protected]> On Behalf Of Jeff Han
Sent: 30 August 2018 20:50 To: [email protected] Subject: Re: [TWS API] braket order failed ? most of cases, things are ok, such as the following: |
Jeff Han
Hi Josh/Richard,
Looking at my own log again, I deleted my previous posting, and I think I still have not find reason my orderid as following: parent: 1535724415 SYM[IBAT] ([AAPL][P][OPT][327473110]) OpenOrder ID: 1535724415, @ SMART BUY: LMT, 7 status: Submitted ct[1775][0][1774][14][13:33:37-632] SYM[IBAT] OrderStatus. Id: 1535724415, Status: Submitted, Filled: 0, Remaining: 7, AvgFillPrice: 0, PermId: 1087925538, LastFillPrice: 0, ClientId: 0, WhyHeld:? ct[1776][0][1775][14][13:33:37-632] SYM[IBAT] ([AAPL][P][OPT][327473110]) OpenOrder ID: 1535724415, @ SMART BUY: LMT, 7 status: Filled ct[1779][0][1778][20][13:33:37-723] SYM[IBAT] OrderStatus. Id: 1535724415, Status: Filled, Filled: 7, Remaining: 0, AvgFillPrice: 3.55, PermId: 1087925538, LastFillPrice: 3.55, ClientId: 0, WhyHeld:? ct[1781][0][1780][14][13:33:37-723] child2: profit taking lmt order (failed) 1535724417 SYM[IBAT] ([AAPL][P][OPT][327473110]) OpenOrder ID: 1535724417, @ SMART SELL: LMT, 7 status: Inactive ct[1782][0][1781][13][13:33:37-723] SYM[IBAT] OrderStatus. Id: 1535724417, Status: Inactive, Filled: 0, Remaining: 7, AvgFillPrice: 0, PermId: 1087925540, LastFillPrice: 0, ClientId: 0, WhyHeld:? ct[1784][0][1783][12][13:33:37-723] Error. SYM[IBAT][13:33:37-723] Id: 1535724417, Code: 201, Msg: Order rejected - reason:The parent order is being canceled. child1: stoploss (stp order and it is OK) 1535724416 SYM[IBAT] ([AAPL][P][OPT][327473110]) OpenOrder ID: 1535724416, @ SMART SELL: STP, 7 status: PreSubmitted ct[1773][0][1772][21][13:33:37-632] SYM[IBAT] OrderStatus. Id: 1535724416, Status: PreSubmitted, Filled: 0, Remaining: 7, AvgFillPrice: 0, PermId: 1087925539, LastFillPrice: 0, ClientId: 0, WhyHel + + +? d: child,locate,trigger ct[1774][0][1773][23][13:33:37-632] SYM[IBAT] OrderStatus. Id: 1535724416, Status: PreSubmitted, Filled: 0, Remaining: 7, AvgFillPrice: 0, PermId: 1087925539, LastFillPrice: 0, ClientId: 0, WhyHel + + +? d: locate,trigger ct[1786][0][1785][15][13:33:37-793] SYM[IBAT] ([AAPL][P][OPT][327473110]) OpenOrder ID: 1535724416, @ SMART SELL: STP, 7 status: PreSubmitted ct[1786][1][1772][13][13:33:40-232] SYM[IBAT] ([AAPL][P][OPT][327473110]) OpenOrder ID: 1535724416, @ SMART SELL: STP, 7 status: PreSubmitted ct[1786][1][1772][13][13:33:42-759] SYM[IBAT] OrderStatus. Id: 1535724416, Status: PreSubmitted, Filled: 0, Remaining: 7, AvgFillPrice: 0, PermId: 1087925539, LastFillPrice: 0, ClientId: 0, WhyHeld: locate,trigger ct[1786][1][1785][11][13:33:42-827] .... SYM[IBAT] ([AAPL][P][OPT][327473110]) OpenOrder ID: 1535724416, @ SMART SELL: STP, 7 status: PreSubmitted ct[1739][1][170][30][14:13:42-878] SYM[IBAT] ([AAPL][P][OPT][327473110]) OpenOrder ID: 1535724416, @ SMART SELL: STP, 7 status: PendingCancel ct[1740][0][1739][25][14:13:44-539] SYM[IBAT] OrderStatus. Id: 1535724416, Status: PendingCancel, Filled: 0, Remaining: 7, AvgFillPrice: 0, PermId: 1087925539, LastFillPrice: 0, ClientId: 0, WhyHeld:? ct[1741][0][1740][12][14:13:44-539] my c++ code: ?int triggerMethod = pc_cmshm->get_conf_int("order.triggerMethod"); ??? vector<Order> orders; ??? //GCL/GPL/GPS order kicked in here ??? if( isGrp ) { ??????? Order parent; ??????? int pordid = pc_cmshm->get_trade_id(); ??????? parent.orderId????????? = pordid; ??????? parent.action?????????? = grp[0].buysell; ??????? parent.totalQuantity??? = pos; ??????? parent.optOutSmartRouting= true; ??????? parent.transmit???????? = false; ??????? //using the orderType and lmtPrice ??????? if(om.orderType.size()>0 && om.lmtPrice > 0 ) { ??????????? parent.orderType??? = om.orderType; ??????????? double lmtPrice???? = om.lmtPrice; ??????????? //make auxPrice/profit_price incr ??????????? if ( incr > 0.01 ) { ??????????????? double amod = fmod(lmtPrice,incr); ??????????????? if ( amod != NAN ) { ??????????????????? lmtPrice += (incr-amod); ??????????????? } ??????????? } ??????????? //increment ??????????? parent.lmtPrice???? = lmtPrice; ??????????? parent.triggerMethod= triggerMethod; ??????? }else{ ??????????? parent.orderType??? = grp[0].orderType; ??????? } ??????? //timed cancel ??????? if(om.enableCancel > 0) { ??????????? string cancelAfterTime? = jat_now_plus_seconds(om.enableCancel); ??????????? TimeCondition* timeCond = dynamic_cast<TimeCondition *>(OrderCondition::create(OrderCondition::OrderConditionType::Time)); ??????????? timeCond->isMore(true); ??????????? timeCond->time(cancelAfterTime); ??????????? parent.conditionsCancelOrder = true; ??????????? parent.conditions.push_back(shared_ptr<TimeCondition>(timeCond)); ??????? } ??????? orders.push_back(parent); ??????? //stoploss must be the second ??????? int this_oid = pc_cmshm->get_trade_id(); ??????? Order stoploss; ??????? stoploss.orderId??????? = this_oid; ??????? stoploss.parentId?????? = pordid; ??????? stoploss.action???????? = grp[1].buysell; ??????? stoploss.orderType????? = grp[1].orderType; ??????? stoploss.auxPrice?????? = grp[1].price; ??????? stoploss.totalQuantity? = pos; ??????? stoploss.optOutSmartRouting = true; ??????? stoploss.triggerMethod? = triggerMethod; ??????? stoploss.transmit?????? = false; ??????? orders.push_back(stoploss); ??????? this_oid = pc_cmshm->get_trade_id(); ??????? Order profit; ??????? profit.orderId????????? = this_oid; ??????? profit.parentId???????? = pordid; ??????? profit.action?????????? = grp[2].buysell; ??????? profit.orderType??????? = grp[2].orderType; ??????? profit.lmtPrice???????? = grp[2].price; ??????? profit.totalQuantity??? = pos; ??????? profit.optOutSmartRouting = true; ??????? profit.triggerMethod??? = triggerMethod; ??????? profit.transmit???????? = true; ??????? orders.push_back(profit); ... ?? for(auto o:orders) { ??????????? errno=0; ??????????? pc_cmshm->wait_for_ok_to_send(); ???????? ??????????????? m_pClient->placeOrder(o.orderId, con, o); ? ??????????? jat_pmsg(); ???? } |
Nick
All orders except the final child should be transmit false. Only the final child should be transmit true.
toggle quoted message
Show quoted text
On 8/30/2018 7:17 PM, Jeff Han wrote:
I have the parent transmit set as false, both children as true, and placeOrder sequence is parent goes first and then children. |
to navigate to use esc to dismiss