示例#1
0
def test_rt_predict():
    p = xa.RTPredict("SH512500", t0dict="SH000905")
    p.get_t0_rate()
示例#2
0
    p = xa.QDIIPredict(c, fetch=True, save=True, positions=True)
    try:
        data["t1"].append(round(p.get_t1(return_date=False), 4))
        data["t1rate"].append(round(p.get_t1_rate(return_date=False), 2))
        try:
            data["t0"].append(round(p.get_t0(return_date=False), 4))
            data["t0rate"].append(round(p.get_t0_rate(return_date=False), 2))
        except ValueError:
            data["t0"].append("-")
            data["t0rate"].append("-")
        data["position"].append(round(p.get_position(return_date=False), 3))
        data["now"].append(xa.get_rt(c)["current"])
        data["code"].append(c)
        data["name"].append(xa.get_rt(c)["name"])
    except xa.exceptions.NonAccurate as e:
        print("%s cannot be predicted exactly now" % c)
        print(e.reason)
for c in nonqdiis:
    p = xa.RTPredict(c)
    data["t1"].append(xa.get_rt("F" + c[2:])["current"])
    data["t1rate"].append("-")
    data["t0"].append(round(p.get_t0(return_date=False), 4))
    data["t0rate"].append(round(p.get_t0_rate(return_date=False), 2))
    data["position"].append("-")
    data["now"].append(xa.get_rt(c)["current"])
    data["code"].append(c)
    data["name"].append(xa.get_rt(c)["name"])
df = pd.DataFrame(data)
with open("demo.html", "w") as f:
    df.to_html(f)