Example #1
0
        public TickerServiceTest()
        {
            _configuration = new ConfigurationBuilder()
                             .AddJsonFile("appsettings.json")
                             .Build();

            _httpRequestHandlerMock = new Mock <IHttpRequestHandler>();
            _tickerService          = new TickerService(_httpRequestHandlerMock.Object, _configuration);
        }
 public ApiController(
     TickerService tickerService,
     CurrencyService currencyService,
     IMemoryCache memoryCache,
     IOptions <NakoSettings> nakoApiSettings)
 {
     _tickerService   = tickerService;
     _currencyService = currencyService;
     _memoryCache     = memoryCache;
     _nakoApiSettings = nakoApiSettings.Value;
 }
Example #3
0
    public static void DoSceneStarted()
    {
        TickerService.StartTickers(SceneLoader.Instance);
        PersistentSingleton <AchievementsService> .Instance.LateInitialize();

        PersistentSingleton <PlayFabService> .Instance.LateInitialize();

        PersistentSingleton <AdColonyProvider> .Instance.LateInitialize();

        AndroidJNIHelper.debug = false;
    }
Example #4
0
 public BlockchainController(
     ILogger <BlockchainController> logger,
     ApplicationDbContext context,
     BitcoinService bitcoin,
     BlockchainService blockchain,
     TickerService ticker)
 {
     _logger     = logger;
     _context    = context;
     _bitcoin    = bitcoin;
     _blockchain = blockchain;
     _ticker     = ticker;
 }
 public ApiController(
     ILogger <ApiController> log,
     TickerService tickerService,
     CurrencyService currencyService,
     IMemoryCache memoryCache,
     IOptions <ExplorerSettings> settings)
 {
     this.log             = log;
     this.tickerService   = tickerService;
     this.currencyService = currencyService;
     this.memoryCache     = memoryCache;
     this.settings        = settings.Value;
 }
Example #6
0
        public void Start()
        {
            Action <BaseExchange> subscribeRestExchange = client =>
            {
                client.Logon();
                foreach (var ins in _restInstruments.Values)
                {
                    ins.SubscribeOrderBook(client, (n, o) => OrderBookRestHandler(n, o));
                }
            };

            var config     = (BotcoinConfigSection)ConfigurationManager.GetSection("botcoin");
            var connection = config.FindConnectionElement("Arbitrage");

#if true
            var domainName = connection.DomainName;
            if (Dns.Resolve(Dns.GetHostName()).AddressList[0].ToString() == "185.226.113.60")
            {
                var str = domainName.Split('.');
                domainName = String.Format("{0}-test.{1}.{2}", str[0], str[1], str[2]);
            }
#endif
            _endPoint = new IPEndPoint(DbGatewayService.GetAddressByHost(domainName), connection.Port);
            _ticker   = new TickerService(_restInstruments, /*_wsInstruments,*/ _dbGateway.GetExchangeSettings(), _log);

            CreateExchanges();

            try
            {
                _ticker.Update();

                foreach (var client in _restExchanges.Values)
                {
                    subscribeRestExchange(client);
                }

                foreach (var client in _wsExchanges.Values)
                {
                    subscribeWsExchange(client);
                }

                _ticker.Start();
                _restSubscriber.Start();
            }
            catch (Exception ex)
            {
                _log.WriteError(ex.Message);
            }
        }
 public HomeController(IMemoryCache memoryCache,
                       ILogger <HomeController> log,
                       TickerService tickerService,
                       WeightService weightService,
                       CurrencyService currencyService,
                       IOptions <ExplorerSettings> settings,
                       IOptions <ChainSettings> chainSettings)
 {
     this.memoryCache     = memoryCache;
     this.log             = log;
     this.settings        = settings.Value;
     this.chainSettings   = chainSettings.Value;
     this.tickerService   = tickerService;
     this.weightService   = weightService;
     this.currencyService = currencyService;
 }
Example #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TickerStore"/> class.
        /// </summary>
        /// <param name="tickerService">The ticker service to use.</param>
        /// <param name="sharedState">The shared state.</param>
        public TickerStore(TickerService tickerService, ISharedState sharedState)
        {
            var set = tickerService.Ticker
                      .Retry(3)
                      .Catch((Exception ex) =>
            {
                sharedState.RunInAction(() => this.ErrorMessage = $"Could not get exchange rates. The error message is: {ex.Message}");
                return(Observable.Empty <IDictionary <string, TickerService.ExchangeRate> >());
            })
                      .ToObservableChangeSet(
                x => x.Key, expireAfter: item => TimeSpan.FromHours(4));

            this.subscription = set.Transform(kvp => sharedState.Observable(() => new ExchangeRate()
            {
                Name   = kvp.Key,
                Symbol = kvp.Value.Symbol,
                Value  = kvp.Value.Last,
                Max    = kvp.Value.Last,
                Min    = kvp.Value.Last,
            }))
                                .Select(x => CalculateMinMax(x))
                                .CortexBind((ObservableDictionary <string, ExchangeRate>) this.ExchangeRates)
                                .Subscribe();
        }
        public TickerServiceFixture()
        {
            _tickerClient = new Mock <ITickerClient>();

            _service = new TickerService(_tickerClient.Object);
        }
Example #10
0
 public TickerHub(TickerService ticker)
 {
     _ticker = ticker;
 }
Example #11
0
 public CacheTickerAdapter(TickerService listener, Action<Guid> revoke)
 {
     _revoke = revoke;
     _disposeOnDone = listener.Filter(Trigger.ResourceChanged).AsObservable().Subscribe(Revoke);
 }