Exemplo n.º 1
0
        internal void ConstructQuotManager()
        {
            MongoMessagePackRecorder recorder = new MongoMessagePackRecorder("192.168.1.167", 6678, this.logHelper);

            QuotV5.Binary.RealTimeQuotConnection stockRealtimeQuotConn  = ConstructRealTimeQuotConnection("StockRealtime", recorder);
            QuotV5.Binary.RealTimeQuotConnection optionRealtimeQuotConn = ConstructRealTimeQuotConnection("OptionRealtime", recorder);
            QuotationRepository quotRepository = new QuotationRepository();


            QuotationMQPublisherConfig publisherConfig = new QuotationMQPublisherConfig()
            {
                Address           = PluginContext.Configuration.ActiveMQ.Address,
                RecordsPerPackage = PluginContext.Configuration.ActiveMQ.RecordsPerPackage
            };
            QuotationMQPublisher quotPublisher = new QuotationMQPublisher(publisherConfig, this.logHelper);


            StaticInfoProviderConfig securityInfoProviderConfig = GetStaticInfoProviderConfig("Securities");
            SecurityInfoProvider     securityInfoProvider       = new SecurityInfoProvider(securityInfoProviderConfig, this.logHelper);


            StaticInfoProviderConfig indexInfoProviderConfig = GetStaticInfoProviderConfig("IndexInfo");
            IndexInfoProvider        indexInfoProvider       = new IndexInfoProvider(indexInfoProviderConfig, this.logHelper);

            StaticInfoProviderConfig  cashAuctionParamsProviderConfig = GetStaticInfoProviderConfig("CashAuctionParams");
            CashAuctionParamsProvider cashAuctionParamsProvider       = new CashAuctionParamsProvider(cashAuctionParamsProviderConfig, this.logHelper);

            StaticInfoProviderConfig        derivativeAuctionParamsProviderConfig = GetStaticInfoProviderConfig("DerivativeAuctionParams");
            DerivativeAuctionParamsProvider derivativeAuctionParamsProvider       = new DerivativeAuctionParamsProvider(derivativeAuctionParamsProviderConfig, this.logHelper);

            StaticInfoProviderConfig  negotiationParamsProviderConfig = GetStaticInfoProviderConfig("NegotiationParams");
            NegotiationParamsProvider negotiationParamsProvider       = new NegotiationParamsProvider(negotiationParamsProviderConfig, this.logHelper);

            StaticInfoProviderConfig securityCloseMDProviderConfig = GetStaticInfoProviderConfig("SecurityCloseMD");
            SecurityCloseMDProvider  securityCloseMDProvider       = new SecurityCloseMDProvider(securityCloseMDProviderConfig, this.logHelper);

            this.quotManager = new QuotationManager(
                //new QuotV5.Binary.RealTimeQuotConnection[] { optionRealtimeQuotConn },
                new QuotV5.Binary.RealTimeQuotConnection[] { stockRealtimeQuotConn, optionRealtimeQuotConn },
                quotRepository,
                quotPublisher,
                // null,
                securityInfoProvider,
                indexInfoProvider,
                cashAuctionParamsProvider,
                derivativeAuctionParamsProvider,
                negotiationParamsProvider,
                securityCloseMDProvider,
                this.logHelper
                );


            QuotationSnapServiceConfig sc = new QuotationSnapServiceConfig()
            {
                Address = PluginContext.Configuration.ActiveMQ.Address, RecordsPerPackage = PluginContext.Configuration.ActiveMQ.RecordsPerPackage
            };

            this.quotSnapService = new QuotationSnapService(sc, quotPublisher, this.logHelper);
        }
Exemplo n.º 2
0
        private static void testRealtimeQuotConn()
        {
            QuotV5.Binary.ConnectionConfig cfg = new QuotV5.Binary.ConnectionConfig()
            {
                IP                  = System.Net.IPAddress.Parse("172.16.1.99"),
                TargetCompID        = "N4005Q0001          ",
                Port                = 8016,
                HeartbeatIntervalS  = 3,
                ConnectionTimeoutMS = 10000,
                ReconnectIntervalMS = 5000,
                SenderCompID        = "realtime            ",
                Password            = "******"
            };
            QuotV5.Binary.RealTimeQuotConnection conn = new QuotV5.Binary.RealTimeQuotConnection(cfg, logHelper);

            conn.OnMarketDataReceived += new Action <QuotV5.Binary.MarketDataEx>(conn_OnMarketDataReceived);
            conn.Start();
        }
Exemplo n.º 3
0
        private QuotV5.Binary.RealTimeQuotConnection ConstructRealTimeQuotConnection(string connConfigkey, QuotV5.Binary.IMessagePackRecorder recorder = null)
        {
            var connConfig = PluginContext.Configuration.BinaryConnections.Connections.FirstOrDefault(c => c.Key == connConfigkey);

            if (connConfig == null)
            {
                throw new Exception();
            }

            QuotV5.Binary.ConnectionConfig realtimeConnConfig = new QuotV5.Binary.ConnectionConfig()
            {
                IP                  = System.Net.IPAddress.Parse(connConfig.IP),
                TargetCompID        = connConfig.TargetCompID,
                Port                = connConfig.Port,
                HeartbeatIntervalS  = connConfig.HeartbeatIntervalS,
                ConnectionTimeoutMS = connConfig.ConnectionTimeoutMS,
                ReconnectIntervalMS = connConfig.ReconnectIntervalMS,
                SenderCompID        = connConfig.SenderCompID,
                Password            = connConfig.Password
            };

            QuotV5.Binary.RealTimeQuotConnection realtimeQuotConn = new QuotV5.Binary.RealTimeQuotConnection(realtimeConnConfig, this.logHelper, recorder);
            return(realtimeQuotConn);
        }
        private QuotV5.Binary.RealTimeQuotConnection ConstructRealTimeQuotConnection(string connConfigkey,QuotV5.Binary.IMessagePackRecorder recorder=null)
        {
            var connConfig = PluginContext.Configuration.BinaryConnections.Connections.FirstOrDefault(c => c.Key == connConfigkey);
            if (connConfig == null)
                throw new Exception();

            QuotV5.Binary.ConnectionConfig realtimeConnConfig = new QuotV5.Binary.ConnectionConfig()
            {
                IP = System.Net.IPAddress.Parse(connConfig.IP),
                TargetCompID = connConfig.TargetCompID,
                Port = connConfig.Port,
                HeartbeatIntervalS = connConfig.HeartbeatIntervalS,
                ConnectionTimeoutMS = connConfig.ConnectionTimeoutMS,
                ReconnectIntervalMS = connConfig.ReconnectIntervalMS,
                SenderCompID = connConfig.SenderCompID,
                Password = connConfig.Password
            };

            QuotV5.Binary.RealTimeQuotConnection realtimeQuotConn = new QuotV5.Binary.RealTimeQuotConnection(realtimeConnConfig, this.logHelper, recorder);
            return realtimeQuotConn;
        }