public async Task <MarketMakerState> GetStateAsync()
        {
            MarketMakerState state = _cache.Get(CacheKey);

            if (state == null)
            {
                state = await _marketMakerStateRepository.GetAsync();

                if (state == null)
                {
                    state = new MarketMakerState
                    {
                        Status = MarketMakerStatus.Disabled,
                        Time   = DateTime.UtcNow
                    };
                }

                _cache.Initialize(new[] { state });
            }

            return(state);
        }
Example #2
0
        public async Task <MarketMakerState> GetAsync()
        {
            MarketMakerState marketMakerState = _cache.Get(CacheKey);

            if (marketMakerState == null)
            {
                marketMakerState = await _marketMakerStateRepository.GetAsync();

                if (marketMakerState == null)
                {
                    marketMakerState = new MarketMakerState
                    {
                        Status    = MarketMakerStatus.Stopped,
                        Timestamp = DateTime.UtcNow
                    };
                }

                _cache.Initialize(new[] { marketMakerState });
            }

            return(marketMakerState);
        }