public MinimumTradeVolume(AssetPair market, Money minimumBuy, Money minimumSell) : this(market) { MinimumBuy = minimumBuy; MinimumSell = minimumSell; }
public PairVolumeData(AssetPair pair) { Pair = pair.Normalised; Id = Pair.Id; }
private static IReadOnlyList <Network> GetProviders(AssetPair pair) { return(AsyncContext.Run(() => AssetPairProvider.I.GetNetworksAsync(pair, true)).ToList()); }
public OrderBook AsPair(AssetPair pair) { return(pair.Id == Pair.Id ? this : Reversed); }
public OrderMarketResponse(AssetPair market) { Market = market; }
/// <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)); }
public AggVolumeDataContext(AssetPair pair, ILogger logger = null) : base(logger) { Pair = pair; }
private NetworkPairVolume(Network network, AssetPair pair) { UtcCreated = DateTime.UtcNow; Network = network; Pair = pair; }
public NetworkPairVolume(Network network, AssetPair pair, decimal volume24) : this(network, pair) { HasVolume24Base = true; Volume24Base = new Money(volume24, pair.Asset1); }
public PublicVolumeResponse(Network network, AssetPair pair, decimal volume24) : this(new NetworkPairVolume(network, pair, volume24)) { }
public PublicVolumeResponse(Network network, AssetPair pair, decimal?vol24Base, decimal?vol24Quote = null) : this(new NetworkPairVolume(network, pair, vol24Base, vol24Quote)) { }
private static AssetPairNetworks DiscoverReversable(AssetPair pair) { var provs = GetProviders(pair); return(provs.Any() ? new AssetPairNetworks(pair, provs) : null); }
private static AssetPairNetworks Discover(AssetPair pair, bool canReverse) { return(DiscoverReversable(pair) ?? (canReverse ? DiscoverReversable(pair.Reversed) : null)); }
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); }
public NetworkPairVolumeData(AssetPair pair) { Pair = pair; Id = pair.Id; }
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)); }
/// <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)); }
public AssetPairNetworks(AssetPair pair, IReadOnlyList <Network> networks) { Pair = pair; Networks = networks; }
/// <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); }
public AssetPairDataContext(AggregatedAssetPairData data, ILogger logger = null) : base(logger) { Pair = data.AssetPair; Document = data; }
public OhlcDataAdapter(AssetPair pair) : this(new OhlcResolutionContext() { Pair = pair }) { }
public IReadOnlyList <MarketPrice> Get(AssetPair pair) { lock (_lock) return(_prices.ContainsKey(pair.Id) ? _prices[pair.Id].ToList() : new List <MarketPrice>()); }
public OrderBook(Network network, AssetPair pair, IEnumerable <OrderBookRecord> asks, IEnumerable <OrderBookRecord> bids) : this(network, pair) { asks.ForEach(Add); bids.ForEach(Add); }
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)); }
private PublicVolumeResponse GetVolumeDataAgg(IAggVolumeDataProvider prov, AssetPair pair) { var apir = ApiCoordinator.GetAggVolumeData(prov, new AggVolumeDataContext(pair)); return(apir.IsNull ? null : apir.Response); }
public MinimumTradeVolume(AssetPair market) : this() { Market = market; }
public OhlcContext(AssetPair pair, TimeResolution resolution, TimeRange range, ILogger logger = null) : base(logger) { Pair = pair; Resolution = resolution; Range = range; }
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()); }