Ejemplo n.º 1
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="huobi"></param>
		/// <param name="market"></param>
		/// <param name="renderer"></param>
        public AlgoBase(IMarket huobi, HuobiMarket market, Rendering renderer)
		{
			m_huobi = huobi;
			m_market = market;
			m_lastOpenOrders = m_huobi.GetOpenOrders(m_market);
			m_startInfo = m_huobi.GetAccountInfo();
			m_renderer = renderer;
		}
Ejemplo n.º 2
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);
		}