Ejemplo n.º 1
0
        /// <summary>
        /// Converts ImportedCoin coins into the proper CryptoCoin.
        /// Then generates the total price paid of the converted coins. Call this after every import.
        /// </summary>
        public static List <CryptoCoin> FormatCoinsAndGenerateTotalPricePaid(List <ImportedCoin> importedCoins, Dictionary <int, HistoricCoinPrice> historicCoinPrice)
        {
            // Filter: Always need Shares & Total price to be over 0 for each coins
            List <CryptoCoin> localExtractedCoins = importedCoins.Where(x => x.Shares > 0 && x.TotalPricePaidInCurrency > 0).Select(x => x.ToPOCO()).ToList();

            localExtractedCoins.ForEach(x => { x.TotalPricePaidUSD = CryptoLogic.GenerateTotalPricePaidUSD(x, historicCoinPrice); });

            return(localExtractedCoins);
        }
Ejemplo n.º 2
0
 public static CryptoCoin ToPOCO(this ImportedCoin item)
 {
     return(new CryptoCoin
     {
         Symbol = item.Symbol.Replace("USDT-", "USD-"),
         CoinCurrency = CryptoLogic.GenerateCoinCurrencyFromSymbol(item.Symbol),
         PricePerUnit = (item.TotalPricePaidInCurrency / item.Shares),
         Shares = item.Shares,
         Exchange = item.Exchange,
         OrderDate = item.OrderDate, // Closed/Order completed date
         OrderType = CryptoLogic.GetProperOrderTypeFromString(item.OrderType)
     });
 }