Ejemplo n.º 1
0
        public MarketDepthViewModel(IBtceModels btceModels, IConfiguration configuration, IBtceTradeApi btceTradeApi, ITradingConfigurations tradingConfigurations, BtcePairEnum pair)
        {
            this.CurrentPair           = pair;
            this.btceModels            = btceModels;
            this.configuration         = configuration;
            this.btceTradeApi          = btceTradeApi;
            this.tradingConfigurations = tradingConfigurations;
            this.paneTitle             = "Depth: " + CurrentPair.ToString();

            AggregatedAsks       = new List <IDepthOrderInfo>();
            AggregatedBids       = new List <IDepthOrderInfo>();
            Asks                 = new List <IDepthOrderInfo>();
            Bids                 = new List <IDepthOrderInfo>();
            MarketMakerViewModel = new MarketMakerViewModel(CurrentPair, btceModels);
            TradeTickerViewModel = new TradeTickerViewModel(btceModels, CurrentPair);

            btceModels.DepthUpdated += btceModels_DepthUpdated;

            AskDoubbleClickCommand = new RelayCommand((tradeClickParameters) =>
            {
                ShowTradeWindow(((IDepthOrderInfo)tradeClickParameters).Price, TradeTypeEnum.Sell);
            });

            BidsDoubbleClickCommand = new RelayCommand((tradeClickParameters) =>
            {
                ShowTradeWindow(((IDepthOrderInfo)tradeClickParameters).Price, TradeTypeEnum.Buy);
            });
        }
        public MarketDepthViewModel(IBtceModels btceModels, IConfiguration configuration, IBtceTradeApi btceTradeApi, ITradingConfigurations tradingConfigurations, BtcePairEnum pair)
        {
            this.CurrentPair = pair;
            this.btceModels = btceModels;
            this.configuration = configuration;
            this.btceTradeApi = btceTradeApi;
            this.tradingConfigurations = tradingConfigurations;
            this.paneTitle = "Depth: " + CurrentPair.ToString();

            AggregatedAsks = new List<IDepthOrderInfo>();
            AggregatedBids = new List<IDepthOrderInfo>();
            Asks = new List<IDepthOrderInfo>();
            Bids = new List<IDepthOrderInfo>();
            MarketMakerViewModel = new MarketMakerViewModel(CurrentPair, btceModels);
            TradeTickerViewModel = new TradeTickerViewModel(btceModels, CurrentPair);

            btceModels.DepthUpdated += btceModels_DepthUpdated;

            AskDoubbleClickCommand = new RelayCommand((tradeClickParameters) =>
                {
                    ShowTradeWindow(((IDepthOrderInfo)tradeClickParameters).Price, TradeTypeEnum.Sell);
                });

            BidsDoubbleClickCommand = new RelayCommand((tradeClickParameters) =>
            {
                ShowTradeWindow(((IDepthOrderInfo)tradeClickParameters).Price, TradeTypeEnum.Buy);
            });
        }
        public EditTradeViewModel(ITradeRequest initialTradeRequest, ITradingConfigurations tradingConfigurations, IAccountInfo accountInfo)
        {
            this.tradingConfigurations = tradingConfigurations;
            this.accountInfo = accountInfo;
            TradeRequest = initialTradeRequest;

            RateTickUp = new RelayCommand((parameters) =>
                {
                    tradeRequest.Rate += TickUpDownInterval;
                    OnPropertyChanged("TradeRequest");
                });

            RateTickDown = new RelayCommand((parameters) =>
            {
                tradeRequest.Rate -= TickUpDownInterval;
                OnPropertyChanged("TradeRequest");
            });

            tradeRequest.Amount = tradingConfigurations.CalculateAmount(initialTradeRequest.Pair, initialTradeRequest.TradeType, accountInfo.GetAmountFromEnum(initialTradeRequest.Pair));
        }
Ejemplo n.º 4
0
        public EditTradeViewModel(ITradeRequest initialTradeRequest, ITradingConfigurations tradingConfigurations, IAccountInfo accountInfo)
        {
            this.tradingConfigurations = tradingConfigurations;
            this.accountInfo           = accountInfo;
            TradeRequest = initialTradeRequest;

            RateTickUp = new RelayCommand((parameters) =>
            {
                tradeRequest.Rate += TickUpDownInterval;
                OnPropertyChanged("TradeRequest");
            });

            RateTickDown = new RelayCommand((parameters) =>
            {
                tradeRequest.Rate -= TickUpDownInterval;
                OnPropertyChanged("TradeRequest");
            });

            tradeRequest.Amount = tradingConfigurations.CalculateAmount(initialTradeRequest.Pair, initialTradeRequest.TradeType, accountInfo.GetAmountFromEnum(initialTradeRequest.Pair));
        }
Ejemplo n.º 5
0
        public MainWindowViewModel(IBtceTradeApi btceTradeApi, IBtceModels btceModels, IConfiguration configuration, ITradingConfigurations tradingConfigurations)
        {
            this.btceTradeApi          = btceTradeApi;
            this.btceModels            = btceModels;
            this.configuration         = configuration;
            this.tradingConfigurations = tradingConfigurations;

            DockedViewModels = new ObservableCollection <IAvalonDockViewModel>();


            ActiveOrdersViewModel = new ActiveOrdersViewModel(this.btceTradeApi, this.btceModels);
            AccountInfoViewModel  = new AccountInfoViewModel(this.btceModels);

            AddDepthCommand = new RelayCommand((parameters) =>
            {
                var viewModel    = new SelectPairViewModel(configuration);
                var view         = new SelectPair();
                view.DataContext = viewModel;

                viewModel.CancelCommand = new RelayCommand((pms) =>
                {
                    view.Close();
                });

                viewModel.OkCommand = new RelayCommand((pms) =>
                {
                    if (viewModel.SelectedPair != null)
                    {
                        var newMarketDepthViewModel = new MarketDepthViewModel(btceModels, configuration, btceTradeApi, tradingConfigurations, viewModel.SelectedPair);

                        DockedViewModels.Add(newMarketDepthViewModel);
                        view.Close();
                    }
                });

                view.ShowDialog();
            });
        }
        public MainWindowViewModel(IBtceTradeApi btceTradeApi, IBtceModels btceModels, IConfiguration configuration, ITradingConfigurations tradingConfigurations)
        {
            this.btceTradeApi = btceTradeApi;
            this.btceModels = btceModels;
            this.configuration = configuration;
            this.tradingConfigurations = tradingConfigurations;

            DockedViewModels = new ObservableCollection<IAvalonDockViewModel>();

            ActiveOrdersViewModel = new ActiveOrdersViewModel(this.btceTradeApi, this.btceModels);
            AccountInfoViewModel = new AccountInfoViewModel(this.btceModels);

            AddDepthCommand = new RelayCommand((parameters) =>
                {
                    var viewModel = new SelectPairViewModel(configuration);
                    var view = new SelectPair();
                    view.DataContext = viewModel;

                    viewModel.CancelCommand = new RelayCommand((pms) =>
                        {
                            view.Close();
                        });

                    viewModel.OkCommand = new RelayCommand((pms) =>
                        {
                            if (viewModel.SelectedPair != null)
                            {
                                var newMarketDepthViewModel = new MarketDepthViewModel(btceModels, configuration, btceTradeApi, tradingConfigurations, viewModel.SelectedPair);

                                DockedViewModels.Add(newMarketDepthViewModel);
                                view.Close();
                            }
                        });

                    view.ShowDialog();
                });
        }