コード例 #1
0
ファイル: TestEngine.cs プロジェクト: Pulemet/Commissions
        public void Initialize(string baseSymbol, string termSymbol)
        {
            BaseSymbol = baseSymbol;
            TermSymbol = termSymbol;
            Symbol     = baseSymbol + termSymbol;

            // Configurator
            ConfiguratorRest    = new RestService(Constants.ConfiguratorUrl, "/token", Constants.ConfiguratorAuthorization);
            ConfiguratorService = new ConfiguratorRestService(ConfiguratorRest);
            ConfiguratorService.Authorize(Constants.ConfiguratorUserName, Constants.ConfiguratorUserPass);
            User = ConfiguratorService.SearchUser(ConfiguratorUser)[0];
            // Get Trading Settings
            Security = ConfiguratorService.GetSecurities().FirstOrDefault(s => s.BaseCurrency == baseSymbol && s.TermCurrency == termSymbol);
            // Crypto
            CryptoRest    = new RestService(Constants.CryptoUrl, "/oauth/token", Constants.CryptoAuthorization);
            CryptoService = new CryptoRestService(CryptoRest);
            CryptoService.Authorize(Constants.CryptoUserName, Constants.CryptoUserPass);
            // Trader subscription
            TraderSubscriber = new TraderSubscription(Constants.CryptoTraderSubscribe, CryptoService.GetToken);
            Thread.Sleep(500);
            TraderSubscriber.ResponsesSubscribe();
            Thread.Sleep(500);
            // Orders
            TraderSubscriber.OrdersReceiver(CheckOrderStatus);
            Thread.Sleep(500);
            // Order book
            TraderSubscriber.OrderBookSubcribe(OrderBookDestination + Symbol, OnBestBidAsk);
            // Manager subscription
            ManagerSubscriber = new ManagerSubscription(Constants.CryptoManagerSubscribe, CryptoService.GetToken);
            ManagerSubscriber.ResponsesSubscribe();
            Thread.Sleep(500);
        }
コード例 #2
0
 public void Initialize()
 {
     CryptoRest    = new RestService(Constants.CryptoUrl, "/oauth/token", Constants.CryptoAuthorization);
     CryptoService = new CryptoRestService(CryptoRest);
     CryptoService.Authorize(Constants.CryptoTraderName, Constants.CryptoUserPass);
     // Trader subscription
     TraderSubscriber = new TraderSubscription(Constants.CryptoTraderSubscribe, CryptoService.GetToken);
     Thread.Sleep(500);
     TraderSubscriber.ResponsesSubscribe();
 }