Exemplo n.º 1
0
 public SpreadViewModel(string board, string seccode)
 {
     Board   = board;
     Seccode = seccode;
     Level2DataHandler.AddLevel2Subscribtion(board, seccode);
     Level2DataHandler.NewBestBuySell += OnNewBestBuySell;
 }
Exemplo n.º 2
0
 public void SetSecurity(string board, string seccode)
 {
     Level2DataHandler.Level2ColChanged -= OnLevel2ColChanged;
     Board   = board;
     Seccode = seccode;
     Level2DataHandler.AddLevel2Subscribtion(Board, Seccode);
     Level2DataHandler.Level2ColChanged += OnLevel2ColChanged;
 }
Exemplo n.º 3
0
 public void SetSecurity(string board, string seccode)
 {
     Task.Run(() => {
         Board       = board;
         Seccode     = seccode;
         Level2Items = Level2DataHandler.AddLevel2Subscribtion(Board, Seccode);
         _dispatcher.Invoke(() =>
         {
             IsUsaChanged?.Invoke(Board == "MCT");
             OnIntsrumentChanged();
         });
         UpdateWindowInstrument();
     });
 }
Exemplo n.º 4
0
 public void SetSecurity(string board, string seccode)
 {
     if (board == Board && seccode == Seccode)
     {
         return;
     }
     Board   = board;
     Seccode = seccode;
     if (Board == "MCT")
     {
         Level2DataHandler.AddLevel2Subscribtion(Board, Seccode);
     }
     AllTrades = TickDataHandler.AddAllTradesSubsribtion(Board, Seccode);
     UpdateWindowInstrument();
 }
Exemplo n.º 5
0
 public AllTradesSimpleViewModel(string board, string seccode, Window window, int id = 0)
 {
     Window  = window;
     Closing = new Command(arg => WindowClosing());
     Board   = board;
     Seccode = seccode;
     if (Board == "MCT")
     {
         Level2DataHandler.AddLevel2Subscribtion(Board, Seccode);
     }
     AllTrades = TickDataHandler.AddAllTradesSubsribtion(Board, Seccode);
     Id        = id;
     if (Id == 0)
     {
         SaveWindow();
     }
     SubscribeToWindowEvents();
 }
Exemplo n.º 6
0
 public FastOrderViewModel(string board, string seccode, Window window, int id = 0)
 {
     Window    = window;
     Board     = board;
     Seccode   = seccode;
     Size      = Settings.Default.FastOrderSize;
     SendOrder = new Command(PlaceOrder);
     Closing   = new Command(arg => WindowClosing());
     Level2DataHandler.AddLevel2Subscribtion(Board, Seccode);
     Level2DataHandler.Level2ColChanged += OnLevel2ColChanged;
     Id = id;
     if (Id == 0)
     {
         SaveWindow();
     }
     SubscribeToWindowEvents();
     IsAnchorEnabled  = true;
     _timer           = new Timer(GetBalance, null, 0, 500);
     ActiveOrders     = MainWindowViewModel.ClientOrdersViewModel.ActiveOrders;
     ActiveStoporders = MainWindowViewModel.ClientOrdersViewModel.ActiveStoporders;
     SubscriveToOrderCountUpdates();
 }
Exemplo n.º 7
0
        public LogBookViewModel(string board, string seccode, Window window, int id = 0)
        {
            Window         = window;
            ClosingCommand = new Command(arg => Closing());
            ResetCommand   = new Command(arg => Reset());
            Board          = board;
            Seccode        = seccode;
            _level2Items   = Level2DataHandler.AddLevel2Subscribtion(Board, Seccode);
            TXmlConnector.SendNewQuotes += XmlConnector_OnSendNewQuotes;
            Level2Subs.Add(new Security {
                Board = Board, Seccode = Seccode
            });
            TXmlConnector.ConnectorSendCommand(
                ConnectorCommands.SubUnsubCommand("subscribe", "alltrades", Board, Seccode));
            TXmlConnector.SendNewAllTrades += XmlConnector_OnSendNewTrades;
            AllTradesSubs.Add(new Security {
                Board = Board, Seccode = Seccode
            });
            Id = id;
            if (Id == 0)
            {
                SaveWindow();
            }
            SubscribeToWindowEvents();
            var args = GetWindowArgs() as LogBookArgs;

            if (args == null)
            {
                UpdateWindowArgs(new LogBookArgs {
                    Alert = false, Ratio = 2, Size = 1, TriggerDelta = 0.5
                });
                return;
            }
            Coef         = args.Ratio;
            Size         = args.Size;
            IsAlerting   = args.Alert;
            TriggerDelta = args.TriggerDelta;
        }
Exemplo n.º 8
0
 public Level2ViewModel(string board, string seccode, Window window, int id = 0)
 {
     Window                = window;
     Closing               = new Command(arg => WindowClosing());
     PlaceOrderCommand     = new Command(PlaceOrder);
     PlaceStoporderCommand = new Command(PlaceStopOrder);
     Board       = board;
     Seccode     = seccode;
     Level2Items = Level2DataHandler.AddLevel2Subscribtion(Board, Seccode);
     if (Board == "MCT")
     {
         IsUSA = true;
     }
     Id = id;
     if (Id == 0)
     {
         SaveWindow();
     }
     SubscribeToWindowEvents();
     //sub for settings changes
     UseCredit = Level2Settings.Default.UseCredit;
     TradeSize = Level2Settings.Default.Size;
     Level2Settings.Default.PropertyChanged += SettingsChanged;
 }