Ejemplo n.º 1
0
def test_mfundinfo():
    zogqb.bcmkset(xa.cashinfo())
    assert round(zogqb.total_annualized_returns('2018-08-01'), 3) == 0.036
    with pytest.raises(FundTypeError) as excinfo:
        xa.fundinfo("001211")
    assert str(excinfo.value
               ) == "This code seems to be a mfund, use mfundinfo instead"
Ejemplo n.º 2
0
import sys

sys.path.insert(0, "../")
import xalpha as xa
from xalpha.exceptions import FundTypeError
import pandas as pd
import pytest

ioconf = {"save": True, "fetch": True, "path": "pytest", "form": "csv"}
ca = xa.cashinfo(interest=0.0002, start="2015-01-01")
zzhb = xa.indexinfo("0000827", **ioconf)
hs300 = xa.fundinfo("000311")
zogqb = xa.mfundinfo("001211", **ioconf)


def test_fundreport():
    # somehow fragile, to be checked
    r = xa.FundReport("000827")
    assert r.get_report()[0][:2] == "广发"
    assert r.analyse_report(1)["bank"][:2] == "兴业"
    assert r.show_report_list(type_=0)[0]["FUNDCODE"] == "000827"
    assert r.get_report(id_="AN202003171376532533")[0][:2] == "广发"


def test_cash():
    assert (
        round(ca.price[ca.price["date"] == "2018-01-02"].iloc[0].netvalue, 4) == 1.2453
    )
    assert ca.code == "mf"
    date, value, share = ca.shuhui(
        300, "2018-01-01", [[pd.Timestamp("2017-01-03"), 200]]
Ejemplo n.º 3
0
def test_mfundinfo():
    zogqb.bcmkset(xa.cashinfo())
    assert round(zogqb.total_annualized_returns('2018-08-01'), 3) == 0.036