Пример #1
0
        public MainWindow()
        {
            InitializeComponent();
            Instance = this;

            Title = Title.Put(LocalizedStrings.Str1355);

            _ordersWindow.MakeHideable();
            _myTradesWindow.MakeHideable();
            _strategiesWindow.MakeHideable();
            _securitiesWindow.MakeHideable();
            _portfoliosWindow.MakeHideable();

            LogManager = new LogManager();
            LogManager.Listeners.Add(new FileLogListener("Data\\sample.log"));
            LogManager.Listeners.Add(new GuiLogListener(Monitor));

            var entityRegistry = new CsvEntityRegistry("Data");

            ConfigManager.RegisterService <IEntityRegistry>(entityRegistry);
            // ecng.serialization invoke in several places IStorage obj
            ConfigManager.RegisterService(entityRegistry.Storage);

            var storageRegistry = ConfigManager.GetService <IStorageRegistry>();

            Connector = new Connector(entityRegistry, storageRegistry);
            LogManager.Sources.Add(Connector);

            InitConnector(entityRegistry);
        }
Пример #2
0
        public MainWindow()
        {
            InitializeComponent();
            Instance = this;

            Title = Title.Put(LocalizedStrings.Str1355);

            _ordersWindow.MakeHideable();
            _myTradesWindow.MakeHideable();
            _strategiesWindow.MakeHideable();
            _securitiesWindow.MakeHideable();
            _portfoliosWindow.MakeHideable();

            LogManager = new LogManager();
            LogManager.Listeners.Add(new FileLogListener("Data\\sample.log"));
            LogManager.Listeners.Add(new GuiLogListener(Monitor));

            var entityRegistry = new CsvEntityRegistry("Data");

            ConfigManager.RegisterService <IEntityRegistry>(entityRegistry);
            // ecng.serialization invoke in several places IStorage obj
            ConfigManager.RegisterService(entityRegistry.Storage);

            var storageRegistry  = ServicesRegistry.StorageRegistry;
            var snapshotRegistry = new SnapshotRegistry(Path.Combine("Data", "Snapshots"));

            Connector = new Connector(entityRegistry.Securities, entityRegistry.PositionStorage, storageRegistry.ExchangeInfoProvider, storageRegistry, snapshotRegistry)
            {
                Adapter =
                {
                    StorageSettings =
                    {
                        DaysLoad    = TimeSpan.FromDays(3),
                    }
                }
            };
            LogManager.Sources.Add(Connector);

            InitConnector(entityRegistry, snapshotRegistry);
        }
Пример #3
0
        public MainWindow()
        {
            InitializeComponent();
            Instance = this;

            Title = Title.Put(LocalizedStrings.Str1355);

            const string path = "Data";

            _settingsFile = Path.Combine(path, $"connection{Paths.DefaultSettingsExt}");

            LogManager = new LogManager();
            LogManager.Listeners.Add(new FileLogListener {
                LogDirectory = Path.Combine(path, "Logs")
            });
            LogManager.Listeners.Add(new GuiLogListener(Monitor));

            var entityRegistry = new CsvEntityRegistry(path);

            ConfigManager.RegisterService <IEntityRegistry>(entityRegistry);

            var exchangeInfoProvider = new StorageExchangeInfoProvider(entityRegistry, false);

            ConfigManager.RegisterService <IExchangeInfoProvider>(exchangeInfoProvider);

            var storageRegistry = new StorageRegistry(exchangeInfoProvider)
            {
                DefaultDrive = new LocalMarketDataDrive(Path.Combine(path, "Storage"))
            };

            var snapshotRegistry = new SnapshotRegistry(Path.Combine(path, "Snapshots"));

            Connector = new Connector(entityRegistry.Securities, entityRegistry.PositionStorage, storageRegistry.ExchangeInfoProvider, storageRegistry, snapshotRegistry, new StorageBuffer())
            {
                Adapter =
                {
                    StorageSettings =
                    {
                        DaysLoad = TimeSpan.FromDays(3),
                        Mode     = StorageModes.Snapshot,
                    }
                },
                CheckSteps = true,
            };
            LogManager.Sources.Add(Connector);

            _securitiesWindow = new SecuritiesWindow();
            _ordersWindow     = new OrdersWindow();
            _portfoliosWindow = new PortfoliosWindow();
            _myTradesWindow   = new MyTradesWindow();

            InitConnector(entityRegistry, snapshotRegistry);

            _strategiesWindow = new StrategiesWindow();
            _strategiesWindow.LoadStrategies(path);

            _ordersWindow.MakeHideable();
            _myTradesWindow.MakeHideable();
            _strategiesWindow.MakeHideable();
            _securitiesWindow.MakeHideable();
            _portfoliosWindow.MakeHideable();
        }