예제 #1
0
파일: HostFix.cs 프로젝트: radtek/Gradual
        public void Iniciar()
        {
            SessionSettings  settings = new SessionSettings(this.ArquivoConfiguracao);
            FileStoreFactory store    = new FileStoreFactory(settings);
            FileLogFactory   logs     = new FileLogFactory(settings);
            MessageFactory   msgs     = new DefaultMessageFactory();

            // Cria o socket
            if (this.EhInitiator)
            {
                _socketInitiator =
                    new SocketInitiator(
                        this.AplicacaoFix, store, settings, logs, msgs);
                _socketInitiator.start();
            }
            else
            {
                _socketAcceptor =
                    new SocketAcceptor(
                        this.AplicacaoFix, store, settings, logs, msgs);
                _socketAcceptor.start();
            }

            // Envia mensagem para aplicação
            this.AplicacaoFix.Iniciar();
        }
예제 #2
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("usage: Executor CONFIG_FILENAME");
                System.Environment.Exit(2);
            }

            try
            {
                SessionSettings        settings     = new SessionSettings(args[0]);
                Application            executorApp  = new Executor();
                MessageStoreFactory    storeFactory = new FileStoreFactory(settings);
                LogFactory             logFactory   = new ScreenLogFactory(settings);
                ThreadedSocketAcceptor acceptor     = new ThreadedSocketAcceptor(executorApp, storeFactory, settings, logFactory);

                acceptor.Start();
                Console.WriteLine("press <enter> to quit");
                Console.Read();
                acceptor.Stop();
            }
            catch (System.Exception e)
            {
                Console.WriteLine("FATAL ERROR: " + e.Message);
                Console.WriteLine(e.ToString());
            }
        }
예제 #3
0
        static void Main(string[] args)
        {
            AppLogger = new PerDayFileLogSource(Directory.GetCurrentDirectory() + "\\Log", Directory.GetCurrentDirectory() + "\\Log\\Backup")
            {
                FilePattern = "Log.{0:yyyy-MM-dd}.log",
                DeleteDays  = 20
            };

            string path = ConfigurationManager.AppSettings["InitiatorPath"];

            SessionSettings  = new SessionSettings(path);
            FileStoreFactory = new FileStoreFactory(SessionSettings);
            ScreenLogFactory = new ScreenLogFactory(SessionSettings);
            MessageFactory   = new QuickFix.FIX44.MessageFactory();

            Program myProgram = new Program();

            Initiator = new SocketInitiator(myProgram, FileStoreFactory, SessionSettings, ScreenLogFactory);

            Initiator.Start();


            Console.WriteLine("Initiator successfully started...");
            Console.ReadKey();
        }
예제 #4
0
        public ServerSession(IApplication application, string configFile)
        {
            _application = application;
            var CurrentSessionSettings       = new SessionSettings(configFile);
            MessageStoreFactory storeFactory = new FileStoreFactory(CurrentSessionSettings);
            LogFactory          logFactory   = new FileLogFactory(CurrentSessionSettings);

            this.Acceptor = new ThreadedSocketAcceptor(_application, storeFactory, CurrentSessionSettings, logFactory);

            _sessionId   = CurrentSessionSettings.GetSessions().FirstOrDefault();
            SessionState = SessionState.Idle;

            _application.MessageEvent += (message) =>
            {
                if (MessageEvent != null)
                {
                    MessageEvent(message);
                }
            };
            _application.LogonEvent += (s) =>
            {
                _sessionId    = s;
                SessionState |= SessionState.Connected;
            };
            _application.LogoutEvent += (s) =>
            {
                SessionState = SessionState.LoggedOut;
            };
        }
