Igår köpte en av mina modeller dubbelt och på samma signal 16 som först kollar att inget innehav finns. När jag tittar i loggarna ser det ut som om autotrader köper först och sedan skickar en cancellering av första ordern som går genom, sedan skickar order två som också går genom.
Frågorna är:
- varför skickar den order två?
- hur kan den cancellera en order som gått genom?
- fungerar inte kontrollen om man ligger i trade redan eller inte? (se kodutdrag)
Modellen är en countertrend modell enligt en kraftigt modifierad Martingale algoritm. När den köper dubbelt så här förstörs hela tanken med algoritmen.
Detta är ett exempel, det har hänt vid ett flertal ytterligare tillfällen, i två olika molnmiljöer.
Version: 2.9.0.19
Dll: 10.9.0.19
Körs på molnserver
Lokala ordertransaktioner
-------------------------
BULL DAX X15 VON8(35 2016-06-09 09:01:03 S 13619291 93 Köp 204,24 16 10*172,93750 204,24 204,24 171*731,00000
BULL DAX X15 VON8(35 2016-06-09 09:01:10 T 13619291 93 Köp 202,76 0 0 0 0 0
BULL DAX X15 VON8(35 2016-06-09 09:01:11 S 13619291 94 Köp 202,76 16 10*178,79250 202,76 202,76 171*731,00000
BULL DAX X15 VON8(35 2016-06-09 09:01:12 T 13619291 94 Köp 202,71 0 0 0 0 0
TRADELOG.TXT
--------------
*-->20160609 09:01:03 ---
Attempting checking to cancel active orders
*-->20160609 09:01:03 ---
No orders to cancel
*-->20160609 09:01:03 Sent order ---
identifier=364E&market_id=35&price=204.2400&volume=93&side=buy¤cy=SEK
*-->20160609 09:01:03 Order response ---
sent orderid=90224999,res=OK,ostate=LOCAL,astate=INS_PEND,accnt=13619291
*-->20160609 09:01:03 Order requested ---
4248 BULL DAX X15 VON8(35) 13619291 90224999 93.0000 0.0000 204.2400 0 2457549.3757337965 ON_MARKET INS_CONF
*-->20160609 09:01:05 Order requested ---
4248 BULL DAX X15 VON8(35) 13619291 90224999 93.0000 0.0000 204.2400 0 2457549.3757365393 ON_MARKET INS_CONF
*-->20160609 09:01:10 Trade ---
4248 BULL DAX X15 VON8(35) 13619291 90224999 93.0000 202.7600 0 2457549.3758080322
*-->20160609 09:01:10 ---
Attempting checking to cancel active orders
*-->20160609 09:01:10 Deleting order ---
90224999
*-->20160609 09:01:10 Order deleted response ---
deleted orderid=90224999,res=OK,ostate=DELETED,astate=DEL_CONF,accnt=13619291
*-->20160609 09:01:10 ---
162618497 Orders canceled
*-->20160609 09:01:11 Sent order ---
identifier=364E&market_id=35&price=202.7600&volume=94&side=buy¤cy=SEK
*-->20160609 09:01:11 Order response ---
sent orderid=90225089,res=OK,ostate=LOCAL,astate=INS_PEND,accnt=13619291
*-->20160609 09:01:12 Trade ---
4248 BULL DAX X15 VON8(35) 13619291 90225089 94.0000 202.7100 0 2457549.3758253125
*-->20160609 09:01:15 Position ---
4248 BULL DAX X15 VON8(35) 13619291 187.0000 202.7349 37906.7700
*-->20160609 09:05:40 ---
Attempting checking to cancel active orders
*-->20160609 09:05:40 ---
No orders to cancel
-----------------------------------------------------------
DEBLOG.TXT
------------
2016-06-09 09:00:59.600 Private feed - Is Alive
2016-06-09 09:01:03.881 - from 13619291 - UpdateAccountDetails - Reading ActiveOrders
2016-06-09 09:01:03.975 - from 13619291 - UpdateAccountDetails - Reading ActiveOrders - content read
2016-06-09 09:01:03.975 [{"volume":93.0,"price":{"currency":"SEK","value":204.24},"accno":13619291,"traded_volume":0.0,"side":"BUY","order_id":90224999,"modified":146545566340 0,"order_type":"LIMIT","tradable":{"identifier":"364E","market_id":35},"validity":{"type":"DAY","valid_until":1465486500000},"price_condition":"LIMIT" ,"volume_condition":"NORMAL","activation_condition":{"type":"NONE"},"order_state":"ON_MARKET","action_state":"INS_CONF"}]
2016-06-09 09:01:03.975 - from 13619291 - ParseJsonActiveOrdersArray - clearing old content
2016-06-09 09:01:03.975 - from 13619291 - UpdateAccountDetails - Reading Cash
2016-06-09 09:01:04.412 - from 13619291 - UpdateAccountDetails - Reading Cash - content read
2016-06-09 09:01:04.412 - from 13619291 - UpdateAccountDetails - Updating account GUI
2016-06-09 09:01:04.412 - from 13619291 - UpdateAccountDetails - Updating account GUI - sending content
2016-06-09 09:01:04.444 Private feed - Is Alive
2016-06-09 09:01:05.194 - from 13619291 - UpdateAccountDetails - Reading ActiveOrders
2016-06-09 09:01:05.647 - from 13619291 - UpdateAccountDetails - Reading ActiveOrders - content read
2016-06-09 09:01:05.647 [{"volume":93.0,"price":{"currency":"SEK","value":204.24},"accno":13619291,"traded_volume":0.0,"side":"BUY","order_id":90224999,"modified":146545566363 7,"order_type":"LIMIT","tradable":{"identifier":"364E","market_id":35},"validity":{"type":"DAY","valid_until":1465486500000},"price_condition":"LIMIT" ,"volume_condition":"NORMAL","activation_condition":{"type":"NONE"},"order_state":"ON_MARKET","action_state":"INS_CONF"}]
2016-06-09 09:01:05.647 - from 13619291 - ParseJsonActiveOrdersArray - clearing old content
2016-06-09 09:01:05.647 - from 13619291 - UpdateAccountDetails - Reading Cash
2016-06-09 09:01:06.084 - from 13619291 - UpdateAccountDetails - Reading Cash - content read
2016-06-09 09:01:06.084 - from 13619291 - UpdateAccountDetails - Updating account GUI
2016-06-09 09:01:06.084 - from 13619291 - UpdateAccountDetails - Updating account GUI - sending content
2016-06-09 09:01:08.350 Doing KeepAlive of session
2016-06-09 09:01:09.256 Private feed - Is Alive
Köpscript (sektioner markerade med ... är borttagna)
--------------------------------------------------
(... borttaget ...)
i1(
inTrade=and(gt(cash(a),0),gt(portfolio(v),0))
(... borttaget ...)
{ Delay orders with five seconds }
okTimeBetweenBuy=gt(mult(86400,sub(date(),lasttrade(b,d))),5)
(... borttaget ...)
firstPreReq=and(not(inTrade),and(okTimeToBuy,and(okBuySpread,and(okTimeBetweenBuy,okTrendFilter))))
(... borttaget ...)
{ Buysignal 16 }
buy16a=and(USE16,firstPreReq)
buy16b=and(...,buy16a)
buy16signal=and(...,buy16b)
(... borttaget ...)
firstSignal=or(buy11signal,or(buy12signal,or(buy13signal,or(buy14signal,or(buy15signal,buy16signal)))))
nextSignal=and(1,buy21signal)
buySignal=or(firstSignal,nextSignal)
(... borttaget ...)
{ Return values for lasttrade }
retval(if(buy21signal,21,if(buy12signal,12,if(buy13signal,13,if(buy14signal,14,if(buy15signal,15,if(buy16signal,16,11)))))),0)
retval(...,1)
retval(...,2)
retval(...,3)
retval(...,4)
mult(20,buySignal)
)
Frågorna är:
- varför skickar den order två?
- hur kan den cancellera en order som gått genom?
- fungerar inte kontrollen om man ligger i trade redan eller inte? (se kodutdrag)
Modellen är en countertrend modell enligt en kraftigt modifierad Martingale algoritm. När den köper dubbelt så här förstörs hela tanken med algoritmen.
Detta är ett exempel, det har hänt vid ett flertal ytterligare tillfällen, i två olika molnmiljöer.
Version: 2.9.0.19
Dll: 10.9.0.19
Körs på molnserver
Lokala ordertransaktioner
-------------------------
BULL DAX X15 VON8(35 2016-06-09 09:01:03 S 13619291 93 Köp 204,24 16 10*172,93750 204,24 204,24 171*731,00000
BULL DAX X15 VON8(35 2016-06-09 09:01:10 T 13619291 93 Köp 202,76 0 0 0 0 0
BULL DAX X15 VON8(35 2016-06-09 09:01:11 S 13619291 94 Köp 202,76 16 10*178,79250 202,76 202,76 171*731,00000
BULL DAX X15 VON8(35 2016-06-09 09:01:12 T 13619291 94 Köp 202,71 0 0 0 0 0
TRADELOG.TXT
--------------
*-->20160609 09:01:03 ---
Attempting checking to cancel active orders
*-->20160609 09:01:03 ---
No orders to cancel
*-->20160609 09:01:03 Sent order ---
identifier=364E&market_id=35&price=204.2400&volume=93&side=buy¤cy=SEK
*-->20160609 09:01:03 Order response ---
sent orderid=90224999,res=OK,ostate=LOCAL,astate=INS_PEND,accnt=13619291
*-->20160609 09:01:03 Order requested ---
4248 BULL DAX X15 VON8(35) 13619291 90224999 93.0000 0.0000 204.2400 0 2457549.3757337965 ON_MARKET INS_CONF
*-->20160609 09:01:05 Order requested ---
4248 BULL DAX X15 VON8(35) 13619291 90224999 93.0000 0.0000 204.2400 0 2457549.3757365393 ON_MARKET INS_CONF
*-->20160609 09:01:10 Trade ---
4248 BULL DAX X15 VON8(35) 13619291 90224999 93.0000 202.7600 0 2457549.3758080322
*-->20160609 09:01:10 ---
Attempting checking to cancel active orders
*-->20160609 09:01:10 Deleting order ---
90224999
*-->20160609 09:01:10 Order deleted response ---
deleted orderid=90224999,res=OK,ostate=DELETED,astate=DEL_CONF,accnt=13619291
*-->20160609 09:01:10 ---
162618497 Orders canceled
*-->20160609 09:01:11 Sent order ---
identifier=364E&market_id=35&price=202.7600&volume=94&side=buy¤cy=SEK
*-->20160609 09:01:11 Order response ---
sent orderid=90225089,res=OK,ostate=LOCAL,astate=INS_PEND,accnt=13619291
*-->20160609 09:01:12 Trade ---
4248 BULL DAX X15 VON8(35) 13619291 90225089 94.0000 202.7100 0 2457549.3758253125
*-->20160609 09:01:15 Position ---
4248 BULL DAX X15 VON8(35) 13619291 187.0000 202.7349 37906.7700
*-->20160609 09:05:40 ---
Attempting checking to cancel active orders
*-->20160609 09:05:40 ---
No orders to cancel
-----------------------------------------------------------
DEBLOG.TXT
------------
2016-06-09 09:00:59.600 Private feed - Is Alive
2016-06-09 09:01:03.881 - from 13619291 - UpdateAccountDetails - Reading ActiveOrders
2016-06-09 09:01:03.975 - from 13619291 - UpdateAccountDetails - Reading ActiveOrders - content read
2016-06-09 09:01:03.975 [{"volume":93.0,"price":{"currency":"SEK","value":204.24},"accno":13619291,"traded_volume":0.0,"side":"BUY","order_id":90224999,"modified":146545566340 0,"order_type":"LIMIT","tradable":{"identifier":"364E","market_id":35},"validity":{"type":"DAY","valid_until":1465486500000},"price_condition":"LIMIT" ,"volume_condition":"NORMAL","activation_condition":{"type":"NONE"},"order_state":"ON_MARKET","action_state":"INS_CONF"}]
2016-06-09 09:01:03.975 - from 13619291 - ParseJsonActiveOrdersArray - clearing old content
2016-06-09 09:01:03.975 - from 13619291 - UpdateAccountDetails - Reading Cash
2016-06-09 09:01:04.412 - from 13619291 - UpdateAccountDetails - Reading Cash - content read
2016-06-09 09:01:04.412 - from 13619291 - UpdateAccountDetails - Updating account GUI
2016-06-09 09:01:04.412 - from 13619291 - UpdateAccountDetails - Updating account GUI - sending content
2016-06-09 09:01:04.444 Private feed - Is Alive
2016-06-09 09:01:05.194 - from 13619291 - UpdateAccountDetails - Reading ActiveOrders
2016-06-09 09:01:05.647 - from 13619291 - UpdateAccountDetails - Reading ActiveOrders - content read
2016-06-09 09:01:05.647 [{"volume":93.0,"price":{"currency":"SEK","value":204.24},"accno":13619291,"traded_volume":0.0,"side":"BUY","order_id":90224999,"modified":146545566363 7,"order_type":"LIMIT","tradable":{"identifier":"364E","market_id":35},"validity":{"type":"DAY","valid_until":1465486500000},"price_condition":"LIMIT" ,"volume_condition":"NORMAL","activation_condition":{"type":"NONE"},"order_state":"ON_MARKET","action_state":"INS_CONF"}]
2016-06-09 09:01:05.647 - from 13619291 - ParseJsonActiveOrdersArray - clearing old content
2016-06-09 09:01:05.647 - from 13619291 - UpdateAccountDetails - Reading Cash
2016-06-09 09:01:06.084 - from 13619291 - UpdateAccountDetails - Reading Cash - content read
2016-06-09 09:01:06.084 - from 13619291 - UpdateAccountDetails - Updating account GUI
2016-06-09 09:01:06.084 - from 13619291 - UpdateAccountDetails - Updating account GUI - sending content
2016-06-09 09:01:08.350 Doing KeepAlive of session
2016-06-09 09:01:09.256 Private feed - Is Alive
Köpscript (sektioner markerade med ... är borttagna)
--------------------------------------------------
(... borttaget ...)
i1(
inTrade=and(gt(cash(a),0),gt(portfolio(v),0))
(... borttaget ...)
{ Delay orders with five seconds }
okTimeBetweenBuy=gt(mult(86400,sub(date(),lasttrade(b,d))),5)
(... borttaget ...)
firstPreReq=and(not(inTrade),and(okTimeToBuy,and(okBuySpread,and(okTimeBetweenBuy,okTrendFilter))))
(... borttaget ...)
{ Buysignal 16 }
buy16a=and(USE16,firstPreReq)
buy16b=and(...,buy16a)
buy16signal=and(...,buy16b)
(... borttaget ...)
firstSignal=or(buy11signal,or(buy12signal,or(buy13signal,or(buy14signal,or(buy15signal,buy16signal)))))
nextSignal=and(1,buy21signal)
buySignal=or(firstSignal,nextSignal)
(... borttaget ...)
{ Return values for lasttrade }
retval(if(buy21signal,21,if(buy12signal,12,if(buy13signal,13,if(buy14signal,14,if(buy15signal,15,if(buy16signal,16,11)))))),0)
retval(...,1)
retval(...,2)
retval(...,3)
retval(...,4)
mult(20,buySignal)
)
Comment