private void Discover()
        {
            var request = new AssetPairDiscoveryRequestMessage
            {
                Network           = _req.NetworkSuggested,
                Pair              = _req.Pair,
                ConversionEnabled = true,
                PeggedEnabled     = true,
                ReversalEnabled   = true
            };

            var r = AssetPairDiscovery.I.Discover(request);

            if (r == null)
            {
                return;
            }

            if (!r.DiscoverFirst.Has <IPublicPricingProvider>())
            {
                return;
            }

            ProcessDiscovery(_req, r.DiscoverFirst);

            _doAfterDiscovery?.Invoke();
        }
示例#2
0
        internal AssetPairDiscoveries Discover(AssetPairDiscoveryRequestMessage request)
        {
            var i = GetOrCreateInstance(request);

            i.Wait(TimeSpan.FromSeconds(20));
            return(!i.IsFinished() ? null : i);
        }
示例#3
0
 internal AssetPairDiscoveries(AssetPairDiscoveryRequestMessage requestMessage)
 {
     Context      = requestMessage;
     ProcessState = ProcessState.None;
     Task.Run(() => Discover());
 }
示例#4
0
 private AssetPairDiscoveries GetOrCreateInstance(AssetPairDiscoveryRequestMessage request)
 {
     lock (_lock)
         return(_cache.GetOrAdd(request, k => new AssetPairDiscoveries(k)));
 }
示例#5
0
        private void AssetPairProviderDiscoveryMessage(AssetPairDiscoveryRequestMessage m)
        {
            var networks = AssetPairDiscovery.I.Discover(m);

            _m.SendAsync(new AssetPairDiscoveryResultMessage(m, networks.DiscoverFirst, networks.Discovered));
        }