Beispiel #1
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);
 }
Beispiel #2
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);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Format the series based on the particular coin
        /// </summary>
        /// <param name="MinerPaymentSummary"></param>
        /// <param name="stackedColumnSeries"></param>
        private static void FormatChartSeries(MinerPaymentSummary MinerPaymentSummary, StackedAreaSeries stackedColumnSeries)
        {
            // Series color
            var converter = new System.Windows.Media.BrushConverter();

            CoinPaymentChartColor.CoinPaymentChartColorDictionary.TryGetValue(MinerPaymentSummary.CoinType, out string chartColor);

            Brush brushFill = (Brush)converter.ConvertFromString(chartColor);

            brushFill.Opacity = 0.05;

            Brush brushStroke = (Brush)converter.ConvertFromString(chartColor);

            brushStroke.Opacity = 1;

            stackedColumnSeries.Title             = MinerPaymentSummary.CoinType.ToString();
            stackedColumnSeries.LineSmoothness    = 0.7;
            stackedColumnSeries.PointGeometrySize = 6;
            stackedColumnSeries.Fill = brushFill;

            stackedColumnSeries.Stroke          = brushStroke;
            stackedColumnSeries.StrokeThickness = 1;
        }