Exemplo n.º 1
0
        public MessageViewModel(QFApp app)
        {
            _qfapp = app;
            Messages = new ObservableCollection<MessageRecord>();

            _qfapp.MessageEvent += new Action<QuickFix.Message,bool>(HandleMessage);
        }
Exemplo n.º 2
0
        public ExecutionViewModel(QFApp app)
        {
            _qfapp = app;
            Executions = new ObservableCollection<ExecutionRecord>();

            _qfapp.Fix42ExecReportEvent += new Action<QuickFix.FIX42.ExecutionReport>(HandleExecutionReport);
        }
Exemplo n.º 3
0
        public NewsSenderViewModel(QFApp app)
        {
            _qfapp = app;

            // command definitions
            SendNewsCommand = new RelayCommand(SendNews);
        }
Exemplo n.º 4
0
        public void Application_Startup(
            object sender,
            StartupEventArgs e,
            ICustomFixStrategy strategy)
        {
            Trace.WriteLine("Application started.");

            // FIX app settings and related
            QuickFix.SessionSettings settings = new QuickFix.SessionSettings(this.ConfigFile);
            strategy.SessionSettings = settings;

            // FIX application setup
            QuickFix.MessageStoreFactory storeFactory = new QuickFix.FileStoreFactory(settings);
            QuickFix.LogFactory logFactory = new QuickFix.FileLogFactory(settings);
            _qfapp = new QFApp(settings, strategy);

            QuickFix.IInitiator initiator = new QuickFix.Transport.SocketInitiator(_qfapp, storeFactory, settings, logFactory);
            _qfapp.Initiator = initiator;


            // Window creation and context assignment
            UIDemo.MainWindow mainWindow = new UIDemo.MainWindow();
            mainWindow.DataContext = new MainWindowViewModel();

            mainWindow.MessageView.DataContext = new MessageViewModel(_qfapp);
            mainWindow.ExecutionView.DataContext = new ExecutionViewModel(_qfapp);
            mainWindow.ConnectionView.DataContext = new ConnectionViewModel(_qfapp);
            mainWindow.OrderView.DataContext = new OrderViewModel(_qfapp, strategy);
            mainWindow.NewsSenderView.DataContext = new NewsSenderViewModel(_qfapp);

            // Set the main UI dispatcher
            SmartDispatcher.SetDispatcher(mainWindow.Dispatcher);

            mainWindow.Show();
        }
        public TradeViewModel(QFApp app)
        {
            _qfapp = app;
            Trades = new ObservableCollection<TradeRecord>();

            //_qfapp.MessageEvent += new Action<QuickFix.Message, bool>(HandleMessage);
            _qfapp.Fix44QuoteRequestEvent += new Action<QuickFix.FIX44.QuoteRequest>(HandleQuoteRequest);
        }
        public ConnectionViewModel(QFApp app)
        {
            _qfapp = app;

            // initialize SessionString
            HashSet<QuickFix.SessionID> sidset = _qfapp.MySessionSettings.GetSessions();
            Trace.WriteLine("Sessions count in config: " + sidset.Count);
            foreach (QuickFix.SessionID sid in sidset)
                Trace.WriteLine("-> " + sid.ToString());
            this.SessionString = sidset.First().ToString();

            // command definitions
            ConnectCommand = new RelayCommand(Connect);
            DisconnectCommand = new RelayCommand(Disconnect);

            _qfapp.LogonEvent += new Action(delegate () { IsConnected = true; });
            _qfapp.LogoutEvent += new Action(delegate () { IsConnected = false; });
        }
Exemplo n.º 7
0
        public OrderViewModel(QFApp app, ICustomFixStrategy strategy)
        {
            _qfapp = app;
            _strategy = strategy;
            Orders = new ObservableCollection<OrderRecord>();
            CustomFields = new ObservableCollection<CustomFieldRecord>();

            // command definitions
            SendBuyCommand = new RelayCommand(SendBuy);
            SendSellCommand = new RelayCommand(SendSell);
            AddCustomFieldCommand = new RelayCommand(AddCustomField);
            ClearCustomFieldsCommand = new RelayCommand(ClearCustomFields);

            _qfapp.Fix42ExecReportEvent += new Action<QuickFix.FIX42.ExecutionReport>(HandleExecutionReport);

            // load pre-set custom fields from strategy, if it has any
            foreach (KeyValuePair<int, string> p in strategy.DefaultNewOrderSingleCustomFields)
                CustomFields.Add(new CustomFieldRecord(p.Key, p.Value));
        }
Exemplo n.º 8
0
        public UnitTestContext()
        {
            QuickFix.Dictionary config = CreateConfig();
            QuickFix.SessionID sessionID = new QuickFix.SessionID("FIX.4.2", "SENDER", "TARGET");
            QuickFix.SessionSettings settings = new QuickFix.SessionSettings();
            settings.Set(sessionID, config);

            App = new QFApp(settings);
            Initiator = new MockInitiator();
            App.Initiator = Initiator;

            Session = new SessionThatTracksOutbound(
                App,
                new QuickFix.MemoryStoreFactory(),
                sessionID,
                new QuickFix.DataDictionaryProvider(),
                new QuickFix.SessionSchedule(config),
                0,
                new QuickFix.ScreenLogFactory(settings),
                new QuickFix.DefaultMessageFactory(),
                "blah");
            Session.MaxLatency = 120;
        }