Пример #1
0
UINT LoadKDataCacheMain(LPVOID pParam)
{
	AfxGetDB().LoadKDataCache( AfxGetStockContainer(), NULL, NULL, 0, STKLIB_MAX_PROGRESS );
	AfxGetStockContainer().OnDataChanged( );

	AfxGetStkReceiver().RefreshStockContainer( AfxGetStockContainer(), TRUE );

	AfxReloadStockMain( );

	::PostMessage( AfxGetMainWnd()->GetSafeHwnd(), WM_USER_UPDATESLISTVIEW,0, 0 );
	::PostMessage( AfxGetMainWnd()->GetSafeHwnd(), WM_USER_INITDATES, 0, 0 );

	AfxEndThread( 0, TRUE );
	return 0;
}
Пример #2
0
BOOL CDomainListBox::SetCurrentStocks( int nType, LPCTSTR lpszDomain, CDomainContainer & groups )
{
	// Delete All
	ResetContent( );

	CStockContainer & container = AfxGetStockContainer();
	CStockContainer cntn;

	BOOL	bOK	=	FALSE;
	if( nType == CStockContainer::typeGroup )
	{
		CSPStringArray	astrSpecify;
		if( groups.GetDomainStocks( lpszDomain, astrSpecify ) )
			bOK	=	cntn.RetrieveSpecify( astrSpecify );	//	Not Set dwDate
	}
	else
	{
		bOK	=	cntn.RetrieveFromStatic( nType, lpszDomain, NULL, -1 );
	}

	if( bOK )
	{
		InitStorage( cntn.GetSize(), 32 );
		for( int i=0; i<cntn.GetSize(); i++ )
		{
			CStockInfo & info = cntn.ElementAt(i);
			CString	strItem	=	CString(info.GetStockCode()) + "(" + info.GetStockShortName() + ")    ";
			while( strItem.GetLength() < 16 )	strItem	+=	" ";
			strItem	+= info.GetStockName() ;
			int nItem = AddString( strItem );
		}
	}

	return bOK;
}
Пример #3
0
BOOL CSetKDataDlg::OnInitDialog()
{
	CPropertyPageEx::OnInitDialog();

	EnableEdit( FALSE );

	CWaitCursor	waitcursor;

	// TODO: Add extra initialization here
	CDomainContainer & groups = AfxGetGroupContainer( );
	CDomainContainer & domains = AfxGetDomainContainer( );
	CStockContainer & container = AfxGetStockContainer();

	// Src
	m_comboGroupSrc.InitStrings( TRUE, TRUE, groups );
	m_comboGroupSrc.SetCurSel( 0 );
	OnSelchangeComboGroupsrc();

	OnSelchangeListStocksrc();

	m_comboKType.InitializeDayMin5();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Пример #4
0
/***
	自动设定交易费用
*/
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 );
}
Пример #5
0
BOOL CSelectStk::OnInitDialog()
{
	CPropertyPageEx::OnInitDialog();
	
	CWaitCursor	waitcursor;

	// TODO: Add extra initialization here
	CDomainContainer & groups = AfxGetGroupContainer( );
	CDomainContainer & domains = AfxGetDomainContainer( );
	CStockContainer & container = AfxGetStockContainer();

	// Src
	m_comboGroupSrc.InitStrings( TRUE, TRUE, groups );
	m_comboGroupSrc.SetCurSel( 0 );
	OnSelchangeComboGroupsrc();

	// Dest
	m_listStockDest.InitStorage( m_listStockSrc.GetCount(), 32 );
	CStockContainer cntn;
	if( cntn.RetrieveSpecify( m_domainTemp ) )
	{
		for( int i=0; i<cntn.GetSize(); i++ )
		{
			CStockInfo & info = cntn.ElementAt(i);
			CString	strItem	=	CString(info.GetStockCode()) + "(" + info.GetStockShortName() + ")    ";
			while( strItem.GetLength() < 16 )	strItem	+=	" ";
			strItem	+= info.GetStockName() ;
			int nItem = m_listStockDest.AddString( strItem );
		}
	}

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Пример #6
0
/***
	初始化操作记录列表的数据
*/
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;
}
Пример #7
0
BOOL CSetGroupDlg::OnInitDialog()
{
	CXFDialog::OnInitDialog();
	
	CWaitCursor	waitcursor;

	// TODO: Add extra initialization here
	CDomainContainer & groups = AfxGetGroupContainer( );
	CDomainContainer & domains = AfxGetDomainContainer( );
	CStockContainer & container = AfxGetStockContainer();

	m_grpTemp	=	groups;

	// Src
	m_comboGroupSrc.InitStrings( TRUE, TRUE, groups );
	m_comboGroupSrc.SetCurSel( 0 );
	OnSelchangeComboGroupsrc();

	// Dest
	m_comboGroupDest.InitStrings( FALSE, FALSE, m_grpTemp );
	m_comboGroupDest.SetCurSel( 0 );
	if( m_strInitialGroupName.GetLength() > 0
		&& CB_ERR != m_comboGroupDest.SelectString( 0, m_strInitialGroupName ) )
	{
		for( int k=0; k<m_astrInitialGroupStocks.GetSize(); k++ )
			m_grpTemp.AddDomainStock( m_strInitialGroupName, m_astrInitialGroupStocks.ElementAt(k) );
	}
	OnSelchangeComboGroupdest();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Пример #8
0
BOOL CSearchBox::InitStocks( BOOL bHasSTTTech, BOOL bShowOnSel, BOOL bDuplicate )
{
	ResetContent( );

	m_bShowOnSel	=	bShowOnSel;

	CStockContainer & container	=	AfxGetStockContainer();
	InitStorage( bDuplicate ? container.GetSize()*2 : container.GetSize(), 32 );
	for( int i=0; i<container.GetSize(); i++ )
	{
		CStockInfo	& info	=	container.ElementAt(i);
		if( !info.IsValidStock() )
			continue;

		CString	strTemp	=	info.GetStockCode();
		while( strTemp.GetLength() < 8 )
			strTemp	+=	' ';
		strTemp	+=	info.GetStockName();
		int	nItem	=	AddString( strTemp );
		SetItemData( nItem, i );

		if( bDuplicate )
		{
			strTemp	=	info.GetStockShortName();
			while( strTemp.GetLength() < 8 )
				strTemp	+=	' ';
			strTemp	+=	info.GetStockName();
			if( CB_ERR == SelectString( 0, strTemp ) )
			{
				nItem = AddString( strTemp );
				SetItemData( nItem, i );
			}
		}
	}
	if( bHasSTTTech )
	{
		// 技术指标项
		UINT nTechUserCount = CTechUser::GetTechUserCount();
		for( UINT i=STT_MIN; i <= STT_MAX+nTechUserCount; i ++ )
		{
			UINT	nTech	=	i;
			if( nTech > STT_MAX )
				nTech	=	i-STT_MAX-1+STT_USER_MIN;
		
			CString	strTemp	=	AfxGetSTTShortName( nTech );
			while( strTemp.GetLength() < 8 )
				strTemp	+=	' ';
			strTemp	+=	AfxGetSTTName( nTech );
			int	nItem	=	AddString( strTemp );
			SetItemData( nItem, nTech | SEARCHBOX_SIGNBIT_STT );
		}
		// 快捷键项
		for( UINT i = ACCE_MIN; i <= ACCE_MAX; i++ )
		{
			CString	strTemp	=	AfxGetAccelerator( i, 8 );
			SetItemData( AddString(strTemp), i | SEARCHBOX_SIGNBIT_ACCE );
		}
	}
	return TRUE;
}
Пример #9
0
BOOL CStkUIApp::OnDBChanged( BOOL bRecalculate )
{
	CWaitCursor	waitcursor;

	// Reload DB
	AfxGetStockContainer().Load( &AfxGetDB(), NULL, NULL );
	AfxGetDomainContainer().Load( AfxGetProfile().GetDomainFile() );
	AfxGetGroupContainer().Load( AfxGetProfile().GetGroupFile() );
	AfxGetDB().LoadKDataCache( AfxGetStockContainer(), NULL, NULL, 0, STKLIB_MAX_PROGRESS );
	AfxGetStockContainer().OnDataChanged( );

	AfxGetStkReceiver().RefreshStockContainer( AfxGetStockContainer(), TRUE );

	// Reload AfxGetStockMain()
	AfxReloadStockMain( );

	// Recalcuate Yield
	if( bRecalculate && IDYES == AfxMessageBox( IDS_INSTALLPAC_IFRECALCULATE, MB_YESNO|MB_ICONINFORMATION ) )
	{
		AfxRecalculateYield( AfxGetProfile().GetYieldAverageDays(), TRUE );
		AfxGetStockContainer().ReloadBase( &AfxGetDB() );
	}

	// Update SListBar
	CMainFrame	* pMainFrame	=	AfxGetMainFrame();
	if( pMainFrame )
	{
		pMainFrame->m_SearchBox.InitStocks( TRUE, TRUE, TRUE );
		pMainFrame->m_SearchBox.SetCurrentWindowText( );
		//pMainFrame->m_DateBox.InitDates( );
		//pMainFrame->m_DateBox.SetCurrentWindowText( );
	}

	// Update Views
	AfxGetSListStockContainer().ReRetrieveFromStatic( AfxGetActiveStrategy(), TRUE );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_SLISTVIEW, NULL );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_GRAPHVIEW, NULL );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_BASEVIEW, NULL );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_SIMUVIEW_REREALRUN, NULL );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_SELECTORVIEW, NULL );
	::PostMessage( AfxGetGroupView()->GetSafeHwnd(), WM_USER_UPDATEGROUPS, 0, 0 );

	return TRUE;
}
Пример #10
0
CString	CSearchBox::GetSelectedStockCode( )
{
	int	nSel	=	GetCurSel();
	if( CB_ERR == nSel )
		return "";
	
	CStockContainer & container	=	AfxGetStockContainer();
	long	dwData	=	GetItemData(nSel);
	if( dwData >= 0 && dwData < container.GetSize() )
	{
		return container.ElementAt(dwData).GetStockCode();
	}
	return "";
}
Пример #11
0
LRESULT CDownloadDlg::OnStkReceiverData(WPARAM wParam, LPARAM lParam)
{
	PCOMMPACKET	pCommPacket	=	(PCOMMPACKET)lParam;

	switch( wParam )
	{
	case CStock::dataReport:
		if( pCommPacket && CStock::dataReport == pCommPacket->m_dwDataType 
			&& pCommPacket->m_dwCount > 0 )
		{
			m_nReportCount += pCommPacket->m_dwCount;
			for( DWORD i=0; i<pCommPacket->m_dwCount; i++ )
			{
				CKData kdata;
				kdata.SetKType( CKData::ktypeDay );
				KDATA kd;
				if( UpdateKDATAByREPORT( kd, &(pCommPacket->m_pReport[i]) ) )
				{
					kdata.Add( kd );
					AfxGetDB().InstallKData( kdata, FALSE );
				}
			}

			CStockContainer & container = AfxGetStockContainer();
			if( m_nReportRequestSent - m_nReportCount < 64 && m_nReportRequestSent < (UINT)container.GetSize() )
			{
				container.Lock();
				m_nReportRequestSent += AfxGetStkReceiver().RequestStockData( CStock::dataReport, container.GetData()+m_nReportRequestSent, min(160,container.GetSize()-m_nReportRequestSent), 0, 0 );
				container.UnLock();
			}

			if( !m_bReportFinished && m_nReportCount > 0.95 * m_nReportTotal )
			{
				m_bReportFinished = TRUE;
				::SendMessage( GetSafeHwnd(), WM_USER_DOWNLOAD_PROGRESS, STKLIB_MAX_PROGRESS, NULL );
				AfxBeginThread( DownloadMain, (LPVOID)m_pDownloadInfo,THREAD_PRIORITY_NORMAL);
			}
			else if( !m_bReportFinished && m_nReportTotal > 0 )
			{
				DWORD dwProgress = STKLIB_MAX_PROGRESS * m_nReportCount / m_nReportTotal;
				::SendMessage( GetSafeHwnd(), WM_USER_DOWNLOAD_PROGRESS, dwProgress, NULL );
			}
		}
		break;
	}
	return 0L;
}
Пример #12
0
void CStockContainer::OnDataChanged( )
{
	CSPMutex::Scoped	l(m_mutex);

	DWORD	dateLatest = m_dwDate;
	if( -1 == dateLatest )
		AfxGetStockContainer().GetLatestTechDate( &dateLatest );

	for( int i=0; i<GetSize(); i++ )
	{
		CStockInfo	& info	=	ElementAt(i);
		info.StatBaseIndex( dateLatest );
		info.StatTechIndex( dateLatest );
	}

	SetAverage( );
}
Пример #13
0
/***
	初始化拥有股票列表的数据
*/
BOOL CReportListCtrl::LoadStockOwnList( CStockOwnContainer & stockown, double dCash, CSPTime tmCur, double dAsset, CTechStockContainer & techstocks )
{
	DeleteAllItems();

	int i;
	for( i=0; i<stockown.GetSize(); i++ )
	{
		STOCKOWN & own = stockown.ElementAt(i);

		CString	strStock, strShare, strBuyPrice, strNowPrice;
		CStockInfo	info;
		strStock	=	own.szCode;
		if( AfxGetStockContainer().GetStockInfo( own.szCode, &info ) )
			strStock	=	info.GetStockName();
		strShare.Format( "%u", own.dwShare );
		strBuyPrice.Format( "%.2f", own.dBuyPrice );
		double	dNowPrice = 0;
		if( techstocks.GetClosePrice( own.szCode, tmCur.GetTime(), &dNowPrice ) )
			strNowPrice.Format( "%.2f", dNowPrice );

		InsertItem( i, strStock );
		SetItemText( i, 0, strStock );
		SetItemText( i, 1, strShare );
		SetItemText( i, 2, strBuyPrice );
		SetItemText( i, 3, strNowPrice );
		SetItemData( i, i );
	}

	CString	strCash;
	strCash.LoadString( IDS_SIMUREPORT_CASH );
	InsertItem( i, strCash );
	strCash.Format( "%.2f", dCash );
	SetItemText( i, 1, strCash );
	i++;

	CString	strAsset;
	strAsset.LoadString( IDS_SIMUREPORT_ASSET );
	InsertItem( i, strAsset );
	strAsset.Format( "%.2f", dAsset );
	SetItemText( i, 1, strAsset );

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

	return TRUE;
}
Пример #14
0
BOOL CStockContainer::RetrieveSpecify( CSPStringArray & astr )
{
	CSPMutex::Scoped	l(m_mutex);

	SetSize( 0, astr.GetSize() );

	int	nCount	=	0;
	for( int i=0; i<astr.GetSize(); i++ )
	{
		CSPString	string	=	astr.ElementAt(i);
		CStockInfo	info;
		if( AfxGetStockContainer().GetStockInfo( string, &info ) )
		{
			Add( info );
			nCount	++;
		}
	}
	SetSize( nCount );

	return TRUE;
}
Пример #15
0
BOOL CDateComboBox::InitDates( )
{
	ResetContent( );

	// Add Date ComboBox Members
	CSPDWordArray dwArray;
	AfxGetStockContainer().GetTechDateArray( dwArray );

	InitStorage( dwArray.GetSize()+2, 32 );

	CString strMore;
	strMore.LoadString( IDS_DATECOMBOBOX_MORE );
	int nIndex = AddString( strMore );
	SetItemData( nIndex, -2 );

	/*int	nMaxDaysCalculate	=	AfxGetProfile().GetMaxDaysCalculate( );*/
	// for( int nCount=dwArray.GetSize()-1; nCount >= 0/*nCount > nMaxDaysCalculate*/; nCount -- )
	for( int nCount=0; nCount < dwArray.GetSize(); nCount ++ )
	{
		CSPTime	sptime;
		if( sptime.FromStockTimeDay( dwArray[nCount] ) )
		{
			CSPTime	time( sptime.GetTime() );
			CString	strItem	=	AfxGetTimeString( time.GetTime(), szDateComboBoxTimeFormat, TRUE );
			if( strItem.GetLength() > 0 )
			{
				int nIndex = AddString( strItem );
				SetItemData( nIndex, dwArray[nCount] );
			}
		}
	}

	CString strNow;
	strNow.LoadString( IDS_DATECOMBOBOX_NOW );
	nIndex = AddString( strNow );
	SetItemData( nIndex, -1 );
	SetCurSel( nIndex );

	return TRUE;
}
Пример #16
0
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;
}
Пример #17
0
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;
}
Пример #18
0
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;
}
Пример #19
0
int CStock::PrepareData( int type, int period, BOOL bReload )
{
	SP_ASSERT( m_pDatabase );
	if( ! m_pDatabase )	return 0;

	switch( type )
	{
	case dataInfo:
		return AfxGetStockContainer().GetStockInfo( m_stockinfo.GetStockCode(), &m_stockinfo );
	case dataK:
		{
			switch( period )
			{
			case CKData::ktypeMonth:
				if( bReload || GetKDataMonth().GetSize() == 0 )
					m_pDatabase->LoadKData( this, CKData::ktypeMonth );
				break;
			case CKData::ktypeWeek:
				if( bReload || GetKDataWeek().GetSize() == 0 )
					m_pDatabase->LoadKData( this, CKData::ktypeWeek );
				break;
			case CKData::ktypeDay:
				if( bReload || GetKDataDay().GetSize() == 0 )
					m_pDatabase->LoadKData( this, CKData::ktypeDay );
				break;		// month, week, and day willnot extract from min60,min30...

			case CKData::ktypeMin60:
				if( bReload || GetKDataMin60().GetSize() == 0 )
					m_pDatabase->LoadKData( this, CKData::ktypeMin60 );
				break;
			case CKData::ktypeMin30:
				if( bReload || GetKDataMin30().GetSize() == 0 )
					m_pDatabase->LoadKData( this, CKData::ktypeMin30 );
				break;
			case CKData::ktypeMin15:
				if( bReload || GetKDataMin15().GetSize() == 0 )
					m_pDatabase->LoadKData( this, CKData::ktypeMin15 );
				break;
			case CKData::ktypeMin5:
				if( bReload || GetKDataMin5().GetSize() == 0 )
					m_pDatabase->LoadKData( this, CKData::ktypeMin5 );
				break;
			case CKData::ktypeMin1:
				if( bReload || GetKDataMin1().GetSize() == 0 )
					m_pDatabase->LoadKData( this, CKData::ktypeMin1 );
				break;
			default:
				SP_ASSERT( FALSE );
				return 0;
			}
			return ExtractKData( period, FALSE );
		}
	case dataDR:
		if( bReload || GetDRData().GetSize() == 0 )
			return m_pDatabase->LoadDRData( this );
		else
			return GetDRData().GetSize();
	case dataBasetable:
		return AfxGetStockContainer().GetStockInfo( m_stockinfo.GetStockCode(), &m_stockinfo );
	case dataBasetext:
		if( bReload || !GetBaseTextPtr() )
			return m_pDatabase->LoadBaseText( this );
		else
			return GetBaseTextLength();
	case dataReport:
		if( bReload || GetReport().GetSize() == 0 )
			return m_pDatabase->LoadReport( this );
		else
			return GetReport().GetSize();
	case dataMinute:
		if( bReload || GetMinute().GetSize() == 0 )
			return m_pDatabase->LoadMinute( this );
		else
			return GetMinute().GetSize();
	case dataOutline:
		if( bReload || GetOutline().GetSize() == 0 )
			return m_pDatabase->LoadOutline( this );
		else
			return GetOutline().GetSize();
	default:
		SP_ASSERT( FALSE );
		return 0;
	}
}
Пример #20
0
BOOL CStockContainer::RetrieveFromStatic( int nType, LPCTSTR lpszDomain, CStrategy * pStrategy, DWORD dwDate )
{
	CSPMutex::Scoped	l(m_mutex);

	Clear( );

	if( nType == typeNone )
	{
		m_nType	=	typeNone;
		return TRUE;
	}

	if( nType < typeMin || nType > typeMax )
		return FALSE;
	m_nType		=	nType;

	m_dwDate	=	dwDate;
	
	CSPStringArray	astrSpecify;

	switch( nType )
	{
	case typeAll:
		CopyData( AfxGetStockContainer() );
		break;
	case typeIndex:
	case typeA:
	case typeBond:
	case typeFund:
	case typeClassShaa:
	case typeClassShab:
	case typeClassSzna:
	case typeClassSznb:
	case typeClassShabond:
	case typeClassSznbond:
		{
			int	nCount	=	0;
			SetSize( 0, AfxGetStockContainer().GetSize() );
			for( int i=0; i<AfxGetStockContainer().GetSize(); i++ )
			{
				CStockInfo	& info = AfxGetStockContainer().ElementAt(i);
				LONG	stocktype	=	info.GetType();
				if( ( typeIndex == nType && CStock::typeshIndex == stocktype )
					|| ( typeIndex == nType && CStock::typeszIndex == stocktype )
					|| ( typeA == nType && (CStock::typeshA == stocktype || CStock::typeszA == stocktype) && !info.IsFund() )
					|| ( typeBond == nType && (CStock::typeshBond == stocktype || CStock::typeszBond == stocktype) )
					|| ( typeFund == nType && info.IsFund() )
					|| ( typeClassShaa == nType && CStock::typeshA == stocktype )
					|| ( typeClassShab == nType && CStock::typeshB == stocktype )
					|| ( typeClassSzna == nType && CStock::typeszA == stocktype )
					|| ( typeClassSznb == nType && CStock::typeszB == stocktype )
					|| ( typeClassShabond == nType && CStock::typeshBond == stocktype )
					|| ( typeClassSznbond == nType && CStock::typeszBond == stocktype ) )
				{
					Add( info );
					nCount	++;
				}
			}
			SetSize( nCount );
		}
		break;
	case typeStrategy:
		{
			if( pStrategy )
				RetrieveSpecify( pStrategy->GetStocks() );
		}
		break;
	case typeGroup:
		{
			if( lpszDomain && strlen(lpszDomain) > 0 )
			{
				AfxGetGroupContainer().GetDomainStocks( lpszDomain, astrSpecify );
				RetrieveSpecify( astrSpecify );
				m_strDomain	=	lpszDomain;
			}
			else
				return AfxGetGroupContainer().GetAllDomainInfo( this, m_dwDate );
		}
		break;
	case typeDomain:
		{
			if( lpszDomain && strlen(lpszDomain) > 0 )
			{
				AfxGetDomainContainer().GetDomainStocks( lpszDomain, astrSpecify );
				RetrieveSpecify( astrSpecify );
				m_strDomain	=	lpszDomain;
			}
			else
				return AfxGetDomainContainer().GetAllDomainInfo( this, m_dwDate );
		}
		break;
	default:
		SP_ASSERT( FALSE );
		SetMap( );
		SetAverage( );
		return FALSE;
	}

	SetMap( );

	DWORD	dwMainDate = -1;
	AfxGetStockContainer().GetCurrentType( NULL, NULL, &dwMainDate );
	if( m_dwDate != dwMainDate )
		OnDataChanged();
	else
		SetAverage( );
	return TRUE;
}
Пример #21
0
void CSetColumnDlg::OnOK() 
{
	// TODO: Add extra validation here
	m_btnOK.EnableWindow( FALSE );

	// Store Show Items
	CSPDWordArray	& anShow	= AfxGetProfile().GetSListColumnsShow( );
	CSPDWordArray	& anOrder	= AfxGetProfile().GetSListColumnsOrder( );
	anShow.RemoveAll();
	anOrder.RemoveAll();
	for( int i=0; i<m_listColumn.GetItemCount(); i++ )
	{
		UINT	nID	=	m_listColumn.GetItemData( i );
		anOrder.Add( nID );

		if( m_listColumn.GetCheck( i ) )
			anShow.Add( nID );
	}

	if( 0 == anShow.GetSize() && IDNO == AfxMessageBox( IDS_SETCOLUMN_NOSELECT, MB_YESNO ) )
		return;

	// Store Parameters
	m_listColumn.HideItemComboBox( );
	for( int nItem=0; nItem<m_listColumn.GetItemCount(); nItem++ )
	{
		// Set Item Text
		UINT	nID	=	m_listColumn.GetItemData(nItem);

		// Set Column Combo Text
		CString	strParam;
		if( SLH_DIFF == nID )
		{
			strParam	=	m_listColumn.GetItemText( nItem, 2 );
			int	nDays	=	atol( strParam );
			AfxGetProfile().SetDiffDays( nDays );
		}
		else if( SLH_DIFFPERCENT == nID )
		{
			strParam	=	m_listColumn.GetItemText( nItem, 2 );
			int	nDays	=	atol( strParam );
			AfxGetProfile().SetDiffPercentDays( nDays );
		}
		else if( SLH_SCOPE == nID )
		{
			strParam	=	m_listColumn.GetItemText( nItem, 2 );
			int	nDays	=	atol( strParam );
			AfxGetProfile().SetScopeDays( nDays );
		}
		else if( SLH_RATIO_CHANGEHAND == nID )
		{
			strParam	=	m_listColumn.GetItemText( nItem, 2 );
			int	nDays	=	atol( strParam );
			AfxGetProfile().SetRatioChangeHandDays( nDays );
		}
		else if( SLH_RATIO_VOLUME == nID )
		{
			strParam	=	m_listColumn.GetItemText( nItem, 2 );
			int	nDays	=	atol( strParam );
			AfxGetProfile().SetRatioVolumeDays( nDays );
		}
		else if( SLH_RS == nID )
		{
			strParam	=	m_listColumn.GetItemText( nItem, 2 );
			int	nDays	=	atol( strParam );
			AfxGetProfile().SetRSDays( nDays );
		}
		else if( SLH_ANNGAINS_AVERAGE == nID )
		{
			strParam	=	m_listColumn.GetItemText( nItem, 2 );
			int	nDays	=	atol( strParam );
			AfxGetProfile().SetYieldAverageDays( nDays );
		}
	}
	
	AfxGetProfile().StoreProfile( );

	CXFDialog::OnOK();

	//CMainFrame	* pMainFrame	=	AfxGetMainFrame();
	//if( pMainFrame )
	//{
	//	pMainFrame->m_DateBox.InitDates( );
	//	pMainFrame->m_DateBox.SetCurrentWindowText( );
	//}

	// Recalculate Yield Average
	if( AfxGetProfile().GetYieldAverageDays() != m_nYieldAverageDaysOld )
	{
		// Need Recalculate
		if( IDYES == AfxMessageBox( IDS_SETCOLUMN_IFRECALCULATE, MB_YESNO|MB_ICONINFORMATION ) )
		{
			AfxRecalculateYield( AfxGetProfile().GetYieldAverageDays(), TRUE );
			AfxGetStockContainer().ReloadBase( &AfxGetDB() );
			AfxGetSListStockContainer().ReRetrieveFromStatic( AfxGetActiveStrategy() );
		}
	}
	
	//	Clear the User Defined Index Cache
	if( m_bUserIndexModified )
		AfxGetSListStockContainer().ClearVariantSaveValue();
}
Пример #22
0
void CSListView::SendRequestQuote( BOOL bForced )
{
	static int nLastStart = -1;
	static int nLastCount = -1;

	BOOL bQuoteTipSended = FALSE;

	BOOL bInTrade = CSPTime::InTradeTime(CSPTime::GetCurrentTime().GetTime(),900);
	CView * pView = AfxGetStaticDoc()->GetActiveView();
	if( bForced )
	{
		CStockContainer stocks;
		CStockInfo	info;
		if( AfxGetStockContainer().GetStockInfo( STKLIB_CODE_MAIN, &info ) )
			stocks.Add(info);
		if( AfxGetStockContainer().GetStockInfo( STKLIB_CODE_MAINSZN, &info ) )
			stocks.Add(info);
		if( stocks.GetSize() > 0 )
			AfxGetStkReceiver().RequestStockData( CStock::dataReport, stocks.GetData(), stocks.GetSize(), 0, 0 );
	}
	if( bForced || pView == this )
	{
		CCellRange cr = m_Grid.GetVisibleNonFixedCellRange();
		int nStart = cr.GetMinRow() - 1;
		int nCount = cr.GetMaxRow() - cr.GetMinRow() + 1;
		CStockContainer & container = AfxGetSListStockContainer();
		container.Lock();
		if( nStart >= 0 && nCount > 0 && container.GetSize() > 0 && (bInTrade || bForced || nLastStart != nStart || nLastCount != nCount) )
		{
			nLastStart = nStart;
			nLastCount = nCount;
			AfxGetStkReceiver().RequestStockData( CStock::dataReport, container.GetData()+nStart, min(nCount,container.GetSize()-nStart), 0, 0 );
			bQuoteTipSended = (0 == nStart && nCount >= 9);
		}
		container.UnLock();
	}

	if( bInTrade )
	{
		// 预警系统所需股票行情刷新
		CAlarmCondContainer & conds = AfxGetProfile().GetAlarmCondContainer();
		CStockContainer stocks;
		stocks.SetSize( 0, conds.GetSize() + 5 );
		for( int i=0; i<conds.GetSize(); i++ )
		{
			ALARMCOND cond = conds.GetAt(i);
			CStockInfo info;
			if( AfxGetStockContainer().GetStockInfo( cond.m_szCode, &info ) )
				stocks.Add( info );
		}
		CStockInfo infoMain, infoMainSzn;
		if( AfxGetStockContainer().GetStockInfo( STKLIB_CODE_MAIN, &infoMain )
			&& AfxGetStockContainer().GetStockInfo( STKLIB_CODE_MAINSZN, &infoMainSzn ) )
		{
			stocks.Add( infoMain );
			stocks.Add( infoMainSzn );
		}

		//  行情QuoteTip 需要行情数据
		if( !bQuoteTipSended )
		{
			CStockContainer & container = AfxGetSListStockContainer();
			container.Lock();
			for( int i=0; i<9 && i<container.GetSize(); i++ )
				stocks.Add( container.ElementAt(i) );
			container.UnLock();
		}

		if( stocks.GetSize() > 0 )
			AfxGetStkReceiver().RequestStockData( CStock::dataReport, stocks.GetData(), stocks.GetSize(), 0, 0 );
	}
}
Пример #23
0
void CMultiSort::DrawMultiSort( CDC * pDC, MULTISORT &ms, CRect rect, UINT nSLH, int nSelectPos )
{
	DECLARE_COLOR_DEFINATION

	int	x	=	rect.left+8;
	int	x2	=	(int)( rect.left+0.56*rect.Width() );
	int	x3	=	rect.right-8;
	int	y	=	rect.top+20;
	int	yStep	=	(rect.Height()-23) / 6 ;
	if( yStep <= 0 )
		return;
	
	CFont	* pOldFont	=	AfxSelectDCFont( pDC, 14 );
	pDC->SetBkColor( clrBK );

	int size = sizeof(m_msRise.m_stocks)/sizeof(m_msRise.m_stocks[0]);
	for( int i=0; i<size; i++ )
	{
		CStockInfo	info;
		char	buf_code[sizeof(ms.m_stocks[i].m_code)+1];
		memset( buf_code, 0, sizeof(buf_code) );
		memcpy( buf_code, ms.m_stocks[i].m_code, sizeof(ms.m_stocks[i].m_code) );
		if( !AfxGetStockContainer().GetStockInfo(buf_code, &info) )
			continue;
		info.m_fClose	=	float(0.001*ms.m_stocks[i].m_data1);

		pDC->SetTextColor( clrText );
//#ifdef	CLKLAN_ENGLISH_US
//		pDC->TextOut( x, y, info.GetStockCode() );
//#else
		pDC->TextOut( x, y, info.GetStockName() );
//#endif

		UINT nOldAlign = pDC->SetTextAlign( TA_RIGHT | TA_TOP );
		pDC->SetTextColor( AfxGetVariantColor(SLH_CLOSE,info) );
		pDC->TextOut( x2, y, (LPCTSTR)AfxGetVariantDispString(SLH_CLOSE,info,NULL) );

		CString strTemp;
		if( CStock::classVolRatio == ms.m_class )
			strTemp.Format( "%.2f", 0.01*ms.m_stocks[i].m_data2 );
		else if( CStock::classAmount == ms.m_class )
			strTemp.Format( "%.0f", 0.001*ms.m_stocks[i].m_data2 );
		else
			strTemp.Format( "%.2f%%", 0.01*ms.m_stocks[i].m_data2 );
		pDC->TextOut( x3, y, strTemp );

		y	+=	yStep;
		pDC->SetTextAlign( nOldAlign );

		// 选中股票
		if( nSelectPos == i )
		{
			int	ySel = y-yStep+16;
			if( ySel > rect.top && ySel < rect.bottom )
				DrawLine( pDC, 2, clrBorder, rect.left+5, ySel, rect.right-5, ySel );
		}
	}

	// 补足股票排名
	for( i=size; i<6; i++ )
	{
		pDC->SetTextColor( clrText );
		pDC->TextOut( x, y, "-" );

		UINT nOldAlign = pDC->SetTextAlign( TA_RIGHT | TA_TOP );
		pDC->TextOut( x2, y, "-" );

		pDC->TextOut( x3, y, "-" );

		y	+=	yStep;
		pDC->SetTextAlign( nOldAlign );
	}

	pDC->SelectObject( pOldFont );
}
Пример #24
0
void CTyDataDlg::OnStart() 
{
	UpdateData( );
	StoreProfile();

	if( m_tmBegin > m_tmEnd )
	{
		AfxMessageBox( IDS_TYDATADLG_ERRORTIME, MB_OK|MB_ICONINFORMATION );
		return;
	}

	if( 0 == access(m_strFileDest,0)
		&& IDNO == AfxMessageBox(IDS_TYDATADLG_OVERWRITE,MB_YESNO) )
		return;

	CFile	file;
	if( !file.Open( m_strFileDest, CFile::modeCreate | CFile::modeWrite ) )
	{
		AfxMessageBox( IDS_TYDATADLG_ERRORCREATEFILE, MB_OK|MB_ICONINFORMATION );
		return;
	}
	file.Close();

	m_btnStart.EnableWindow( FALSE );

	int	nFileCountTotal	=	CNetDatabase::GetFileCount( m_strPathSrcSH, FALSE )
							+ CNetDatabase::GetFileCount( m_strPathSrcSZ, FALSE );
	int	nFileCount = 0, nCount = 0, nProgress = 0;
	
	m_ctrlProgress.SetWindowPos( NULL, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE );
	m_ctrlProgress.SetRange( 0, nFileCountTotal );
	m_ctrlProgress.SetPos( 0 );

	CFileFind finder;
	// ÉϺ£
	BOOL	bWorking	=	finder.FindFile( AfxGetFilePath( (LPCTSTR)m_strPathSrcSH, LPCTSTR("*.day") ) );
	while( bWorking )
	{
		bWorking	=	finder.FindNextFile();
		CString	sKFile	=	finder.GetFilePath();
		CString	sCode	=	AfxGetFileTitleNoExt(sKFile);
		CString	sName;
		CStockInfo	info;
		if( AfxGetStockContainer().GetStockInfo( sCode, &info ) )
			sName	=	info.GetStockName();
		
		int	nRet = CStDatabase::AppendToTyData( sCode, sName, CKData::ktypeDay, sKFile,
					m_strFileDest, m_tmBegin.GetTime(), m_tmEnd.GetTime() );
		
		nCount	+=	nRet;
		if( nRet > 0 )	nFileCount	++;

		// Progress
		m_ctrlProgress.SetPos(++nProgress);
		CString	strProgressNew;
		if( nFileCountTotal > 0 )
			strProgressNew.Format( "%d%%", 100*nProgress/nFileCountTotal );
		CString	strProgressOld;
		m_staticProgress.GetWindowText( strProgressOld );
		if( 0 != strProgressNew.Compare( strProgressOld ) )
			m_staticProgress.SetWindowText( strProgressNew );
	}
	finder.Close();

	// ÉîÛÚ
	bWorking	=	finder.FindFile( AfxGetFilePath( (LPCTSTR)m_strPathSrcSZ, LPCTSTR("*.day") ) );
	while( bWorking )
	{
		bWorking	=	finder.FindNextFile();
		CString	sKFile	=	finder.GetFilePath();
		CString	sCode	=	AfxGetFileTitleNoExt(sKFile);
		CString	sName;
		CStockInfo	info;
		if( AfxGetStockContainer().GetStockInfo( sCode, &info ) )
			sName	=	info.GetStockName();
		
		int nRet = CStDatabase::AppendToTyData( sCode, sName, CKData::ktypeDay, sKFile,
					m_strFileDest, m_tmBegin.GetTime(), m_tmEnd.GetTime() );
		
		nCount	+=	nRet;
		if( nRet > 0 )	nFileCount	++;

		// Progress
		m_ctrlProgress.SetPos(++nProgress);
		CString	strProgressNew;
		if( nFileCountTotal > 0 )
			strProgressNew.Format( "%.2f%%", 100.*nProgress/nFileCountTotal );
		CString	strProgressOld;
		m_staticProgress.GetWindowText( strProgressOld );
		if( 0 != strProgressNew.Compare( strProgressOld ) )
			m_staticProgress.SetWindowText( strProgressNew );
	}
	finder.Close();

	CString	strReportFmt, strReport;
	strReportFmt.LoadString( IDS_TYDATADLG_REPORTFMT );
	strReport.Format( strReportFmt, nFileCount, nCount );
	AfxMessageBox( strReport, MB_OK|MB_ICONINFORMATION );

	m_btnStart.EnableWindow( TRUE );
}
Пример #25
0
void CStockInfo::ResolveTypeAndMarket( )
{
	CStockInfo	info;
	if( AfxGetStockContainer().GetStockInfo( m_szCode, &info )
		&& CStock::typeNone != info.GetType()
		&& CStock::marketUnknown != info.GetMarket() )
	{
		if( CStock::typeNone == m_type )
			m_type = info.GetType();
		if( CStock::marketUnknown == m_dwMarket )
			m_dwMarket = info.GetMarket();
		return;
	}

	long	type = CStock::typeNone;
	DWORD	dwMarket = CStock::marketUnknown;
	if( strlen(m_szCode) > 0 )
	{
		if( strcmp(m_szCode,"000001") >= 0 && strcmp(m_szCode,"000999") <= 0 )		// 深圳A股
		{	type = CStock::typeszA;			dwMarket = CStock::marketSZSE;	}
		else if( strcmp(m_szCode,"002001") >= 0 && strcmp(m_szCode,"002999") <= 0 )	// 深圳A股(中小企业)
		{	type = CStock::typeszA;			dwMarket = CStock::marketSZSE;	}
		else if( strcmp(m_szCode,"200001") >= 0 && strcmp(m_szCode,"200999") <= 0 )	// 深圳B股
		{	type = CStock::typeszB;			dwMarket = CStock::marketSZSE;	}
		else if( strncmp(m_szCode,"600",3) == 0 )	// 上海A股
		{	type = CStock::typeshA;			dwMarket = CStock::marketSHSE;	}
		else if( strncmp(m_szCode,"500",3) == 0 )	// 上海基金
		{	type = CStock::typeshA;			dwMarket = CStock::marketSHSE;	}
		else if( strncmp(m_szCode,"900",3) == 0 )	// 上海B股
		{	type = CStock::typeshB;			dwMarket = CStock::marketSHSE;	}

		else if( strcmp(m_szCode,"001001") >= 0 && strcmp(m_szCode,"001199") <= 0 )	// 深圳企业债券
		{	type = CStock::typeszBond;		dwMarket = CStock::marketSZSE;	}
		else if( strcmp(m_szCode,"001200") >= 0 && strcmp(m_szCode,"001899") <= 0 )	// 深圳国债回购
		{	type = CStock::typeszBond;		dwMarket = CStock::marketSZSE;	}
		else if( strcmp(m_szCode,"001900") >= 0 && strcmp(m_szCode,"001999") <= 0 )	// 深圳国债现货
		{	type = CStock::typeszBond;		dwMarket = CStock::marketSZSE;	}
		else if( strcmp(m_szCode,"002600") >= 0 && strcmp(m_szCode,"002999") <= 0 )	// 深圳B股权证
		{	type = CStock::typeszRight;		dwMarket = CStock::marketSZSE;	}
		else if( strcmp(m_szCode,"003001") >= 0 && strcmp(m_szCode,"003999") <= 0 )	// 深圳转配认购
		{	type = CStock::typeszAdmeasure;	dwMarket = CStock::marketSZSE;	}
		else if( strcmp(m_szCode,"009001") >= 0 && strcmp(m_szCode,"009999") <= 0 )	// 深圳新股配售
		{	type = CStock::typeszAdmeasure;	dwMarket = CStock::marketSZSE;	}
		else if( strcmp(m_szCode,"005001") >= 0 && strcmp(m_szCode,"005999") <= 0 )	// 深圳可转换债券
		{	type = CStock::typeszBond;		dwMarket = CStock::marketSZSE;	}
		else if( strcmp(m_szCode,"006001") >= 0 && strcmp(m_szCode,"006999") <= 0 )	// 深圳国债期货
		{	type = CStock::typeszBond;		dwMarket = CStock::marketSZSE;	}
		else if( strcmp(m_szCode,"004601") >= 0 && strcmp(m_szCode,"004699") <= 0 )	// 深圳证券投资基金
		{	type = CStock::typeszA;			dwMarket = CStock::marketSZSE;	}
		else if( strcmp(m_szCode,"008001") >= 0 && strcmp(m_szCode,"008999") <= 0 )	// 深圳配股认购
		{	type = CStock::typeszAdmeasure;	dwMarket = CStock::marketSZSE;	}


		else if( strncmp(m_szCode,"001",3) == 0 )	// 上海国债现货
		{	type = CStock::typeshBond;		dwMarket = CStock::marketSHSE;	}
		else if( strncmp(m_szCode,"110",3) == 0 || strncmp(m_szCode,"120",3) == 0 )	// 上海企业债券
		{	type = CStock::typeshBond;		dwMarket = CStock::marketSHSE;	}
		else if( strncmp(m_szCode,"310",3) == 0 )	// 上海国债期货
		{	type = CStock::typeshBond;		dwMarket = CStock::marketSHSE;	}
		else if( strncmp(m_szCode,"580",3) == 0 || strncmp(m_szCode,"582",3) == 0 )	// 上海权证
		{	type = CStock::typeshRight;		dwMarket = CStock::marketSHSE;	}
		else if( strncmp(m_szCode,"710",3) == 0 )	// 上海转配股
		{	type = CStock::typeshAdmeasure;	dwMarket = CStock::marketSHSE;	}
		else if( strncmp(m_szCode,"711",3) == 0 )	// 上海转配股再转配股
		{	type = CStock::typeshAdmeasure;	dwMarket = CStock::marketSHSE;	}
		else if( strncmp(m_szCode,"730",3) == 0 )	// 上海新股申购
		{	type = CStock::typeshAdmeasure;	dwMarket = CStock::marketSHSE;	}
		else if( strncmp(m_szCode,"737",3) == 0 )	// 上海新股配售
		{	type = CStock::typeshAdmeasure;	dwMarket = CStock::marketSHSE;	}
		else if( strncmp(m_szCode,"201",3) == 0 )	// 上海国债回购	
		{	type = CStock::typeshBond;		dwMarket = CStock::marketSHSE;	}
		else if( strncmp(m_szCode,"129",3) == 0 || strncmp(m_szCode,"100",3) == 0 )	// 上海可转换债券
		{	type = CStock::typeshBond;		dwMarket = CStock::marketSHSE;	}
		else if( strncmp(m_szCode,"700",3) == 0 )	// 上海配股
		{	type = CStock::typeshAdmeasure;	dwMarket = CStock::marketSHSE;	}
		else if( strncmp(m_szCode,"701",3) == 0 )	// 上海转配股再配股
		{	type = CStock::typeshAdmeasure;	dwMarket = CStock::marketSHSE;	}
		else if( strncmp(m_szCode,"720",3) == 0 )	// 上海红利
		{	type = CStock::typeshBonus;		dwMarket = CStock::marketSHSE;	}
		else if( strncmp(m_szCode,"735",3) == 0 )	// 上海新基金申购
		{	type = CStock::typeshAdmeasure;	dwMarket = CStock::marketSHSE;	}
	}

	if( CStock::typeNone == m_type )
		m_type		= type;
	if( CStock::marketUnknown == m_dwMarket )
		m_dwMarket	= dwMarket;
}
Пример #26
0
void CDownloadDlg::OnOK() 
{
	UpdateData( );

	// clear error pac msg
	m_astrErrorPac.RemoveAll();

	// disable and enble buttons
	m_btnOK.EnableWindow( FALSE );
	m_btnCancel.EnableWindow( FALSE );
	m_btnProxySet.EnableWindow( FALSE );
	m_btnRefreshServers.EnableWindow( FALSE );
	m_btnStop.EnableWindow( TRUE );

	BOOL	bOK	=	TRUE;

	// Set Message
	SendMessage( WM_USER_DOWNLOAD_MESSAGE, PROG_NEWGROUP, IDS_DLMSG_CONNECTING );
	m_staticStatus.SetWindowPos( NULL, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_SHOWWINDOW);
	MSG		msg;
	while (::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE) )
		AfxGetApp()->PumpMessage();
	
	// set server info
	if( bOK && !m_netdb.SetRootPath( AfxGetProfile().GetSelfDBPath(), IStStore::dbtypeSelfDB ) )
	{
		AfxMessageBox( IDS_ROOTPATH_ERROR, MB_OK | MB_ICONINFORMATION );
		bOK	=	FALSE;
	}
	CString	strServer;
	m_comboServers.GetWindowText( strServer );
	CDownloadServer	server;
	if( !server.FromString( strServer ) )
	{
		AfxMessageBox( IDS_NOSERVER_DEFINED, MB_OK | MB_ICONINFORMATION );
		bOK	=	FALSE;
	}
	AfxGetProfile().SetDefaultServer( strServer );
	
	if( bOK && !m_netdb.SetServer( server.m_strAddress, server.m_nPort ) )
	{
		AfxMessageBox( IDS_NOSERVER_DEFINED, MB_OK | MB_ICONINFORMATION );
		bOK	=	FALSE;
	}
	// set access type
	if( bOK && !m_netdb.SetAccessType( AfxGetQSProfile().GetAccessType(), AfxGetQSProfile().GetProxyType(),
			AfxGetQSProfile().GetProxyAddress(), AfxGetQSProfile().GetProxyPort(),
			AfxGetQSProfile().GetProxyUser(), AfxGetQSProfile().GetProxyPasswd() ) )
	{
		AfxMessageBox( IDS_NOSERVER_DEFINED, MB_OK | MB_ICONINFORMATION );
		bOK	=	FALSE;
	}

	// login
	if( bOK && !m_netdb.Login( AfxGetSView().GetS(), AfxGetSView().GetU(),
							   NULL, AfxGetProfile().GetVersion() ) )
	{
		char	szErr[1024];
		if( m_netdb.GetLastErrorMessage(szErr,1023) )
			AfxMessageBox( szErr, MB_OK | MB_ICONINFORMATION );
		else
			AfxMessageBox( IDS_LOGIN_FAILED, MB_OK | MB_ICONINFORMATION );
		bOK	=	FALSE;
	}
	// load package info
	if( bOK && ! m_netdb.NetloadPackageInfo( NULL, NULL ) )
	{
		char	szErr[1024];
		if( m_netdb.GetLastErrorMessage(szErr,1023) )
			AfxMessageBox( szErr, MB_OK | MB_ICONINFORMATION );
		else
			AfxMessageBox( IDS_DOWNLOAD_FAILED, MB_OK | MB_ICONINFORMATION );
		bOK	=	FALSE;
	}

	if( bOK )
	{
		// show message
		m_staticStatus.SetWindowPos( NULL, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_SHOWWINDOW);
		m_ctrlProgress.SetWindowPos( NULL, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_SHOWWINDOW);
		CString	strMsg;
		strMsg.LoadString( IDS_DATA_DOWNLOADING );
		m_staticStatus.SetWindowText( strMsg );

		CDownloadDlg::m_hEventKillDownloadThread = CreateEvent(NULL,FALSE,FALSE,NULL);
		CDownloadDlg::m_hEventDownloadThreadKilled = CreateEvent(NULL,FALSE,FALSE,NULL);

		if( NULL == m_pDownloadInfo )
			m_pDownloadInfo	=	new DOWNLOAD_INFO;
		memset( m_pDownloadInfo, 0, sizeof(DOWNLOAD_INFO) );
		m_pDownloadInfo->hMainWnd	=	GetSafeHwnd();
		m_pDownloadInfo->pNetDB		=	&m_netdb;
		m_pDownloadInfo->bReport	=	m_btnCheckReport.GetCheck();
		m_pDownloadInfo->bDay		=	m_btnCheckDay.GetCheck();
		m_pDownloadInfo->tmDayFrom	=	m_tmDayFrom.GetTime();
		m_pDownloadInfo->tmDayTo	=	m_tmDayTo.GetTime();
		m_pDownloadInfo->bMin5		=	m_btnCheckMin5.GetCheck();
		m_pDownloadInfo->tmMin5From	=	m_tmMin5From.GetTime();
		m_pDownloadInfo->tmMin5To	=	m_tmMin5To.GetTime();
		m_pDownloadInfo->bBase		=	m_btnCheckBase.GetCheck();
		m_pDownloadInfo->bXDR		=	m_btnCheckXDR.GetCheck();

		if( m_pDownloadInfo->bReport )
		{
			::SendMessage( GetSafeHwnd(), WM_USER_DOWNLOAD_MESSAGE, PROG_NEWGROUP, IDS_DLMSG_REPORT );
			::SendMessage( GetSafeHwnd(), WM_USER_DOWNLOAD_PROGRESS, 0, NULL );
			m_nReportCount = 0;
			m_bReportFinished = FALSE;
			AfxGetStkReceiver().AddRcvDataWnd( GetSafeHwnd() );
			CStockContainer & container = AfxGetStockContainer();
			container.Lock();
			m_nReportTotal = container.GetSize();
			m_nReportRequestSent = AfxGetStkReceiver().RequestStockData( CStock::dataReport, container.GetData(), min(160,container.GetSize()), 0, 0 );
			container.UnLock();
		}
		else
		{
			AfxBeginThread( DownloadMain, (LPVOID)m_pDownloadInfo,THREAD_PRIORITY_NORMAL);
		}
	}
	else
	{
		// disable and enble buttons
		m_btnOK.EnableWindow( TRUE );
		m_btnCancel.EnableWindow( TRUE );
		m_btnProxySet.EnableWindow( TRUE );
		m_btnRefreshServers.EnableWindow( TRUE );
		m_btnStop.EnableWindow( FALSE );
	}
}
Пример #27
0
void CSetBaseDlg::OnStart() 
{
	UpdateData( );

	CNetDatabase	netdb;
	if( !netdb.SetRootPath( AfxGetProfile().GetSelfDBPath(), IStStore::dbtypeSelfDB ) )
	{
		AfxMessageBox( IDS_ROOTPATH_ERROR, MB_OK | MB_ICONINFORMATION );
		return;
	}

	if( ( m_strFileF10.IsEmpty() && m_strFileTdx.IsEmpty() && m_strFileFxj.IsEmpty() && m_strPathFxjBlock.IsEmpty() )
		|| ( 0 != access(m_strFileF10,0) && 0 != access(m_strFileTdx,0) && 0 != access(m_strFileFxj,0) && 0 != access(m_strPathFxjBlock,0) ) )
	{
		AfxMessageBox( IDS_SETBASE_FILENOTEXISTS, MB_OK|MB_ICONINFORMATION );
		return;
	}

	m_btnStart.EnableWindow( FALSE );

	AfxGetApp()->WriteProfileString( "setbasedlg", "filef10", m_strFileF10 );
	AfxGetApp()->WriteProfileString( "setbasedlg", "filetdx", m_strFileTdx );
	AfxGetApp()->WriteProfileString( "setbasedlg", "filefxj", m_strFileFxj );
	AfxGetApp()->WriteProfileString( "setbasedlg", "pathfxjblock", m_strPathFxjBlock );

	m_ctrlProgress.SetWindowPos( NULL, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE );
	m_ctrlProgress.SetRange( 0, STKLIB_MAX_PROGRESS );
	m_ctrlProgress.SetPos( 0 );

	if( m_strFileF10.GetLength() > 0 )
	{
		CPackage	pac;
		pac.m_nType		=	CPackage::packageBasetext;
		pac.m_bIsZipped	=	( m_strFileF10.GetLength() > 4 && 0 == m_strFileF10.Right(4).CompareNoCase(".zip") );
		pac.m_strDescript	=	m_strFileF10;
		if( netdb.InstallPackageEx( pac, m_strFileF10, InstallBaseCallback, GetSafeHwnd() ) )
			AfxMessageBox( IDS_SETBASE_INSTALLF10OK, MB_OK|MB_ICONINFORMATION );
		else
			AfxMessageBox( IDS_SETBASE_INSTALLF10FAIL, MB_OK|MB_ICONINFORMATION );
	}
	
	if( m_strFileTdx.GetLength() > 0 )
	{
		CPackage	pac;
		pac.m_nType		=	CPackage::packageBasetable;
		pac.m_bIsZipped	=	( m_strFileTdx.GetLength() > 4 && 0 == m_strFileTdx.Right(4).CompareNoCase(".zip") );
		pac.m_strDescript	=	m_strFileTdx;
		if( netdb.InstallPackageEx( pac, m_strFileTdx, NULL, NULL ) )
			AfxMessageBox( IDS_SETBASE_INSTALLTDXOK, MB_OK|MB_ICONINFORMATION );
		else
			AfxMessageBox( IDS_SETBASE_INSTALLTDXFAIL, MB_OK|MB_ICONINFORMATION );
	}
	
	if( m_strFileFxj.GetLength() > 0 )
	{
		CPackage	pac;
		pac.m_nType		=	CPackage::packageBasetable;
		pac.m_bIsZipped	=	( m_strFileFxj.GetLength() > 4 && 0 == m_strFileFxj.Right(4).CompareNoCase(".zip") );
		pac.m_strDescript	=	m_strFileFxj;
		if( netdb.InstallPackageEx( pac, m_strFileFxj, NULL, NULL ) )
			AfxMessageBox( IDS_SETBASE_INSTALLFXJOK, MB_OK|MB_ICONINFORMATION );
		else
			AfxMessageBox( IDS_SETBASE_INSTALLFXJFAIL, MB_OK|MB_ICONINFORMATION );
	}

	if( m_strPathFxjBlock.GetLength() > 0 )
	{
		CPackage	pac;
		pac.m_nType		=	CPackage::packageCode;
		pac.m_bIsZipped	=	( m_strPathFxjBlock.GetLength() > 4 && 0 == m_strPathFxjBlock.Right(4).CompareNoCase(".zip") );
		pac.m_strDescript	=	m_strPathFxjBlock;

		BOOL bOK = FALSE;
		int	nFileCountTotal	=	CNetDatabase::GetFileCount( m_strPathFxjBlock, FALSE );

		DWORD	attr = GetFileAttributes( m_strPathFxjBlock );
		if( 0xFFFFFFFF != attr && (attr & FILE_ATTRIBUTE_DIRECTORY) )
			bOK =	netdb.InstallPackagePath( pac, m_strPathFxjBlock, InstallBaseCallback, GetSafeHwnd(), nFileCountTotal, 0, FALSE );
		else
			bOK =	netdb.InstallPackage( pac, m_strPathFxjBlock, InstallBaseCallback, GetSafeHwnd() );

		if( bOK )
		{
			AfxGetDomainContainer().Store( AfxGetProfile().GetDomainFile() );
			AfxMessageBox( IDS_SETBASE_INSTALLFXJBLOCKOK, MB_OK|MB_ICONINFORMATION );
		}
		else
			AfxMessageBox( IDS_SETBASE_INSTALLFXJBLOCKFAIL, MB_OK|MB_ICONINFORMATION );
	}

	m_ctrlProgress.SetPos( STKLIB_MAX_PROGRESS );
	m_btnStart.EnableWindow( TRUE );

	AfxGetStockContainer().ReloadBase( &AfxGetDB() );
	AfxGetSListStockContainer().ReRetrieveFromStatic( AfxGetActiveStrategy() );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_GRAPHVIEW, NULL );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_BASEVIEW, NULL );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_SLISTVIEW, NULL );
	AfxGetStaticDoc()->UpdateAllViews( NULL, UPDATE_HINT_SELECTORVIEW, NULL );
}
Пример #28
0
BOOL CMultiSort::RecalculateSortID( BOOL bReloadMinute, BOOL bUpdateWindow )
{
	BOOL	bModified	=	FALSE;
	// 备份,以判断是否改变
	CSPDWordArray	aRise, aFall, aDiff, aRiseMin5, aFallMin5, aVolRatio, aBSRatioAsc, aBSRatioDesc, aAmount;
	aRise.Copy( m_adwRise );
	aFall.Copy( m_adwFall );
	aDiff.Copy( m_adwDiff );
	aRiseMin5.Copy( m_adwRiseMin5 );
	aFallMin5.Copy( m_adwFallMin5 );
	aVolRatio.Copy( m_adwVolRatio );
	aBSRatioAsc.Copy( m_adwBSRatioAsc );
	aBSRatioDesc.Copy( m_adwBSRatioDesc );
	aAmount.Copy( m_adwAmount );

	BOOL	bOK	=	TRUE;
	if( !AfxGetStockContainer().GetMultiSortIDArray( m_adwRise, m_lMultiSortClass, SLH_DIFFPERCENT, FALSE, 6 ) )
		bOK	=	FALSE;

	if( !AfxGetStockContainer().GetMultiSortIDArray( m_adwFall, m_lMultiSortClass, SLH_DIFFPERCENT, TRUE, 6 ) )
		bOK	=	FALSE;

	if( !AfxGetStockContainer().GetMultiSortIDArray( m_adwDiff, m_lMultiSortClass, SLH_SCOPE, FALSE, 6 ) )
		bOK	=	FALSE;

	if( bReloadMinute )
	{
		AfxRefreshStockContainerMinute( AfxGetStockContainer(), m_lMultiSortClass, 1000 );
	}
	
	if( !AfxGetStockContainer().GetMultiSortIDArray( m_adwRiseMin5, m_lMultiSortClass, SLH_DIFFPERCENT_MIN5, FALSE, 6 ) )
		bOK	=	FALSE;
	if( !AfxGetStockContainer().GetMultiSortIDArray( m_adwFallMin5, m_lMultiSortClass, SLH_DIFFPERCENT_MIN5, TRUE, 6 ) )
		bOK	=	FALSE;

	if( !AfxGetStockContainer().GetMultiSortIDArray( m_adwVolRatio, m_lMultiSortClass, SLH_RATIO_VOLUME, FALSE, 6 ) )
		bOK	=	FALSE;

	if( !AfxGetStockContainer().GetMultiSortIDArray( m_adwBSRatioAsc, m_lMultiSortClass, SLH_SELLBUYRATIO, FALSE, 6 ) )
		bOK	=	FALSE;

	if( !AfxGetStockContainer().GetMultiSortIDArray( m_adwBSRatioDesc, m_lMultiSortClass, SLH_SELLBUYRATIO, TRUE, 6 ) )
		bOK	=	FALSE;

	if( !AfxGetStockContainer().GetMultiSortIDArray( m_adwAmount, m_lMultiSortClass, SLH_AMOUNT, FALSE, 6 ) )
		bOK	=	FALSE;

	if( !bUpdateWindow )
		return TRUE;

	if( !m_pParent || !::IsWindow(m_pParent->GetSafeHwnd()) )
		return TRUE;

	if( !aRise.IsEqualTo( m_adwRise ) )
		m_pParent->InvalidateRect( m_rectRise );
	if( !aFall.IsEqualTo( m_adwFall ) )
		m_pParent->InvalidateRect( m_rectFall );
	if( !aDiff.IsEqualTo( m_adwDiff ) )
		m_pParent->InvalidateRect( m_rectDiff );
	if( !aRiseMin5.IsEqualTo( m_adwRiseMin5 ) )
		m_pParent->InvalidateRect( m_rectRiseMin5 );
	if( !aFallMin5.IsEqualTo( m_adwFallMin5 ) )
		m_pParent->InvalidateRect( m_rectFallMin5 );
	if( !aVolRatio.IsEqualTo( m_adwVolRatio ) )
		m_pParent->InvalidateRect( m_rectVolRatio );
	if( !aBSRatioAsc.IsEqualTo( m_adwBSRatioAsc ) )
		m_pParent->InvalidateRect( m_rectBSRatioAsc );
	if( !aBSRatioDesc.IsEqualTo( m_adwBSRatioDesc ) )
		m_pParent->InvalidateRect( m_rectBSRatioDesc );
	if( !aAmount.IsEqualTo( m_adwAmount ) )
		m_pParent->InvalidateRect( m_rectAmount );
	
	return bModified;
}
Пример #29
0
UINT AfxRecalculateYield( int nDays, BOOL bReport )
{
	// 计算市场年平均收益率
	double	market_yield_average = 0.0, market_yield_d = 0.0;
	double	market_dayyield_average = 0.0, market_dayyield_d = 0.0;
	CKData	& kdayMain	=	AfxGetStockMain().GetKDataDay();

	if( kdayMain.GetSize() <= nDays )
	{
		if( bReport )
			AfxMessageBox( IDS_RECALYIELD_NOSZZS, MB_OK | MB_ICONINFORMATION );
		return 0;
	}
	BOOL bmarket_yield_ok = CalculateYieldYear( kdayMain, &market_yield_average, &market_yield_d, nDays );
	BOOL bmarket_dayyield_ok = CalculateYieldDay( kdayMain, &market_dayyield_average, &market_dayyield_d, nDays );

	if( !bmarket_yield_ok && !bmarket_dayyield_ok )
	{
		if( bReport )
			AfxMessageBox( IDS_RECALYIELD_NOSZZS, MB_OK | MB_ICONINFORMATION );
	}
	
	// 开始生成结果数据
	CStockContainer & container = AfxGetStockContainer();
	int	nCount	=	0;
	// 等待对话框
	CWaitDlg	*	pWait	=	NULL;
	if( bReport )
	{
		pWait	=	new CWaitDlg( AfxGetMainWnd() );
		pWait->SetProgressRange( 0, container.GetSize()-1 );
	}
	for( int i=0; i<container.GetSize(); i++ )
	{
		if( pWait )
		{
			pWait->SetProgress( i );
			if( pWait->WaitForCancel( ) )
				break;
		}

		CStockInfo	& info	=	container.ElementAt(i);

		LONG	stocktype	=	info.GetType();
		if( CStock::typeshIndex != stocktype && CStock::typeshA != stocktype && CStock::typeshB != stocktype
			&& CStock::typeszIndex != stocktype && CStock::typeszA != stocktype && CStock::typeszB != stocktype )
			continue;

		CStock	stock;
		stock.SetStockInfo( &info );
		AfxPrepareStockData(&AfxGetDB(),stock,CKData::ktypeDay,CKData::formatXDRup,CKData::mdtypeClose,TRUE,TRUE);
		CKData	& kday	=	stock.GetKDataDay();

		info.m_fYield_average		=	(float)STKLIB_DATA_INVALID;
		info.m_fYield_stddev		=	(float)STKLIB_DATA_INVALID;
		info.m_fBeite				=	(float)STKLIB_DATA_INVALID;

		double	yield_average = 0., yield_d = 0., beite = 0. ;
		if( CalculateYieldYear( kday, &yield_average, &yield_d, nDays ) )
		{
			info.m_fYield_average	=	(float)( 100. * yield_average );
			info.m_fYield_stddev	=	(float)( 100. * yield_d );
			if( bmarket_yield_ok && CalculateBeiteYear( kday, kdayMain, market_yield_average, market_yield_d, &beite, nDays ) )
				info.m_fBeite		=	(float)( beite );
			else if( bmarket_dayyield_ok && CalculateBeiteDay( kday, kdayMain, market_dayyield_average, market_dayyield_d, &beite, nDays ) )
				info.m_fBeite		=	(float)( beite );
		}
		else if( CalculateYieldDay( kday, &yield_average, &yield_d, nDays ) )
		{
			info.m_fYield_average	=	(float)( 100. * (pow(1+yield_average,STKLIB_DAYS_INONEYEAR)-1) );
			info.m_fYield_stddev	=	(float)( 100. * sqrt((double)STKLIB_DAYS_INONEYEAR) * yield_d );
			if( bmarket_dayyield_ok && CalculateBeiteDay( kday, kdayMain, market_dayyield_average, market_dayyield_d, &beite, nDays ) )
				info.m_fBeite		=	(float)( beite );
		}

		nCount	++;
	}

	// 保存到硬盘文件
	AfxGetDB().StoreBasetable( container );

	// 关闭等待对话框和目标文件
	if( pWait )
	{
		pWait->DestroyWindow();
		delete	pWait;
	}

	return nCount;
}
Пример #30
0
int CDomainComboBox::InitStrings( BOOL bHasClass, BOOL bHasDomain, CDomainContainer & groups )
{
	ResetContent( );

	CDomainContainer & domains = AfxGetDomainContainer( );
	CStockContainer & container = AfxGetStockContainer();

	int	nItemCount	=	groups.GetSize();
	if( bHasClass )		nItemCount	+=	8;
	if( bHasDomain )	nItemCount	+=	domains.GetSize();
	
	// Init Storage
	InitStorage( nItemCount, 32 );
	CString	strGroup;

	if( bHasClass )
	{
		strGroup.LoadString( IDS_DOMAIN_ALL );
		int nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeAll );

		strGroup.LoadString( IDS_DOMAIN_INDEX );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeIndex );
		
		strGroup.LoadString( IDS_DOMAIN_CLASSSHAA );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeClassShaa );

		strGroup.LoadString( IDS_DOMAIN_CLASSSHAB );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeClassShab );

		strGroup.LoadString( IDS_DOMAIN_CLASSSZNA );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeClassSzna );

		strGroup.LoadString( IDS_DOMAIN_CLASSSZNB );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeClassSznb );

		strGroup.LoadString( IDS_DOMAIN_CLASSSHABOND );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeClassShabond );

		strGroup.LoadString( IDS_DOMAIN_CLASSSZNBOND );
		nItem = AddString( strGroup );
		SetItemData( nItem, CStockContainer::typeClassSznbond );
	}

	// Domains
	if( bHasDomain )
	{
		for( int i=0; i<domains.GetSize(); i++ )
		{
			CDomain	& domain = domains.ElementAt(i);
			int nItem = AddString( domain.m_strName );
			SetItemData( nItem, CStockContainer::typeDomain );
		}
	}

	// Groups
	for( int i=0; i<groups.GetSize(); i++ )
	{
		CDomain	& domain = groups.ElementAt(i);
		int nItem = AddString( domain.m_strName );
		SetItemData( nItem, CStockContainer::typeGroup );
	}

	return nItemCount;
}