⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 realtime.cpp.svn-base

📁 股票软件源码
💻 SVN-BASE
📖 第 1 页 / 共 5 页
字号:
	// 均价
	pDC->SetTextColor( clrPlane );
	strTemp	=	"-";
	if( info.m_fVolume > 0 )
	{
		double dAve	=	info.m_fAmount/info.m_fVolume;
		pDC->SetTextColor( RT_DETERMINE_COLOR(dAve,info.m_fLast) );
		strTemp.Format( strPriceFmt, dAve );
	}
	pDC->TextOut( x2, y+187, strTemp );
	
	// 涨跌
	pDC->SetTextColor( RT_DETERMINE_COLOR(info.m_fClose,info.m_fLast) );
	strTemp.Format( strPriceFmt, info.m_fClose-info.m_fLast );
	pDC->TextOut( x, y+203, strTemp );

	// 开盘
	pDC->SetTextColor( RT_DETERMINE_COLOR(info.m_fOpen,info.m_fLast) );
	strTemp.Format( strPriceFmt, info.m_fOpen );
	pDC->TextOut( x2, y+203, strTemp );
	
	// 幅度
	pDC->SetTextColor( RT_DETERMINE_COLOR(info.m_fClose,info.m_fLast) );
	strTemp	=	"-";
	if( info.m_fLast > 1e-4 )
		strTemp.Format( "%.2f%%", 100*(info.m_fClose-info.m_fLast)/info.m_fLast );
	pDC->TextOut( x, y+219, strTemp );
	
	// 最高
	pDC->SetTextColor( RT_DETERMINE_COLOR(info.m_fHigh,info.m_fLast) );
	strTemp.Format( strPriceFmt, info.m_fHigh );
	pDC->TextOut( x2, y+219, strTemp );
	
	// 总手
	pDC->SetTextColor( clrPlane );
	strTemp.Format( "%.0f", info.m_fVolume/100. );
	pDC->TextOut( x, y+235, strTemp );
	
	// 最低
	pDC->SetTextColor( RT_DETERMINE_COLOR(info.m_fLow,info.m_fLast) );
	strTemp.Format( strPriceFmt, info.m_fLow );
	pDC->TextOut( x2, y+235, strTemp );
	
	// 现手
	pDC->SetTextColor( clrPlane );
	strTemp	=	"-";
	double	dVolNow = 0, dVolOuter = 0, dVolInner = 0;
	BOOL bStatSuc = m_CurStock.GetMinute().StatVolumeInfo( &dVolNow, &dVolOuter, &dVolInner );
	if( bStatSuc )
		strTemp.Format( "%.0f", dVolNow/100. );
	pDC->TextOut( x, y+251, strTemp );
	
	// 量比
	pDC->SetTextColor( clrPlane );
	double	dVolRatio = 0;
	strTemp	=	"-";
	if( info.GetRatioVolume( &dVolRatio, info.m_datetech, AfxGetProfile().GetRatioVolumeDays() ) )
	{
		CSPTime	tTrade;
		if( tTrade.FromStockTimeDay( info.m_datetech ) )
			dVolRatio = dVolRatio / CSPTime::GetTimeTradeRatioOfOneDay( tTrade, CSPTime::GetCurrentTime() );
		strTemp.Format( "%.2f", dVolRatio );
	}
	pDC->TextOut( x2, y+251, strTemp );

	// 外盘
	pDC->SetTextColor( clrRise );
	strTemp	=	"-";
	if( bStatSuc )
		strTemp.Format( "%.0f", dVolOuter/100 );
	pDC->TextOut( x, y+270, strTemp );
	
	// 内盘
	pDC->SetTextColor( clrFall );
	strTemp	=	"-";
	if( bStatSuc )
		strTemp.Format( "%.0f", dVolInner/100 );
	pDC->TextOut( x2, y+270, strTemp );

	// 涨家数,跌家数
	int	nRetValue = 287;
	if( info.IsIndex() )
	{
		pDC->SetTextColor( clrRise );
		strTemp	=	"-";
		if( info.m_dwAdvance > 0 )
			strTemp.Format( "%uf", info.m_dwAdvance );
		pDC->TextOut( x, y+289, strTemp );

		pDC->SetTextColor( clrFall );
		strTemp	=	"-";
		if( info.m_dwDecline > 0 )
			strTemp.Format( "%uf", info.m_dwDecline );
		pDC->TextOut( x2, y+289, strTemp );
		
		nRetValue = 306;
	}

	pDC->SetTextAlign( nOldAlign );
	pDC->SelectObject( pOldFont );

	return nRetValue;
}