예제 #5
0
        static void Main()
        {
            try
            {
                ClientInitiator      app            = new ClientInitiator();
                SessionSettings      settings       = new SessionSettings(@"C:\Users\anhtv\Desktop\QuickFix\QuickFix\initiator.cfg");
                QuickFix.Application application    = new ClientInitiator();
                FileStoreFactory     storeFactory   = new FileStoreFactory(settings);
                ScreenLogFactory     logFactory     = new ScreenLogFactory(settings);
                MessageFactory       messageFactory = new DefaultMessageFactory();

                SocketInitiator initiator = new SocketInitiator(application, storeFactory, settings, logFactory, messageFactory);
                initiator.start();
                Thread.Sleep(3000);
                System.Collections.ArrayList list = initiator.getSessions();
                SessionID sessionID = (SessionID)list[0];
                Console.WriteLine("Press any key: ");
                string x = Console.ReadLine();
                QuickFix42.NewOrderSingle order = new QuickFix42.NewOrderSingle(new ClOrdID("Hello"), new HandlInst(HandlInst.AUTOMATED_EXECUTION_ORDER_PRIVATE), new Symbol("ABC"), new Side(Side.SELL), new TransactTime(DateTime.Now), new OrdType(OrdType.MARKET));
                bool sent = Session.sendToTarget(order, sessionID);
                Console.ReadLine();
                initiator.stop();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Console.ReadLine();
            }
        }
예제 #6
0
        static void Main(string[] args)
        {
            var configBroker = AppDomain.CurrentDomain.BaseDirectory + "\\sample_acceptor.cfg";

            SessionSettings settings = new SessionSettings(configBroker);

            IMessageStoreFactory storeFactory = new FileStoreFactory(settings);

            ILogFactory logFactory = new FileLogFactory(settings);

            var broker = new TradeAcceptor();

            ThreadedSocketAcceptor acceptor = new ThreadedSocketAcceptor(
                broker,
                storeFactory,
                settings,
                logFactory);

            string HttpServerPrefix = "http://127.0.0.1:5080/";

            HttpServer srv = new HttpServer(HttpServerPrefix, settings);

            acceptor.Start();

            srv.Start();

            Console.WriteLine("View Executor status: " + HttpServerPrefix);

            Run();

            srv.Stop();

            acceptor.Stop();
        }
예제 #7
0
        static void Main(string[] args)
        {
            Console.WriteLine("=============");
            Console.WriteLine("This is only an example program, meant to be used with the TradeClient example.");
            Console.WriteLine("=============");

            if (args.Length != 1)
            {
                Console.WriteLine("usage: Executor CONFIG_FILENAME");
                System.Environment.Exit(2);
            }

            try
            {
                SessionSettings        settings     = new SessionSettings(args[0]);
                IApplication           executorApp  = new Executor();
                IMessageStoreFactory   storeFactory = new FileStoreFactory(settings);
                ILogFactory            logFactory   = new FileLogFactory(settings);
                ThreadedSocketAcceptor acceptor     = new ThreadedSocketAcceptor(executorApp, storeFactory, settings, logFactory);

                acceptor.Start();
                Console.WriteLine("press <enter> to quit");
                Console.Read();
                acceptor.Stop();
            }
            catch (System.Exception e)
            {
                Console.WriteLine("==FATAL ERROR==");
                Console.WriteLine(e.ToString());
            }
        }
예제 #8
0
        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;
        }
예제 #9
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                System.Console.WriteLine("usage: AcceptanceTest CONFIG_FILENAME");
                System.Environment.Exit(2);
            }

            FileLog debugLog = new FileLog("log", new SessionID("AT", "Application", "Debug"));

            try
            {
                SessionSettings     settings     = new SessionSettings(args[0]);
                Application         testApp      = new ATApplication(debugLog);
                MessageStoreFactory storeFactory = new FileStoreFactory(settings);
                LogFactory          logFactory   = null;
                if (settings.Get().Has("Verbose") && settings.Get().GetBool("Verbose"))
                {
                    logFactory = new FileLogFactory(settings); //ScreenLogFactory(true, true, true);
                }
                ThreadedSocketAcceptor acceptor = new ThreadedSocketAcceptor(testApp, storeFactory, settings, logFactory);

                acceptor.Start();
                while (true)
                {
                    System.Console.WriteLine("o hai");
                    System.Threading.Thread.Sleep(1000);
                }
                //acceptor.Stop();
            }
            catch (System.Exception e)
            {
                debugLog.OnEvent(e.ToString());
            }
        }
 public SqlExportToCsvWorker(ILogger <SqlExportToCsvWorker> logger, IEnumerable <BaseDatabase> databases, FileStoreFactory fileStoreFactory) :
     base("exportToCsv", TimeSpan.FromSeconds(30), 5)
 {
     _logger           = logger;
     _databases        = databases;
     _fileStoreFactory = fileStoreFactory;
 }
