Exemplo n.º 1
0
        public override void Init()
        {
            _keyboardSettings = _settingsService.GetSettings <ChartsSettings>().Keyboard;

            Account = _tradingService.CurrentAccount;

            _instrument = _tradingService.GetInstrument(_marketEpic);

            _currency          = _instrument.InstrumentData.currencies.First().code;
            DoublePlacesFactor = _instrument.SnapshotData.doublePlacesFactor;
            ScalingFactor      = _instrument.SnapshotData.scalingFactor;

            Title = _instrument.InstrumentData.name;

            LoadMarketSettings();

            PivotPoints = _tradingService.GetPivotPoints(_marketEpic);

            _tradingService.SubscribeToChartCandle();

            foreach (var position in _tradingService.Positions.Where(p => p.Instrument.Epic == _marketEpic))
            {
                AddPosition(position);
            }

            Messenger.Default.Register <PositionAddedMessage>(this, _marketEpic, PositionAddedMessageReceived);
            Messenger.Default.Register <PositionDeletedMessage>(this, _marketEpic, PositionDeletedMessageReceived);
            Messenger.Default.Register <SettingsChangedMessage>(this, SettingsUpdated);
        }