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


C++ CStockInfo类代码示例

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


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

示例1: UpdateData

/***
	自动设定交易费用
*/
void CSimuAddOpDlg::AutoSetRateCost( )
{
	UpdateData( );

	if( NULL == m_pStrategy )
		return;

	// Share
	if( !IsNumber( m_strShare, TRUE ) || !IsNumber( m_strSharePrice, TRUE ) || !IsNumber( m_strRateCost, TRUE ) )
	{
		AfxMessageBox( IDS_SIMUADDOP_NOTNUMBER, MB_OK|MB_ICONINFORMATION );
		return;
	}

	DWORD	dwShare		=	atol(m_strShare);
	double	dSharePrice	=	atol(m_strSharePrice);
	
	CString	strStockCode	=	m_comboStock.GetSelectedStockCode();
	CStockInfo	info;
	if( !AfxGetStockContainer().GetStockInfo( strStockCode, &info )
		|| !info.IsValidStock() )
		return;
	m_strRateCost.Format( "%.2f", dwShare*dSharePrice*m_pStrategy->GetRateParam().GetRate(info) );
	UpdateData( FALSE );
}
开发者ID:darwinbeing,项目名称:trade,代码行数:28,代码来源:SimuAddOpDlg.cpp

示例2: UpdateStockContainerByREPORT

// update CStockContainer by Report data
BOOL UpdateStockContainerByREPORT( CStockContainer &container, REPORT * pReport, BOOL bAddIfNotExist, REPORT * pReportLast )
{
	SP_ASSERT( pReport );
	if( NULL == pReport )
		return FALSE;

	REPORT	reportLast;
	memset( &reportLast, 0, sizeof(reportLast) );

	int	id = 0;
	if( container.GetStockInfo( pReport->m_szCode, NULL, &id ) )
	{
		container.Lock();

		CStockInfo	& info	=	container.ElementAt(id);
		reportLast	=	info.m_reportLatest;
		UpdateStockInfoByREPORT( info, pReport );

		container.UnLock();
	}
	else if( bAddIfNotExist && strlen(pReport->m_szCode)>0 )
	{
		CStockInfo	info;
		info.SetStockCode( pReport->m_dwMarket, pReport->m_szCode );
		if( UpdateStockInfoByREPORT( info, pReport ) )
		{
			container.Add( info );
		}
	}

	if( pReportLast )
		memcpy( pReportLast, &reportLast, sizeof(reportLast) );

	return TRUE;
}
开发者ID:amikey,项目名称:tradingstrategyking,代码行数:36,代码来源:Packets.cpp

示例3: DeleteAllItems

/***
	初始化操作记录列表的数据
*/
BOOL CReportListCtrl::LoadOpRecordList( COpRecordContainer & container )
{
	DeleteAllItems();

	for( int i=0; i<container.GetSize(); i++ )
	{
		OPRECORD & record = container.ElementAt(i);
		CString	strTime, strOp, strStock, strShare, strSharePrice, strAmount, strRateCost;
		strTime	=	CSPTime(record.time).Format( "%Y/%m/%d" );
		strOp	=	AfxGetStrategyOpTypeString( record.lOpType );
		CStockInfo	info;
		strStock	=	record.szCode;
		if( AfxGetStockContainer().GetStockInfo( record.szCode, &info ) )
			strStock	=	info.GetStockName();
		strShare.Format( "%u", record.dwShare );
		strSharePrice.Format( "%.2f", record.dSharePrice );
		strAmount.Format( "%.2f", record.dwShare*record.dSharePrice );
		strRateCost.Format( "%.2f", record.dRateCost );

		InsertItem( i, strStock );
		SetItemText( i, 0, strTime );
		SetItemText( i, 1, strOp );
		SetItemText( i, 2, strStock );
		SetItemText( i, 3, strShare );
		SetItemText( i, 4, strSharePrice );
		SetItemText( i, 5, strAmount );
		SetItemText( i, 6, strRateCost );
		SetItemData( i, i );
	}

	if( GetItemCount() > 0 )
		SetItemState( 0, LVIS_SELECTED, LVIS_SELECTED );

	return TRUE;
}
开发者ID:amikey,项目名称:tradingstrategyking,代码行数:38,代码来源:SimuReport.cpp

示例4: UpdateData

