Esempio n. 1
0
        private void ProcessAcceptStoplossTakeProfit(byte[] arrMsgBody)
        {
            CSetOrder stopLossTakeProfit = CUtilProto.DeserializeProto <CSetOrder>(arrMsgBody);

            Log("[ProcessAcceptStoplossTakeProfit]");
            _kernelTerminal.AcceptStopLossTakeProfit(stopLossTakeProfit);
        }
        public void AcceptStopLossTakeProfit(CSetOrder setOrder)
        {
            if (setOrder.OrderType == EnmOrderTypes.TakePofit)
            {
                TakeProfitPrice = (double)setOrder.Price;
            }

            if (setOrder.OrderType == EnmOrderTypes.StopLoss)
            {
                StopLossPrice = (double)setOrder.Price;
            }

            if (setOrder.OrderType == EnmOrderTypes.StopLossInvert)
            {
                StopLossInvertPrice = (double)setOrder.Price;
            }

            if (setOrder.OrderType == EnmOrderTypes.BuyStop)
            {
                BuyStopPrice  = (double)setOrder.Price;
                BuyStopAmount = setOrder.Amount;
            }

            if (setOrder.OrderType == EnmOrderTypes.SellStop)
            {
                SellStopPrice  = (double)setOrder.Price;
                SellStopAmount = setOrder.Amount;
            }
        }
        public void SendOrderType(int conId, string instrument, EnmOrderTypes stopLossTakeProfit, decimal price, decimal amount = 0)
        {
            enmTradingEvent ev  = enmTradingEvent.SetStoplossTakeProfit;
            CSetOrder       ssp = new CSetOrder
            {
                Instrument = instrument,
                Price      = price,
                OrderType  = stopLossTakeProfit,
                Amount     = amount
            };

            SendDataToServer(conId, ssp, ev);
        }
        private void ProcessTypeOrder(int conId, byte[] arrMsgBody)
        {
            CSetOrder sltp = CUtilProto.DeserializeProto <CSetOrder>(arrMsgBody);

            _dictKBotIdVBotTrader[_dictConnIdTrader[conId].BotId].SetTypeOrderByTrader(sltp.Instrument, sltp.OrderType, sltp.Price, sltp.Amount);
        }
 private void SetStopLossTakeProfitAccepted(int connId, CSetOrder stopLossTakeProfit)
 {
     SendDataToClients(stopLossTakeProfit, enmTradingEvent.StopLossTakeProfitAccepted, "", connId);
 }