public void HandleExecutionReport(QuickFix.FIX44.ExecutionReport msg) { try { string execId = msg.ExecID.Obj; //string transType = FixEnumTranslator.Translate(msg.ExecType); string execType = FixEnumTranslator.Translate(msg.ExecType); Trace.WriteLine("EVM: Handling ExecutionReport: " + execId + " / " + execType); ExecutionRecord exRec = new ExecutionRecord( msg.ExecID.Obj, msg.OrderID.Obj, string.Empty, execType, msg.Symbol.Obj, FixEnumTranslator.Translate(msg.Side)); exRec.LeavesQty = msg.LeavesQty.getValue(); exRec.TotalFilledQty = msg.CumQty.getValue(); exRec.LastQty = msg.LastQty.getValue(); SmartDispatcher.Invoke(new Action <ExecutionRecord>(AddExecution), exRec); } catch (Exception e) { Trace.WriteLine(e.ToString()); } }
public void HandleExecutionReport(QuickFix.FIX42.ExecutionReport msg) { try { string execId = msg.ExecID.Obj; string transType = FixEnumTranslator.Translate(msg.ExecTransType); string execType = FixEnumTranslator.Translate(msg.ExecType); Trace.WriteLine("EVM: Handling ExecutionReport: " + execId + " / " + transType + " / " + execType); ExecutionRecord exRec = new ExecutionRecord( msg.ExecID.Obj, msg.OrderID.Obj, transType, execType, msg.Symbol.Obj, FixEnumTranslator.Translate(msg.Side)); SmartDispatcher.Invoke(new Action <ExecutionRecord>(AddExecution), exRec); } catch (Exception e) { Trace.WriteLine(e.ToString()); } }
private void OnLogout() { // Clear all the orders, we'll get a new list when we reconnect lock (_marketLock) { _market.Clear(); } lock (_stackLock) { SmartDispatcher.Invoke(() => OrderStack.Clear()); } }
public void HandleMessage(QuickFix.Message msg, bool isIncoming) { try { MessageRecord mr = new MessageRecord(msg, isIncoming); SmartDispatcher.Invoke(new Action <MessageRecord>(AddMessage), mr); } catch (Exception e) { Trace.WriteLine(e.ToString()); } }
public void Run( string configFilepath, IFixStrategy strategy, IFixMessageGenerator messageGenerator, IMessageSink messageSink, IExecIDGenerator execIDGenerator, IClOrdIDGenerator clOrdIDGenerator) { _server = ServerFacadeFactory.CreateFixServer(configFilepath, strategy, execIDGenerator, messageGenerator, messageSink); var atOrderRepository = new ATOrderRepository(); var atOrderMediator = new ATOrderMediator(atOrderRepository, _server, clOrdIDGenerator); // Setup the data contexts for the child views in the main view // Ideally we'd do this in each view but due to the need to pass _app and the // message sink to the view models for expediency purposes we do it here var mainWindow = new MainWindow { ATOrderBook = { DataContext = new ATOrderBookViewModel(_server, atOrderMediator) }, OrderBook = { DataContext = new OrderBookViewModel(_server, clOrdIDGenerator, messageSink) }, ConnectionView = { DataContext = new ConnectionViewModel(_server, messageSink) } }; // Set the main UI dispatcher SmartDispatcher.SetDispatcher(mainWindow.Dispatcher); // Send messages to the status bar messageSink.SetMessageSink( s => { var vm = (ConnectionViewModel)mainWindow.ConnectionView.DataContext; SmartDispatcher.Invoke(() => vm.StatusMessage = s); }); _server.Start(); mainWindow.Show(); }
public void HandleExecutionReport(QuickFix.FIX42.ExecutionReport msg) { try { string execId = msg.ExecID.Obj; string transType = FixEnumTranslator.Translate(msg.ExecTransType); string execType = FixEnumTranslator.Translate(msg.ExecType); Trace.WriteLine("EVM: Handling ExecutionReport: " + execId + " / " + transType + " / " + execType); String securityType = ""; if (msg.IsSetField(167)) { securityType = FixEnumTranslator.Translate(msg.SecurityType); } String putOrCall = ""; if (msg.IsSetField(201)) { putOrCall = FixEnumTranslator.Translate(msg.PutOrCall); } decimal strikePrice = 0; if (msg.IsSetField(202)) { strikePrice = msg.StrikePrice.Obj; } ExecutionRecord exRec = new ExecutionRecord( msg.ExecID.Obj, msg.OrderID.Obj, transType, execType, msg.Symbol.Obj, FixEnumTranslator.Translate(msg.Side), securityType, putOrCall, strikePrice); SmartDispatcher.Invoke(new Action <ExecutionRecord>(AddExecution), exRec); } catch (Exception e) { Trace.WriteLine(e.ToString()); } }
public void displayOrder(QuickFix.FIX42.NewOrderSingle orderSingle) { //if (this.InvokeRequired) //{ // ThreadSafeMoveSplitterDistance d = // new ThreadSafeMoveSplitterDistance(threadSafeMoveSplitter); // this.Invoke(d, 0); //} //else //{ // threadSafeMoveSplitter(0); //} //ThreadSafeDisplayOrder d = new ThreadSafeDisplayOrder(displayOrderThreadSafe); //this.d.invoke() SmartDispatcher.Invoke(displayOrderThreadSafe, orderSingle); }
public void HandleQuoteRequest(QuickFix.FIX44.QuoteRequest msg) { try { string quoteRequestId = msg.QuoteReqID.Obj; //string status = FixEnumTranslator.Translate(msg.OrdStatus); Trace.WriteLine("OVM: Handling QuoteRequest: " + quoteRequestId); TradeRecord tr = new TradeRecord(quoteRequestId, "1", "New", "100.1", "CT10", "B"); SmartDispatcher.Invoke(new Action <TradeRecord>(AddTrade), tr); /* * lock (_ordersLock) * { * foreach (OrderRecord r in Orders) * { * if (r.ClOrdID == clOrdId) * { * r.Status = status; * if (msg.IsSetLastPx()) * r.Price = msg.LastPx.Obj; * if (msg.IsSetOrderID()) * r.OrderID = msg.OrderID.Obj; * * return; * } * } * } */ Trace.WriteLine("OVM: No order corresponds to QuoteRequestId: '" + quoteRequestId + "'"); } catch (Exception e) { Trace.WriteLine(e.ToString()); } }
private void UpdateOrderStackRows() { // TODO Diff the old and new stacks // Phase 1 just swaps out the old for the new, which is bad for many reasons var displayStack = new List <OrderStackRow>(); lock (_marketLock) { var backgroundColours = new[] { Colors.White, Colors.LightGray }; bool useColour1 = true; foreach (var orderStack in _market) { var rowColour = useColour1 ? backgroundColours[0] : backgroundColours[1]; var symbol = orderStack.Key; var stack = orderStack.Value; var rows = CreateOrderStackRows(symbol, stack, rowColour); rows.ForEach(displayStack.Add); useColour1 = !useColour1; } } SmartDispatcher.Invoke(UpdateOrderStack, displayStack); }