BOOL CSetKDataDlg::DeleteKData( CString strStockCode )
{
	if( strStockCode.GetLength() <= 0 )
		return FALSE;

	UpdateData( );

	if( m_tmDate.GetTime() == -1 )
		return FALSE;

	CStockInfo info;
	CStock	stock;
	if( !info.SetStockCode( CStock::marketUnknown, strStockCode ) )
		return FALSE;
	stock.SetStockInfo( &info );
	
	int nKType = m_comboKType.GetSelect();
	AfxPrepareStockData( &AfxGetDB(), stock, nKType,  CKData::formatOriginal, CKData::mdtypeClose, FALSE, TRUE );
	CKData & kdata = stock.GetKData(nKType);

	CSPTime sptime = m_tmDate.GetTime();
	int nIndex = kdata.GetIndexByDate( sptime.ToStockTime(CKData::IsDayOrMin(kdata.GetKType())) );
	if( nIndex >= 0 && nIndex < kdata.GetSize() )
	{
		kdata.RemoveAt(nIndex);
		AfxGetDB().InstallKData( kdata, TRUE );
		return TRUE;
	}
	return FALSE;
}
开发者ID:darwinbeing,项目名称:trade,代码行数:30,代码来源:SetKDataDlg.cpp

示例5: AfxGetStaticDoc

void CMultiSortView::SendRequestQuote( BOOL bForced )
{
	BOOL bInTrade = CSPTime::InTradeTime(CSPTime::GetCurrentTime().GetTime(),900);
	CView * pView = AfxGetStaticDoc()->GetActiveView();
	if( bForced || (bInTrade && pView == this) )
	{
		CStockInfo info;
		info.SetType( m_multisort.GetMultiSortClass( ) );
		AfxGetStkReceiver().RequestStockData( CStock::dataMultisort, &info, 1, 0, 0 );
	}
}
开发者ID:darwinbeing,项目名称:trade,代码行数:11,代码来源:MultiSortView.cpp

示例6: SetMultiSortClass

void CMultiSort::SetMultiSortClass( LONG type )
{
	m_lMultiSortClass	=	type;
	if( modeDirect == m_nRefreshMode )
	{
		CStockInfo info;
		info.SetType( GetMultiSortClass( ) );
		AfxGetStkReceiver().RequestStockData( CStock::dataMultisort, &info, 1, 0, 0 );
	}
	else
	{
		RecalculateSortID( TRUE, TRUE );
	}
}
开发者ID:darwinbeing,项目名称:trade,代码行数:14,代码来源:MultiSort.cpp

示例7: GetVariantSaveValue

BOOL CStockContainer::GetVariantSaveValue( double *pValue, UINT nVariantID, CStockInfo &info, BOOL *pNoValue )
{
	CSPMutex::Scoped	l(m_mutex);

	void * pArrayID	=	NULL;
	if( !m_map.Lookup( info.GetStockCode(), pArrayID ) )
		return FALSE;

	int	nIndex	=	(int)pArrayID;
	if( nIndex >= 0 && nIndex < m_aptrSaveValueArray.GetSize() )
	{
		CSPPtrArray * pArray = (CSPPtrArray *)m_aptrSaveValueArray.ElementAt( nIndex );
		if( pArray )
		{
			VARIANT_SAVEVALUE * pSave = NULL;
			for( int j=0; j<pArray->GetSize(); j++ )
			{
				pSave = (VARIANT_SAVEVALUE *) pArray->GetAt(j);
				if( pSave->nVariantID == nVariantID )
				{
					if( pValue )	*pValue		=	pSave->Value;
					if( pNoValue )	*pNoValue	=	pSave->bNoValue;
					return TRUE;
				}
			}
		}
	}
	
	return FALSE;
}
开发者ID:darwinbeing,项目名称:trade,代码行数:30,代码来源:Container.cpp

示例8: 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

示例9: l

int CStockContainer::Add( CStockInfo &newElement )
{
	CSPMutex::Scoped	l(m_mutex);

	int nIndex = CStockInfoArray::Add(newElement);
	m_map.SetAt( newElement.GetStockCode(), (void *)nIndex );
	return nIndex;
}
开发者ID:darwinbeing,项目名称:trade,代码行数:8,代码来源:Container.cpp

示例10: SetCurrentWindowText

void CSearchBox::SetCurrentWindowText( )
{
	if( !::IsWindow(m_hWnd) )
		return;

	if( !m_bShowOnSel )
		return;

	CStockInfo	info;
	if( AfxGetProfile().GetCurrentStock( &info ) )
	{
		if( CB_ERR == SelectString( 0, info.GetStockCode() ) )
			SetWindowText( info.GetStockCode() );
	}
	else
	{
		SetWindowText( NULL );
	}
}
开发者ID:amikey,项目名称:tradingstrategyking,代码行数:19,代码来源:SListCombos.cpp

示例11: SetFocus

