コード例 #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
ファイル: AfxCore.cpp プロジェクト: darwinbeing/trade
BOOL AfxReloadStock( CStock & stock )
{
	CStockInfo info = stock.GetStockInfo();

	// Reload AfxGetStockMain()
	AfxGetStockContainer().GetStockInfo( info.GetStockCode(), &info );

	stock.Clear( );
	stock.SetStockInfo( &info );
	stock.SetDatabase( &AfxGetDB() );
	stock.PrepareData( CStock::dataK, CKData::ktypeDay );
	
	// Merge New
	stock.GetKDataDay().MergeKData( &(info.m_kdata) );
	
	stock.PrepareData( CStock::dataK, CKData::ktypeWeek );
	stock.PrepareData( CStock::dataK, CKData::ktypeMonth );
	stock.PrepareData( CStock::dataK, CKData::ktypeMin5 );
	stock.PrepareData( CStock::dataK, CKData::ktypeMin15 );
	stock.PrepareData( CStock::dataK, CKData::ktypeMin30 );
	stock.PrepareData( CStock::dataK, CKData::ktypeMin60 );
	return TRUE;
}