Beispiel #1
0
 public MainWindowViewModel()
 {
     _bitmexAuthorization = new BitmexAuthorization {
         BitmexEnvironment = BitmexEnvironment.Test
     };
     _bitmexApiService       = BitmexApiService.CreateDefaultApi(_bitmexAuthorization);
     _bitmexApiSocketService = BitmexApiSocketService.CreateDefaultApi(_bitmexAuthorization);
     BuyCmd              = new DelegateCommand(Buy);
     SellCmd             = new DelegateCommand(Sell);
     StartLoadSymbolsCmd = new DelegateCommand(StartLoad, CanStart);
     Size         = 1;
     Instruments  = new ObservableCollection <InstrumentModel>();
     OrderUpdates = new ObservableCollection <OrderUpdateModel>();
     BindingOperations.EnableCollectionSynchronization(Instruments, _syncObj);
     BindingOperations.EnableCollectionSynchronization(OrderUpdates, _syncObjOrders);
 }
        public MainWindowViewModel()
        {
            if (IsTest)
            {
                _bitmexAuthorization = new BitmexAuthorization {
                    BitmexEnvironment = BitmexEnvironment.Test
                }
            }
            ;
            else
            {
                _bitmexAuthorization = new BitmexAuthorization {
                    BitmexEnvironment = BitmexEnvironment.Prod
                }
            };

            _bitmexApiSocketService = BitmexApiSocketService.CreateDefaultApi(_bitmexAuthorization);
            BuyCmd              = new DelegateCommand(Buy);
            SellCmd             = new DelegateCommand(Sell);
            BuyLimitCmd         = new DelegateCommand(BuyLimit);
            SellLimitCmd        = new DelegateCommand(SellLimit);
            CancleCmd           = new DelegateCommand(CancleOrder);
            ChaseCmd            = new DelegateCommand(ChaseOrder);
            StartLoadSymbolsCmd = new DelegateCommand(StartLoad, CanStart);
            Size           = 1;
            Instruments    = new ObservableCollection <InstrumentModel>();
            OrderUpdates   = new ObservableCollection <OrderUpdateModel>();
            OrderBookL2_25 = new ObservableCollection <OrderBookModel>();
            BidWall        = new List <OrderBookModel>();
            BidDepthChart  = new List <DepthChartData>();
            AskWall        = new List <OrderBookModel>();
            AskDepthChart  = new List <DepthChartData>();

            BindingOperations.EnableCollectionSynchronization(Instruments, _syncObj);
            BindingOperations.EnableCollectionSynchronization(OrderUpdates, _syncObjOrders);
            BindingOperations.EnableCollectionSynchronization(OrderBookL2_25, _syncObjOrderBookL2_25);

            /*
             * BindingOperations.EnableCollectionSynchronization(BidWall, _syncBidWall);
             * BindingOperations.EnableCollectionSynchronization(BidDepthChart, _syncBidDepthChart);
             * BindingOperations.EnableCollectionSynchronization(AskWall, _syncAskWall);
             * BindingOperations.EnableCollectionSynchronization(AskDepthChart, _syncAskDepthChart);*/
        }
 private void CreateServices()
 {
     try
     {
         _bitmexAuthorization = new BitmexAuthorization()
         {
             BitmexEnvironment = BitmexEnvironment.Prod,
             Key    = "Your_API_Key",
             Secret = "Your_API_Secret"
         };
         _bitmexApiService       = BitmexApiService.CreateDefaultApi(_bitmexAuthorization);
         _bitmexApiSocketService = BitmexApiSocketService.CreateDefaultApi(_bitmexAuthorization);
         _bitmexApiSocketService.Connect();
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
        public MainWindowViewModel()
        {
            _key    = "TGILaGzUbldGjQcsDkDolY8M";
            _secret = "hF32jD-OsGPxcTqY6sPxwvNEVpqJMgirxOTnME5t7J6sjqH4";

            _bitmexAuthorization = new BitmexAuthorization
            {
                BitmexEnvironment = BitmexEnvironment.Test,
                Key    = _key,
                Secret = _secret
            };
            _bitmexApiSocketService = BitmexApiSocketService.CreateDefaultApi(_bitmexAuthorization);
            BuyCmd              = new DelegateCommand(Buy);
            SellCmd             = new DelegateCommand(Sell);
            StartLoadSymbolsCmd = new DelegateCommand(StartLoad, CanStart);
            Size         = 1;
            Instruments  = new ObservableCollection <InstrumentModel>();
            OrderUpdates = new ObservableCollection <OrderUpdateModel>();
            OrderBookL2  = new ObservableCollection <OrderBookModel>();
            BindingOperations.EnableCollectionSynchronization(Instruments, _syncObj);
            BindingOperations.EnableCollectionSynchronization(OrderUpdates, _syncObjOrders);
            BindingOperations.EnableCollectionSynchronization(OrderBookL2, _syncObjOrderBookL2);
        }