您现在的位置:程序化交易>> 期货公式>> 金字塔等>> 金字塔知识>>正文内容

C++如何获取更多的历史数据和历史指标数据 [金字塔]

  • 咨询内容: 如下代码,我需要获取15分钟K线的数据和MACD,SAR指标数据,但最多只能获取到14个,请问有什么办法能获取更多的吗?
    STKINDIEX_EXTFUN_ST stFormulaData = {0}; stFormulaData.m_nMarket = 'JZ'; strcpy(stFormulaData.m_szLabel,"IF06"); //调用浦发银行数据 memset(stFormulaData.m_szIndiName, 0, 256); //strcpy(stFormulaData.m_szIndiName,"MA.MA2(5,10,20,60)"); //调用MA指标的MA2指标线 strcpy(stFormulaData.m_szIndiName,"SAR.SARV"); //调用MA指标的MA2指标线 stFormulaData.m_nCoType = 0; stFormulaData.m_nPeriod = 2;  //stFormulaData.m_nPower = 1;  stFormulaData.m_nDataNum = 1000; //调用最近1000周期数据
    //通过扩展函数调用 STKINDIEX_EXTFUN_DATA_RET * pSARData = (STKINDIEX_EXTFUN_DATA_RET*)g_pMainFormework->ExpandFunction(&stFormulaData,STKINDIEX_EXTFUN); memset(stFormulaData.m_szIndiName, 0, 256); strcpy(stFormulaData.m_szIndiName,"MACD.DEA"); //调用MA指标的MA2指标线 STKINDIEX_EXTFUN_DATA_RET * pMACDData = (STKINDIEX_EXTFUN_DATA_RET*)g_pMainFormework->ExpandFunction(&stFormulaData,STKINDIEX_EXTFUN);
    PCALCINFO stData = {0}; stData.m_dataType = MIN15_DATA;//日线 //stData.m_bIsPow = 1; //是否复权 stData.m_wMarket = 'JZ'; strcpy(stData.m_szLabel,"IF06"); //读取600000 浦发银行数据 if(g_pMainFormework->GetDataInfo(&stData)==0 || pSARData->m_nDataCount <= 0 || pMACDData->m_nDataCount <= 0) { AfxMessageBox("调用失败。"); return; }
    CString strMsg; strMsg.Format("%d, %d, %d",stData.m_nNumData,pSARData->m_nDataCount,pMACDData->m_nDataCount); AfxMessageBox(strMsg);
    int nSize = pSARData->m_nDataCount; if(nSize > pMACDData->m_nDataCount) nSize = pMACDData->m_nDataCount; if(nSize > stData.m_nNumData) nSize = stData.m_nNumData;
    CString strAllData; for(int i=0; i<nSize; i++) { CString strOneData; COleDateTime time = pSARData->m_pValues[i].m_timeDate; strOneData.Format("%s,%f,%f,%f,%f,%f,%f,%f\n",time.Format("%Y/%m/%d %H:%M:%S"),stData.m_pMainData[i].m_fOpen, stData.m_pMainData[i].m_fHigh, stData.m_pMainData[i].m_fLow, stData.m_pMainData[i].m_fClose, stData.m_pMainData[i].m_fVolume, pSARData->m_pValues[i].m_dbValues, pMACDData->m_pValues[i].m_dbValues); strAllData += strOneData; }
    CFile file; file.Open("D:\\data.txt",CFile::modeCreate|CFile::modeReadWrite); file.Write(strAllData,strAllData.GetLength()); file.Close();
    AfxMessageBox("OK"); return;

     

  • 金字塔客服: 打开图表看下本地数据是否齐全。

 

有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友

可联系技术人员 QQ: 511411198  点击这里给我发消息进行 有偿 编写!不贵!点击查看价格!


【字体: 】【打印文章】【查看评论

相关文章

    没有相关内容