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);
            });
        }
Пример #2
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 ActiveOrderAgent(IBtceTradeApi btceApi, IBtceModels btceModels)
 {
     lastRequestTime = DateTime.Now.AddSeconds(-10);
     hasReceivedLastRequst = true;
     btceModels.ActiveOrdersUpdated += btceModels_ActiveOrdersUpdated;
     this.btceModels = btceModels;
     this.btceApi = btceApi;
 }
Пример #4
0
 public DepthAgent(IBtceTradeApi btceTradeApi, IBtceModels btceModels)
 {
     lastRequestTime = DateTime.Now.AddSeconds(-10);
     hasReceivedLastRequst = true;
     this.btceTradeApi = btceTradeApi;
     this.btceModels = btceModels;
     this.btceModels.DepthUpdated += btceModels_DepthUpdated;
 }
Пример #5
0
 public DepthAgent(IBtceTradeApi btceTradeApi, IBtceModels btceModels)
 {
     lastRequestTime               = DateTime.Now.AddSeconds(-10);
     hasReceivedLastRequst         = true;
     this.btceTradeApi             = btceTradeApi;
     this.btceModels               = btceModels;
     this.btceModels.DepthUpdated += btceModels_DepthUpdated;
 }
Пример #6
0
 public ActiveOrderAgent(IBtceTradeApi btceApi, IBtceModels btceModels)
 {
     lastRequestTime                 = DateTime.Now.AddSeconds(-10);
     hasReceivedLastRequst           = true;
     btceModels.ActiveOrdersUpdated += btceModels_ActiveOrdersUpdated;
     this.btceModels                 = btceModels;
     this.btceApi = btceApi;
 }
Пример #7
0
        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 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);
                        }
                    }
                });
        }
Пример #9
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();
                });
        }
Пример #11
0
 public AccountInfoAgent(IBtceTradeApi btceTradeApi, IBtceModels btceModels)
 {
     this.btceTradeApi = btceTradeApi;
     this.btceModels   = btceModels;
 }
 public AccountInfoAgent(IBtceTradeApi btceTradeApi, IBtceModels btceModels)
 {
     this.btceTradeApi = btceTradeApi;
     this.btceModels = btceModels;
 }
Пример #13
0
 public TradeAgent(IBtceTradeApi btceTradeApi)
 {
     this.btceTradeApi = btceTradeApi;
 }
Пример #14
0
 public TradeAgent(IBtceTradeApi btceTradeApi)
 {
     this.btceTradeApi = btceTradeApi;
 }
Пример #15
0
 public void SetUp()
 {
     webRequestWrapperMock = MockRepository.GenerateMock <IWebRequestWrapper>();
     requestInputQueueMock = MockRepository.GenerateMock <IRequestInputQueue>();
     btceTradeApi          = new BtceTradeApi(webRequestWrapperMock, requestInputQueueMock);
 }
 public void SetUp()
 {
     webRequestWrapperMock = MockRepository.GenerateMock<IWebRequestWrapper>();
     requestInputQueueMock = MockRepository.GenerateMock<IRequestInputQueue>();
     btceTradeApi = new BtceTradeApi(webRequestWrapperMock, requestInputQueueMock);
 }