コード例 #1
0
 public MinimumTradeVolume(AssetPair market, Money minimumBuy, Money minimumSell) : this(market)
 {
     MinimumBuy  = minimumBuy;
     MinimumSell = minimumSell;
 }
コード例 #2
0
 public PairVolumeData(AssetPair pair)
 {
     Pair = pair.Normalised;
     Id   = Pair.Id;
 }
コード例 #3
0
 private static IReadOnlyList <Network> GetProviders(AssetPair pair)
 {
     return(AsyncContext.Run(() => AssetPairProvider.I.GetNetworksAsync(pair, true)).ToList());
 }
コード例 #4
0
ファイル: OrderBook.cs プロジェクト: treverson/prime
 public OrderBook AsPair(AssetPair pair)
 {
     return(pair.Id == Pair.Id ? this : Reversed);
 }
コード例 #5
0
 public OrderMarketResponse(AssetPair market)
 {
     Market = market;
 }
コード例 #6
0
 /// <summary>
 /// Will search for the price in both directions (normal / reversed).
 /// </summary>
 public static MarketPrice GetPrice(this PriceGraph graph, Network network, AssetPair pair)
 {
     return(graph?.PricesByNetwork?.Get(network)?.GetPrice(pair));
 }
コード例 #7
0
 public AggVolumeDataContext(AssetPair pair, ILogger logger = null) : base(logger)
 {
     Pair = pair;
 }
コード例 #8
0
 private NetworkPairVolume(Network network, AssetPair pair)
 {
     UtcCreated = DateTime.UtcNow;
     Network    = network;
     Pair       = pair;
 }
コード例 #9
0
 public NetworkPairVolume(Network network, AssetPair pair, decimal volume24) : this(network, pair)
 {
     HasVolume24Base = true;
     Volume24Base    = new Money(volume24, pair.Asset1);
 }
コード例 #10
0
 public PublicVolumeResponse(Network network, AssetPair pair, decimal volume24) : this(new NetworkPairVolume(network, pair, volume24))
 {
 }
コード例 #11
0
 public PublicVolumeResponse(Network network, AssetPair pair, decimal?vol24Base, decimal?vol24Quote = null) : this(new NetworkPairVolume(network, pair, vol24Base, vol24Quote))
 {
 }
コード例 #12
0
        private static AssetPairNetworks DiscoverReversable(AssetPair pair)
        {
            var provs = GetProviders(pair);

            return(provs.Any() ? new AssetPairNetworks(pair, provs) : null);
        }
コード例 #13
0
 private static AssetPairNetworks Discover(AssetPair pair, bool canReverse)
 {
     return(DiscoverReversable(pair) ?? (canReverse ? DiscoverReversable(pair.Reversed) : null));
 }
コード例 #14
0
        private static AssetPairNetworks DiscoverSpecified(AssetPair pair, Network network)
        {
            var provs = GetProviders(pair).Where(x => x.Equals(network)).ToList();

            return(provs.Any() ? new AssetPairNetworks(pair, provs) : null);
        }
コード例 #15
0
 public NetworkPairVolumeData(AssetPair pair)
 {
     Pair = pair;
     Id   = pair.Id;
 }
コード例 #16
0
ファイル: OhlcUtilities.cs プロジェクト: treverson/prime
 public static ObjectId GetHash(AssetPair pair, TimeResolution market, Network network)
 {
     return($"prime:{pair.Asset1.ShortCode}:{pair.Asset2.ShortCode}:{(int)market}:{network.Id}".GetObjectIdHashCode(true, true));
 }
コード例 #17
0
 /// <summary>
 /// Will search for the price in both directions (normal / reversed).
 /// </summary>
 public static MarketPrice GetPrice(this PriceGraph graph, AssetPair pair)
 {
     return(graph?.Prices?.GetPrice(pair));
 }
コード例 #18
0
ファイル: AssetPairNetworks.cs プロジェクト: treverson/prime
 public AssetPairNetworks(AssetPair pair, IReadOnlyList <Network> networks)
 {
     Pair     = pair;
     Networks = networks;
 }
コード例 #19
0
        /// <summary>
        /// Will search for the price in both directions (normal / reversed).
        /// </summary>
        public static MarketPrice GetPrice(this IEnumerable <MarketPrice> prices, Network network, AssetPair pair)
        {
            var m = prices.FirstOrDefault(x => x.Pair.Id == pair.Id && x.Network.Id == network.Id);

            if (m != null)
            {
                return(m);
            }

            m = prices.FirstOrDefault(x => x.Pair.Id == pair.Reversed.Id && x.Network.Id == network.Id);
            return(m?.Reversed);
        }
コード例 #20
0
 public AssetPairDataContext(AggregatedAssetPairData data, ILogger logger = null) : base(logger)
 {
     Pair     = data.AssetPair;
     Document = data;
 }
コード例 #21
0
 public OhlcDataAdapter(AssetPair pair) : this(new OhlcResolutionContext() { Pair = pair })
 {
 }
コード例 #22
0
 public IReadOnlyList <MarketPrice> Get(AssetPair pair)
 {
     lock (_lock)
         return(_prices.ContainsKey(pair.Id) ? _prices[pair.Id].ToList() : new List <MarketPrice>());
 }
コード例 #23
0
ファイル: OrderBook.cs プロジェクト: treverson/prime
 public OrderBook(Network network, AssetPair pair, IEnumerable <OrderBookRecord> asks, IEnumerable <OrderBookRecord> bids) : this(network, pair)
 {
     asks.ForEach(Add);
     bids.ForEach(Add);
 }
コード例 #24
0
        public (TimeSpan duration, decimal percentage) PercentageDirection(Network network, AssetPair pair, TimeSpan span)
        {
            var prices = Get(pair).Where(x => x.Network.Id == network.Id).ToList();

            if (prices.Count < 2)
            {
                return(TimeSpan.Zero, 0);
            }

            var ordered = prices.Where(x => x.UtcCreated.IsWithinTheLast(span)).OrderBy(x => x.UtcCreated).ToList();

            if (ordered.Count < 2)
            {
                return(TimeSpan.Zero, 0);
            }

            var earliest = ordered.First();
            var latest   = ordered.Last();
            var duration = latest.UtcCreated - earliest.UtcCreated;

            return(duration, earliest.PercentageDifference(latest));
        }
コード例 #25
0
        private PublicVolumeResponse GetVolumeDataAgg(IAggVolumeDataProvider prov, AssetPair pair)
        {
            var apir = ApiCoordinator.GetAggVolumeData(prov, new AggVolumeDataContext(pair));

            return(apir.IsNull ? null : apir.Response);
        }
コード例 #26
0
 public MinimumTradeVolume(AssetPair market) : this()
 {
     Market = market;
 }
コード例 #27
0
 public OhlcContext(AssetPair pair, TimeResolution resolution, TimeRange range, ILogger logger = null) : base(logger)
 {
     Pair       = pair;
     Resolution = resolution;
     Range      = range;
 }
コード例 #28
0
        private AssetPairNetworks DiscoverIntermediariesLoop(AssetPair pair)
        {
            var ints = Intermediaries.Select(intermediary => DoIntermerdiaryReverseable(pair, intermediary)).Where(provs => provs != null).ToList();

            return(ints.OrderByDescending(x => x.Sort).ThenByDescending(x => x.TotalNetworksInvolved).FirstOrDefault());
        }