当前位置: 首页>>代码示例>>C++>>正文


C++ CStockInfo::GetShareCurrency方法代码示例

本文整理汇总了C++中CStockInfo::GetShareCurrency方法的典型用法代码示例。如果您正苦于以下问题:C++ CStockInfo::GetShareCurrency方法的具体用法?C++ CStockInfo::GetShareCurrency怎么用?C++ CStockInfo::GetShareCurrency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CStockInfo的用法示例。


在下文中一共展示了CStockInfo::GetShareCurrency方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetRange

/***
	根据换手率m_dChangeHand和终止日,计算起始日
*/
BOOL CCW::GetRange( int & nStart, int & nEnd, CStockInfo & info )
{
	if( !m_pKData || m_pKData->GetSize() <= 0 )
		return FALSE;
	if( nEnd < 0 || nEnd >= m_pKData->GetSize() )
		nEnd	=	m_pKData->GetSize()-1;
	
	BOOL	bIndex = FALSE;
	double	dShareCurrency = 0;
	if( !info.GetShareCurrency( &dShareCurrency ) || dShareCurrency < 1e+6 )
		bIndex	=	TRUE;

	if( bIndex )
		dShareCurrency	=	100 * m_dChangeHand;
	else
		dShareCurrency	*=	m_dChangeHand;

	double	dVol	=	0;
	for( int k=nEnd; k>=0; k-- )
	{
		if( bIndex )
			dVol	+=	1;
		else
			dVol	+=	m_pKData->ElementAt(k).m_fVolume;

		if( dVol > dShareCurrency )
			break;
	}
	nStart	=	k;
	if( nStart < 0 )
		nStart	=	0;
	return TRUE;
}
开发者ID:darwinbeing,项目名称:trade,代码行数:36,代码来源:TechKLine.cpp

示例2: CalculateCW

/***
	筹码分布图计算,计算筹码分布
*/
BOOL CCW::CalculateCW(	int nStart, int nEnd, CStockInfo & info, double dStep,
						CSPDWordArray & adwPrice, CSPDWordArray & adwVolume,
						double * pdMinVolume, double * pdMaxVolume, double * pdTotalVolume, double * pdVolPercent )
{
	STT_ASSERT_GETMINMAXINFO( m_pKData, nStart, nEnd );
	if( dStep < 1e-4 )
		return FALSE;

	float dMinPrice = 0, dMaxPrice = 0;
	if( !m_pKData->GetMinMaxInfo( nStart, nEnd, &dMinPrice, &dMaxPrice ) )
		return FALSE;

	// Calculate
	int nMaxCount = (int)((dMaxPrice-dMinPrice)/dStep) + 10;
	adwPrice.SetSize( 0, nMaxCount );
	adwVolume.SetSize( 0, nMaxCount );
	double	dMinVolume = 0, dMaxVolume = 0, dTotalVolume = 0, dVolume = 0;
	BOOL	bFirst	=	TRUE;
	for( double dPrice = dMinPrice; dPrice < dMaxPrice; dPrice += dStep )
	{
		if( CalculateCW( &dVolume, nStart, nEnd, dPrice, dStep ) )
		{
			if( bFirst || dVolume < dMinVolume )	dMinVolume	=	dVolume;
			if( bFirst || dVolume > dMaxVolume )	dMaxVolume	=	dVolume;
			adwPrice.Add( DWORD(dPrice * 1000) );
			adwVolume.Add( DWORD(dVolume) );
			dTotalVolume	+=	dVolume;
			bFirst	=	FALSE;
		}
	}

	// Return
	// Min Max
	dMinVolume	-=	fabs(dMinVolume)*0.01;
	dMaxVolume	+=	fabs(dMaxVolume)*0.01;
	if( dMaxVolume - dMinVolume < 3 )
		dMaxVolume	=	dMinVolume + 3;
	if( pdMinVolume )	*pdMinVolume	=	dMinVolume;
	if( pdMaxVolume )	*pdMaxVolume	=	dMaxVolume;
	if( pdTotalVolume )	*pdTotalVolume	=	dTotalVolume;

	// VolPercent
	double dVolPercent = 1.0;
	double	dShareCurrency = 0;
	if( (!info.GetShareCurrency( &dShareCurrency ) || dShareCurrency < 1e+6) && nEnd-nStart+1 > 0 )
		dShareCurrency	=	dTotalVolume * 100 / (nEnd-nStart+1);
	if( dShareCurrency > 1e-4 )
		dVolPercent	=	dTotalVolume / (dShareCurrency*m_dChangeHand);
	if( dVolPercent > 1.0 )		dVolPercent	=	1.0;
	if( dVolPercent < 0.0 )		dVolPercent	=	0.0;
	if( pdVolPercent )	*pdVolPercent	=	dVolPercent;

	return adwPrice.GetSize() > 0;
}
开发者ID:darwinbeing,项目名称:trade,代码行数:57,代码来源:TechKLine.cpp

示例3: CalculatePastCW

/***
	筹码分布图计算,计算nDays天前内的筹码分布
*/
BOOL CCW::CalculatePastCW(int nEnd, int nDays, CStockInfo & info, double dStep,
						CSPDWordArray & adwPrice, CSPDWordArray & adwVolume,
						double * pdMinVolume, double * pdMaxVolume, double * pdTotalVolume, double * pdVolPercent )
{
	// Prepare
	if( !m_pKData || m_pKData->GetSize() <= 0 )
		return FALSE;
	if( nEnd < 0 || nEnd >= m_pKData->GetSize() )
		nEnd	=	m_pKData->GetSize()-1;
	int	nStart = nEnd - nDays;
	if( nStart < 0 || nStart >= m_pKData->GetSize() )
		return FALSE;

	nEnd = nStart;
	if( !GetRange( nStart, nEnd, info ) )
		return FALSE;

	BOOL bOK = CalculateCW( nStart, nEnd, info, dStep, adwPrice, adwVolume, pdMinVolume, pdMaxVolume, pdTotalVolume, pdVolPercent );

	// TotalVolumeRecent
	double dTotalVolumeRecent = 0;
	for( int k=nEnd+1; k<=nEnd+nDays && k<m_pKData->GetSize(); k ++ )
		dTotalVolumeRecent	+=	m_pKData->ElementAt(k).m_fVolume;

	// VolPercent
	double dVolPercent = 1.0;
	double	dShareCurrency = 0;
	if( (!info.GetShareCurrency( &dShareCurrency ) || dShareCurrency < 1e+6) && nDays > 0 )
		dShareCurrency	=	dTotalVolumeRecent * 100 / nDays;
	if( dShareCurrency > 1e-4 )
		dVolPercent	=	dTotalVolumeRecent / (dShareCurrency*m_dChangeHand);
	dVolPercent	=	1.0 - dVolPercent;
	if( dVolPercent > 1.0 )		dVolPercent	=	1.0;
	if( dVolPercent < 0.0 )		dVolPercent	=	0.0;
	if( pdVolPercent )	*pdVolPercent	=	dVolPercent;

	return bOK;
}
开发者ID:darwinbeing,项目名称:trade,代码行数:41,代码来源:TechKLine.cpp


注:本文中的CStockInfo::GetShareCurrency方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。