当前位置: 首页>>代码示例>>C#>>正文


C# ISession.Start方法代码示例

本文整理汇总了C#中ISession.Start方法的典型用法代码示例。如果您正苦于以下问题:C# ISession.Start方法的具体用法?C# ISession.Start怎么用?C# ISession.Start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISession的用法示例。


在下文中一共展示了ISession.Start方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoginCallback

        private void LoginCallback(ISession session)
        {
            Console.WriteLine("My accountId is: " + session.AccountDetails.AccountId);

            _session = session;
            _session.MarketDataChanged += MarketDataUpdate;

            _session.Subscribe(new OrderBookSubscriptionRequest(_instrumentId),
                               () => Console.WriteLine("Subscribed to " + ("instrument: " + _instrumentId)),
                               FailureCallback("subscribe to order book " + _instrumentId));

            _session.Start();
        }
开发者ID:simonlongson,项目名称:tx.link.incoming,代码行数:13,代码来源:LoginClient.cs

示例2: OnLoginSuccess

        private void OnLoginSuccess(ISession session)
        {
            Console.WriteLine("My accountId is: " + session.AccountDetails.AccountId);

            _session = session;
            _session.HeartbeatReceived += HeartbeatEvent;

            session.Subscribe(new HeartbeatSubscriptionRequest(), () => Console.WriteLine("Subscribed to heartbeat"), FailureCallback("subscribe to heartbeats"));

            Thread thread = new Thread(RunHeartbeatClient);
            thread.IsBackground = true;

            thread.Start();

            session.Start();
        }
开发者ID:simonlongson,项目名称:tx.link.incoming,代码行数:16,代码来源:HeartbeatClient.cs

示例3: OnLoginSuccess

        private void OnLoginSuccess(ISession session)
        {
            Console.WriteLine("My accountId is: " + session.AccountDetails.AccountId);

            _session = session;
            _session.MarketDataChanged += MarketDataUpdate;
            _session.EventStreamFailed += StreamFailure;
            _session.EventStreamSessionDisconnected += SessionDisconnected;


            InitialiseInstruments();

            foreach (long instrumentId in _instrumentIds)
            {
                SubscribeToInstrument(instrumentId);
            }

            session.Start();
        }
开发者ID:simonlongson,项目名称:tx.link.incoming,代码行数:19,代码来源:MarketDataClient.cs

示例4: OnLoginSuccess

        private void OnLoginSuccess(ISession session)
        {
            const long instructionId = 1;
            const long instrumentId = 4001;

            _session = session;
            _session.HistoricMarketDataReceived += OnHistoricMarketData;
            _session.Subscribe(new HistoricMarketDataSubscriptionRequest(),
                               () => Console.WriteLine("Successful subscription"),
                               failureResponse => Console.Error.WriteLine("Failed to subscribe: {0}", failureResponse));

            _session.RequestHistoricMarketData(new AggregateHistoricMarketDataRequest(instructionId, instrumentId,
                                                                                      DateTime.Parse("2011-05-11"),
                                                                                      DateTime.Parse("2011-06-13"),
                                                                                      Resolution.Day, Format.Csv,
                                                                                      Option.Bid),
                                               () => Console.WriteLine("Successful request"),
                                               failureResponse =>
                                               Console.Error.WriteLine("Failed request: {0}", failureResponse));
            _session.Start();
        }
开发者ID:simonlongson,项目名称:tx.link.incoming,代码行数:21,代码来源:HistoricMarketDataRequester.cs

示例5: LoginCallback

        private void LoginCallback(ISession session)
        {
            Console.WriteLine("My accountId is: " + session.AccountDetails.AccountId);

            // Hold onto the session for later use.
            _session = session;

            // Add listeners for events.
            _session.OrderChanged += OrderEventListener;
            _session.InstructionRejected += FailOnInstructionRejected;
            _session.MarketDataChanged += MarketDataUpdate;

            // Subscribe to my order events.
            _session.Subscribe(new OrderSubscriptionRequest(), SubscribeCallback("orders"),
                               FailureCallback("subscribe to orders"));

            // Subscribe to the order book that I'm interested in.
            _session.Subscribe(new OrderBookSubscriptionRequest(_instrumentId),
                               SubscribeCallback("instrument: " + _instrumentId),
                               FailureCallback("subscribe to order book " + _instrumentId));

            // Start the event processing loop, this method will block until the session is stopped.
            session.Start();
        }
开发者ID:simonlongson,项目名称:tx.link.incoming,代码行数:24,代码来源:TradeInsideTheSpreadBot.cs


注:本文中的ISession.Start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。