Placing Adaptive Algorithmic orders

Discuss, post your questions about TWSLink here.

Users who just registered, please write an email to
forum@trade-commander.de
with your username mentioned.
So we can distinguish you from bots.
Thank you
sectorbets
Posts: 78
Joined: Wed Apr 26, 2017 12:41 pm

Re: Placing Adaptive Algorithmic orders

Post by sectorbets » Thu Oct 19, 2017 3:47 pm

I checked every SET_FA_MEMBERS, and they are all using "VXX Algo Alloc"

Also the string "VXX Alloc" is nowhere in the code

I will rename to VXXAlgoAlloc and we will see what happens when the next execution is triggered -- I am using live code, so there are typically only 2 - 3 trades per day, so it is possible it will take a day or two to have the next execution

board_admin
Site Admin
Posts: 134
Joined: Mon Apr 24, 2017 3:24 pm

Re: Placing Adaptive Algorithmic orders

Post by board_admin » Thu Oct 19, 2017 5:31 pm

Just made a check. If i pass "VXX Algo Alloc" then it arrives exactly at the socket and is sent to IB without being manipulated.
(It simply makes no sense to cut something out in the mid or cut anything).

From the log you picked the place order entry, pick the corresponding SET_FA_MEMBERS entry, so mind uid.
Or call SET_FA_MEMBERS with a profile string like "test". If you still get "VXX Alloc", you know your code is doing something unexpected.

sectorbets
Posts: 78
Joined: Wed Apr 26, 2017 12:41 pm

Re: Placing Adaptive Algorithmic orders

Post by sectorbets » Thu Oct 19, 2017 7:19 pm

I can't make it work with the "VXX Algo Alloc" string -- the Algo part always gets stripped out before it is transmitted.

However, the string "VXXAlgoAlloc" works perfectly, so that is what I am going with unless it blows up down the line.

sectorbets
Posts: 78
Joined: Wed Apr 26, 2017 12:41 pm

Re: Placing Adaptive Algorithmic orders

Post by sectorbets » Thu Oct 19, 2017 7:27 pm

Here is the original order from this morning -- the SET_FA_MEMBERS has stripped out the "Algo" from the string:

20171019 09:45:00:021; 86544;note;tcExpFunc;PLACE_ORDER;-50007 -0 -BUY -MKT -5610 -0.0000000000 -0.0000000000 -DAY --1 -0
20171019 09:45:00:022; 86544;note;tcExpFunc;PLACE_ORDER;ret=97058
20171019 09:45:00:023; 86544;note;tcExpFunc;SET_ORDER_VAL;-97058 -14 -0 --1
20171019 09:45:00:023; 86544;note;tcExpFunc;SET_ORDER_VAL;ret=1
20171019 09:45:00:023; 86544;note;tcExpFunc;SET_ORDER_VAL;-97058 -67 -Adaptive --1
20171019 09:45:00:023; 86544;note;tcExpFunc;SET_ORDER_VAL;ret=1
20171019 09:45:00:023; 86544;note;tcExpFunc;SET_ORDER_VAL;-97058 -68 -adaptivePriority=Normal --1
20171019 09:45:00:023; 86544;note;tcExpFunc;SET_ORDER_VAL;ret=1
20171019 09:45:00:023; 86544;note;tcExpFunc;SET_FA_MEMBERS;-97058 -acc_? - -VXX Alloc - - 1


And here is teh order from this afternoon -- the "VXXAlgoAlloc" was passed correctly -- the only difference in our code is that string.

86544;note;tcExpFunc;PLACE_ORDER;-50007 -0 -SELL -MKT -5770 -0.0000000000 -0.0000000000 -DAY --1 -0
20171019 15:00:00:370; 86544;note;tcExpFunc;PLACE_ORDER;ret=97067
20171019 15:00:00:370; 86544;note;tcExpFunc;SET_ORDER_VAL;-97067 -14 -0 --1
20171019 15:00:00:370; 86544;note;tcExpFunc;SET_ORDER_VAL;ret=1
20171019 15:00:00:371; 86544;note;tcExpFunc;SET_ORDER_VAL;-97067 -67 -Adaptive --1
20171019 15:00:00:371; 86544;note;tcExpFunc;SET_ORDER_VAL;ret=1
20171019 15:00:00:371; 86544;note;tcExpFunc;SET_ORDER_VAL;-97067 -68 -adaptivePriority=Normal --1
20171019 15:00:00:371; 86544;note;tcExpFunc;SET_ORDER_VAL;ret=1
20171019 15:00:00:371; 86544;note;tcExpFunc;SET_FA_MEMBERS;-97067 -acc_? - -VXXAlgoAlloc - - 1

