public OrderData StartTradingOption(OptionData optionData, bool sell, int quantity)
        {
            if (OptionData != null)
            {
                throw new ArgumentException("The OptionNegotiator already has open order!!!");
            }

            OptionData = optionData ?? throw new Exception("The option data not exist!!!");

            OrderAction = sell ? OrderAction.SELL : OrderAction.BUY;
            Quantity    = quantity;
            //InializeTrading:
            FirstBidPrice = Math.Round(OptionData.BidPrice, 2);
            FirstAskPrice = Math.Round(OptionData.AskPrice, 2);

            MinPriceStep = Math.Max(MinPriceStep, (FirstAskPrice - FirstBidPrice) / 10);

            TradingCycleCount   = (int)Math.Ceiling((FirstAskPrice - FirstBidPrice) / MinPriceStep);
            TradingCycleCounter = 1;

            StarTime = DateTime.Now;
            RoundCurrentLimitPrice(FirstLimitPrice);
            //SendWhatIfOrder(CurrentLimitPrice);

            CreateOrder(CurrentLimitPrice);
            //Start negotiation proccess:
            ScheduledTaskId = UnlManager.AddScheduledTaskOnUnl(OrderIntervalTimeSpan, DoTrading, true);
            return(OrderData);
        }
示例#2
0
        public OrderData StartTradingOption(OptionData optionData, bool sell, int quantity)
        {
            if (OptionData != null)
            {
                throw new ArgumentException("The OptionNegotiator already has open order!!!");
            }

            OptionData = optionData ?? throw new Exception("The option data not exist!!!");

            OrderAction = sell ? OrderAction.SELL : OrderAction.BUY;
            Quantity    = quantity;
            //InializeTrading:
            InitializeNegotiationsTradingParameters();
            SendWhatIfOrder(CurrentLimitPrice);
            CreateOrder(CurrentLimitPrice);
            //Start negotiation proccess:
            ScheduledTaskId = UnlManager.AddScheduledTaskOnUnl(SuccesiveIntervalTimeSpan, DoTrading, true);
            return(OrderData);
        }