public static EthereumCsvRow FromCsv(string csvLine) { List <string> values = new List <string>(); csvLine.Split(',').ToList().ForEach(value => values.Add(value.Trim('\"'))); EthereumCsvRow csvRow = new EthereumCsvRow { Txhash = values[0], Blockno = Convert.ToInt32(values[1]), UnixTimestamp = Convert.ToInt32(values[2]), TimestampUTC = Convert.ToDateTime(values[3]), From = values[4], To = values[5], ContractAddress = values[6], Value_IN_ETH = Convert.ToDecimal(values[7], CultureInfo.InvariantCulture), Value_OUT_ETH = Convert.ToDecimal(values[8], CultureInfo.InvariantCulture), CurrentValue = Convert.ToDecimal(values[9], CultureInfo.InvariantCulture), TxnFeeETH = Convert.ToDecimal(values[10], CultureInfo.InvariantCulture), TxnFeeUSD = Convert.ToDecimal(values[11], CultureInfo.InvariantCulture), HistoricalPrice = Convert.ToDecimal(values[12], CultureInfo.InvariantCulture), Status = values[13], ErrCode = values[14] }; return(csvRow); }
private static Transaccion CreateEthereumTransaccion(EthereumCsvRow row) { if (row.Value_IN_ETH != 0) { return(CreateEthereumDeposito(row)); } if (row.Value_OUT_ETH != 0) { return(CreateEthereumRetirada(row)); } if (row.TxnFeeETH != 0) { return(CreateEthereumComision(row)); } return(null); }
private static Transaccion CreateEthereumComision(EthereumCsvRow row) { Transaccion transaccion = new Transaccion { Id = Guid.NewGuid(), Tipo = "perdida", Subtipo = "comisiones", Exchange = row.From, Cantidad_Comision = row.TxnFeeETH, Divisa_Comision = "ETH", Comentarios = row.To, Detalles = "", Fecha = row.TimestampUTC, Alerta = !string.IsNullOrWhiteSpace(row.Status), Mensaje_Alerta = string.IsNullOrWhiteSpace(row.Status) ? "" : $"{row.Status}: {row.ErrCode}", }; return(transaccion); }
public static Transaccion GetEthereumTransaccion(string line) { var row = EthereumCsvRow.FromCsv(line); return(CreateEthereumTransaccion(row)); }