示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="now"></param>
        /// <param name="infoNow"></param>
        protected void CalculateProfit(DateTime now, decimal midPrice, HuobiAccountInfo infoNow)
        {
            //
            // total ROI
            //

            decimal totalBtcValueStart = m_startInfo.m_TotalCny / midPrice + m_startInfo.m_TotalBtc;
            decimal totalBtcValueNow   = infoNow.m_TotalCny / midPrice + infoNow.m_TotalBtc;

            decimal profitPercent = totalBtcValueStart > 0
                        ? 100 * (totalBtcValueNow - totalBtcValueStart) / totalBtcValueStart
                        : 0;

            Console.WriteLine("profit % = " + profitPercent);

            m_renderer.AddProfitDataPoints(profitPercent, now);
        }