策略为王源代码分析-主力大单和盘中预警处理窗口

Published

1.收到分笔数据后

G:\stock\TskingVS2019\src\Client\StkNet\Src\StkReceiver.cpp

//主力大单和盘中预警处理 by freeman
void CStkReceiver::OnReceiveReport(REPORT * pReport)
{
	CStockContainer & container = AfxGetStockContainer();
	REPORT reportLast;
	if (!UpdateStockContainerByREPORT(container, pReport, TRUE, &reportLast))
		return;

	CStockInfo infoCur;

	// 主力大单
	if (container.GetStockInfo(pReport->m_szCode, &infoCur, NULL))
	{
		if (0 != reportLast.m_time && reportLast.m_time < pReport->m_time
			&& pReport->m_fVolume - reportLast.m_fVolume >= 100000
			&& !infoCur.IsIndex() && !infoCur.IsBond() && !infoCur.IsFund() && !infoCur.IsBondIndex())
		{
			REPORT	report;
			memcpy(&report, pReport, sizeof(report));
			report.m_fVolume	=	pReport->m_fVolume - infoCur.m_reportLatest.m_fVolume;
			report.m_fAmount	=	pReport->m_fAmount - infoCur.m_reportLatest.m_fAmount;
			AfxGetDB().StoreReport(&report, 1, TRUE);
		}
	}

	// 指数发生变化
	if (0 == strncmp(pReport->m_szCode, STKLIB_CODE_MAIN, sizeof(pReport->m_szCode))
		|| 0 == strncmp(pReport->m_szCode, STKLIB_CODE_MAINSZN, sizeof(pReport->m_szCode)))
	{
		NotifyWndRcvAlarm(STKRCV_ALARM_REFRESH, 0);
	}

	// 盘中预警在此处加入
	if (AfxGetAlarmContainer().OnReceiveReport(&infoCur, pReport, &reportLast))
	{
		NotifyWndRcvAlarm(STKRCV_ALARM_WARNING, 0);
	}
}