board_admin
Site Admin
Posts: 134
Joined: Mon Apr 24, 2017 3:24 pm

Re: Placing Adaptive Algorithmic orders

Post by board_admin » Thu Oct 19, 2017 8:28 pm

So this makes it clear. The order with uid=97058 has profile VXX Alloc.

Mind your own post. (where you thought about alloc is wrong but your prev. post proofs it is correct)
171019 09:45:02:546 [IN] uid=97058 BUY VXX MKT 5610 DAY SMART lmt=0 aux=0 Submitted acc_? clientid=2 transmit=IB ref= nref=#~tc#;0=97058;1=20171019 09:45:00:023d;2=5610;> oca= filled=0 lastfill=0 fa group= fa profile=VXX Alloc fa method= fa percentage= gat= gtd= outside rth=0 hidden=0 algo=Adaptive algo-param=adaptivePriority=Normal oid=5253 permid=709398922 uidp=0 oidp=0 cid=50007 comment=open order
20171019 09:45:02:547;

The 2nd order with uid=97067 and VXXAlgoAlloc should arrive with exact that profile.

sectorbets
Posts: 78
Joined: Wed Apr 26, 2017 12:41 pm

Re: Placing Adaptive Algorithmic orders

Post by sectorbets » Thu Oct 19, 2017 8:44 pm

Yes -- let's be clear.

The first order does not allocate correctly because somewhere along the line the "Algo" got stripped out of the string, and the profile "VXX Alloc" was transmitted -- incorrectly. "VXX Alloc" is wrong -- period.

On the other hand, the second order worked perfectly since the "VXXAlgoAlloc" was not modified, and it used the proper profile "VXXAlgoAlloc"

Since the ONLY change at our end is the two strings "VXX Algo Alloc" and "VXXAlgoAlloc" -- I used a global replace to swap them and I can assure you there were no other changes to our code -- I think it is on your end -- but it doesn't matter at this point -- we know that using "Algo" with spaces on either side gets modified, and "VXXAlgoAlloc" with no spaces works fine,so we will just avoid the first format and it seems everything will be OK.

board_admin
Site Admin
Posts: 134
Joined: Mon Apr 24, 2017 3:24 pm

Re: Placing Adaptive Algorithmic orders

Post by board_admin » Thu Oct 19, 2017 9:01 pm

- I think it is on your end -- but it doesn't matter at this point
Sorry no, strong opposition: your own logs proved TWSLink works correct here.

There is no malfunction in TWSLink regarding this point. You can pass any string as profile, there is no trim, no cut or any other
manipulation of this parameter.

>> The error must be in your code.<<

Poeple use this forum to get information. I wont left them with wrong information.

Please check your code again more closely.

sectorbets
Posts: 78
Joined: Wed Apr 26, 2017 12:41 pm

Re: Placing Adaptive Algorithmic orders

Post by sectorbets » Thu Oct 19, 2017 9:33 pm

There is nothing more to check -- you have all our code and you can see for yourself that we aren't manipulating the string -- it is either "VXX Algo Alloc" which doesn't work or "VXXAlgoAlloc" that does work. Every SET_FA_MEMBERS string is either

setFAVXX = SET_FA_MEMBERS(oidCloseOrderVXX,"","","VXXAlgoAlloc","","",1);

for closing orders or

setFAVXX = SET_FA_MEMBERS(uidOfOrderVXX,"","","VXXAlgoAlloc","","",1);

for opening orders. There are no exceptions and as we showed yesterday, the SET_FA_MEMBERS is the last statement before the order is transmitted -- see the "1" at the end of the line of code -- we aren't doing anything except sending the order.

I totally agree that we don't want to mislead anyone about how well the DLL's work -- it is a great product, and have already recommended it to several friends.

board_admin
Site Admin
Posts: 134
Joined: Mon Apr 24, 2017 3:24 pm

Re: Placing Adaptive Algorithmic orders

Post by board_admin » Thu Oct 19, 2017 9:39 pm

Then i suggest we have TeamViewer where we can clear this together. My bet: What ever string you pass, it will arrive at IB.

sectorbets
Posts: 78
Joined: Wed Apr 26, 2017 12:41 pm

Re: Placing Adaptive Algorithmic orders

Post by sectorbets » Thu Oct 19, 2017 9:59 pm

I have mentioned before that we are on a live machine and we don't allow TeamViewer to access it.

