public AllSctSidsMustHaveAValidRouteTest() { sectorElements.Add(FixFactory.Make("testfix")); sectorElements.Add(VorFactory.Make("testvor")); sectorElements.Add(NdbFactory.Make("testndb")); sectorElements.Add(AirportFactory.Make("testairport")); }
public AllFixesMustBeUniqueTest() { first = FixFactory.Make("DIKAS", new Coordinate("abc", "def")); second = FixFactory.Make("DIKAS", new Coordinate("abd", "cef")); third = FixFactory.Make("DIKAP", new Coordinate("abc", "def")); fourth = FixFactory.Make("DIKAS", new Coordinate("abc", "def")); }
private void SendPositionUpdate(SymbolInfo symbol, int position) { var writePacket = fixSocket.CreatePacket(); var mbtMsg = (FIXMessage4_4)FixFactory.Create(); mbtMsg.SetAccount("33006566"); mbtMsg.SetSymbol(symbol.Symbol); if (position <= 0) { mbtMsg.SetShortQty(position); } else { mbtMsg.SetLongQty(position); } mbtMsg.AddHeader("AP"); string message = mbtMsg.ToString(); writePacket.DataOut.Write(message.ToCharArray()); if (debug) { log.Debug("Sending position update: " + message); } fixPacketQueue.Enqueue(writePacket); }
public AllRegionsMustHaveValidPointsTest() { sectorElements.Add(FixFactory.Make("testfix")); sectorElements.Add(VorFactory.Make("testvor")); sectorElements.Add(NdbFactory.Make("testndb")); sectorElements.Add(AirportFactory.Make("testairport")); }
private void SendHeartbeat() { var fixMsg = (FIXMessage4_4)FixFactory.Create(); fixMsg.AddHeader("0"); SendMessage(fixMsg); }
public AllCircleSectorlinesMustHaveValidCentreTest() { sectorElements.Add(FixFactory.Make("testfix")); sectorElements.Add(VorFactory.Make("testvor")); sectorElements.Add(NdbFactory.Make("testndb")); sectorElements.Add(AirportFactory.Make("testairport")); }
public bool SendSessionStatus(string status) { switch (status) { case "2": ProviderSimulator.SetOrderServerOnline(); break; case "3": ProviderSimulator.SetOrderServerOffline(); break; default: throw new ApplicationException("Unknown session status:" + status); } var mbtMsg = FixFactory.Create(); mbtMsg.AddHeader("h"); mbtMsg.SetTradingSessionId("TSSTATE"); mbtMsg.SetTradingSessionStatus(status); if (debug) { log.Debug("Sending order server status: " + mbtMsg); } SendMessage(mbtMsg); return(true); }
public AllCoordinationPointsMustHaveValidNextTest() { sectorElements.Add(FixFactory.Make("testfix")); sectorElements.Add(VorFactory.Make("testvor")); sectorElements.Add(NdbFactory.Make("testndb")); sectorElements.Add(AirportFactory.Make("testairport")); }
private void SendHeartbeat() { if (debug) { log.Debug("SendHeartBeat Status " + ConnectionStatus + ", Session Status Online " + isOrderServerOnline + ", Resend Complete " + IsResendComplete); } if (!IsRecovered) { TryEndRecovery(); } if (IsRecovered) { lock (orderAlgorithmsLocker) { foreach (var kvp in orderAlgorithms) { var algo = kvp.Value; algo.OrderAlgorithm.RejectRepeatCounter = 0; if (!algo.OrderAlgorithm.CheckForPending()) { algo.OrderAlgorithm.ProcessOrders(); } } } } var fixMsg = (FIXMessage4_2)FixFactory.Create(); fixMsg.AddHeader("0"); SendMessage(fixMsg); previousHeartbeatTime = recentHeartbeatTime; recentHeartbeatTime = TimeStamp.UtcNow; }
public void OnCancelBrokerOrder(SymbolInfo symbol, object origBrokerOrder) { PhysicalOrder physicalOrder; try { physicalOrder = GetOrderById(origBrokerOrder); } catch (ApplicationException ex) { log.Warn("Order probably already canceled. " + ex.Message); if (SyncTicks.Enabled) { var tickSync = SyncTicks.GetTickSync(symbol.BinaryIdentifier); tickSync.RemovePhysicalOrder(); } return; } physicalOrder.OrderState = OrderState.Pending; if (debug) { log.Debug("OnCancelBrokerOrder " + physicalOrder); } var fixMsg = (FIXMessage4_4)FixFactory.Create(); string newClientOrderId = physicalOrder.LogicalOrderId + "." + GetUniqueOrderId(); fixMsg.SetOriginalClientOrderId((string)origBrokerOrder); fixMsg.SetClientOrderId(newClientOrderId); fixMsg.SetAccount(AccountNumber); fixMsg.SetSide(GetOrderSide(physicalOrder.Side)); fixMsg.AddHeader("F"); fixMsg.SetSymbol(physicalOrder.Symbol.Symbol); fixMsg.SetTransactTime(TimeStamp.UtcNow); SendMessage(fixMsg); }
public void TestItAddsFixes() { Fix fix = FixFactory.Make(); collection.Add(fix); Assert.Equal(fix, collection.Fixes[0]); }
private void Logout() { var mbtMsg = FixFactory.Create(); log.Info("Logout message = " + mbtMsg); mbtMsg.AddHeader("5"); SendMessage(mbtMsg); }
public RoutePointValidatorTest() { sectorElements = new SectorElementCollection(); sectorElements.Add(FixFactory.Make("testfix")); sectorElements.Add(VorFactory.Make("testvor")); sectorElements.Add(NdbFactory.Make("testndb")); sectorElements.Add(AirportFactory.Make("testairport")); }
private FIXTMessage1_1 GapFillMessage(int currentSequence) { var message = FixFactory.Create(currentSequence); message.SetGapFill(); message.SetNewSeqNum(currentSequence + 1); message.AddHeader("4"); return(message); }
private void RequestOrders() { var fixMsg = (FIXMessage4_4)FixFactory.Create(); fixMsg.SetAccount(AccountNumber); fixMsg.SetMassStatusRequestID(TimeStamp.UtcNow); fixMsg.SetMassStatusRequestType(90); fixMsg.AddHeader("AF"); SendMessage(fixMsg); }
private FIXTMessage1_1 CreateLoginResponse() { var mbtMsg = (FIXTMessage1_1)FixFactory.Create(); mbtMsg.SetEncryption(0); mbtMsg.SetHeartBeatInterval(HeartbeatDelay); mbtMsg.AddHeader("A"); mbtMsg.SetSendTime(new TimeStamp(1800, 1, 1)); return(mbtMsg); }
public AllSidsMustHaveAValidRouteTest() { first = SidStarFactory.Make(route: new List <string>(new[] { "testfix", "testvor", "testndb", "testairport" })); second = SidStarFactory.Make(route: new List <string>(new[] { "nottestfix", "testvor", "testndb", "testairport" })); sectorElements.Add(FixFactory.Make("testfix")); sectorElements.Add(VorFactory.Make("testvor")); sectorElements.Add(NdbFactory.Make("testndb")); sectorElements.Add(AirportFactory.Make("testairport")); }
private void RequestPositions() { var fixMsg = (FIXMessage4_4)FixFactory.Create(); fixMsg.SetSubscriptionRequestType(1); fixMsg.SetAccount(AccountNumber); fixMsg.SetPositionRequestId(1); fixMsg.SetPositionRequestType(0); fixMsg.AddHeader("AN"); SendMessage(fixMsg); }
private void SendHeartbeat() { var mbtMsg = (FIXTMessage1_1)FixFactory.Create(); mbtMsg.AddHeader("0"); if (trace) { log.Trace("Requesting heartbeat: " + mbtMsg); } SendMessage(mbtMsg); }
private void SendLogout() { var mbtMsg = (FIXMessage4_2)FixFactory.Create(); mbtMsg.AddHeader("5"); SendMessage(mbtMsg); if (trace) { log.Trace("Sending logout confirmation: " + mbtMsg); } }
public void DumpHistory() { for (var i = 0; i <= FixFactory.LastSequence; i++) { FIXTMessage1_1 message; if (FixFactory.TryGetHistory(i, out message)) { log.Info(message.ToString()); } } }
private bool HandleResend(MessageFIXT1_1 messageFIX) { int end = messageFIX.EndSeqNum == 0 ? FixFactory.LastSequence : messageFIX.EndSeqNum; if (debug) { log.Debug("Found resend request for " + messageFIX.BegSeqNum + " to " + end + ": " + messageFIX); } for (int i = messageFIX.BegSeqNum; i <= end; i++) { FIXTMessage1_1 textMessage; var gapFill = false; if (!FixFactory.TryGetHistory(i, out textMessage)) { gapFill = true; textMessage = GapFillMessage(i); } else { switch (textMessage.Type) { case "A": // Logon case "0": // Heartbeat case "1": // Heartbeat case "2": // Resend request. case "4": // Reset sequence. textMessage = GapFillMessage(i); gapFill = true; break; default: textMessage.SetDuplicate(true); break; } } if (gapFill) { if (debug) { var fixString = textMessage.ToString(); string view = fixString.Replace(FIXTBuffer.EndFieldStr, " "); log.Debug("Sending Gap Fill message " + i + ": \n" + view); } ResendMessageProtected(textMessage); } else { ResendMessage(textMessage); } } return(true); }
private void FIXOrderList(MessageFIX4_2 packet) { var mbtMsg = (FIXMessage4_4)FixFactory.Create(); mbtMsg.SetText("END"); mbtMsg.AddHeader("8"); if (debug) { log.Debug("Sending end of order list: " + mbtMsg); } SendMessage(mbtMsg); }
private void FIXPositionList(MessageFIX4_2 packet) { var mbtMsg = (FIXMessage4_4)FixFactory.Create(); mbtMsg.SetText("DONE"); mbtMsg.AddHeader("AO"); if (debug) { log.Debug("Sending end of position list: " + mbtMsg); } SendMessage(mbtMsg); }
private void SendSystemOffline() { var mbtMsg = FixFactory.Create(); mbtMsg.AddHeader("5"); mbtMsg.SetText("System offline"); SendMessage(mbtMsg); if (trace) { log.Trace("Sending system offline simulation: " + mbtMsg); } //resetSequenceNumbersNextDisconnect = true; }
private void OnBusinessRejectOrder(string clientOrderId, string error) { var mbtMsg = (FIXMessage4_2)FixFactory.Create(); //mbtMsg.SetBusinessRejectReferenceId(clientOrderId); mbtMsg.SetText(error); mbtMsg.SetTransactTime(TimeStamp.UtcNow); mbtMsg.AddHeader("j"); if (trace) { log.Trace("Sending business reject order: " + mbtMsg); } SendMessage(mbtMsg); }
private void CloseWithFixError(PacketFIX4_4 packet, string message) { var writePacket = fixSocket.CreatePacket(); var fixMsg = (FIXMessage4_4)FixFactory.Create(); TimeStamp timeStamp = TimeStamp.UtcNow; fixMsg.SetAccount(packet.Account); fixMsg.SetText(message); fixMsg.AddHeader("j"); string errorMessage = fixMsg.ToString(); writePacket.DataOut.Write(errorMessage.ToCharArray()); fixPacketQueue.Enqueue(writePacket); }
protected virtual Yield OnHeartbeat() { if (fixSocket != null && FixFactory != null) { var mbtMsg = (FIXTMessage1_1)FixFactory.Create(); mbtMsg.AddHeader("1"); if (trace) { log.Trace("Requesting heartbeat: " + mbtMsg); } SendMessage(mbtMsg); } return(Yield.DidWork.Return); }
public override void OnRejectOrder(CreateOrChangeOrder order, string error) { var mbtMsg = (FIXMessage4_2)FixFactory.Create(); mbtMsg.SetAccount("33006566"); mbtMsg.SetClientOrderId(order.BrokerOrder.ToString()); mbtMsg.SetOrderStatus("8"); mbtMsg.SetText(error); mbtMsg.SetSymbol(order.Symbol.Symbol); mbtMsg.SetTransactTime(TimeStamp.UtcNow); mbtMsg.AddHeader("8"); if (trace) { log.Trace("Sending reject order: " + mbtMsg); } SendMessage(mbtMsg); }
private Yield OnHeartbeat() { if (fixSocket != null && FixFactory != null) { var writePacket = fixSocket.CreatePacket(); var mbtMsg = (FIXMessage4_4)FixFactory.Create(); mbtMsg.AddHeader("1"); string message = mbtMsg.ToString(); writePacket.DataOut.Write(message.ToCharArray()); if (trace) { log.Trace("Requesting heartbeat: " + message); } fixPacketQueue.Enqueue(writePacket); } return(Yield.DidWork.Return); }