예제 #11
0
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("Iniciando.....");
                SessionSettings        settings     = new SessionSettings("../../../executor.cfg");
                IApplication           myApp        = new MyQuickFixApp();
                IMessageStoreFactory   storeFactory = new FileStoreFactory(settings);
                ILogFactory            logFactory   = new FileLogFactory(settings);
                ThreadedSocketAcceptor acceptor     = new ThreadedSocketAcceptor(
                    myApp,
                    storeFactory,
                    settings,
                    logFactory);
                HttpServer srv = new HttpServer(HttpServerPrefix, settings);

                //Iniciando acceptor
                acceptor.Start();
                //Iniciando servidor http
                srv.Start();
                Console.WriteLine("Rodando em: " + HttpServerPrefix);
                Console.WriteLine("Aperte enter para finalizar");
                Console.ReadLine();
                //Finalizando acceptor e servidor http
                srv.Stop();
                acceptor.Stop();
            }
            catch (System.Exception e)
            {
                Console.WriteLine("Error");
                Console.WriteLine(e.ToString());
            }
        }
예제 #12
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("usage: executor_csharp FILE.");
                return;
            }

            try
            {
                SessionSettings  settings       = new SessionSettings(args[0]);
                Application      application    = new Application();
                FileStoreFactory storeFactory   = new FileStoreFactory(settings);
                ScreenLogFactory logFactory     = new ScreenLogFactory(settings);
                MessageFactory   messageFactory = new DefaultMessageFactory();
                SocketAcceptor   acceptor
                    = new SocketAcceptor(application, storeFactory, settings, logFactory, messageFactory);

                acceptor.start();
                Console.WriteLine("press <enter> to quit");
                Console.Read();
                acceptor.stop();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #13
0
    static void Main(string[] args)
    {
        string file = "";

        if (args.Length >= 2 && args[0].Equals("-f") && args[1] != null)
        {
            file = args[1];
        }
        else
        {
            Console.WriteLine("usage: at" + " -f FILE [-t]");
            return;
        }

        SessionSettings  settings    = new SessionSettings(file);
        at_application   application = new at_application();
        FileStoreFactory factory     = new FileStoreFactory(settings);
        Acceptor         acceptor    = new SocketAcceptor
                                           (application, factory, settings, new DefaultMessageFactory());

        acceptor.start();
        while (true)
        {
            Thread.Sleep(1000);
        }
    }
예제 #14
0
        static void Main(string[] args)
        {
            //SessionSettings settings = new SessionSettings("config.txt");
            SessionSettings settings = new SessionSettings();

            settings.Set(defaults);
            settings.Set(new SessionID("FIX.4.4", Guid.NewGuid().ToString(), "DERIBITSERVER"), new Dictionary("SESSION", new System.Collections.Generic.Dictionary <string, string>()
            {
                { "BeginString", "FIX.4.4" },
                //  {"SenderCompID",Guid.NewGuid().ToString() },
                //  {"ConnectionType","initiator" }
            }));
            // settings.Set(session);

            DerbitFixClient application = new DerbitFixClient();

            IMessageStoreFactory storeFactory = new FileStoreFactory(settings);
            ILogFactory          logFactory   = new 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.QuerySecurityListRequest();
            application.Run();
            initiator.Stop();
        }
예제 #15
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                System.Console.WriteLine("usage: AcceptanceTest CONFIG_FILENAME");
                System.Environment.Exit(2);
            }

            FileLog debugLog = new FileLog("log", new SessionID("AT", "Application", "Debug"));
            ThreadedSocketAcceptor acceptor = null;

            try
            {
                ATApplication testApp = new ATApplication(debugLog);
                testApp.StopMeEvent += new System.Action(delegate() { _stopMe = true; });

                SessionSettings      settings     = new SessionSettings(args[0]);
                IMessageStoreFactory storeFactory = new FileStoreFactory(settings);
                ILogFactory          logFactory   = null;
                if (settings.Get().Has("Verbose") && settings.Get().GetBool("Verbose"))
                {
                    logFactory = new FileLogFactory(settings);
                }
                acceptor = new ThreadedSocketAcceptor(testApp, storeFactory, settings, logFactory);

                acceptor.Start();
                while (true)
                {
                    System.Console.WriteLine("o hai " + System.DateTime.Now.ToString());
                    System.Threading.Thread.Sleep(1000);

                    // for tests of logout
                    if (_stopMe)
                    {
                        // this doesn't seem to work
                        // after stop, it doesn't seem to start up again

                        /*
                         * acceptor.Stop();
                         * Thread.Sleep(5 * 1000);
                         * _stopMe = false;
                         * acceptor.Start();
                         */
                    }
                }
            }
            catch (System.Exception e)
            {
                debugLog.OnEvent(e.ToString(), Severity.Error, e);
            }

            finally
            {
                if (acceptor != null)
                {
                    acceptor.Stop();
                }
            }
        }