I totally agree that we are sending "VXX Alloc" even though the code has "VXX Algo Alloc" in every one of our SET_FA_MEMBERS statements. I have done a global search for "VXX Alloc" and it simply is not in our code -- anywhere -- so somehow the "Algo" word is disappearing before the string is sent, and we aren't doing it in our code.

Here is our code again -- every instance of it has identical SET_FA_MEMBERS statements, and what is sent to IB is just the "VXX Alloc" string as we have both seen repeatedly. The first block of code entered a long position this morning and the second is when it exited teh posiiton later in teh day, and in both cases it allocated to "VXX Alloc"

uidOfOrderVXX=PLACE_ORDER(uidVXX,0,"BUY","MKT",PosSizeVXXX,0,0.0,"DAY",-1,0);
SetOrderVal14 = SET_ORDER_VAL(uidOfOrderVXX,14,"0",-1);
SetOrderVal67 = SET_ORDER_VAL(uidOfOrderVXX,67,"Adaptive",-1);
SetOrderVal68 = SET_ORDER_VAL(uidOfOrderVXX,68,"adaptivePriority=Normal",-1);
setFAVXX = SET_FA_MEMBERS(uidOfOrderVXX,"","","VXX Algo Alloc","","",1);

oidCloseOrderVXX = PLACE_ORDER(uidVXX,0,"SELL","MKT",LastVXX,0,0.0,"DAY",-1,0);
SetOrderVal14 = SET_ORDER_VAL(oidCloseOrderVXX,14,"0",-1);
SetOrderVal67 = SET_ORDER_VAL(oidCloseOrderVXX,67,"Adaptive",-1);
SetOrderVal68 = SET_ORDER_VAL(oidCloseOrderVXX,68,"adaptivePriority=Normal",-1);
setFAVXX = SET_FA_MEMBERS(oidCloseOrderVXX,"","","VXX Algo Alloc","","",1);

Later in the day I changed every instance of "VXX Algo Aloc" to "VXXAlgoAlloc" and everything was fine. If you have any ideas what I should look for, I'm happy to try to debug things, but we have to do it via email since we don't allow TeamViewer on that live machine.

sectorbets
Posts: 78
Joined: Wed Apr 26, 2017 12:41 pm

Re: Placing Adaptive Algorithmic orders

Post by sectorbets » Thu Oct 19, 2017 10:15 pm

One other thought:

We are running models in three other TS windows -- none of them are using the IB algos yet

The three other models have profiles of "SVXY Alloc", "SPY Alloc", and one uses "VXX Alloc" -- they all work fine and have been fine for many months. Is there any scenario where this model running in its own window is picking up the "VXX Alloc from the other window ??

sectorbets
Posts: 78
Joined: Wed Apr 26, 2017 12:41 pm

Re: Placing Adaptive Algorithmic orders

Post by sectorbets » Thu Oct 19, 2017 11:09 pm

I just want to be 100% sure that we are addressing the same problem -- I am not disputing that we somehow were sending "VXX Alloc" to IB -- that is very clear. What is not clear is where that string is coming from since it is nowhere in our code.

board_admin
Site Admin
Posts: 134
Joined: Mon Apr 24, 2017 3:24 pm

Re: Placing Adaptive Algorithmic orders

Post by board_admin » Mon Oct 23, 2017 10:59 am

I believe to understand the problem but i have no idea where this wrong argument is coming from.
I cant reproduce it, the TWSLink code is very simple in this, so easy to track for issues.

All TWSLink functions are thread safe. Shall mean: if you call them from different threads (charts), internal containers
like the profle are protected against concurrent access.

The only thing i can recommend is to try to reproduce it. Once you can reproduce it, set loglevel to 0, replay and send the logfiles.

sectorbets
Posts: 78
Joined: Wed Apr 26, 2017 12:41 pm

Re: Placing Adaptive Algorithmic orders

Post by sectorbets » Tue Oct 24, 2017 4:39 pm

I will try -- thank you.

sectorbets
Posts: 78
Joined: Wed Apr 26, 2017 12:41 pm

Re: Placing Adaptive Algorithmic orders

Post by sectorbets » Wed Oct 25, 2017 3:10 pm

We have run 9 trades so far this morning and everything is working fine. I saved the log from the day we had problems if you ever want it

board_admin
Site Admin
Posts: 134
Joined: Mon Apr 24, 2017 3:24 pm

Re: Placing Adaptive Algorithmic orders

Post by board_admin » Wed Oct 25, 2017 3:35 pm

Thank you for feedback.
If there are no problems, no logs required.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests