Регистрация заявок на опционы

Регистрация заявок на опционы
Atom
10/27/2011
lshaton



```**Уважаемые господа, может кто видит, почему на  RealTimeEmulationTrader<QuikTrader> три заявки регистритуются, а на реальных торгах регистрируется только одна TargetOrder1, а от остальных никакого следа (нет сообщений об ошибке). Первая заявка на фьючерс, а две последних на опционы.
Под фрагментом программы приведена распечатка содержимого TargetOrder2 и TargetOrder3. Может чего не указал в кострукторе заявок на опцион?**
```plain
                                if ((dShortProf > Profitgap) & (dShortProf != dShortProfOld))
                                {
                                    sLS = "Short";
                                    TargetOrder1 = new Order
                                    {
                                        Security = dicSecurities[secKey].Undelying,
                                        Direction = OrderDirections.Sell,
                                        Price = dicSecurities[secKey].Undelying.MinPrice,
                                        Volume = 1,
                                        Portfolio = _portfolio,
                                        Type = OrderTypes.Limit,
                                    };
                                    TargetOrder2 = new Order
                                    {
                                        Security = dicSecurities[secKey].CallOpt,
                                        Direction = OrderDirections.Buy,
                                        Price = dicSecurities[secKey].CallOpt.BestBid.Price + dicSecurities[secKey].CallOpt.MinStepPrice, // + 500m,
                                        Volume = 1,
                                        Portfolio = _portfolio,
                                        Type = OrderTypes.Limit,
                                    };
                                    TargetOrder3 = new Order
                                    {
                                        Security = dicSecurities[secKey].PutOpt,
                                        Direction = OrderDirections.Sell,
                                        Price = dicSecurities[secKey].PutOpt.BestAsk.Price - dicSecurities[secKey].PutOpt.MinStepPrice, // - 500m,
                                        Volume = 1,
                                        Portfolio = _portfolio,
                                        Type = OrderTypes.Limit, 
                                    };
                                };
                                if ((sLS == "Long") || (sLS == "Short"))
                                {
                                    if ((TargetOrder1 != null) && (TargetOrder2 != null) && (TargetOrder3 != null))
                                    {
                                        if (_strategy != null) _strategy.RegOrd(TargetOrder1);
                                        else  _trader.RegisterOrder(TargetOrder1);
                                        if (_strategy != null) _strategy.RegOrd(TargetOrder2);
                                        else   _trader.RegisterOrder(TargetOrder2);
                                        if (_strategy != null) _strategy.RegOrd(TargetOrder3);
                                        else  _trader.RegisterOrder(TargetOrder3);
                                    };
                                };

- TargetOrder2 StockSharp.BusinessEntities.Order

  •   base	{StockSharp.BusinessEntities.Order}	Ecng.Common.Cloneable<StockSharp.BusinessEntities.Order> {StockSharp.BusinessEntities.Order}
      Balance	0	decimal
      CancelTime	null	System.DateTime?
      Comment	null	string
      DerivedOrder	null	StockSharp.BusinessEntities.Order
      Direction	Buy	StockSharp.BusinessEntities.OrderDirections
      ExecutionCondition	PutInQueue	StockSharp.BusinessEntities.OrderExecutionConditions
      ExtensionInfo	null	System.Collections.Generic.IDictionary<object,object>
      Id	0	long
    
  •   Latency	{00:00:00}	System.TimeSpan
    
  •   Messages	{Ecng.Collections.SynchronizedList<string>}	System.Collections.Generic.IList<string> {Ecng.Collections.SynchronizedList<string>}
    
  •   Portfolio	{SPBFUT00000}	StockSharp.BusinessEntities.Portfolio
      Price	1305	decimal
      RepoInfo	null	StockSharp.BusinessEntities.RepoOrderInfo
      RpsInfo	null	StockSharp.BusinessEntities.RpsOrderInfo
    
  •   Security	{GZ18000BL1@RTS}	StockSharp.BusinessEntities.Security
    
  •   BestAsk	{Оффер 1264 0}	StockSharp.BusinessEntities.Quote
    
  •   BestBid	{Бид 1304 0}	StockSharp.BusinessEntities.Quote
    
  •   BestPair	{Бид 1304 0} {Оффер 1264 0}	StockSharp.BusinessEntities.MarketDepthPair
      Class	"SPBOPT"	string
      ClosePrice	1076	decimal
      Code	"GZ18000BL1"	string
      Decimals	0	int
    
  •   Exchange	{РТС}	StockSharp.BusinessEntities.Exchange
      ExpiryDate	null	System.DateTime?
    
  •   ExtensionInfo	Count = 9	System.Collections.Generic.IDictionary<object,object> {System.Collections.Generic.Dictionary<object,object>}
      HighPrice	0	decimal
      Id	"GZ18000BL1@RTS"	string
    
  •   LastTrade	{StockSharp.BusinessEntities.Trade}	StockSharp.BusinessEntities.Trade
      LowPrice	0	decimal
      MarginBuy	0	decimal
      MarginSell	0	decimal
      MaxPrice	0	decimal
      MinLotSize	1	int
      MinPrice	0	decimal
      MinStepPrice	1	decimal
      MinStepSize	1	decimal
      Name	"GAZR-12.11M141211CA 18000"	string
      OpenPrice	0	decimal
      OptionType	null	StockSharp.BusinessEntities.OptionTypes?
      SettlementDate	null	System.DateTime?
      ShortName	""	string
      State	Trading	StockSharp.BusinessEntities.SecurityStates
      Strike	18000	decimal
      TheorPrice	0	decimal
    
  •   Trader	{StockSharp.Quik.QuikTrader}	StockSharp.BusinessEntities.ITrader {StockSharp.Quik.QuikTrader}
      Type	Option	StockSharp.BusinessEntities.SecurityTypes
      UnderlyingSecurityId	"GZZ1@RTS"	string
      Volatility	0	decimal
    
  •   Non-Public members	{GZ18000BL1@RTS}	StockSharp.BusinessEntities.Security
      State	None	StockSharp.BusinessEntities.OrderStates
      Status	null	StockSharp.BusinessEntities.OrderStatus?
      StopCondition	null	StockSharp.BusinessEntities.StopCondition
    
  •   Time	{1/1/0001 12:00:00 AM}	System.DateTime
      Trader	null	StockSharp.BusinessEntities.ITrader
      TransactionId	0	long
      Type	Limit	StockSharp.BusinessEntities.OrderTypes
      Volume	1	decimal
    
  •   Non-Public members	{StockSharp.BusinessEntities.Order}	StockSharp.BusinessEntities.Order
    

- TargetOrder3 StockSharp.BusinessEntities.Order+ base Ecng.Common.Cloneable<StockSharp.BusinessEntities.Order> Balance 0 decimal CancelTime null System.DateTime? Comment null string DerivedOrder null StockSharp.BusinessEntities.Order Direction Sell StockSharp.BusinessEntities.OrderDirections ExecutionCondition PutInQueue StockSharp.BusinessEntities.OrderExecutionConditions ExtensionInfo null System.Collections.Generic.IDictionary<object,object> Id 0 long

  •   Latency	{00:00:00}	System.TimeSpan
    
  •   Messages	{Ecng.Collections.SynchronizedList<string>}	System.Collections.Generic.IList<string> {Ecng.Collections.SynchronizedList<string>}
    
  •   Portfolio	{SPBFUT00000}	StockSharp.BusinessEntities.Portfolio
      Price	927	decimal
      RepoInfo	null	StockSharp.BusinessEntities.RepoOrderInfo
      RpsInfo	null	StockSharp.BusinessEntities.RpsOrderInfo
    
  •   Security	{GZ18000BX1@RTS}	StockSharp.BusinessEntities.Security
    
  •   BestAsk	{Оффер 928 0}	StockSharp.BusinessEntities.Quote
    
  •   BestBid	{Бид 979 0}	StockSharp.BusinessEntities.Quote
    
  •   BestPair	{Бид 979 0} {Оффер 928 0}	StockSharp.BusinessEntities.MarketDepthPair
      Class	"SPBOPT"	string
      ClosePrice	1245	decimal
      Code	"GZ18000BX1"	string
      Decimals	0	int
    
  •   Exchange	{РТС}	StockSharp.BusinessEntities.Exchange
      ExpiryDate	null	System.DateTime?
    
  •   ExtensionInfo	Count = 9	System.Collections.Generic.IDictionary<object,object> {System.Collections.Generic.Dictionary<object,object>}
      HighPrice	0	decimal
      Id	"GZ18000BX1@RTS"	string
    
  •   LastTrade	{StockSharp.BusinessEntities.Trade}	StockSharp.BusinessEntities.Trade
      LowPrice	0	decimal
      MarginBuy	0	decimal
      MarginSell	0	decimal
      MaxPrice	0	decimal
      MinLotSize	1	int
      MinPrice	0	decimal
      MinStepPrice	1	decimal
      MinStepSize	1	decimal
      Name	"GAZR-12.11M141211PA 18000"	string
      OpenPrice	0	decimal
      OptionType	null	StockSharp.BusinessEntities.OptionTypes?
      SettlementDate	null	System.DateTime?
      ShortName	""	string
      State	Trading	StockSharp.BusinessEntities.SecurityStates
      Strike	18000	decimal
      TheorPrice	0	decimal
    
  •   Trader	{StockSharp.Quik.QuikTrader}	StockSharp.BusinessEntities.ITrader {StockSharp.Quik.QuikTrader}
      Type	Option	StockSharp.BusinessEntities.SecurityTypes
      UnderlyingSecurityId	"GZZ1@RTS"	string
      Volatility	0	decimal
    
  •   Non-Public members		
      State	None	StockSharp.BusinessEntities.OrderStates
      Status	null	StockSharp.BusinessEntities.OrderStatus?
      StopCondition	null	StockSharp.BusinessEntities.StopCondition
    
  •   Time	{1/1/0001 12:00:00 AM}	System.DateTime
      Trader	null	StockSharp.BusinessEntities.ITrader
      TransactionId	0	long
      Type	Limit	StockSharp.BusinessEntities.OrderTypes
      Volume	1	decimal
    
  •   Non-Public members
    

Tags:


Thanks:


1 2  >
Alexander

Avatar
Date: 10/27/2011
Reply


OrderFail поднимается? Что выдаёт?

Thanks:

lshaton

Avatar
Date: 10/27/2011
Reply


Alexander Mukhanchikov: OrderFail поднимается? Что выдаёт? Не не поднимается. Я не регистрировал никакого EventHandler на OrderFail. Все проходит молчком. Только по первой заявки на фьючерс проходит сделка как положено. А остальные "как в воду".

Thanks:

lshaton

Avatar
Date: 10/27/2011
Reply


Alexander Mukhanchikov: OrderFail поднимается? Что выдаёт? Заявка подается не через стратегию а через _trader. Не пойму куда дальше идти. Может есть какя-то трассировка событий. Может _trader не успевает в реальном времени?

Thanks:

Alexander

Avatar
Date: 10/27/2011
Reply


lshaton:

Alexander Mukhanchikov: OrderFail поднимается? Что выдаёт? Не не поднимается. Я не регистрировал никакого EventHandler на OrderFail. Все проходит молчком. Только по первой заявки на фьючерс проходит сделка как положено. А остальные "как в воду".

Ну тогда естественно не поднимется, если вы на событие не подписались. Подпишитесь да посмотрите почему заявка не регистрируется. Чего гадать? :)

Thanks: lshaton

lshaton

Avatar
Date: 10/27/2011
Reply


Alexander Mukhanchikov:

lshaton:

Alexander Mukhanchikov: OrderFail поднимается? Что выдаёт? Не не поднимается. Я не регистрировал никакого EventHandler на OrderFail. Все проходит молчком. Только по первой заявки на фьючерс проходит сделка как положено. А остальные "как в воду".

Ну тогда естественно не поднимется, если вы на событие не подписались. Подпишитесь да посмотрите почему заявка не регистрируется. Чего гадать? :) Подписался и изменил параметр Price, чтоб не происходили сделки. И вышло, что заявки нормально зарегистрировались! А что произошло не пойму.. Но хоть прогресс есть! Может dicSecurities[secKey].CallOpt.MinStepPrice, dicSecurities[secKey].PutOpt.MinStepPrice виноваты?

 
                            if ((dicSecurities[secKey].Undelying != null) && (dicSecurities[secKey].CallOpt != null) && (dicSecurities[secKey].PutOpt != null)
                                && (dicSecurities[secKey].CallOpt.BestAsk != null) && (dicSecurities[secKey].CallOpt.BestBid != null)
                                && (dicSecurities[secKey].PutOpt.BestAsk != null) && (dicSecurities[secKey].PutOpt.BestBid != null)
                                && (dicSecurities[secKey].CallOpt.BestAsk.Price > 0) && (dicSecurities[secKey].CallOpt.BestBid.Price > 0)
                                && (dicSecurities[secKey].PutOpt.BestAsk.Price > 0) && (dicSecurities[secKey].PutOpt.BestBid.Price > 0)
                                )
                            {
   
                                if ((dLongProf > Profitgap) && (dLongProf != dLongProfOld))
                                {
                                    Debug.WriteLine(secKey + "=>" + " dLongProf =" + dLongProf.ToString() + " Time =" + DateTime.Now.ToLongTimeString());
                                    sLS = "Long";
                                    TargetOrder1 = new Order
                                    {
                                        Security = dicSecurities[secKey].Undelying,
                                        Direction = OrderDirections.Buy,
                                        //Price = dicSecurities[secKey].Undelying.MaxPrice,
                                        Price = dicSecurities[secKey].Undelying.MinPrice,
                                        Volume = 1,
                                        Portfolio = _portfolio,
                                        Type = OrderTypes.Limit,
                                    };
                                    TargetOrder2 = new Order
                                    {
                                        Security = dicSecurities[secKey].CallOpt,
                                        Direction = OrderDirections.Sell,
                                        //Price = dicSecurities[secKey].CallOpt.BestAsk.Price - dicSecurities[secKey].CallOpt.MinStepPrice, //-500m,
                                        Price = dicSecurities[secKey].CallOpt.BestAsk.Price +500m,
                                        Volume = 1,
                                        Portfolio = _portfolio,
                                        Type = OrderTypes.Limit,
                                    };
                                    TargetOrder3 = new Order
                                    {
                                        Security = dicSecurities[secKey].PutOpt,
                                        Direction = OrderDirections.Buy,
                                        //Price = dicSecurities[secKey].PutOpt.BestBid.Price + dicSecurities[secKey].PutOpt.MinStepPrice, //+500m,
                                        Price = 5m,
                                        Volume = 1,
                                        Portfolio = _portfolio,
                                        Type = OrderTypes.Limit, 
                                    };
                                };
                                if ((dShortProf > Profitgap) & (dShortProf != dShortProfOld))
                                {
                                    Debug.WriteLine(secKey + "=>" + " dShortProf =" + dShortProf.ToString() + " Time =" + DateTime.Now.ToLongTimeString());
                                    sLS = "Short";
                                    TargetOrder1 = new Order
                                    {
                                        Security = dicSecurities[secKey].Undelying,
                                        Direction = OrderDirections.Sell,
                                        //Price = dicSecurities[secKey].Undelying.MinPrice,
                                        Price = dicSecurities[secKey].Undelying.MaxPrice,
                                        Volume = 1,
                                        Portfolio = _portfolio,
                                        Type = OrderTypes.Limit,
                                    };
                                    TargetOrder2 = new Order
                                    {
                                        Security = dicSecurities[secKey].CallOpt,
                                        Direction = OrderDirections.Buy,
                                        //Price = dicSecurities[secKey].CallOpt.BestBid.Price + dicSecurities[secKey].CallOpt.MinStepPrice, // + 500m,
                                        Price = 5m,
                                        Volume = 1,
                                        Portfolio = _portfolio,
                                        Type = OrderTypes.Limit,
                                    };
                                    TargetOrder3 = new Order
                                    {
                                        Security = dicSecurities[secKey].PutOpt,
                                        Direction = OrderDirections.Sell,
                                        //Price = dicSecurities[secKey].PutOpt.BestAsk.Price - dicSecurities[secKey].PutOpt.MinStepPrice, // - 500m,
                                        Price = dicSecurities[secKey].PutOpt.BestAsk.Price + 500m,
                                        Volume = 1,
                                        Portfolio = _portfolio,
                                        Type = OrderTypes.Limit, 
                                    };
                                };
                                if ((sLS == "Long") || (sLS == "Short"))
                                {
                                    iTransactionId++;
                                    if ((TargetOrder1 != null) && (TargetOrder2 != null) && (TargetOrder3 != null))
                                    {
                                        if (_strategy != null) _strategy.RegOrd(TargetOrder1);
                                        else  _trader.RegisterOrder(TargetOrder1);
                                        if (_strategy != null) _strategy.RegOrd(TargetOrder2);
                                        else   _trader.RegisterOrder(TargetOrder2);
                                        if (_strategy != null) _strategy.RegOrd(TargetOrder3);
                                        else  _trader.RegisterOrder(TargetOrder3);
                                    dLongProf = dLongProfOld;
                                    dShortProf = dShortProfOld;
                                };
 };

Thanks:

Mikhail Sukhov

Avatar
Date: 10/27/2011
Reply


Кто-нибудь читал этот неформатированный кусок войны и мир?

Thanks:

Alexander

Avatar
Date: 10/27/2011
Reply


Mikhail Sukhov: Кто-нибудь читал этот неформатированный кусок войны и мир?

кто прочитал война и мир в школе - прочтёт и это :)

Thanks:

lshaton

Avatar
Date: 10/27/2011
Reply


Mikhail Sukhov: Кто-нибудь читал этот неформатированный кусок войны и мир? Я конечно извиняюсь, но как форматировать? Я просто сделал Cut & Paste из VS и все форматирование пропало.

Thanks:

lshaton

Avatar
Date: 10/27/2011
Reply


Alexander Mukhanchikov:

Mikhail Sukhov: Кто-нибудь читал этот неформатированный кусок войны и мир?

кто прочитал война и мир в школе - прочтёт и это :) Под Достоевского (точнее Достаевского) кошу [flapper]

Thanks:

Alexander

Avatar
Date: 10/27/2011
Reply


Неизвестно что виновато. Видимо цены виноваты. Посмотрите дебагером какую заявку вы создаёте, с какими параметрами.

Thanks:
1 2  >

Attach files by dragging & dropping, , or pasting from the clipboard.

loading
clippy