int CRealTime::DrawBuySellEx( CDC * pDC, int xStart, int yStart, int nWidth )
{
	DECLARE_COLOR_DEFINATION

	CStockInfo & info	=	m_CurStock.GetStockInfo();
	CString	strTemp, strTempFmt;

	// Draw Name And Code
	CFont	* pOldFont	=	AfxSelectDCFont( pDC, 18 );
	pDC->SetTextColor( clrTitle );
	pDC->TextOut( xStart+1, m_rectAll.top+3, info.GetStockName() );
	pDC->SetTextColor( clrText );
	pDC->TextOut( xStart+96, m_rectAll.top+3, info.GetStockCode() );

	// Select Report Font
	AfxSelectDCFont( pDC, 14 );
	
	// Draw Report Names
	int	x	=	xStart+2;
	int	x2	=	xStart+2+nWidth/2;
	int	y	=	yStart;
	pDC->SetTextColor( clrText );
	
	// 委比和委差
	strTemp.LoadString( IDS_REALTIME_BSRATIO );	// "委比";
	pDC->TextOut( x, y+2,   strTemp );
	strTemp.LoadString( IDS_REALTIME_BSDIFF );	// "委差";
	pDC->TextOut( x2, y+2,   strTemp );

	// 委卖数
	DrawLine( pDC, 1, clrBorder, xStart, y+19, xStart+nWidth, y+19 );
	pDC->SetTextColor( clrNewKLine );
	strTemp.LoadString( IDS_REALTIME_SELL8 );	// "卖⑧";
	pDC->TextOut( x, y+21, strTemp );
	strTemp.LoadString( IDS_REALTIME_SELL7 );	// "卖⑦";
	pDC->TextOut( x, y+37, strTemp );
	strTemp.LoadString( IDS_REALTIME_SELL6 );	// "卖⑥";
	pDC->TextOut( x, y+53, strTemp );
	pDC->SetTextColor( clrText );
	strTemp.LoadString( IDS_REALTIME_SELL5 );	// "卖⑤";
	pDC->TextOut( x, y+69, strTemp );
	strTemp.LoadString( IDS_REALTIME_SELL4 );	// "卖④";
	pDC->TextOut( x, y+85, strTemp );
	strTemp.LoadString( IDS_REALTIME_SELL3 );	// "卖③";
	pDC->TextOut( x, y+101, strTemp );
	strTemp.LoadString( IDS_REALTIME_SELL2 );	// "卖②";
	pDC->TextOut( x, y+117, strTemp );
	strTemp.LoadString( IDS_REALTIME_SELL1 );	// "卖①";
	pDC->TextOut( x, y+133, strTemp );

	// 委买数
	DrawLine( pDC, 1, clrBorder, xStart, y+150, xStart+nWidth, y+150 );
	strTemp.LoadString( IDS_REALTIME_BUY1 );	// "买①";
	pDC->TextOut( x, y+152, strTemp );
	strTemp.LoadString( IDS_REALTIME_BUY2 );	// "买②";
	pDC->TextOut( x, y+168, strTemp );
	strTemp.LoadString( IDS_REALTIME_BUY3 );	// "买③";
	pDC->TextOut( x, y+184, strTemp );
	strTemp.LoadString( IDS_REALTIME_BUY4 );	// "买④";
	pDC->TextOut( x, y+200, strTemp );
	strTemp.LoadString( IDS_REALTIME_BUY5 );	// "买⑤";
	pDC->TextOut( x, y+216, strTemp );
	pDC->SetTextColor( clrNewKLine );
	strTemp.LoadString( IDS_REALTIME_BUY6 );	// "买⑥";
	pDC->TextOut( x, y+232, strTemp );
	strTemp.LoadString( IDS_REALTIME_BUY7 );	// "买⑦";
	pDC->TextOut( x, y+248, strTemp );
	strTemp.LoadString( IDS_REALTIME_BUY8 );	// "买⑧";
	pDC->TextOut( x, y+264, strTemp );
	pDC->SetTextColor( clrText );

	// 其他信息报告
	DrawLine( pDC, 1, clrBorder, xStart, y+281, xStart+nWidth, y+281 );
	strTemp.LoadString( IDS_REALTIME_PRICENOW );	// "成交";
	pDC->TextOut( x, y+283, strTemp );
	strTemp.LoadString( IDS_REALTIME_PRICEAVE );	// "均价";
	pDC->TextOut( x2, y+283, strTemp );
	strTemp.LoadString( IDS_REALTIME_PRICEDIFF );	// "涨跌";
	pDC->TextOut( x, y+299, strTemp );
	strTemp.LoadString( IDS_REALTIME_PRICEOPEN );	// "开盘";
	pDC->TextOut( x2, y+299, strTemp );
	strTemp.LoadString( IDS_REALTIME_PRICEDIFFPERCENT );	// "幅度";
	pDC->TextOut( x, y+315, strTemp );
	strTemp.LoadString( IDS_REALTIME_PRICEHIGH );	// "最高";
	pDC->TextOut( x2, y+315, strTemp );
	strTemp.LoadString( IDS_REALTIME_VOLSUM );		// "总手";
	pDC->TextOut( x, y+331, strTemp );
	strTemp.LoadString( IDS_REALTIME_PRICELOW );	// "最低";
	pDC->TextOut( x2, y+331, strTemp );
	strTemp.LoadString( IDS_REALTIME_VOLNOW );		// "现手";
	pDC->TextOut( x, y+347, strTemp );
	strTemp.LoadString( IDS_REALTIME_VOLRATION );	// "量比";
	pDC->TextOut( x2, y+347, strTemp );

	// 内外盘
	DrawLine( pDC, 1, clrBorder, xStart, y+364, xStart+nWidth, y+364 );
	strTemp.LoadString( IDS_REALTIME_VOLOUTER );	// "外盘";
	pDC->TextOut( x, y+366, strTemp );
	strTemp.LoadString( IDS_REALTIME_VOLINNER );	// "内盘";
	pDC->TextOut( x2, y+366, strTemp );

	DrawLine( pDC, 1, clrBorder, xStart, y+383, xStart+nWidth, y+383 );	

	// 涨家数,跌家数
	if( info.IsIndex() )
	{
		strTemp.LoadString( IDS_REALTIME_ADVANCE );	// "涨家数";
		pDC->TextOut( x, y+385, strTemp );
		strTemp.LoadString( IDS_REALTIME_DECLINE );	// "跌家数";
		pDC->TextOut( x2, y+385, strTemp );
		DrawLine( pDC, 1, clrBorder, xStart, y+402, xStart+nWidth, y+402 );
	}
	

	// Draw Report Values
	x	=	xStart-1+nWidth/2;
	x2	=	xStart+nWidth-1;
	UINT nOldAlign = pDC->SetTextAlign( TA_RIGHT | TA_TOP );
	pDC->SetTextColor( clrPlane );
	
	// 委比和委差
	double	dRatio = 0, dDiff = 0;
	if( info.IsIndex() || info.GetSellBuyRatio( &dRatio, &dDiff ) )
	{
		strTemp.Format( "%.2f%%", dRatio );
		pDC->TextOut( x, y+2,   strTemp );
		strTemp.Format( "%.0f", dDiff*0.01 );
		pDC->TextOut( x2, y+2,   strTemp );
	}

	// 价格小数位数格式串
	CString strPriceFmt;
	strPriceFmt.Format( "%%.%df", info.DigitBit() );

	// 委卖数
	float	fSellPrice[8], fSellVolume[8], fBuyPrice[8], fBuyVolume[8];
	m_CurStock.GetReport().StatBuySellEx( fSellPrice, fSellVolume, fBuyPrice, fBuyVolume, 8 );
	if( info.IsIndex() )
	{
		memset( fSellPrice, 0, sizeof(fSellPrice) );
		memset( fSellVolume, 0, sizeof(fSellVolume) );
		memset( fBuyPrice, 0, sizeof(fBuyPrice) );
		memset( fBuyVolume, 0, sizeof(fBuyVolume) );
	}
	pDC->SetTextColor( RT_DETERMINE_COLOR(fSellPrice[7],info.m_fLast) );
	strTemp.Format( strPriceFmt, fSellPrice[7] );
	pDC->TextOut( x, y+21, strTemp );
	strTemp.Format( "%.0f", fSellVolume[7]/100 );
	pDC->TextOut( x2, y+21, strTemp );

	pDC->SetTextColor( RT_DETERMINE_COLOR(fSellPrice[6],info.m_fLast) );
	strTemp.Format( strPriceFmt, fSellPrice[6] );
	pDC->TextOut( x, y+37, strTemp );
	strTemp.Format( "%.0f", fSellVolume[6]/100 );
	pDC->TextOut( x2, y+37, strTemp );

	pDC->SetTextColor( RT_DETERMINE_COLOR(fSellPrice[5],info.m_fLast) );
	strTemp.Format( strPriceFmt, fSellPrice[5] );
	pDC->TextOut( x, y+53, strTemp );
	strTemp.Format( "%.0f", fSellVolume[5]/100 );
	pDC->TextOut( x2, y+53, strTemp );

	pDC->SetTextColor( RT_DETERMINE_COLOR(fSellPrice[4],info.m_fLast) );
	strTemp.Format( strPriceFmt, fSellPrice[4] );
	pDC->TextOut( x, y+69, strTemp );
	strTemp.Format( "%.0f", fSellVolume[4]/100 );
	pDC->TextOut( x2, y+69, strTemp );

	pDC->SetTextColor( RT_DETERMINE_COLOR(fSellPrice[3],info.m_fLast) );
	strTemp.Format( strPriceFmt, fSellPrice[3] );
	pDC->TextOut( x, y+85, strTemp );
	strTemp.Format( "%.0f", fSellVolume[3]/100 );
	pDC->TextOut( x2, y+85, strTemp );

	pDC->SetTextColor( RT_DETERMINE_COLOR(fSellPrice[2],info.m_fLast) );
	strTemp.Format( strPriceFmt, fSellPrice[2] );
	pDC->TextOut( x, y+101, strTemp );
	strTemp.Format( "%.0f", fSellVolume[2]/100 );
	pDC->TextOut( x2, y+101, strTemp );

	pDC->SetTextColor( RT_DETERMINE_COLOR(fSellPrice[1],info.m_fLast) );
	strTemp.Format( strPriceFmt, fSellPrice[1] );
	pDC->TextOut( x, y+117, strTemp );
	strTemp.Format( "%.0f", fSellVolume[1]/100 );
	pDC->TextOut( x2, y+117, strTemp );

	pDC->SetTextColor( RT_DETERMINE_COLOR(fSellPrice[0],info.m_fLast) );
	strTemp.Format( strPriceFmt, fSellPrice[0] );
	pDC->TextOut( x, y+133, strTemp );
	strTemp.Format( "%.0f", fSellVolume[0]/100 );
	pDC->TextOut( x2, y+133, strTemp );

	// 委买数
	pDC->SetTextColor( RT_DETERMINE_COLOR(fBuyPrice[0],info.m_fLast) );
	strTemp.Format( strPriceFmt, fBuyPrice[0] );
	pDC->TextOut( x, y+152, strTemp );
	strTemp.Format( "%.0f", fBuyVolume[0]/100 );
	pDC->TextOut( x2, y+152, strTemp );

	pDC->SetTextColor( RT_DETERMINE_COLOR(fBuyPrice[1],info.m_fLast) );
	strTemp.Format( strPriceFmt, fBuyPrice[1] );
	pDC->TextOut( x, y+168, strTemp );
	strTemp.Format( "%.0f", fBuyVolume[1]/100 );
	pDC->TextOut( x2, y+168, strTemp );
	
	pDC->SetTextColor( RT_DETERMINE_COLOR(fBuyPrice[2],info.m_fLast) );
	strTemp.Format( strPriceFmt, fBuyPrice[2] );
	pDC->TextOut( x, y+184, strTemp );
	strTemp.Format( "%.0f", fBuyVolume[2]/100 );
	pDC->TextOut( x2, y+184, strTemp );

	pDC->SetTextColor( RT_DETERMINE_COLOR(fBuyPrice[3],info.m_fLast) );
	strTemp.Format( strPriceFmt, fBuyPrice[3] );
	pDC->TextOut( x, y+200, strTemp );
	strTemp.Format( "%.0f", fBuyVolume[3]/100 );
	pDC->TextOut( x2, y+200, strTemp );

	pDC->SetTextColor( RT_DETERMINE_COLOR(fBuyPrice[4],info.m_fLast) );
	strTemp.Format( strPriceFmt, fBuyPrice[4] );
	pDC->TextOut( x, y+216, strTemp );
	strTemp.Format( "%.0f", fBuyVolume[4]/100 );
	pDC->TextOut( x2, y+216, strTemp );

	pDC->SetTextColor( RT_DETERMINE_COLOR(fBuyPrice[5],info.m_fLast) );
	strTemp.Format( strPriceFmt, fBuyPrice[5] );
	pDC->TextOut( x, y+232, strTemp );
	strTemp.Format( "%.0f", fBuyVolume[5]/100 );
	pDC->TextOut( x2, y+232, strTemp );

	pDC->SetTextColor( RT_DETERMINE_COLOR(fBuyPrice[6],info.m_fLast) );
	strTemp.Format( strPriceFmt, fBuyPrice[6] );
	pDC->TextOut( x, y+248, strTemp );
	strTemp.Format( "%.0f", fBuyVolume[6]/100 );
	pDC->TextOut( x2, y+248, strTemp );

	pDC->SetTextColor( RT_DETERMINE_COLOR(fBuyPrice[7],info.m_fLast) );
	strTemp.Format( strPriceFmt, fBuyPrice[7] );
	pDC->TextOut( x, y+264, strTemp );
	strTemp.Format( "%.0f", fBuyVolume[7]/100 );
	pDC->TextOut( x2, y+264, strTemp );

	// 其他信息报告
	// 成交
	pDC->SetTextColor( RT_DETERMINE_COLOR(info.m_fClose,info.m_fLast) );
	strTemp.Format( strPriceFmt, info.m_fClose );
	pDC->TextOut( x, y+283, strTemp );
	
	// 均价
	pDC->SetTextColor( clrPlane );
	strTemp	=	"-";
	if( info.m_fVolume > 0 )
	{
		double dAve	=	info.m_fAmount/info.m_fVolume;
		pDC->SetTextColor( RT_DETERMINE_COLOR(dAve,info.m_fLast) );
		strTemp.Format( strPriceFmt, dAve );
	}
	pDC->TextOut( x2, y+283, strTemp );
	
	// 涨跌
	pDC->SetTextColor( RT_DETERMINE_COLOR(info.m_fClose,info.m_fLast) );
	strTemp.Format( strPriceFmt, info.m_fClose-info.m_fLast );
	pDC->TextOut( x, y+299, strTemp );

	// 开盘
	pDC->SetTextColor( RT_DETERMINE_COLOR(info.m_fOpen,info.m_fLast) );
	strTemp.Format( strPriceFmt, info.m_fOpen );
	pDC->TextOut( x2, y+299, strTemp );
	
	// 幅度
	pDC->SetTextColor( RT_DETERMINE_COLOR(info.m_fClose,info.m_fLast) );
	strTemp	=	"-";
	if( info.m_fLast > 1e-4 )
		strTemp.Format( "%.2f%%", 100*(info.m_fClose-info.m_fLast)/info.m_fLast );
	pDC->TextOut( x, y+315, strTemp );
	
	// 最高
	pDC->SetTextColor( RT_DETERMINE_COLOR(info.m_fHigh,info.m_fLast) );
	strTemp.Format( strPriceFmt, info.m_fHigh );
	pDC->TextOut( x2, y+315, strTemp );
	
	// 总手
	pDC->SetTextColor( clrPlane );
	strTemp.Format( "%.0f", info.m_fVolume/100. );
	pDC->TextOut( x, y+331, strTemp );
	
	// 最低
	pDC->SetTextColor( RT_DETERMINE_COLOR(info.m_fLow,info.m_fLast) );
	strTemp.Format( strPriceFmt, info.m_fLow );
	pDC->TextOut( x2, y+331, strTemp );
	
	// 现手
	pDC->SetTextColor( clrPlane );
	strTemp	=	"-";
	double	dVolNow = 0, dVolOuter = 0, dVolInner = 0;
	BOOL bStatSuc = m_CurStock.GetMinute().StatVolumeInfo( &dVolNow, &dVolOuter, &dVolInner );
	if( bStatSuc )
		strTemp.Format( "%.0f", dVolNow/100. );
	pDC->TextOut( x, y+347, strTemp );
	
	// 量比
	pDC->SetTextColor( clrPlane );
	doub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -