def test_con1_con3_rate(): env = FormulaEnv(id=2, unit="", pre_data=DBPreProcess(id=1, varieties='zn')) env.introduction = "沪%s连1-连3合约高于预警指数%s元" env.varieties = Zn env.contract = CON_CONTRACT_1 env.exchange = SHFE env.price = CON1_CON3_DIFF_RATE data = REFD(env, CON1_CON3_DIFF_RATE, n=3) print("连1-连3差价:", data)
def test_open_price(): env = FormulaEnv(id=2, unit="", pre_data=DBPreProcess(id=1, varieties='cu')) env.introduction = "沪铜开盘价连续下跌3天" env.contract = CON_CONTRACT_1 env.varieties = Cu env.exchange = SHFE env.price = OPEN data = REFD(env, OPEN, 10) # d1, d2, gd, rate = data_gap(data) print("data: %s", data)
def test_spot_zn(): env = FormulaEnv(id=2, unit="", pre_data=DBPreProcess(id=1, varieties='zn')) # env.introduction = "沪%s交割月%s合约持仓:仓单环比连续上涨%s天" env.varieties = Zn # env.exchange = SHFE # env.source = SHMET # env.contract = CON_CONTRACT_1 env.price = SPOT data = REFD(env, SPOT, 3) print("现货价格data: ", data)
def test_exchange_rate(): """ 持仓比 :return: """ env = FormulaEnv(id=2, unit="", pre_data=DBPreProcess(id=1, varieties='cu')) env.introduction = "汇率" env.varieties = Cu env.exchange = SHFE env.contract = CON_CONTRACT_1 env.price = EXCHANGE data = REFD(env, EXCHANGE, n=10) print("汇率data: ", data)
def test_cross_star(): """ 十字星 :return: """ env = FormulaEnv(id=2, unit="", pre_data=DBPreProcess(id=1, varieties='cu')) env.introduction = "沪铜十字星" env.contract = MAIN_CONTRACT env.varieties = Cu env.exchange = SHFE env.price = CROSS_STAR data = REFD(env, CROSS_STAR, n=10) print("十字星data: ", data)