コード例 #1
0
ファイル: AfxCore.cpp プロジェクト: darwinbeing/trade
BOOL AfxPrepareStockData( CStDatabase * pDatabase, CStock &stock, int nKType, int nKFormat, int nMaindataType, BOOL bFullFill, BOOL bReload )
{
	CStockInfo	info;
	if( !AfxGetStockContainer().GetStockInfo( stock.GetStockCode(), &info ) )
		info	=	stock.GetStockInfo( );

	stock.SetDatabase( pDatabase );
	stock.PrepareData( CStock::dataK, CKData::ktypeDay, bReload );
	stock.PrepareData( CStock::dataK, CKData::ktypeMin5, bReload );
	stock.PrepareData( CStock::dataDR, CKData::ktypeDay, bReload );
	if( bReload || stock.GetKDataDay().GetCurFormat() == CKData::formatOriginal )
		stock.GetKDataDay().MergeKData( &(info.m_kdata) );
	
	CKData	& kday	=	stock.GetKData(CKData::ktypeDay);
	CKData	& kdata	=	stock.GetKData( nKType );
	kdata.SetDRData( stock.GetDRData() );
	kday.SetDRData( stock.GetDRData() );
	if( bFullFill )
		kday.FullFillKData( AfxGetStockMain().GetKDataDay(), FALSE );
	kday.ChangeCurFormat( nKFormat, AfxGetProfile().GetAutoResumeDRBegin(), AfxGetProfile().GetAutoResumeDRLimit() );
	if( CKData::ktypeWeek == nKType || CKData::ktypeMonth == nKType )
	{
		// 周线和月线不能ChangeCurFormat(...)
		if( CKData::formatOriginal == nKFormat )
			stock.PrepareData( CStock::dataK, nKType, bReload );
		else
			stock.ExtractKData( nKType, TRUE );
	}
	else if( CKData::ktypeDay != nKType )
	{
		stock.PrepareData( CStock::dataK, nKType, bReload );
		kdata.ChangeCurFormat( nKFormat, AfxGetProfile().GetAutoResumeDRBegin(), AfxGetProfile().GetAutoResumeDRLimit() );
	}
	kdata.SetMaindataType( nMaindataType );
	return TRUE;
}
コード例 #2
0
ファイル: Stock.cpp プロジェクト: ZhaoboMeng/k-line-print
int CStock::MergeDRData( CStock &stock )
{
	if( GetDRData().GetSize() < stock.GetDRData().GetSize() )
		GetDRData().Copy( stock.GetDRData() );
	return GetDRData().GetSize();
}