예제 #16
0
파일: Class1.cs 프로젝트: sw00/algo-poc
        private ThreadedSocketAcceptor createAppFrom(string configFileName)
        {
            var app          = new InitiatorApp();
            var settings     = new SessionSettings(configFileName);
            var storeFactory = new FileStoreFactory(settings);
            var logFactory   = new FileLogFactory(settings);

            return(new ThreadedSocketAcceptor(app, storeFactory, settings, logFactory));
        }
예제 #17
0
        public void Init(string path)
        {
            sessionSettings = new SessionSettings(path);
            IApplication         fixapp       = new FixApp();
            IMessageStoreFactory storeFactory = new FileStoreFactory(sessionSettings);
            FileLogFactory       logFactory   = new FileLogFactory(sessionSettings);

            initiator = new SocketInitiator(fixapp, storeFactory, sessionSettings, logFactory);
        }
예제 #18
0
        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);
        }
예제 #19
0
        public void Start()
        {
            SessionSettings  settings       = new SessionSettings(ConfigFileName);
            FileStoreFactory storeFactory   = new FileStoreFactory(settings);
            FileLogFactory   logFactory     = new FileLogFactory(settings);
            MessageFactory   messageFactory = new DefaultMessageFactory();

            this.initiator = new SocketInitiator(this, storeFactory, settings, logFactory /*optional*/, messageFactory);
            this.initiator.start();
        }
예제 #20
0
        public static IServiceCollection RegisterEntityFrameworkStore(this IServiceCollection services, Action <DbContextOptionsBuilder> optionsAction)
        {
            services.AddStoresDbContext(optionsAction);

            services.AddScopedWithImplementation <IFileStore, EfFileStore>();

            FileStoreFactory.RegisterFileStore <EfFileStore>("ef", true);

            return(services);
        }
        protected FixTradeSessionConnector(FixConnectorConfiguration config, ILog log)
        {
            _config = config;
            Log     = log.CreateComponentScope(GetType().Name);
            var settings     = new SessionSettings(config.FixConfig);
            var storeFactory = new FileStoreFactory(settings);
            var logFactory   = new LykkeLogFactory(Log, false, false);

            _socketInitiator = new SocketInitiator(this, storeFactory, settings, logFactory);
        }
예제 #22
0
 public void Start(IFIXServices fixServices)
 {
     this.fixServices    = fixServices;
     this.settings       = new SessionSettings(settingsPath);
     this.storeFactory   = new FileStoreFactory(this.settings);
     this.logFactory     = new FileLogFactory(this.settings);
     this.messageFactory = new DefaultMessageFactory();
     this.initiator      = new SocketInitiator(this, this.storeFactory, this.settings, this.messageFactory);
     this.initiator.start();
 }
예제 #23
0
        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();
        }
예제 #24
0
        public Form1()
        {
            InitializeComponent();
            conn = new Connection();

            SessionSettings      settings     = new SessionSettings("session_client.txt");
            IMessageStoreFactory storeFactory = new FileStoreFactory(settings);
            ILogFactory          logFactory   = new FileLogFactory(settings);

            initiator = new QuickFix.Transport.SocketInitiator(conn, storeFactory, settings, logFactory);
        }
예제 #25
0
        public JfdQuotesSessionConnector(FixConnectorConfiguration config, ILog log)
        {
            _config = config;
            _log    = log.CreateComponentScope(GetType().Name);
            var settings     = new SessionSettings(config.FixConfig);
            var storeFactory = new FileStoreFactory(settings);
            var logFactory   = new LykkeLogFactory(_log, false, false);

            _socketInitiator = new SocketInitiator(this, storeFactory, settings, logFactory);
            RechargeQuotesTcs();
        }
        public bool StartSession(string strHostName, int nPort, string strSenderCompID, string strTargetCompID, string strPassword)
        {
            try
            {
                if (!IsPortOpen(strHostName, nPort, new TimeSpan(0, 0, 10)))
                {
                    return(false);
                }

                string strAppDirPath = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);

                QuickFix.Dictionary dicConfig = new QuickFix.Dictionary();
                dicConfig.SetString("ConnectionType", "initiator");
                dicConfig.SetDay("StartDay", DayOfWeek.Sunday);
                dicConfig.SetString("StartTime", "00:00:00");
                dicConfig.SetDay("EndDay", DayOfWeek.Saturday);
                dicConfig.SetString("EndTime", "00:00:00");
                dicConfig.SetDouble("HeartBtInt", 20);
                dicConfig.SetDouble("ReconnectInterval", 10);
                dicConfig.SetBool("ResetOnLogout", true);
                dicConfig.SetBool("ResetOnLogon", true);
                dicConfig.SetBool("ResetOnDisconnect", true);
                dicConfig.SetBool("ResetSeqNumFlag", true);
                dicConfig.SetDouble("EncryptMethod", 0);
                dicConfig.SetBool("CheckLatency", false);
                dicConfig.SetString("FileStorePath", strAppDirPath + "/Store/Ctrader_Price");
                dicConfig.SetString("FileLogPath", strAppDirPath + "/Log");
                dicConfig.SetBool("UseDataDictionary", true);
                dicConfig.SetString("DataDictionary", strAppDirPath + "/Settings/FIX44-OneZero.xml");
                dicConfig.SetBool("ScreenLogShowIncoming", false);
                dicConfig.SetBool("ScreenLogShowOutgoing", false);
                dicConfig.SetString("Password", strPassword);

                SessionID           quoteSessionID  = new SessionID("FIX.4.4", strSenderCompID, strTargetCompID);
                QuickFix.Dictionary dicQuoteSession = new QuickFix.Dictionary();
                dicQuoteSession.SetString("SocketConnectHost", strHostName);
                dicQuoteSession.SetDouble("SocketConnectPort", nPort);

                settings = new SessionSettings();
                settings.Set(dicConfig);
                settings.Set(quoteSessionID, dicQuoteSession);

                FileStoreFactory storeFactory = new FileStoreFactory(settings);
                ScreenLogFactory logFactory   = new ScreenLogFactory(settings);
                initiator = new SocketInitiator(this, storeFactory, settings, logFactory);
                initiator.Start();
                return(true);
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e.Message);
                return(false);
            }
        }
