コード例 #1
0
        /// <summary>
        /// Create a new chart data point
        /// </summary>
        /// <param name="minerPaymentsGroupedByDay"></param>
        /// <returns></returns>
        private DateTimePoint CreateChartDataPoint(MinerPaymentsGroupedByDay minerPaymentsGroupedByDay)
        {
            DateTimePoint dateTimePoint = new DateTimePoint();

            dateTimePoint.Value    = (double)minerPaymentsGroupedByDay.PaymentAmountFiat;
            dateTimePoint.DateTime = new DateTime(minerPaymentsGroupedByDay.PaymentDate.Year, minerPaymentsGroupedByDay.PaymentDate.Month, minerPaymentsGroupedByDay.PaymentDate.Day);
            return(dateTimePoint);
        }
コード例 #2
0
 /// <summary>
 /// Add payment to list of unioned payments used to bind to the UI
 /// </summary>
 /// <param name="MinerPaymentSummary"></param>
 /// <param name="minerPaymentsGroupedByDay"></param>
 private void AddMinerPaymentPerDayToUnionedList(MinerPaymentSummary MinerPaymentSummary, MinerPaymentsGroupedByDay minerPaymentsGroupedByDay)
 {
     // Add payment to complete unioned list that will be bound to the UI
     minerPaymentsGroupedByDay.CoinLogo = MinerPaymentSummary.CoinLogo;
     minerPaymentsGroupedByDay.CoinType = MinerPaymentSummary.CoinType;
     profitabilityData.MinerPaymentsGroupedByDayUnionedList.Add(minerPaymentsGroupedByDay);
 }
コード例 #3
0
        /// <summary>
        /// Lookup daily historical rate for each day and calculate payment in users fiat currency
        /// </summary>
        /// <param name="MinerPaymentSummary"></param>
        /// <param name="histoDayResponse"></param>
        /// <param name="minerPaymentsGroupedByDay"></param>
        /// <returns></returns>
        private void CalculateDailyPaymentUsingHistoricalRates(MinerPaymentSummary MinerPaymentSummary, HistoDayResponse histoDayResponse, MinerPaymentsGroupedByDay minerPaymentsGroupedByDay)
        {
            // Lookup CryptoCompare rate for the specific date
            HistoDateResponseData histoDayResponseDay = histoDayResponse.data.Where(x => x.dateTime <= minerPaymentsGroupedByDay.PaymentDate.ToUniversalTime().AddHours(9) &&
                                                                                    x.dateTime >= minerPaymentsGroupedByDay.PaymentDate.ToUniversalTime().AddHours(-9)).FirstOrDefault();

            if (histoDayResponseDay == null)
            {
                minerPaymentsGroupedByDay.PaymentAmountFiat = 0;
                minerPaymentsGroupedByDay.FiatExchangeRate  = 0;
                ShowError(String.Format("{0} {1} Missing", minerPaymentsGroupedByDay.PaymentDate.ToUniversalTime(), MinerPaymentSummary.CoinType));
            }
            else
            {
                minerPaymentsGroupedByDay.FiatExchangeRate  = histoDayResponseDay.high;
                minerPaymentsGroupedByDay.PaymentAmountFiat = (minerPaymentsGroupedByDay.PaymentAmount * histoDayResponseDay.high);
            }
        }