private void MenuItem_Click_ZhengZhou(object sender, RoutedEventArgs e)
        {
            var quoteGrpVw = new MarketDataControl();

            quoteGrpVw.Filter("", "CZCE", "", "");
            quotePane.AddContent(new MarketDataControl()).Title = WPFUtility.GetLocalizedString("CFFEX", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
        }
Пример #2
0
        private void Add_MarketMaker_Click(object sender, RoutedEventArgs e)
        {
            var title          = WPFUtility.GetLocalizedString("MarketMaker", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
            var marketmakerWin = new OpMarketMakerCtrl();

            optionModelPane.AddContent(marketmakerWin).Title = title;
        }
Пример #3
0
        private void Add_VolModel_Click(object sender, RoutedEventArgs e)
        {
            var title    = WPFUtility.GetLocalizedString("Model", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
            var modelWin = new OptionModelCtrl();

            optionModelPane.AddContent(modelWin).Title = title;
        }
        private void Add_ContractRiskGraph_Click(object sender, RoutedEventArgs e)
        {
            var title = WPFUtility.GetLocalizedString("ContractRiskGraph", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
            var contractriskGraphCtrl = new OptionContractRiskGraphCtrl();

            optionRiskPane.AddContent(contractriskGraphCtrl).Title = title;
        }
Пример #5
0
        public OptionRiskCtrl()
        {
            InitializeComponent();
            portfolioLayout.CanClose = false;
            portfolioLayout.CanHide  = false;
            var marketdataHandler    = MessageHandlerContainer.DefaultInstance.Get <MarketDataHandler>();
            var otcmarketdataHandler = MessageHandlerContainer.DefaultInstance.Get <OTCOptionDataHandler>();
            var domesticTradeHandler = MessageHandlerContainer.DefaultInstance.Get <TraderExHandler>();
            var otcTradeHandler      = MessageHandlerContainer.DefaultInstance.Get <OTCOptionTradeHandler>();

            domesticPositionsWindow.TradeHandler      = domesticTradeHandler;
            domesticPositionsWindow.MarketDataHandler = marketdataHandler;
            otcPositionsWindow.TradeHandler           = otcTradeHandler;
            otcPositionsWindow.MarketDataHandler      = otcmarketdataHandler;
            domesticTradeWindow.TradeHandler          = domesticTradeHandler;
            otcTradeWindow.TradeHandler                = otcTradeHandler;
            marketDataLV.MarketDataHandler             = marketdataHandler;
            marketDataLV.AnchorablePane                = quotePane;
            quotePane.Children[0].Title                = WPFUtility.GetLocalizedString("Quote", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
            domesticPositionsWindow.AnchorablePane     = domesticPositionPane;
            domesticPositionPane.Children[0].Title     = WPFUtility.GetLocalizedString("PositionWindow", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
            otcPositionsWindow.AnchorablePane          = otcPositionPane;
            otcPositionPane.Children[0].Title          = WPFUtility.GetLocalizedString("PositionWindow", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
            domesticTradeWindow.AnchorablePane         = domesticTradePane;
            domesticTradePane.Children[0].Title        = WPFUtility.GetLocalizedString("TradeWindow", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
            otcTradeWindow.AnchorablePane              = otcTradePane;
            otcTradePane.Children[0].Title             = WPFUtility.GetLocalizedString("TradeWindow", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
            portfolioCtl.portfolioCB.SelectionChanged += PortfolioCB_SelectionChanged;
        }
        private void Add_RiskMatrix_Click(object sender, RoutedEventArgs e)
        {
            var title          = WPFUtility.GetLocalizedString("RiskMatrix", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
            var riskMatrixCtrl = new OptionMatrixCtrl();

            optionRiskPane.AddContent(riskMatrixCtrl).Title = title;
        }
 private void MenuItem_Click_Traded(object sender, RoutedEventArgs e)
 {
     var title = WPFUtility.GetLocalizedString("TRADED", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
     var executionWin = new ExecutionControl(executionWindow.PersistanceId, Guid.NewGuid().ToString(), MessageHandlerContainer.DefaultInstance.Get<TraderExHandler>());
     executionWin.FilterSettingsWin.Title += "(" + title + ")";
     executionWin.FilterSettingsWin.FilterTabTitle = title;
     executionWin.FilterByStatus(new List<OrderStatus> { OrderStatus.ALL_TRADED, OrderStatus.PARTIAL_TRADED });
     executionPane.AddContent(executionWin).Title = title;
     executionWin.Save();
 }
 private void MenuItem_Click_AllTraded(object sender, RoutedEventArgs e)
 {
     //tradePane.AddContent(new TradeRecordControl()).Title = WPFUtility.GetLocalizedString("AllTraded", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
     var title = WPFUtility.GetLocalizedString("AllTraded", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
     var tradeRecordWin = new TradeRecordControl(tradeWindow.PersistanceId, Guid.NewGuid().ToString(), MessageHandlerContainer.DefaultInstance.Get<TraderExHandler>());
     tradeRecordWin.FilterSettingsWin.Title += "(" + title + ")";
     tradeRecordWin.FilterSettingsWin.FilterTabTitle = title;
     tradePane.AddContent(tradeRecordWin).Title = title;
     tradeRecordWin.FilterSettingsWin.Save();
 }
        //private void MenuItem_Click_Open(object sender, RoutedEventArgs e)
        //{
        //    var tradeWin = new TradeRecordControl(Guid.NewGuid().ToString(), MessageHandlerContainer.DefaultInstance.Get<TraderExHandler>());
        //    tradeWin.FilterByStatus(new List<OrderOpenCloseType> { OrderOpenCloseType.OPEN });
        //    tradePane.AddContent(tradeWin).Title = WPFUtility.GetLocalizedString("Open", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
        //}

        //private void MenuItem_Click_Close(object sender, RoutedEventArgs e)
        //{
        //    var tradeWin = new TradeRecordControl(Guid.NewGuid().ToString(), MessageHandlerContainer.DefaultInstance.Get<TraderExHandler>());
        //    tradeWin.FilterByStatus(new List<OrderOpenCloseType> { OrderOpenCloseType.CLOSE });
        //    tradePane.AddContent(tradeWin).Title = WPFUtility.GetLocalizedString("Close", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
        //}

        private void MenuItem_Click_Position(object sender, RoutedEventArgs e)
        {
            //positionPane.AddContent(new PositionControl()).Title = WPFUtility.GetLocalizedString("Position", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
            var title = WPFUtility.GetLocalizedString("Position", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
            var positionWin = new PositionControl(positionsWindow.PersistanceId, Guid.NewGuid().ToString(), MessageHandlerContainer.DefaultInstance.Get<TraderExHandler>(), MessageHandlerContainer.DefaultInstance.Get<MarketDataHandler>());
            positionWin.FilterSettingsWin.Title += "(" + title + ")";
            positionWin.FilterSettingsWin.FilterTabTitle = title;
            positionPane.AddContent(positionWin).Title = title;
            positionWin.FilterSettingsWin.Save();
        }
 private void MenuItem_Click_Contract(object sender, RoutedEventArgs e)
 {
     //quotePane.AddContent(new MarketDataControl()).Title = WPFUtility.GetLocalizedString("Optional", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
     var title = WPFUtility.GetLocalizedString("Optional", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
     var marketDataWin = new MarketDataControl(marketDataLV.PersistanceId, Guid.NewGuid().ToString(), MessageHandlerContainer.DefaultInstance.Get<MarketDataHandler>());
     marketDataWin.FilterSettingsWin.Title += "(" + title + ")";
     marketDataWin.FilterSettingsWin.FilterTabTitle = title;
     quotePane.AddContent(marketDataWin).Title = title;
     marketDataWin.FilterSettingsWin.Save();
 }
 private void MenuItem_Click_ShowCustomizedContractTab(object sender, RoutedEventArgs e)
 {
     if (AnchorablePane != null)
     {
         var title             = WPFUtility.GetLocalizedString("Optional", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
         var marketDataControl = new MarketDataControl(PersistanceId, Guid.NewGuid().ToString(), MarketDataHandler);
         AnchorablePane.AddContent(marketDataControl).Title = title;
         marketDataControl.FilterSettingsWin.FilterTabTitle = title;
         marketDataControl.FilterSettingsWin.Save();
     }
 }
        private void MenuItem_Click_Execution(object sender, RoutedEventArgs e)
        {
            //executionPane.AddContent(new ExecutionControl(Guid.NewGuid().ToString())).Title = WPFUtility.GetLocalizedString("AllExecution", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
            var title        = WPFUtility.GetLocalizedString("AllExecution", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
            var executionWin = new ExecutionControl(executionWindow.PersistanceId, Guid.NewGuid().ToString(), MessageHandlerContainer.DefaultInstance.Get <OTCOptionTradeHandler>());

            executionWin.FilterSettingsWin.Title         += "(" + title + ")";
            executionWin.FilterSettingsWin.FilterTabTitle = title;
            executionPane.AddContent(executionWin).Title  = title;
            executionWin.Save();
        }
 private void MenuItem_Click_AllTrade(object sender, RoutedEventArgs e)
 {
     if (AnchorablePane != null)
     {
         var title = WPFUtility.GetLocalizedString("AllTraded", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
         var tradeRecordControltrl = new TradeRecordControl(PersistanceId, Guid.NewGuid().ToString(), TradeHandler);
         AnchorablePane.AddContent(tradeRecordControltrl).Title = title;
         tradeRecordControltrl.FilterSettingsWin.FilterTabTitle = title;
         tradeRecordControltrl.FilterSettingsWin.Save();
     }
 }
        private void MenuItem_Click_OpenTrade(object sender, RoutedEventArgs e)
        {
            var tradeWin = new TradeRecordControl(PersistanceId, Guid.NewGuid().ToString(), TradeHandler);

            tradeWin.FilterByStatus(new List <OrderOpenCloseType> {
                OrderOpenCloseType.OPEN
            });
            if (AnchorablePane != null)
            {
                AnchorablePane.AddContent(tradeWin).Title = WPFUtility.GetLocalizedString("Open", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
            }
        }
        private void MenuItem_Click_CloseTrade(object sender, RoutedEventArgs e)
        {
            var tradeWin = new TradeRecordControl();

            tradeWin.FilterByStatus(new List <OrderOpenCloseType> {
                OrderOpenCloseType.CLOSE
            });
            if (AnchorablePane != null)
            {
                AnchorablePane.AddContent(tradeWin).Title = WPFUtility.GetLocalizedString("Close", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
            }
        }
        public void Initialize()
        {
            // Initailize UI events

            MarketDataControl.OnQuoteSelected += FastOrderCtl.OnQuoteSelected;
            PositionControl.OnPositionSelected += FastOrderCtl.OnPositionSelected;
            marketDataLV.AnchorablePane = quotePane;
            executionWindow.AnchorablePane = executionPane;
            tradeWindow.AnchorablePane = tradePane;
            positionsWindow.AnchorablePane = positionPane;
            quotePane.Children[0].Title = WPFUtility.GetLocalizedString("Quote", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
            executionPane.Children[0].Title = WPFUtility.GetLocalizedString("ExecutionWindow", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
            tradePane.Children[0].Title = WPFUtility.GetLocalizedString("TradeWindow", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
            positionPane.Children[0].Title = WPFUtility.GetLocalizedString("PositionWindow", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);

            // Initialize Market Data
            var msgWrapper = _ctpMdSignIner.MessageWrapper;

            _ctpMdSignIner.OnLogged += ctpLoginStatus.OnLogged;
            _ctpMdSignIner.OnLogged += _ctpMdSignIner_OnLogged;
            _ctpMdSignIner.OnLoginError += ctpLoginStatus.OnDisconnected;
            msgWrapper.MessageClient.OnDisconnected += ctpLoginStatus.OnDisconnected;
            MessageHandlerContainer.DefaultInstance.Get<MarketDataHandler>().RegisterMessageWrapper(msgWrapper);

            // Initialize Trading Server
            msgWrapper = _ctpTradeSignIner.MessageWrapper;

            _ctpTradeSignIner.OnLogged += _ctpTradeSignIner_OnLogged;
            _ctpTradeSignIner.OnLoginError += _ctpTradeSignIner_OnLoginError;
            _ctpTradeSignIner.OnLogged += ctpTradeLoginStatus.OnLogged;
            _ctpTradeSignIner.OnLoginError += ctpTradeLoginStatus.OnDisconnected;
            msgWrapper.MessageClient.OnDisconnected += ctpTradeLoginStatus.OnDisconnected;

            var tradeHandler = MessageHandlerContainer.DefaultInstance.Get<TraderExHandler>();
            tradeHandler.RegisterMessageWrapper(msgWrapper);
            var marketdataHandler = MessageHandlerContainer.DefaultInstance.Get<MarketDataHandler>();


            clientFundLV.TradeHandler = tradeHandler;
            marketDataLV.MarketDataHandler = marketdataHandler;
            FastOrderCtl.TradeHandler = tradeHandler;
            FastOrderCtl.MarketDataHandler = marketdataHandler;
            executionWindow.TradeHandler = tradeHandler;
            executionWindow.MarketDataHandler = marketdataHandler;
            tradeWindow.TradeHandler = tradeHandler;
            positionsWindow.TradeHandler = tradeHandler;
            positionsWindow.MarketDataHandler = marketdataHandler;

        }
Пример #17
0
        public void ReloadData()
        {
            Initialize();
            //MessageHandlerContainer.DefaultInstance.Get<TraderExHandler>().OrderVMCollection.Clear();
            //MessageHandlerContainer.DefaultInstance.Get<TraderExHandler>().QueryOrder();
            LayoutAnchorable defaultTab =
                AnchorablePane.Children.FirstOrDefault(pane => ((ExecutionControl)pane.Content).FilterSettingsWin.FilterId == DEFAULT_ID);

            AnchorablePane.Children.Clear();
            if (defaultTab != null)
            {
                AnchorablePane.Children.Add(defaultTab);
            }

            var filtersettings = ClientDbContext.GetFilterSettings(TradeHandler.MessageWrapper.User.Id, PersistanceId);
            //var userId = MessageHandlerContainer.DefaultInstance.Get<TraderExHandler>().MessageWrapper.User.Id;
            var  userId = TradeHandler.MessageWrapper.User.Id;
            bool found  = false;

            foreach (var fs in filtersettings)
            {
                var executionctrl = new ExecutionControl(PersistanceId, fs.Id, TradeHandler, fs.Title, fs.Exchange, fs.Underlying, fs.Contract);
                AnchorablePane.AddContent(executionctrl).Title = fs.Title;
                if (fs.Id == DEFAULT_ID)
                {
                    found = true;
                }
                var statuses = ClientDbContext.GetOrderStatus(userId, fs.Id);
                executionctrl.FilterByStatus(statuses.Select(c => (OrderStatus)c));
                if (statuses.Contains((int)OrderStatus.OPENED))
                {
                    var titleopen = WPFUtility.GetLocalizedString("Opened", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
                    executionctrl.FilterSettingsWin.Title += "  " + titleopen + " ";
                }
                else if ((statuses.Contains((int)OrderStatus.ALL_TRADED)) || (statuses.Contains((int)OrderStatus.PARTIAL_TRADING)))
                {
                    var titletraded = WPFUtility.GetLocalizedString("TRADED", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
                    executionctrl.FilterSettingsWin.Title += "  " + titletraded + " ";
                }
            }
            if (found)
            {
                AnchorablePane.Children.Remove(defaultTab);
            }
        }
 private void MenuItem_Click_AccountCtrl(object sender, RoutedEventArgs e)
 {
     var title = WPFUtility.GetLocalizedString("AccountControl", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
     var accountCtrl = new AccountInfoControl();
     fundPane.AddContent(accountCtrl).Title = title;
 }
 private void MenuItem_Click_FastOrderCtrl(object sender, RoutedEventArgs e)
 {
     var title = WPFUtility.GetLocalizedString("FastOrderControl", LocalizationInfo.ResourceFile, LocalizationInfo.AssemblyName);
     var fastOrderCtrl = new FastOrderControl();
     fastorderPane.AddContent(fastOrderCtrl).Title = title;
 }