精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
锐英源精品原创,禁止转载和任何形式的非法内容使用,违者必究
除权就是除下K线值,不除会有缺口不连续。代码如下:
BOOL CDay::PowKline(Kline* pdyAll, Kline* pLast, const MAPSTPOW& pow) { OEM_SPLIT* pTmp; MAPSTPOW::const_iterator itQ = pow.upper_bound(pdyAll->day); for (; itQ != pow.end(); itQ++) { pTmp = itQ->second; if (pTmp->give != 0.0f) {//送股 //pdyAll->m_fVolume *= (pTmp->give / 10.0f) + 1.0f; pdyAll->open /= (pTmp->give / 10.0f) + 1.0f; pdyAll->high /= (pTmp->give / 10.0f) + 1.0f; pdyAll->low /= (pTmp->give / 10.0f) + 1.0f; pdyAll->close /= (pTmp->give / 10.0f) + 1.0f; } if (pLast->close > 0.0001) { if (pTmp->allocate != 0.0f) {//配股 //配股价pTmp->price //pdyAll->m_fVolume *= ((pLast->m_fClose - pTmp->price) * pTmp->allocate / 10.0f / pLast->m_fClose + 1.0f); pdyAll->open /= ((pLast->close - pTmp->price) * pTmp->allocate / 10.0f / pLast->close + 1.0f); pdyAll->high /= ((pLast->close - pTmp->price) * pTmp->allocate / 10.0f / pLast->close + 1.0f); pdyAll->low /= ((pLast->close - pTmp->price) * pTmp->allocate / 10.0f / pLast->close + 1.0f); pdyAll->close /= ((pLast->close - pTmp->price) * pTmp->allocate / 10.0f / pLast->close + 1.0f); } if (pTmp->earnings != 0.0f) {//每股红利 //pdyAll->m_fVolume *= pTmp->earnings / 10.0f / pLast->m_fClose + 1; pdyAll->open /= pTmp->earnings / 10.0f / pLast->close; pdyAll->high /= pTmp->earnings / 10.0f / pLast->close; pdyAll->low= pTmp->earnings / 10.0f / pLast->close; pdyAll->close/= pTmp->earnings / 10.0f / pLast->close; } } } return TRUE; }
OEM_SPLIT是网际风股票接口数据结构。
锐英源软件擅长开发股票K线类软件,也擅长各类通信软件,股票自定义算法公式,欢迎合作。左侧有联系方式。