コード例 #1
0
        public void AddOrderProcessBuySellLot(Guid instrumentId,Order deletedOrder)
        {
            //if (_RepairNewOrderMultiNotifyOrders.Exists(order.id)) ??
            //{
            //    return;
            //}
            //else
            //{
            //    _RepairNewOrderMultiNotifyOrders.Add(order.id, order.id);
            //}
            Phase phase = deletedOrder.Phase;
            decimal lotBalance = deletedOrder.LotBalance;
            bool isOpen = deletedOrder.OpenClose == OpenClose.Open;
            bool isBuy = deletedOrder.BuySell == BuySell.Buy;
            InstrumentClient instrument = this._ExchangeDataManager.GetExchangeSetting(deletedOrder.ExchangeCode).Instruments.Values.SingleOrDefault(P => P.Id == instrumentId);
            Customer customer = new Customer();
            QuotePolicyDetail quotePolicyDetail = this._ExchangeDataManager.ExchangeSettingManagers["WF01"].GetQuotePolicyDetail(instrumentId, customer);
            ObservableCollection<CloseOrder> closeOrders = deletedOrder.CloseOrders;

            if (phase == Phase.Executed || phase == Phase.Completed)
            {
                instrument.LastLot = deletedOrder.Lot;
                instrument.LastSales = (isBuy ? "B" : "S") + deletedOrder.ExecutePrice.ToString();
            }

            if (isOpen)
            {
                this.AddBuySellLot(instrument, quotePolicyDetail, isBuy, lotBalance);
            }
            else
            {
                foreach (CloseOrder closeOrder in closeOrders)
                {
                    bool closeOrderIsBuy = !isBuy;
                    this.SubtractBuySellLot(instrument, quotePolicyDetail, closeOrderIsBuy, lotBalance);
                }
            }
        }
コード例 #2
0
        public QuotePriceClient(QuoteMessage quoteMessage, int waitTimes, InstrumentClient instrument, Customer customer, ExchangeQuotation quotation)
        {
            this._ExchangeQuotation = quotation;
            this._Origin = quotation.Origin;
            this._CustomerClient = customer;
            this._Instrument = instrument;
            this._ExchangeCode = quoteMessage.ExchangeCode;
            this._CustomerId = quoteMessage.CustomerID;
            this._InstrumentId = quoteMessage.InstrumentID;

            this._Lot = (decimal)quoteMessage.QuoteLot;
            this._AnswerLot = this._Lot;
            this._BSStatus = (BSStatus)quoteMessage.BSStatus;
            this._BuyLot = this._BSStatus == BSStatus.Buy ? this._Lot : decimal.Zero;
            this._SellLot = this._BSStatus == BSStatus.Sell ? this._Lot : decimal.Zero;
            if (this._BSStatus == BSStatus.Both)
            {
                this._BuyLot = this._Lot;
                this._SellLot = this._Lot;
            }
            this._WaitTimes = waitTimes;
            this._TimeStamp = quoteMessage.TimeStamp;
        }