Initialize() public method

public Initialize ( IConfiguration configuration ) : void
configuration IConfiguration
return void
コード例 #1
0
        private void StartApplication(IConfiguration configuration)
        {
            UiDispatcher.Init(Dispatcher);
            Configuration = configuration;

            var dependencyInjection = new DependencyInjection();
            dependencyInjection.Initialize(configuration);

            DependencyInjection.Container.Resolve<IClient>().Start(configuration.ClientId, configuration.ServerAddress, configuration.ServerCommandPort, configuration.ServerPublishPort);

            var window = new MainWindow();
            var viewModel = new MainWindowViewModel();

            window.DataContext = viewModel;
            window.Show();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            config = new Configuration
            {
                ClientId = 99,
                ServerAddress = "localhost",
                ServerCommandPort = 9192,
                ServerPublishPort = 9193
            };

            var dependencyInjection = new DependencyInjection();
            dependencyInjection.Initialize(config);

            var prices = new List<double>();
            for (double x = 0; x < 90; x += 1)
            {
                double val = Math.Round(Math.Sin(x / Math.PI), 4) + 2;
                prices.Add(val);
            }

            string symbol = string.Format("{0}{1}{2}", GetLetter(), GetLetter(), GetLetter());
            var client = DependencyInjection.Container.Resolve<IClient>();
            client.Start(config.ClientId, config.ServerAddress, config.ServerCommandPort, config.ServerPublishPort);
            client.LimitOrderAccepted += (sender, dto) =>
            {
                while (true)
                {
                    for (int c = 0; c < prices.Count; c++)
                    {
                        client.ModifyLimitOrder(dto.ExchangeOrderId, prices[c], 100);
                        Thread.Sleep(0);
                    }
                }
            };

            client.SubmitLimitOrder(symbol, 90, 90, WayEnum.Buy);

            Console.WriteLine("Sending orders on symbol '{0}' ...", symbol);
            Console.ReadKey();
            client.Stop();
        }