Example #1
0
    else:
        print 'CZCE', "持仓排名top20数据已经存在"

    # GetDCEPosition(info,startdate,"DCE")            #大商所持仓信息
    #
    # GetSHFEPosition(info, startdate, "SHFE")        # 上期所
    # #
    # GetCZCEPosition(info, startdate, "CZCE")        # 郑商所阶段性前20名

    # GetDCEStagedTurnover(info,startdate,"DCE")      #阶段性成交


if __name__ == "__main__":
    info = InfoApi()
    info.GetDbHistoryConnect()
    info.Get_Msplider()

    t = NextTradingDay.TradingDay(info)
    startdate = datetime.datetime.now() - datetime.timedelta(days=7)
    startdate = t.NextTradingDay(startdate.strftime("%Y%m%d"), False)
    startdate = datetime.datetime.strptime(startdate, "%Y%m%d")

    enddate = datetime.datetime.now()
    mysplider = info.mysplider

    while startdate.strftime("%Y%m%d") <= enddate.strftime("%Y%m%d"):
        print startdate,
        main(startdate, mysplider, info)
        startdate = t.NextTradingDay(startdate.strftime("%Y%m%d"), True)
        startdate = datetime.datetime.strptime(startdate, "%Y%m%d")
Example #2
0
    else:
        print TradingDay, "中金所期货结算结算数据已经存在"


def main(startdate, infoapi):
    CFFEXSettlementDetail(startdate, infoapi)  # 上期所保证金手续费相关信息

    CZCESettlementDetail(startdate, infoapi)  # 郑商所保证金手续费信息

    DCESettlementDetail(startdate, infoapi)  # 大商所保证金手续费信息

    SHFESettlementDetail(startdate, infoapi)  #上期所保证金手续费相关信息


if __name__ == "__main__":
    infoapi = InfoApi()
    infoapi.Get_Msplider()
    t = TradingDay(infoapi)
    startdate = datetime.datetime.now() - datetime.timedelta(days=7)
    startdate = t.NextTradingDay(startdate.strftime("%Y%m%d"), False)
    startdate = datetime.datetime.strptime(startdate, "%Y%m%d")
    enddate = datetime.datetime.now()
    if enddate.hour < 16:
        enddate = t.NextTradingDayFuture(enddate.strftime("%Y%m%d"), False)
        enddate = datetime.datetime.strptime(enddate, "%Y%m%d")
    while startdate.strftime("%Y%m%d") <= enddate.strftime("%Y%m%d"):
        print startdate
        main(startdate, infoapi)
        startdate = t.NextTradingDay(startdate.strftime("%Y%m%d"), True)
        startdate = datetime.datetime.strptime(startdate, "%Y%m%d")