public void Add(Money balance, MarketPrice price = null) { lock (_lock) { CurrentBalance = balance; Audits.Add(new AuditEntry(DateTime.UtcNow, balance, price)); } }
public MarketPricesResult(MarketPrice price) { if (price != null) { MarketPrices.Add(price); } WasViaSingleMethod = true; }
public void Add(Money balance, MarketPrice price = null) { if (balance.Asset.Id != Asset.Id) { throw new Exception($"You cant add this balance to {nameof(AuditByAsset)} as it has the wrong asset class: {balance.Asset.ShortCode} needs {Asset.ShortCode}"); } lock (_lock) Audit.Add(new AuditEntry(DateTime.UtcNow, balance, price)); }
public decimal PercentageDifference(MarketPrice secondPrice) { if (secondPrice.Reversed.Pair.Id == this.Pair.Id) { secondPrice = secondPrice.Reversed; } if (secondPrice.Pair.Id != Pair.Id) { throw new Exception($"Can't calculate percentage difference for {nameof(MarketPrice)}, as pairs don't match: {secondPrice.Pair} - {Pair}"); } return(Price.PercentageProfit(secondPrice.Price)); }
public void Add(MarketPrice price) { lock (_lock) { if (!_prices.ContainsKey(price.Pair.Id)) { _prices.Add(price.Pair.Id, new List <MarketPrice>()); } var col = _prices[price.Pair.Id]; var dt = DateTime.UtcNow.Add(-FlushSpan); col.RemoveAll(x => x.UtcCreated < dt); col.Add(price); } }
public AuditEntry(DateTime utcCreated, Money value, MarketPrice tradePrice = null) { UtcCreated = utcCreated; Value = value; TradePrice = tradePrice; }
public AuditByAsset(Money startingBalance, MarketPrice price = null) { Asset = startingBalance.Asset; Add(startingBalance, price); }