예제 #27
0
        static void Main(string[] args)
        {
            SessionSettings        settings     = new SessionSettings("ini.cfg");
            IApplication           fixHub       = new FixHub();
            IMessageStoreFactory   storeFactory = new FileStoreFactory(settings);
            ILogFactory            logFactory   = new FileLogFactory(settings);
            ThreadedSocketAcceptor acceptor     = new ThreadedSocketAcceptor(fixHub, storeFactory, settings, logFactory);

            acceptor.Start();
            Console.ReadKey();
            acceptor.Stop();
        }
예제 #28
0
        /// <summary>
        /// Connects to the FIX session.
        /// </summary>
        protected void ConnectFix()
        {
            this.MaintainConnection = true;
            var settings     = new SessionSettings(this.configPath);
            var storeFactory = new FileStoreFactory(settings);

            this.initiator = new SocketInitiator(this, storeFactory, settings, null);

            this.Logger.LogDebug(LogId.Network, "Starting initiator...");
            this.initiator.Start();
            this.SocketStopped = false;
        }
예제 #29
0
        static void Main(string[] args)
        {
            SessionID _DummySessionID = new SessionID("a", "b", "c");

            IMessageFactory _defaultMsgFactory = new DefaultMessageFactory();

            //string data = "8=FIXT.1.1"+Message.SOH+"9=735"+Message.SOH+"35=AE"+Message.SOH+"34=494"+Message.SOH+"1128=8"+Message.SOH+"49=RTNSFIXUAT"+Message.SOH+"56=YEPIRECUAT"+Message.SOH+"52=20151027-11:59:15"+Message.SOH+"552=1"+Message.SOH+"54=1"+Message.SOH+"37=Z0009WSGC4"+Message.SOH+"11=NOREF"+Message.SOH+"826=0"+Message.SOH+"78=1"+Message.SOH+"79=NOT SPECIFIED"+Message.SOH+"80=120.000000"+Message.SOH+"5967=91.070000"+Message.SOH+"5966=120.000000"+Message.SOH+"5968=91.040000"+Message.SOH+"453=5"+Message.SOH+"448=YPKB"+Message.SOH+"452=3"+Message.SOH+"447=D"+Message.SOH+"802=1"+Message.SOH+"523=YPKB"+Message.SOH+"803=5"+Message.SOH+"448=BARX"+Message.SOH+"452=1"+Message.SOH+"447=D"+Message.SOH+"802=1"+Message.SOH+"523=BARX"+Message.SOH+"803=5"+Message.SOH+"448=BARX"+Message.SOH+"452=16"+Message.SOH+"447=D"+Message.SOH+"802=1"+Message.SOH+"523=BARX"+Message.SOH+"803=5"+Message.SOH+"448=bcart7"+Message.SOH+"452=11"+Message.SOH+"447=D"+Message.SOH+"448=Barclays Capital"+Message.SOH+"452=12"+Message.SOH+"447=D"+Message.SOH+"571=10106232"+Message.SOH+"150=F"+Message.SOH+"17=Z0009WSGC4"+Message.SOH+"32=120.000000"+Message.SOH+"38=120.000000"+Message.SOH+"15=CAD"+Message.SOH+"31=1.317700"+Message.SOH+"555=2"+Message.SOH+"624=1"+Message.SOH+"637=1.317700"+Message.SOH+"1418=120.000000"+Message.SOH+"588=20151028"+Message.SOH+"587=0"+Message.SOH+"1073=0.0000"+Message.SOH+"1074=91.070000"+Message.SOH+"5190=1.317700"+Message.SOH+"624=2"+Message.SOH+"637=1.318062"+Message.SOH+"1418=120.000000"+Message.SOH+"588=20151130"+Message.SOH+"587=M1"+Message.SOH+"1073=3.6200"+Message.SOH+"1074=91.040000"+Message.SOH+"5190=1.317700"+Message.SOH+"60=20151027-11:59:14"+Message.SOH+"75=20151027"+Message.SOH+"1057=Y"+Message.SOH+"39=2"+Message.SOH+"460=4"+Message.SOH+"167=FOR"+Message.SOH+"65=SW"+Message.SOH+"55=USD/CAD"+Message.SOH+"10=076"+Message.SOH;

            //var msg = new QuickFix.FIX50.TradeCaptureReport();
            //var dd = new QuickFix.DataDictionary.DataDictionary();
            //dd.Load(@"C:\Code\tfs\neerajkaushik\MarketConnect Gateway\Source\Source\QuickFix1.5\quickfixn-master\quickfixn-master\spec\fix\reuters.fix50sp1.xml");
            //msg.FromString(data, false, dd, dd, _defaultMsgFactory);

            //MessageCracker mc = new TestCracker();

            //mc.Crack(msg, _DummySessionID);

            //var grp = msg.GetGroup(1, Tags.NoLegs);



            Console.WriteLine("=============");
            Console.WriteLine("This is only an example program.");
            Console.WriteLine("It's a simple server (e.g. Acceptor) app that will let clients (e.g. Initiators)");
            Console.WriteLine("connect to it.  It will accept and display any application-level messages that it receives.");
            Console.WriteLine("Connecting clients should set TargetCompID to 'SIMPLE' and SenderCompID to 'CLIENT1' or 'CLIENT2'.");
            Console.WriteLine("Port is 5001.");
            Console.WriteLine("(see simpleacc.cfg for configuration details)");
            Console.WriteLine("=============");



            try
            {
                SessionSettings        settings     = new SessionSettings("acceptor.cfg");
                Application            executorApp  = new Executor();
                MessageStoreFactory    storeFactory = new FileStoreFactory(settings);
                LogFactory             logFactory   = new FileLogFactory(settings);
                ThreadedSocketAcceptor acceptor     = new ThreadedSocketAcceptor(executorApp, storeFactory, settings, logFactory);

                acceptor.Start();
                Console.WriteLine("press <enter> to quit");
                Console.Read();
                acceptor.Stop();
            }
            catch (System.Exception e)
            {
                Console.WriteLine("==FATAL ERROR==");
                Console.WriteLine(e.ToString());
                Console.WriteLine("press <enter> to quit");
                Console.Read();
            }
        }
