def init():
    #(1) 更新t_position,没有就插入
    dao.updateAllPosition(max, jqdata_security)
    #(2) 更新CTA_setting.json
    with open('CTA_setting.json', 'w') as json_file:
        json_file.write(
            json.dumps([{
                "name":
                strategy,
                "className":
                strategy,
                "vtSymbol":
                util.get_CTA_setting_dominant_future(
                    jqSecurity=jqdata_security)
            }]))
        print "################# My t_position and CTA_setting.json REFRESH! ######################"
Exemple #2
0
def init():
    #(1) 更新t_position,没有就插入
    dao.updateAllPosition(duo=duo, kon=kon, max=max, security=jqdata_security)
    #(2) 更新CTA_setting.json
    vtSymbol = util.get_CTA_setting_dominant_future(jqSecurity=jqdata_security)
    #(3)riskcontrol重设
    controlRisk = ControlRisk(security=jqdata_security, ctaEngine=None)
    controlRisk.releaseAll()
    controlRisk.setOpenKonPrice(price=init_realOpenKonPrice)
    controlRisk.setOpenDuoPrice(price=init_realOpenDuoPrice)
    if init_realOpenDuoPrice is not None or init_realOpenKonPrice is not None:
        controlRisk.activeLocking()
    with open('CTA_setting.json', 'w') as json_file:
        json_file.write(
            json.dumps([{
                "name": strategy,
                "className": strategy,
                "vtSymbol": vtSymbol
            }]))
        print "################# My t_position and CTA_setting.json REFRESH! ######################"