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));
        }
        public ActiveOrdersViewModel(IBtceTradeApi tradeApi, IBtceModels btceModels)
        {
            this.tradeApi = tradeApi;
            this.btceModels = btceModels;
            this.btceModels.ActiveOrdersUpdated += btceModels_ActiveOrdersUpdated;

            CancelOrderCommand = new RelayCommand(o =>
                {
                    var currentOrder = ActiveOrders.ToList().Find(a => a.Id == (string) o);
                    if (currentOrder != null)
                    {
                        string message = string.Format("Confirm cancelation of order:\n\n {0}", currentOrder.Summery);

                        if (MessageBox.Show(message, "Cancel order?", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                        {
                            tradeApi.CancelOrder(currentOrder.Id);
                        }
                    }
                });
        }
        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();
                });
        }