FAQ > 金融建模 > 数据提取 > 行情数据

Q:取BegT到EndT的高频数据时,取出来的数据却只到EndT前一个交易日的    

  • A:
    情况一:EndT非交易日;
    情况二:请注意,当系统周期设为比日高的频率(即60分钟线、30分钟线、5分钟线、分钟线、秒线等)时,EndT只写年月日,相当于该日期的零点零分,举例如下:

    SetSysParam(PN_Cycle(),cy_1m());
    BegT:=inttodate(20110330);
    EndT:=inttodate(20110331);
    return select datetimetostr(['date']) as '日期',['close'] as '收盘价'
    from markettable datekey BegT to EndT of 'SH600000' end;
    //返回结果只有2011年3月30日的分钟线数据

    此时,为了取出EndT的数据,可设置EndT+=16/24(收盘),EndT+=0.9999(EndT的23点59分)或者EndT+=1(EndT的第二天),只要所加的值在16/24与1之间,都满足;参考范例如下:

    SetSysParam(PN_Cycle(),cy_1m());
    BegT:=inttodate(20110330);
    EndT:=inttodate(20110331)+16/24;
    return select datetimetostr(['date']) as '日期',['close'] as '收盘价'
    from markettable datekey BegT to EndT of 'SH600000' end;
    //返回结果只有2011年3月30日和2011年3月31日的分钟线数据