void CBaseView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
	// TODO: Add your specialized code here and/or call the base class
	if( UPDATE_HINT_BASEVIEW != lHint )
		return;
	if( IsWindowVisible() )
		SetFocus( );

	CStockInfo	info;
	if( !AfxGetProfile().GetCurrentStock( &info ) )
		return;
	
	CString	strHeader	=	info.GetStockCode();
	strHeader	+=	"  ";
	strHeader	+=	info.GetStockName();
	strHeader	+=	"\r\n\r\n ";
	GetEditCtrl().SetWindowText( strHeader );
	GetEditCtrl().SetSel( strHeader.GetLength()-1, strHeader.GetLength()-1 );

	m_stock.Clear( );
	m_stock.SetStockInfo( &info );
	m_stock.SetDatabase( &AfxGetDB() );

	m_stock.PrepareBaseInfo( TRUE );

	char	* pText	=	m_stock.GetBaseTextPtr();
	int		nLength	=	m_stock.GetBaseTextLength();
	if( pText && nLength > 0 )
	{
		GetEditCtrl().ReplaceSel( pText );
	}
	else
	{
		CString	strNoBaseData;
		strNoBaseData.LoadString( IDS_BASEVIEW_NOBASEDATA );
		GetEditCtrl().ReplaceSel( strNoBaseData );
	}

	GetEditCtrl().SetSel( 0, 0 );

	AfxGetStkReceiver().RequestStockData( CStock::dataBasetext, &info, 1, 0, 0 );
}
开发者ID:darwinbeing,项目名称:trade,代码行数:42,代码来源:BaseView.cpp

示例12: 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

示例13: AfxReloadStock

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;
}
开发者ID:darwinbeing,项目名称:trade,代码行数:23,代码来源:AfxCore.cpp

示例14: SP_ASSERT

BOOL CDomainContainer::GetAllDomainInfo( CStockContainer * pContainer, DWORD dwDate )
{
	SP_ASSERT( pContainer );
	if( NULL == pContainer )
		return FALSE;

	DWORD	dwDateLatest = -1;
	AfxGetStockContainer().GetLatestTechDate( &dwDateLatest );

	for( int nDomain=0; nDomain<GetSize(); nDomain++ )
	{
		CDomain	&	domain	=	ElementAt(nDomain);
		CStockContainer	cntn;
		if( cntn.RetrieveSpecify( domain ) )
		{
			if( -1 != dwDate && dwDateLatest != dwDate )
			{
				for( int i=0; i<cntn.GetSize(); i++ )
				{
					CStockInfo	& info	=	cntn.ElementAt(i);
					info.StatBaseIndex( dwDate );
					info.StatTechIndex( dwDate );
				}
			}
			// cntn.SetMap( );
			cntn.SetAverage( );

			CStockInfo	info	=	cntn.GetAverage( );
			info.SetStockName( domain.m_strName );
			info.SetStockShortName( domain.m_strName );
			pContainer->Add( info );
		}
	}
	pContainer->SetMap();
	pContainer->SetAverage();
	return TRUE;
}
开发者ID:darwinbeing,项目名称:trade,代码行数:37,代码来源:Container.cpp

示例15: SetVariantSaveValue

void CStockContainer::SetVariantSaveValue( double Value, UINT nVariantID, CStockInfo &info, BOOL bNoValue )
{
	CSPMutex::Scoped	l(m_mutex);

	void * pArrayID	=	NULL;
	if( !m_map.Lookup( info.GetStockCode(), pArrayID ) )
		return;

	// alloc for m_aptrSaveValueArray
	if( m_aptrSaveValueArray.GetSize() == 0 )
	{
		m_aptrSaveValueArray.SetSize( GetSize() );
		for( int i=0; i<m_aptrSaveValueArray.GetSize(); i++ )
			m_aptrSaveValueArray.SetAt( i, NULL );
	}

	int	nIndex	=	(int)pArrayID;
	if( nIndex >= 0 && nIndex < m_aptrSaveValueArray.GetSize() )
	{
		CSPPtrArray * pArray = (CSPPtrArray *)m_aptrSaveValueArray.ElementAt( nIndex );
		if( NULL == pArray )
		{
			pArray	=	new	CSPPtrArray;
			m_aptrSaveValueArray.SetAt( nIndex, pArray );
		}
		
		// 如果已经存在,覆盖之
		for( int j=0; j<pArray->GetSize(); j++ )
		{
			VARIANT_SAVEVALUE * pSave = (VARIANT_SAVEVALUE *) pArray->GetAt(j);
			if( pSave->nVariantID == nVariantID )
			{
				pSave->Value	=	Value;
				pSave->bNoValue	=	bNoValue;
				return;
			}
		}
		
		// 加入新的
		VARIANT_SAVEVALUE * pSaveValue = new VARIANT_SAVEVALUE;
		pSaveValue->nVariantID	=	nVariantID;
		pSaveValue->Value		=	Value;
		pSaveValue->bNoValue	=	bNoValue;
		pArray->Add( pSaveValue );
	}
}
开发者ID:darwinbeing,项目名称:trade,代码行数:46,代码来源:Container.cpp


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