Exemple #1
0
        private void InitializeAssetPairs()
        {
            var assets          = _assetsService.AssetGetAll();
            var lykkeAssetPairs = _assetsService.AssetPairGetAll();

            foreach (var lykkeAssetPair in lykkeAssetPairs)
            {
                var baseAsset  = assets.SingleOrDefault(x => x.Id == lykkeAssetPair.BaseAssetId);
                var quoteAsset = assets.SingleOrDefault(x => x.Id == lykkeAssetPair.QuotingAssetId);

                if (baseAsset == null || quoteAsset == null)
                {
                    continue;
                }

                var baseAssetName  = GetShortestName(baseAsset.Id, baseAsset.Name, baseAsset.DisplayId);
                var quoteAssetName = GetShortestName(quoteAsset.Id, quoteAsset.Name, quoteAsset.DisplayId);

                var newAssetPair = new AssetPair(baseAssetName, quoteAssetName, lykkeAssetPair.Accuracy, lykkeAssetPair.InvertedAccuracy);
                _lykkeAssetIdsAssetPairs[lykkeAssetPair.Id]   = newAssetPair;
                _lykkeAssetNamesAssetPairs[newAssetPair.Name] = newAssetPair;
            }

            _log.Info($"Initialized {_lykkeAssetIdsAssetPairs.Count} of {lykkeAssetPairs.Count} asset pairs.");
        }
Exemple #2
0
        public void Start()
        {
            var assetPairs = _assetsService.AssetPairGetAll();

            foreach (var assetPair in assetPairs)
            {
                _cache.Set(GetKey(assetPair.Id), Mapper.ToAssetPair(assetPair));
            }
            _cache.Set(AllKey, new ConcurrentBag <string>(assetPairs.Select(x => x.Id)));
        }
Exemple #3
0
        private void InitializeAssetPairs()
        {
            var assetPairs = _assetsService.AssetPairGetAll();

            foreach (var assetPair in assetPairs)
            {
                var baseAsset  = _assets.Values.SingleOrDefault(x => x.Id == assetPair.BaseAssetId);
                var quoteAsset = _assets.Values.SingleOrDefault(x => x.Id == assetPair.QuotingAssetId);

                if (baseAsset == null || quoteAsset == null)
                {
                    continue;
                }

                _assetPairs[assetPair.Id] = new AssetPair(assetPair.Id, baseAsset.Name + quoteAsset.Name, baseAsset, quoteAsset, assetPair.Accuracy, assetPair.InvertedAccuracy);
            }

            _log.Info($"Initialized {_assetPairs.Count} of {assetPairs.Count} asset pairs.");
        }