예제 #1
0
        private void OControl_Account_Trade_SelectedAccount(object sender, SelectedAccountEventArg e)
        {
            //Update main info and holdings!
            oControl_Account_MainInfo.UpdateAcountInfo(m_AccountHandler.GetAccount(e.Identifier));
            //TODO: add update of holdings when done!

            oControl_Account_Holdings.UpdateAccountInfo(m_AccountHandler.GetAccount(e.Identifier));
        }
예제 #2
0
        public bool ExecuteOrder(IAccountHandlerInterface AccountHandler, ITradeHandlerInterface TradeHandler, out IOrder StopLossOrder)
        {
            StopLossOrder = this;
            if (EvaluateTriggerOnOrder())
            {
                try
                {
                    IAccountInterface oA = AccountHandler.GetAccount(m_oAccountIdentifier);
                    switch (m_oOrderType)
                    {
                    case OrderType.Buy:
                        oA.AddHoldingToAccount(m_oQuantity, m_oSymbol, TradeHandler);
                        StopLossOrder = this;
                        return(true);

                    case OrderType.Sell:
                        oA.SellHoldingFromAccount(m_oQuantity, m_oSymbol, TradeHandler);
                        return(true);

                    case OrderType.StopLoss:
                        oA.AddHoldingToAccount(m_oQuantity, m_oSymbol, TradeHandler);
                        StopLossOrder = CreateStopLossOrder(ImperaturGlobal.Quotes.Where(q => q.Symbol.Equals(m_oSymbol)).First().LastTradePrice.Amount);
                        return(true);

                    default:
                        break;
                    }
                }
                catch (Exception ex)
                {
                    m_oLastErrorMessage = "OrderExecute error: " + ex.Message;
                    return(false);
                }
            }
            return(false);
        }