예제 #30
0
        public static void Initialize(string settingsFilePath, Router router, FixSessionStatusChangedDelegate sessionStatus)
        {
            _FixSessionStatusChangedDelegate = sessionStatus;
            _router = router;
            SessionSettings  settings     = new SessionSettings(settingsFilePath);
            ClientApp        application  = new ClientApp();
            FileStoreFactory storeFactory = new FileStoreFactory(settings);
            //logFactory = new ScreenLogFactory(settings);
            FileLogFactory logFactory     = new FileLogFactory(settings);
            MessageFactory messageFactory = new DefaultMessageFactory();

            _initiator = new SocketInitiator(application, storeFactory, settings, logFactory, messageFactory);
        }
        static void Main(string[] args)
        {
            SessionSettings settings = new SessionSettings(@"C:\acceptor.cfg");
            Startup application = new Startup();

            FileStoreFactory storeFactory = new FileStoreFactory(settings);
            ScreenLogFactory logFactory = new ScreenLogFactory(settings);
            IMessageFactory messageFactory = new DefaultMessageFactory();
            ThreadedSocketAcceptor server = new ThreadedSocketAcceptor(application, storeFactory, settings, logFactory, messageFactory);

            server.Start();
            Console.WriteLine("####### Server Socket Fix Start ...press <enter> to quit");

            Console.Read();
            server.Stop();
        }