public OKCMarketFIXAPI(string keyfile, string symbol, bool orderbook, bool livetrade) { SessionSettings settings = new SessionSettings("config/quickfix-client.cfg"); var storeFactory = new FileStoreFactory(settings); var logFactory = new ScreenLogFactory(settings); Initiator = new QuickFix.Transport.SocketInitiator(this, storeFactory, settings, logFactory); Initiator.Start(); OrderCancelCallback = null; OrderSubmitCallback = null; AccountUtil.ReadKeyFile(keyfile); TradeSymbolString = symbol; TradeSymbol = new Symbol(symbol); OKTradingRequest.TradeSymbol = TradeSymbol; OKMarketDataRequest.TradeSymbol = TradeSymbol; CurrentOrders = new List <Order>(); if (orderbook) { CurrentOrderBook = new OrderBook(); } LastTrade = null; TrackOrderBook = orderbook; TrackLiveTrade = livetrade; }
static void Main(string[] args) { System.Console.WriteLine("============="); System.Console.WriteLine("This is only an example program."); System.Console.WriteLine(); System.Console.WriteLine(" ! ! !"); System.Console.WriteLine(" DO NOT USE THIS ON A COMMERCIAL FIX INTERFACE!"); System.Console.WriteLine(" ! ! !"); System.Console.WriteLine(); System.Console.WriteLine("============="); try { QuickFix.SessionSettings settings = new QuickFix.SessionSettings("execution.cfg"); TradingApp application = new TradingApp(settings.Get().GetString("LogonName"), settings.Get().GetString("LogonPassword")); QuickFix.IMessageStoreFactory storeFactory = new QuickFix.FileStoreFactory(settings); QuickFix.ILogFactory logFactory = new QuickFix.FileLogFactory(settings); QuickFix.Transport.SocketInitiator initiator = new QuickFix.Transport.SocketInitiator(application, storeFactory, settings, logFactory); // this is a developer-test kludge. do not emulate. application.MyInitiator = initiator; initiator.Start(); application.Run(); initiator.Stop(); } catch (System.Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); } }
static void Main(string[] args) { if (args.Length != 1) { System.Console.WriteLine("usage: TradeClient.exe CONFIG_FILENAME"); System.Environment.Exit(2); } string file = args[0]; try { QuickFix.SessionSettings settings = new QuickFix.SessionSettings(file); TradeClientApp application = new TradeClientApp(); QuickFix.MessageStoreFactory storeFactory = new QuickFix.FileStoreFactory(settings); QuickFix.LogFactory logFactory = new QuickFix.ScreenLogFactory(settings); QuickFix.Transport.SocketInitiator initiator = new QuickFix.Transport.SocketInitiator(application, storeFactory, settings, logFactory); initiator.Start(); application.Run(); initiator.Stop(); } catch (System.Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); } Environment.Exit(1); }
public void Start() { if (initiator.IsStopped) { initiator.Start(); } }
static void Main(string[] args) { Console.WriteLine("============="); Console.WriteLine(); Console.WriteLine(" ! ! !"); Console.WriteLine(" Test for NASDAQ UMS"); Console.WriteLine(" ! ! !"); Console.WriteLine(); Console.WriteLine("============="); string file = "./tradeclient.cfg"; try { QuickFix.SessionSettings settings = new QuickFix.SessionSettings(file); TradeClientApp application = new TradeClientApp(); QuickFix.IMessageStoreFactory storeFactory = new QuickFix.FileStoreFactory(settings); QuickFix.ILogFactory logFactory = new QuickFix.ScreenLogFactory(settings); QuickFix.Transport.SocketInitiator initiator = new QuickFix.Transport.SocketInitiator(application, storeFactory, settings, logFactory); application.Initiator = initiator; initiator.Start(); application.Run(); initiator.Stop(); } catch (System.Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); } Environment.Exit(1); }
public static void Main2(string[] args) { BTCCFIXClientApp app = new BTCCFIXClientApp(); string sessionFile = Environment.CurrentDirectory + "/session_client.txt"; SessionSettings settings = new SessionSettings(sessionFile); IMessageStoreFactory storeFactory = new FileStoreFactory(settings); ILogFactory logFactory = new FileLogFactory(settings); QuickFix.Transport.SocketInitiator initiator = new QuickFix.Transport.SocketInitiator(app, storeFactory, settings, logFactory); initiator.Start(); BTCCMarketDataRequest btccDataRequest = new BTCCMarketDataRequest(); System.Threading.Thread.Sleep(5000); //request full snapshot MarketDataRequest dataRequest = btccDataRequest.marketDataFullSnapRequest("BTCCNY"); bool ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); dataRequest = btccDataRequest.marketDataFullSnapRequest("LTCCNY"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); dataRequest = btccDataRequest.marketDataFullSnapRequest("LTCBTC"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); System.Threading.Thread.Sleep(15000); //request incremental request dataRequest = btccDataRequest.marketDataIncrementalRequest("BTCCNY"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); dataRequest = btccDataRequest.marketDataIncrementalRequest("LTCCNY"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); dataRequest = btccDataRequest.marketDataIncrementalRequest("LTCBTC"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); System.Threading.Thread.Sleep(40000); //unsubscribe incremental request dataRequest = btccDataRequest.unsubscribeIncrementalRequest("BTCCNY"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); dataRequest = btccDataRequest.unsubscribeIncrementalRequest("LTCCNY"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); dataRequest = btccDataRequest.unsubscribeIncrementalRequest("LTCBTC"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); }
public void initFix() { settings = new QuickFix.SessionSettings(@"c:\s2trading\zmqhubresource\tradeclient.cfg"); myApp = new FixClient(); FileStoreFactory storeFactory = new FileStoreFactory(settings); FileLogFactory logFactory = new FileLogFactory(settings); initiator = new QuickFix.Transport.SocketInitiator(myApp, storeFactory, settings, logFactory); initiator.Start(); }
// Used for Getting Data from the Exchange Server and saving it to an excel file private void bStartApp_Click(object sender, EventArgs e) { try { timer1.Enabled = true; timer4.Enabled = true; initiator.Start(); Thread.Sleep(1000); if (initiator.IsLoggedOn) { application.StartExcel(dataFile); } } catch (Exception error) { logger.Error(error.Message); logger.Error(error.StackTrace); } }
static void Main(string[] args) { Console.WriteLine("============="); Console.WriteLine("This is only an example program, meant to run against the Executor or SimpleAcceptor example programs."); Console.WriteLine(); Console.WriteLine(" ! ! !"); Console.WriteLine(" DO NOT USE THIS ON A COMMERCIAL FIX INTERFACE! It won't work and it's a bad idea!"); Console.WriteLine(" ! ! !"); Console.WriteLine(); Console.WriteLine("============="); if (args.Length != 1) { System.Console.WriteLine("usage: TradeClient.exe CONFIG_FILENAME"); System.Environment.Exit(2); } string file = args[0]; try { QuickFix.SessionSettings settings = new QuickFix.SessionSettings(file); TradeClientApp application = new TradeClientApp(); QuickFix.IMessageStoreFactory storeFactory = new QuickFix.ODBCStoreFactory(settings); QuickFix.ILogFactory logFactory = new QuickFix.ScreenLogFactory(settings); //QuickFix.IMessageStoreFactory storeFactory = new QuickFix.FileStoreFactory(settings); //QuickFix.ILogFactory logFactory = new QuickFix.ScreenLogFactory(settings); QuickFix.Transport.SocketInitiator initiator = new QuickFix.Transport.SocketInitiator(application, storeFactory, settings, logFactory); // this is a developer-test kludge. do not emulate. application.MyInitiator = initiator; initiator.Start(); application.Run(); initiator.Stop(); } catch (System.Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); } Environment.Exit(1); }
static void Main(string[] args) { Console.WriteLine("============="); Console.WriteLine("This is only an example program, meant to run against the Executor or SimpleAcceptor example programs."); Console.WriteLine(); Console.WriteLine(" ! ! !"); Console.WriteLine(" DO NOT USE THIS ON A COMMERCIAL FIX INTERFACE! It won't work and it's a bad idea!"); Console.WriteLine(" ! ! !"); Console.WriteLine(); Console.WriteLine("============="); if (args.Length != 1) { System.Console.WriteLine("usage: TradeClient.exe CONFIG_FILENAME"); System.Environment.Exit(2); } string file = args[0]; try { QuickFix.SessionSettings settings = new QuickFix.SessionSettings(file); TradeClientApp application = new TradeClientApp(); QuickFix.IMessageStoreFactory storeFactory = new QuickFix.FileStoreFactory(settings); QuickFix.ILogFactory logFactory = new QuickFix.ScreenLogFactory(settings); QuickFix.Transport.SocketInitiator initiator = new QuickFix.Transport.SocketInitiator(application, storeFactory, settings, logFactory); // this is a developer-test kludge. do not emulate. application.MyInitiator = initiator; initiator.Start(); application.Run(); initiator.Stop(); } catch (System.Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); } Environment.Exit(1); }
static void Main(string[] args) { try { QuickFix.SessionSettings settings = new QuickFix.SessionSettings("config/quickfix-client.cfg"); MyQuickFixApp application = new MyQuickFixApp(); QuickFix.IMessageStoreFactory storeFactory = new QuickFix.FileStoreFactory(settings); QuickFix.ILogFactory logFactory = new QuickFix.ScreenLogFactory(settings); QuickFix.Transport.SocketInitiator initiator = new QuickFix.Transport.SocketInitiator(application, storeFactory, settings, logFactory); initiator.Start(); Console.ReadKey(); initiator.Stop(); } catch (System.Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); Console.ReadKey(); } Environment.Exit(1); }
static void Main(string[] args) { try { QuickFix.SessionSettings settings = new QuickFix.SessionSettings("config_ssl.cfg"); MarketDataApp application = new MarketDataApp(); QuickFix.IMessageStoreFactory storeFactory = new QuickFix.FileStoreFactory(settings); QuickFix.ILogFactory logFactory = new QuickFix.ScreenLogFactory(settings); QuickFix.Transport.SocketInitiator initiator = new QuickFix.Transport.SocketInitiator(application, storeFactory, settings, logFactory); initiator.Start(); System.Threading.Thread.Sleep(TimeSpan.MaxValue); } catch (System.Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); Console.ReadLine(); } Environment.Exit(1); }
static void Main(string[] args) { string file = "client.cfg"; try { QuickFix.SessionSettings settings = new QuickFix.SessionSettings(file); Client application = new Client(); QuickFix.IMessageStoreFactory storeFactory = new QuickFix.FileStoreFactory(settings); //QuickFix.ILogFactory logFactory = new QuickFix.ScreenLogFactory(settings); QuickFix.Transport.SocketInitiator initiator = new QuickFix.Transport.SocketInitiator(application, storeFactory, settings); // this is a developer-test kludge. do not emulate. application.MyInitiator = initiator; initiator.Start(); application.Run(); initiator.Stop(); } catch (System.Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); } Environment.Exit(1); }
static void Main(string[] args) { try { //OmsFix44Client application = new OmsFix44Client(new REST.V1.CoinApiRestClient("API_KEY")); OmsFix50Client application = new OmsFix50Client(new REST.V1.CoinApiRestClient("API_KEY")); QuickFix.SessionSettings settings = new QuickFix.SessionSettings("FixSettings.cfg"); QuickFix.IMessageStoreFactory storeFactory = new QuickFix.FileStoreFactory(settings); QuickFix.ILogFactory logFactory = new QuickFix.ScreenLogFactory(settings); QuickFix.Transport.SocketInitiator initiator = new QuickFix.Transport.SocketInitiator(application, storeFactory, settings, logFactory); initiator.Start(); System.Threading.Thread.Sleep(Int32.MaxValue); } catch (System.Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); Console.ReadLine(); } Environment.Exit(1); }
static void Main(string[] args) { Console.WriteLine("== CharEncoding Initiator startup"); try { SessionSettings settings = new QuickFix.SessionSettings("initiator.cfg"); CEInitiatorApp application = new CEInitiatorApp(); IMessageStoreFactory storeFactory = new QuickFix.FileStoreFactory(settings); ILogFactory logFactory = new QuickFix.ScreenLogFactory(settings); QuickFix.Transport.SocketInitiator initiator = new QuickFix.Transport.SocketInitiator(application, storeFactory, settings, logFactory); initiator.Start(); application.ListenOnConsole(); initiator.Stop(); } catch (System.Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); } Environment.Exit(1); }
private void connectButton_Click(object sender, EventArgs e) { string file = "c:/FIX/tradeclientIB.cfg"; try { QuickFix.SessionSettings settings = new QuickFix.SessionSettings(file); QuickFix.IApplication myApp = new MyQuickFixApp(); QuickFix.IMessageStoreFactory storeFactory = new QuickFix.FileStoreFactory(settings); QuickFix.ILogFactory logFactory = new QuickFix.ScreenLogFactory(settings); //QuickFix.Transport.SocketInitiator initiator = new QuickFix.Transport.SocketInitiator(myApp, storeFactory, settings, logFactory); _Initiator = new QuickFix.Transport.SocketInitiator(myApp, storeFactory, settings, logFactory); MyQuickFixApp.UpdateEvent += new MyQuickFixApp.OnUpdateEvent(AddLogItem); _Initiator.Start(); } catch (System.Exception err) { Console.WriteLine(err.Message); Console.WriteLine(err.StackTrace); MessageBox.Show(err.ToString()); } }
/// <summary> /// Initiate a connection through QuickFix to the TT Fix Adapter /// </summary> /// <param name="cfg">configuration file name</param> /// <param name="p">password</param> /// <param name="r">reset sequence numbers - always true for this application</param> /// <param name="c">the mainForm control</param> public void initiate(string cfg, string p, bool r, Control c) { log.CreateLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), null); try { _password = p; _resetSession = r; _control = c; _settings = new QuickFix.SessionSettings(cfg); _storeFactory = new QuickFix.FileStoreFactory(_settings); _logFactory = new QuickFix.FileLogFactory(_settings); _messageFactory = new QuickFix.FIX42.MessageFactory(); _initiator = new QuickFix.Transport.SocketInitiator(this, _storeFactory, _settings, _logFactory, _messageFactory); _initiator.Start(); } catch (Exception ex) { updateDisplay("QuickFIX Error"); log.WriteLog(ex.ToString()); } }
public static void Main2(string[] args) { BTCCFIXClientApp app = new BTCCFIXClientApp(); string sessionFile = Environment.CurrentDirectory+"/session_client.txt"; SessionSettings settings = new SessionSettings(sessionFile); IMessageStoreFactory storeFactory = new FileStoreFactory(settings); ILogFactory logFactory = new FileLogFactory(settings); QuickFix.Transport.SocketInitiator initiator = new QuickFix.Transport.SocketInitiator(app, storeFactory, settings, logFactory); initiator.Start(); BTCCMarketDataRequest btccDataRequest = new BTCCMarketDataRequest(); System.Threading.Thread.Sleep(5000); //request full snapshot MarketDataRequest dataRequest = btccDataRequest.marketDataFullSnapRequest("BTCCNY"); bool ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); dataRequest = btccDataRequest.marketDataFullSnapRequest("LTCCNY"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); dataRequest = btccDataRequest.marketDataFullSnapRequest("LTCBTC"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); System.Threading.Thread.Sleep(15000); //request incremental request dataRequest = btccDataRequest.marketDataIncrementalRequest("BTCCNY"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); dataRequest = btccDataRequest.marketDataIncrementalRequest("LTCCNY"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); dataRequest = btccDataRequest.marketDataIncrementalRequest("LTCBTC"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); System.Threading.Thread.Sleep(40000); //unsubscribe incremental request dataRequest = btccDataRequest.unsubscribeIncrementalRequest("BTCCNY"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); dataRequest = btccDataRequest.unsubscribeIncrementalRequest("LTCCNY"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); dataRequest = btccDataRequest.unsubscribeIncrementalRequest("LTCBTC"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); }
private void button2_Click(object sender, EventArgs e) { initiator.Start(); button2.Enabled = false; }
public ChannelTcpConflated(TCPConflatedConfig conflatedConfig) { logger = LogManager.GetLogger("ChannelTcpConflated-" + conflatedConfig.ChannelID); MDSUtils.AddAppender("ChannelTcpConflated-" + conflatedConfig.ChannelID, logger.Logger); _bKeepRunning = true; machineGun = new MachineGunFixSplitter(); machineGun.UnderFIXMessageFire += new FIXMachineGunEventHandler(machineGun_UnderFIXMessageFire); machineGun.Start(); thQueueProc = new Thread(new ThreadStart(queueProc)); thQueueProc.Start(); thSplitProc = new Thread(new ThreadStart(splitterThreadWork)); thSplitProc.Start(); _channelUmdfConfig = conflatedConfig; //if (!listaChannelQueues.ContainsKey(conflatedConfig.ChannelID)) // listaChannelQueues.Add(conflatedConfig.ChannelID, new ListChannelQueues(qUdpPkt, replayLockObject)); logger.Info("Start(): iniciando sessao FIX..."); try { // Cria sessao FIX _session = new QuickFix.SessionID( conflatedConfig.BeginString, conflatedConfig.SenderCompID, conflatedConfig.TargetCompID); // Cria dicionario da configuracao QuickFix.Dictionary mainDic = new QuickFix.Dictionary(); mainDic.SetLong("SocketConnectPort", conflatedConfig.ProxyPort); mainDic.SetLong("HeartBtInt", conflatedConfig.HeartBtInt); mainDic.SetLong("ReconnectInterval", conflatedConfig.ReconnectInterval); mainDic.SetBool("ResetOnLogon", conflatedConfig.ResetOnLogon); mainDic.SetBool("ResetOnLogout", conflatedConfig.ResetOnLogout); mainDic.SetBool("ResetOnDisconnect", conflatedConfig.ResetOnDisconnect); mainDic.SetBool("PersistMessages", conflatedConfig.PersistMessages); mainDic.SetString("ConnectionType", conflatedConfig.ConnectionType); mainDic.SetString("SocketConnectHost", conflatedConfig.ProxyHost); mainDic.SetString("FileStorePath", conflatedConfig.FileStorePath); mainDic.SetString("FileLogPath", conflatedConfig.FileLogPath); mainDic.SetString("StartTime", conflatedConfig.StartTime); mainDic.SetString("EndTime", conflatedConfig.EndTime); QuickFix.Dictionary sessDic = new QuickFix.Dictionary(); sessDic.SetString("BeginString", conflatedConfig.BeginString); sessDic.SetString("SenderCompID", conflatedConfig.SenderCompID); sessDic.SetString("TargetCompID", conflatedConfig.TargetCompID); sessDic.SetString("DataDictionary", conflatedConfig.DataDictionary); sessDic.SetBool("CheckLatency", false); sessDic.SetBool("UseDataDictionary", true); sessDic.SetLong("SocketReceiveBufferSize", conflatedConfig.SocketReceiveBufferSize); // Configure the session settings QuickFix.SessionSettings settings = new QuickFix.SessionSettings(); settings.Set(mainDic); settings.Set(_session, sessDic); MemoryStoreFactory store = new MemoryStoreFactory(); FileLogFactory log = new FileLogFactory(settings); IMessageFactory message = new DefaultMessageFactory(); // Cria o socket _initiator = new QuickFix.Transport.SocketInitiator(this, store, settings, this, message); _initiator.Start(); QuickFix.Session mySession = QuickFix.Session.LookupSession(_session); QuickFix.Session.LookupSession(_session).ValidateLengthAndChecksum = false; } catch (Exception ex) { logger.Error("Start():" + ex.Message, ex); } logger.Info("Start(): Sessao FIX iniciado!"); }
public FixInitiator(MarketIncrementalProcessor mktIncProc, ChannelUMDFConfig channelUmdfConfig, string templateFile, Queue <UdpPacket> qUdpPkt, Object replayLockObject) { logger = LogManager.GetLogger("FixInitiator-" + channelUmdfConfig.ChannelID); MDSUtils.AddAppender("FixInitiator-" + channelUmdfConfig.ChannelID, logger.Logger); XMLMessageTemplateLoader loader = new XMLMessageTemplateLoader(); registry = UmdfUtils.loadTemplates(templateFile); context = new Context(); context.TemplateRegistry = registry; _mktIncProc = mktIncProc; _channelUmdfConfig = channelUmdfConfig; if (!listaChannelQueues.ContainsKey(channelUmdfConfig.ChannelID)) { listaChannelQueues.Add(channelUmdfConfig.ChannelID, new ListChannelQueues(qUdpPkt, replayLockObject)); } logger.Info("Start(): iniciando sessao FIX..."); try { // Cria sessao FIX _session = new QuickFix.SessionID( _channelUmdfConfig.TCPConfig.BeginString, _channelUmdfConfig.TCPReplayConfig.SenderCompID, _channelUmdfConfig.TCPReplayConfig.SubID, _channelUmdfConfig.TCPReplayConfig.TargetCompID, _channelUmdfConfig.TCPReplayConfig.SubID); // Cria dicionario da configuracao QuickFix.Dictionary mainDic = new QuickFix.Dictionary(); mainDic.SetLong("SocketConnectPort", _channelUmdfConfig.TCPReplayConfig.SocketConnectPort); mainDic.SetLong("HeartBtInt", _channelUmdfConfig.TCPConfig.HeartBtInt); mainDic.SetLong("ReconnectInterval", _channelUmdfConfig.TCPConfig.ReconnectInterval); mainDic.SetBool("ResetOnLogon", _channelUmdfConfig.TCPConfig.ResetOnLogon); mainDic.SetBool("ResetOnLogout", _channelUmdfConfig.TCPConfig.ResetOnLogout); mainDic.SetBool("ResetOnDisconnect", _channelUmdfConfig.TCPConfig.ResetOnDisconnect); mainDic.SetBool("PersistMessages", _channelUmdfConfig.TCPConfig.PersistMessages); mainDic.SetString("ConnectionType", _channelUmdfConfig.TCPConfig.ConnectionType); mainDic.SetString("SocketConnectHost", _channelUmdfConfig.TCPReplayConfig.SocketConnectHost); mainDic.SetString("FileStorePath", _channelUmdfConfig.TCPConfig.FileStorePath); mainDic.SetString("FileLogPath", _channelUmdfConfig.TCPConfig.FileLogPath); mainDic.SetString("StartTime", _channelUmdfConfig.TCPReplayConfig.StartTime); mainDic.SetString("EndTime", _channelUmdfConfig.TCPReplayConfig.EndTime); QuickFix.Dictionary sessDic = new QuickFix.Dictionary(); sessDic.SetString("BeginString", _channelUmdfConfig.TCPConfig.BeginString); sessDic.SetString("SenderCompID", _channelUmdfConfig.TCPReplayConfig.SenderCompID); sessDic.SetString("SenderSubID", _channelUmdfConfig.TCPReplayConfig.SubID); sessDic.SetString("TargetCompID", _channelUmdfConfig.TCPReplayConfig.TargetCompID); sessDic.SetString("TargetSubID", _channelUmdfConfig.TCPReplayConfig.SubID); sessDic.SetString("DataDictionary", _channelUmdfConfig.TCPConfig.DataDictionary); sessDic.SetBool("UseDataDictionary", true); // Configure the session settings QuickFix.SessionSettings settings = new QuickFix.SessionSettings(); settings.Set(mainDic); settings.Set(_session, sessDic); MemoryStoreFactory store = new MemoryStoreFactory(); FileLogFactory log = new FileLogFactory(settings); IMessageFactory message = new DefaultMessageFactory(); // Cria o socket _initiator = new QuickFix.Transport.SocketInitiator(this, store, settings, log, message); _initiator.Start(); } catch (Exception ex) { logger.Error("Start():" + ex.Message, ex); } logger.Info("Start(): Sessao FIX iniciado!"); }
public FixServerInitiator( string channelsID, TCPReplayConfig tcpReplayConfig, Dictionary <string, SessionID> dctSessionsFixClients, Dictionary <string, SessionID> dctSessionsFixChannels) { _tcpReplayConfig = tcpReplayConfig; _dctSessionsFixClients = dctSessionsFixClients; _dctSessionsFixChannels = dctSessionsFixChannels; logger = LogManager.GetLogger("FixServerInitiator-" + tcpReplayConfig.ChannelID); MDSUtils.AddAppender("FixServerInitiator-" + tcpReplayConfig.ChannelID, logger.Logger); XMLMessageTemplateLoader loader = new XMLMessageTemplateLoader(); registry = UmdfUtils.loadTemplates(tcpReplayConfig.TemplateFile); context = new Context(); context.TemplateRegistry = registry; try { // Cria dicionario da configuracao QuickFix.Dictionary mainDic = new QuickFix.Dictionary(); mainDic.SetString("SocketConnectHost", tcpReplayConfig.SocketConnectHost); mainDic.SetLong("SocketConnectPort", tcpReplayConfig.SocketConnectPort); if (!String.IsNullOrEmpty(tcpReplayConfig.SocketConnectHost1)) { mainDic.SetString("SocketConnectHost1", tcpReplayConfig.SocketConnectHost1); mainDic.SetLong("SocketConnectPort1", tcpReplayConfig.SocketConnectPort1); } mainDic.SetLong("HeartBtInt", tcpReplayConfig.HeartBtInt); mainDic.SetLong("ReconnectInterval", tcpReplayConfig.ReconnectInterval); mainDic.SetBool("ResetOnLogon", tcpReplayConfig.ResetOnLogon); mainDic.SetBool("PersistMessages", tcpReplayConfig.PersistMessages); mainDic.SetString("ConnectionType", tcpReplayConfig.ConnectionType); mainDic.SetString("FileStorePath", tcpReplayConfig.FileStorePath); mainDic.SetString("FileLogPath", tcpReplayConfig.FileLogPath); mainDic.SetString("StartTime", tcpReplayConfig.StartTime); mainDic.SetString("EndTime", tcpReplayConfig.EndTime); QuickFix.Dictionary sessDic = new QuickFix.Dictionary(); sessDic.SetString("BeginString", tcpReplayConfig.BeginString); sessDic.SetString("SenderCompID", tcpReplayConfig.SenderCompID); sessDic.SetString("TargetCompID", tcpReplayConfig.TargetCompID); sessDic.SetString("DataDictionary", tcpReplayConfig.DataDictionary); sessDic.SetBool("UseDataDictionary", true); // Configure the session settings QuickFix.SessionSettings settings = new QuickFix.SessionSettings(); settings.Set(mainDic); MemoryStoreFactory store = new MemoryStoreFactory(); FileLogFactory log = new FileLogFactory(settings); IMessageFactory message = new DefaultMessageFactory(); // Cria sessao FIX _sessionID = new QuickFix.SessionID( tcpReplayConfig.BeginString, tcpReplayConfig.SenderCompID, tcpReplayConfig.TargetCompID); settings.Set(_sessionID, sessDic); string[] quebraChannelsID = channelsID.Split(",".ToCharArray()); foreach (string channel in quebraChannelsID) { dctSessionsFixChannels.Add(channel, _sessionID); } logger.InfoFormat("Start(): iniciando FIX com sessionID[{0}]...", _sessionID.ToString()); _initiator = new QuickFix.Transport.SocketInitiator(this, store, settings, log, message); _initiator.Start(); } catch (Exception ex) { logger.Error("Start():" + ex.Message, ex); } logger.Info("Start(): Sessao FIX iniciada!"); }