Best way to confirm buying power before issuing order??
Posted: Thu Jan 25, 2018 7:20 pm
I am having a problem when reversing positions.
1) Let's say I am long and want to reverse to a short using an inverse ETF
2) I sell the long position, and if I immediately place an order to buy the inverse ETF, the inverse ETF order is usually rejected due to insufficient buying power available
3) So, the first thing I tried is wait_for_filled before placing the inverse ETF orderand it is better, but the problem still occurs sometimes -- it appears that IB isn't updating the buying power quickly enough so even though wait_for_filled has returned "1", the buying power hasn't been updated as quickly
4) And then I tried a timer after I get the fill notification, and it is better still, but once in awhile I still get rejected because the buying power hasn't been updated
5) I have exactly the same problem when reversing from short to long
6) I would like to just check that there is sufficient buying power before placing any order, but I don't see how to do that in the documentation.
7) You can see the messages in the log below, but what you can't see is that IB has plenty of buying power, but it just hasn't reported it back yet -- after the first sale of XIV in the first line from the log, plenty of BP was freed up, but IB hasn't reported it back before the order to buy VXX is placed
What is your preferred way to reverse a position ??
Thank you
Rick
here is an example from this morning:
20180125 10:00:00:081 [OUT] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 Order in Transit acc_? clientid=2 transmit=IB ref= nref= oca= filled=0 lastfill=0 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=1 hidden=0 algo= algo-param= oid=99 permid=0 uidp=0 oidp=0 cid=50673 comment=
20180125 10:00:00:104; 5440;warning;API;;API-warning: order event warning:attribute 'outside regular trading hours' is ignored based on the order type and destination. placeorder is now being processed. code=2109 id=99
20180125 10:00:00:105; 2980;note;tcExpFunc;WAIT_FOR_FILLED;-103543 -2000
20180125 10:00:00:144; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=-200 conid=81488225 account=acc_2_master context=updatePortfolio avg=19.6114143 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:00:146; 5440;note;TWSSocket;execDetails;execution: SLD shares=200 at 137.279900 oid=103543, contract=XIV_STK_USD___0.000000_SMART_ exec-id=00015e7e.5a69e011.01.01&20180125 10:00:00#
20180125 10:00:00:146 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 Filled Partially acc_? clientid=2 transmit=IB ref= nref= oca= filled=200 lastfill=137.2799 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=1 hidden=0 algo= algo-param= oid=99 permid=0 uidp=0 oidp=0 cid=50673 comment=
20180125 10:00:00:147; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103543
20180125 10:00:00:147 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 ApiPending acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103543;1=20180125 10:00:00:080d;2=1348;> oca= filled=200 lastfill=137.2799 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo= algo-param= oid=99 permid=490088303 uidp=0 oidp=0 cid=50673 comment=open order
20180125 10:00:00:172; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=-250 conid=81488225 account=acc_2_master context=updatePortfolio avg=23.6686069 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:00:174; 5440;note;TWSSocket;execDetails;execution: SLD shares=50 at 137.270000 oid=103543, contract=XIV_STK_USD___0.000000_SMART_ exec-id=0000d6a5.5a69f029.01.01&20180125 10:00:00#
20180125 10:00:00:174 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 Filled Partially acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103543;1=20180125 10:00:00:080d;2=1348;> oca= filled=250 lastfill=137.27 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo= algo-param= oid=99 permid=490088303 uidp=0 oidp=0 cid=50673 comment=
20180125 10:00:00:175; 5440;note;libwts_db;perf;perf(30-avg,SetStatus)=00:00:00:00:002:083
20180125 10:00:00:175; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103543
20180125 10:00:00:176 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 ApiPending acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103543;1=20180125 10:00:00:080d;2=1348;> oca= filled=250 lastfill=137.27 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo= algo-param= oid=99 permid=490088303 uidp=0 oidp=0 cid=50673 comment=open order
20180125 10:00:00:178; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=-300 conid=81488225 account=acc_2_master context=updatePortfolio avg=27.4553200 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:00:179; 5440;note;TWSSocket;execDetails;execution: SLD shares=50 at 137.270000 oid=103543, contract=XIV_STK_USD___0.000000_SMART_ exec-id=0000d6a5.5a69f02a.01.01&20180125 10:00:00#
20180125 10:00:00:180 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 Filled Partially acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103543;1=20180125 10:00:00:080d;2=1348;> oca= filled=300 lastfill=137.27 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo= algo-param= oid=99 permid=490088303 uidp=0 oidp=0 cid=50673 comment=
20180125 10:00:00:182; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103543
20180125 10:00:00:182 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 ApiPending acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103543;1=20180125 10:00:00:080d;2=1348;> oca= filled=300 lastfill=137.27 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo= algo-param= oid=99 permid=490088303 uidp=0 oidp=0 cid=50673 comment=open order
20180125 10:00:00:184; 5440;note;libwts_db;perf;perf(20-avg,update portfolio)=00:00:00:00:000:541
20180125 10:00:00:184; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=-1300 conid=81488225 account=acc_2_master context=updatePortfolio avg=71.3816320 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:00:188; 5440;note;TWSSocket;execDetails;execution: SLD shares=1000 at 137.271100 oid=103543, contract=XIV_STK_USD___0.000000_SMART_ exec-id=0001506d.5a69dbc7.01.01&20180125 10:00:00#
20180125 10:00:00:188 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 Filled Partially acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103543;1=20180125 10:00:00:080d;2=1348;> oca= filled=1300 lastfill=137.2711 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo= algo-param= oid=99 permid=490088303 uidp=0 oidp=0 cid=50673 comment=
20180125 10:00:00:189; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103543
20180125 10:00:00:189 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 ApiPending acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103543;1=20180125 10:00:00:080d;2=1348;> oca= filled=1300 lastfill=137.2711 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo= algo-param= oid=99 permid=490088303 uidp=0 oidp=0 cid=50673 comment=open order
20180125 10:00:00:191; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103543
20180125 10:00:00:191 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 PreSubmitted acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103543;1=20180125 10:00:00:080d;2=1348;> oca= filled=1300 lastfill=137.2711 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo= algo-param= oid=99 permid=490088303 uidp=0 oidp=0 cid=50673 comment=open order
20180125 10:00:00:192; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103543
20180125 10:00:00:221; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103543
20180125 10:00:00:243; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103543
20180125 10:00:00:244; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103543
20180125 10:00:01:154; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=-1348 conid=81488225 account=acc_2_master context=updatePortfolio avg=72.6152367 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:01:157; 5440;note;libwts_db;perf;perf(20-avg,AddExecution)=00:00:00:00:001:164
20180125 10:00:01:157; 5440;note;TWSSocket;execDetails;execution: SLD shares=48 at 137.090000 oid=103543, contract=XIV_STK_USD___0.000000_SMART_ exec-id=0001a2f3.5a69de79.02.01&20180125 10:00:01#
20180125 10:00:01:157 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 Filled acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103543;1=20180125 10:00:00:080d;2=1348;> oca= filled=1348 lastfill=137.09 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo= algo-param= oid=99 permid=490088303 uidp=0 oidp=0 cid=50673 comment=
20180125 10:00:01:158; 2980;note;tcExpFunc;WAIT_FOR_FILLED;ret=1
20180125 10:00:01:158; 2980;note;tcExpFunc;PLACE_ORDER;-50672 -0 -BUY -MKT -6741 -0.0000000000 -0.0000000000 -DAY --1 -0
20180125 10:00:01:159; 2980;note;tcExpFunc;PLACE_ORDER;ret=103544
20180125 10:00:01:159; 2980;note;tcExpFunc;SET_ORDER_VAL;-103544 -14 -0 --1
20180125 10:00:01:159; 2980;note;tcExpFunc;SET_ORDER_VAL;ret=1
20180125 10:00:01:159; 2980;note;tcExpFunc;SET_ORDER_VAL;-103544 -67 -Adaptive --1
20180125 10:00:01:160; 2980;note;tcExpFunc;SET_ORDER_VAL;ret=1
20180125 10:00:01:160; 2980;note;tcExpFunc;SET_ORDER_VAL;-103544 -68 -adaptivePriority=Normal --1
20180125 10:00:01:160; 2980;note;tcExpFunc;SET_ORDER_VAL;ret=1
20180125 10:00:01:160; 2980;note;tcExpFunc;SET_FA_MEMBERS;-103544 -acc_? - -XIV Algo Alloc - - 1
20180125 10:00:01:160; 2980;note;tcExpFunc;SET_FA_MEMBERS;ret=1
20180125 10:00:01:161; 5440;action;TWSSocket;FinishRequest;command [placeOrder] transmitted. Bytes sent=254
20180125 10:00:01:161; 5440;note;SmartOrder;openOrderCallExpected;flag=1 uid=103544
20180125 10:00:01:161 [OUT] uid=103544 BUY VXX MKT 6741 DAY SMART lmt=0 aux=0 Order in Transit acc_? clientid=2 transmit=IB ref= nref= oca= filled=0 lastfill=0 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo=Adaptive algo-param=adaptivePriority=Normal oid=100 permid=0 uidp=0 oidp=0 cid=50672 comment=
20180125 10:00:01:172; 5440;note;libwts_db;perf;perf(60-avg,update acc)=00:00:00:00:000:420
20180125 10:00:01:174; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=-1016 conid=81488225 account=acc_2_master context=updatePortfolio avg=72.6152367 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:01:176; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=0 conid=81488225 account=acc_43 context=updatePortfolio avg=0.0000000 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:01:189; 5440;note;TWSSocket;execDetails;execution: SLD shares=332 at 137.265770 oid=103543, contract=XIV_STK_USD___0.000000_SMART_ exec-id=U+0000f9b8.5a69eaa6.01.01&20180125 10:00:01#
20180125 10:00:01:191; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=-627 conid=81488225 account=acc_2_master context=updatePortfolio avg=72.6152367 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:01:194; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=0 conid=81488225 account=acc_34 context=updatePortfolio avg=0.0000000 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:01:195; 5440;note;TWSSocket;execDetails;execution: SLD shares=389 at 137.265812 oid=103543, contract=XIV_STK_USD___0.000000_SMART_ exec-id=U+0000f9b8.5a69eaa8.01.01&20180125 10:00:01#
20180125 10:00:01:196; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=0 conid=81488225 account=acc_2_master context=updatePortfolio avg=72.6152367 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:01:197; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=0 conid=81488225 account=acc_29 context=updatePortfolio avg=0.0000000 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:01:198; 5440;note;TWSSocket;execDetails;execution: SLD shares=627 at 137.265970 oid=103543, contract=XIV_STK_USD___0.000000_SMART_ exec-id=U+0000f9b8.5a69eaaa.01.01&20180125 10:00:01#
20180125 10:00:01:208; 5440;note;TWSSocket;position;postions of contract VXX_STK_USD___0.000000_=26 conid=285777413 account=acc_30 context=updatePortfolio avg=4740.5603077 calls=4 publish_pos=1 publish_pl=1
20180125 10:00:01:288; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103544
20180125 10:00:01:288 [IN] uid=103544 BUY VXX MKT 6741 DAY SMART lmt=0 aux=0 Inactive acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103544;1=20180125 10:00:01:161d;2=6741;> oca= filled=0 lastfill=0 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo=Adaptive algo-param=adaptivePriority=Normal oid=100 permid=490088304 uidp=0 oidp=0 cid=50672 comment=open order
20180125 10:00:01:323; 5440;error;API;;API-error: order rejected - reason:u1821349: cash available: 12255.64; cash needed for this order and other pending orders: 56728.18
<br>u2360031: cash available: 3459.09; cash needed for this order and other pending orders: 48307.82 code=201 id=100
20180125 10:00:01:323; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103544
20180125 10:00:01:325 [IN ERROR] uid=103544 BUY VXX MKT 6741 DAY SMART lmt=0 aux=0 Invalid acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103544;1=20180125 10:00:01:161d;2=6741;> oca= filled=0 lastfill=0 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo=Adaptive algo-param=adaptivePriority=Normal oid=100 permid=490088304 uidp=0 oidp=0 cid=50672 comment=Order rejected - reason:U1821349: CASH AVAILABLE: 12255.64; CASH NEEDED FOR THIS ORDER AND OTHER PENDING ORDERS: 56728.18
<br>U2360031: CASH AVAILABLE: 3459.09; CASH NEEDED FOR THIS ORDER AND OTHER PENDING ORDERS: 48307.82
1) Let's say I am long and want to reverse to a short using an inverse ETF
2) I sell the long position, and if I immediately place an order to buy the inverse ETF, the inverse ETF order is usually rejected due to insufficient buying power available
3) So, the first thing I tried is wait_for_filled before placing the inverse ETF orderand it is better, but the problem still occurs sometimes -- it appears that IB isn't updating the buying power quickly enough so even though wait_for_filled has returned "1", the buying power hasn't been updated as quickly
4) And then I tried a timer after I get the fill notification, and it is better still, but once in awhile I still get rejected because the buying power hasn't been updated
5) I have exactly the same problem when reversing from short to long
6) I would like to just check that there is sufficient buying power before placing any order, but I don't see how to do that in the documentation.
7) You can see the messages in the log below, but what you can't see is that IB has plenty of buying power, but it just hasn't reported it back yet -- after the first sale of XIV in the first line from the log, plenty of BP was freed up, but IB hasn't reported it back before the order to buy VXX is placed
What is your preferred way to reverse a position ??
Thank you
Rick
here is an example from this morning:
20180125 10:00:00:081 [OUT] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 Order in Transit acc_? clientid=2 transmit=IB ref= nref= oca= filled=0 lastfill=0 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=1 hidden=0 algo= algo-param= oid=99 permid=0 uidp=0 oidp=0 cid=50673 comment=
20180125 10:00:00:104; 5440;warning;API;;API-warning: order event warning:attribute 'outside regular trading hours' is ignored based on the order type and destination. placeorder is now being processed. code=2109 id=99
20180125 10:00:00:105; 2980;note;tcExpFunc;WAIT_FOR_FILLED;-103543 -2000
20180125 10:00:00:144; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=-200 conid=81488225 account=acc_2_master context=updatePortfolio avg=19.6114143 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:00:146; 5440;note;TWSSocket;execDetails;execution: SLD shares=200 at 137.279900 oid=103543, contract=XIV_STK_USD___0.000000_SMART_ exec-id=00015e7e.5a69e011.01.01&20180125 10:00:00#
20180125 10:00:00:146 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 Filled Partially acc_? clientid=2 transmit=IB ref= nref= oca= filled=200 lastfill=137.2799 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=1 hidden=0 algo= algo-param= oid=99 permid=0 uidp=0 oidp=0 cid=50673 comment=
20180125 10:00:00:147; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103543
20180125 10:00:00:147 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 ApiPending acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103543;1=20180125 10:00:00:080d;2=1348;> oca= filled=200 lastfill=137.2799 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo= algo-param= oid=99 permid=490088303 uidp=0 oidp=0 cid=50673 comment=open order
20180125 10:00:00:172; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=-250 conid=81488225 account=acc_2_master context=updatePortfolio avg=23.6686069 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:00:174; 5440;note;TWSSocket;execDetails;execution: SLD shares=50 at 137.270000 oid=103543, contract=XIV_STK_USD___0.000000_SMART_ exec-id=0000d6a5.5a69f029.01.01&20180125 10:00:00#
20180125 10:00:00:174 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 Filled Partially acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103543;1=20180125 10:00:00:080d;2=1348;> oca= filled=250 lastfill=137.27 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo= algo-param= oid=99 permid=490088303 uidp=0 oidp=0 cid=50673 comment=
20180125 10:00:00:175; 5440;note;libwts_db;perf;perf(30-avg,SetStatus)=00:00:00:00:002:083
20180125 10:00:00:175; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103543
20180125 10:00:00:176 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 ApiPending acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103543;1=20180125 10:00:00:080d;2=1348;> oca= filled=250 lastfill=137.27 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo= algo-param= oid=99 permid=490088303 uidp=0 oidp=0 cid=50673 comment=open order
20180125 10:00:00:178; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=-300 conid=81488225 account=acc_2_master context=updatePortfolio avg=27.4553200 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:00:179; 5440;note;TWSSocket;execDetails;execution: SLD shares=50 at 137.270000 oid=103543, contract=XIV_STK_USD___0.000000_SMART_ exec-id=0000d6a5.5a69f02a.01.01&20180125 10:00:00#
20180125 10:00:00:180 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 Filled Partially acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103543;1=20180125 10:00:00:080d;2=1348;> oca= filled=300 lastfill=137.27 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo= algo-param= oid=99 permid=490088303 uidp=0 oidp=0 cid=50673 comment=
20180125 10:00:00:182; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103543
20180125 10:00:00:182 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 ApiPending acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103543;1=20180125 10:00:00:080d;2=1348;> oca= filled=300 lastfill=137.27 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo= algo-param= oid=99 permid=490088303 uidp=0 oidp=0 cid=50673 comment=open order
20180125 10:00:00:184; 5440;note;libwts_db;perf;perf(20-avg,update portfolio)=00:00:00:00:000:541
20180125 10:00:00:184; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=-1300 conid=81488225 account=acc_2_master context=updatePortfolio avg=71.3816320 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:00:188; 5440;note;TWSSocket;execDetails;execution: SLD shares=1000 at 137.271100 oid=103543, contract=XIV_STK_USD___0.000000_SMART_ exec-id=0001506d.5a69dbc7.01.01&20180125 10:00:00#
20180125 10:00:00:188 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 Filled Partially acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103543;1=20180125 10:00:00:080d;2=1348;> oca= filled=1300 lastfill=137.2711 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo= algo-param= oid=99 permid=490088303 uidp=0 oidp=0 cid=50673 comment=
20180125 10:00:00:189; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103543
20180125 10:00:00:189 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 ApiPending acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103543;1=20180125 10:00:00:080d;2=1348;> oca= filled=1300 lastfill=137.2711 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo= algo-param= oid=99 permid=490088303 uidp=0 oidp=0 cid=50673 comment=open order
20180125 10:00:00:191; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103543
20180125 10:00:00:191 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 PreSubmitted acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103543;1=20180125 10:00:00:080d;2=1348;> oca= filled=1300 lastfill=137.2711 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo= algo-param= oid=99 permid=490088303 uidp=0 oidp=0 cid=50673 comment=open order
20180125 10:00:00:192; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103543
20180125 10:00:00:221; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103543
20180125 10:00:00:243; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103543
20180125 10:00:00:244; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103543
20180125 10:00:01:154; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=-1348 conid=81488225 account=acc_2_master context=updatePortfolio avg=72.6152367 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:01:157; 5440;note;libwts_db;perf;perf(20-avg,AddExecution)=00:00:00:00:001:164
20180125 10:00:01:157; 5440;note;TWSSocket;execDetails;execution: SLD shares=48 at 137.090000 oid=103543, contract=XIV_STK_USD___0.000000_SMART_ exec-id=0001a2f3.5a69de79.02.01&20180125 10:00:01#
20180125 10:00:01:157 [IN] uid=103543 SELL XIV MKT 1348 DAY SMART lmt=0 aux=0 Filled acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103543;1=20180125 10:00:00:080d;2=1348;> oca= filled=1348 lastfill=137.09 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo= algo-param= oid=99 permid=490088303 uidp=0 oidp=0 cid=50673 comment=
20180125 10:00:01:158; 2980;note;tcExpFunc;WAIT_FOR_FILLED;ret=1
20180125 10:00:01:158; 2980;note;tcExpFunc;PLACE_ORDER;-50672 -0 -BUY -MKT -6741 -0.0000000000 -0.0000000000 -DAY --1 -0
20180125 10:00:01:159; 2980;note;tcExpFunc;PLACE_ORDER;ret=103544
20180125 10:00:01:159; 2980;note;tcExpFunc;SET_ORDER_VAL;-103544 -14 -0 --1
20180125 10:00:01:159; 2980;note;tcExpFunc;SET_ORDER_VAL;ret=1
20180125 10:00:01:159; 2980;note;tcExpFunc;SET_ORDER_VAL;-103544 -67 -Adaptive --1
20180125 10:00:01:160; 2980;note;tcExpFunc;SET_ORDER_VAL;ret=1
20180125 10:00:01:160; 2980;note;tcExpFunc;SET_ORDER_VAL;-103544 -68 -adaptivePriority=Normal --1
20180125 10:00:01:160; 2980;note;tcExpFunc;SET_ORDER_VAL;ret=1
20180125 10:00:01:160; 2980;note;tcExpFunc;SET_FA_MEMBERS;-103544 -acc_? - -XIV Algo Alloc - - 1
20180125 10:00:01:160; 2980;note;tcExpFunc;SET_FA_MEMBERS;ret=1
20180125 10:00:01:161; 5440;action;TWSSocket;FinishRequest;command [placeOrder] transmitted. Bytes sent=254
20180125 10:00:01:161; 5440;note;SmartOrder;openOrderCallExpected;flag=1 uid=103544
20180125 10:00:01:161 [OUT] uid=103544 BUY VXX MKT 6741 DAY SMART lmt=0 aux=0 Order in Transit acc_? clientid=2 transmit=IB ref= nref= oca= filled=0 lastfill=0 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo=Adaptive algo-param=adaptivePriority=Normal oid=100 permid=0 uidp=0 oidp=0 cid=50672 comment=
20180125 10:00:01:172; 5440;note;libwts_db;perf;perf(60-avg,update acc)=00:00:00:00:000:420
20180125 10:00:01:174; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=-1016 conid=81488225 account=acc_2_master context=updatePortfolio avg=72.6152367 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:01:176; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=0 conid=81488225 account=acc_43 context=updatePortfolio avg=0.0000000 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:01:189; 5440;note;TWSSocket;execDetails;execution: SLD shares=332 at 137.265770 oid=103543, contract=XIV_STK_USD___0.000000_SMART_ exec-id=U+0000f9b8.5a69eaa6.01.01&20180125 10:00:01#
20180125 10:00:01:191; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=-627 conid=81488225 account=acc_2_master context=updatePortfolio avg=72.6152367 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:01:194; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=0 conid=81488225 account=acc_34 context=updatePortfolio avg=0.0000000 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:01:195; 5440;note;TWSSocket;execDetails;execution: SLD shares=389 at 137.265812 oid=103543, contract=XIV_STK_USD___0.000000_SMART_ exec-id=U+0000f9b8.5a69eaa8.01.01&20180125 10:00:01#
20180125 10:00:01:196; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=0 conid=81488225 account=acc_2_master context=updatePortfolio avg=72.6152367 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:01:197; 5440;note;TWSSocket;position;postions of contract XIV_STK_USD___0.000000_=0 conid=81488225 account=acc_29 context=updatePortfolio avg=0.0000000 calls=2 publish_pos=1 publish_pl=1
20180125 10:00:01:198; 5440;note;TWSSocket;execDetails;execution: SLD shares=627 at 137.265970 oid=103543, contract=XIV_STK_USD___0.000000_SMART_ exec-id=U+0000f9b8.5a69eaaa.01.01&20180125 10:00:01#
20180125 10:00:01:208; 5440;note;TWSSocket;position;postions of contract VXX_STK_USD___0.000000_=26 conid=285777413 account=acc_30 context=updatePortfolio avg=4740.5603077 calls=4 publish_pos=1 publish_pl=1
20180125 10:00:01:288; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103544
20180125 10:00:01:288 [IN] uid=103544 BUY VXX MKT 6741 DAY SMART lmt=0 aux=0 Inactive acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103544;1=20180125 10:00:01:161d;2=6741;> oca= filled=0 lastfill=0 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo=Adaptive algo-param=adaptivePriority=Normal oid=100 permid=490088304 uidp=0 oidp=0 cid=50672 comment=open order
20180125 10:00:01:323; 5440;error;API;;API-error: order rejected - reason:u1821349: cash available: 12255.64; cash needed for this order and other pending orders: 56728.18
<br>u2360031: cash available: 3459.09; cash needed for this order and other pending orders: 48307.82 code=201 id=100
20180125 10:00:01:323; 5440;note;SmartOrder;openOrderCallExpected;flag=0 uid=103544
20180125 10:00:01:325 [IN ERROR] uid=103544 BUY VXX MKT 6741 DAY SMART lmt=0 aux=0 Invalid acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=103544;1=20180125 10:00:01:161d;2=6741;> oca= filled=0 lastfill=0 fa group= fa profile=XIV Algo Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo=Adaptive algo-param=adaptivePriority=Normal oid=100 permid=490088304 uidp=0 oidp=0 cid=50672 comment=Order rejected - reason:U1821349: CASH AVAILABLE: 12255.64; CASH NEEDED FOR THIS ORDER AND OTHER PENDING ORDERS: 56728.18
<br>U2360031: CASH AVAILABLE: 3459.09; CASH NEEDED FOR THIS ORDER AND OTHER PENDING ORDERS: 48307.82