How to use the xalpha.get_rt function in xalpha

To help you get started, we’ve selected a few xalpha examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github refraction-ray / xalpha / tests / test_universal.py View on Github external
def test_get_ttjj():
    assert xa.get_rt("F501018")["name"] == "南方原油A"
    assert xa.get_rt("F511600")["type"] == "货币型"
github refraction-ray / xalpha / tests / test_universal.py View on Github external
def test_get_xueqiu_rt():
    assert xa.get_rt("PDD")["currency"] == "USD"
    assert xa.get_rt("03333")["name"] == xa.get_rt("HK03333")["name"]
    assert isinstance(xa.get_rt("SH501018")["percent"], float)
github refraction-ray / xalpha / tests / test_universal.py View on Github external
def test_get_ft_rt():
    assert xa.get_rt("FT-INX:IOM")["currency"] == "USD"
    assert xa.get_rt("FTC-WTI+Crude+Oil")["name"] == "NYMEX Crude Oil Front Month"
github refraction-ray / xalpha / tests / test_universal.py View on Github external
def test_get_investing_rt():
    assert xa.get_rt("currencies/usd-cny")["currency"] == None
    assert xa.get_rt("/indices/germany-30")["name"] == "德国DAX30指数 (GDAXI)"
    ext = xa.get_rt("equities/pinduoduo")["current_ext"]
    assert isinstance(ext, float) or (ext is None)
github refraction-ray / xalpha / tests / test_universal.py View on Github external
def test_get_ft_rt():
    assert xa.get_rt("FT-INX:IOM")["currency"] == "USD"
    assert xa.get_rt("FTC-WTI+Crude+Oil")["name"] == "NYMEX Crude Oil Front Month"
github refraction-ray / xalpha / tests / test_universal.py View on Github external
def test_get_xueqiu_rt():
    assert xa.get_rt("PDD")["currency"] == "USD"
    assert xa.get_rt("03333")["name"] == xa.get_rt("HK03333")["name"]
    assert isinstance(xa.get_rt("SH501018")["percent"], float)
github refraction-ray / xalpha / tests / test_universal.py View on Github external
def test_get_sina_rt():
    assert xa.get_rt("PDD", _from="sina")["currency"] == "USD"
    xa.get_rt("HK00700", double_check=True)  # 港股 sina 实时数据延迟, 代码前需加 rt_ 方可获取实时
    xa.get_rt("SH600000", double_check=True)
github refraction-ray / xalpha / tests / test_universal.py View on Github external
def test_get_sina_rt():
    assert xa.get_rt("PDD", _from="sina")["currency"] == "USD"
    xa.get_rt("HK00700", double_check=True)  # 港股 sina 实时数据延迟, 代码前需加 rt_ 方可获取实时
    xa.get_rt("SH600000", double_check=True)
github refraction-ray / xalpha / doc / samples / qdiipred.py View on Github external
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:
    try:
        p = xa.RTPredict(c)
        data["t0"].append(round(p.get_t0(return_date=False), 4))
        data["t0rate"].append(round(p.get_t0_rate(return_date=False), 2))
        data["t1"].append(xa.get_rt("F" + c[2:])["current"])
        data["t1rate"].append("-")
        data["position"].append("-")
        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)
df = pd.DataFrame(data)

htmlstr = (
    """