def test_mul_properties(): hl_m = xa.mul(status=statnb, **ioconf) assert (round( hl_m.totcftable[hl_m.totcftable["date"] == "2020-03-06"].iloc[0] ["cash"], 2) == 339.89) assert round(hl_m.fundtradeobj[2].cftable.iloc[1]["cash"], 2) == 1000 hl_m2 = xa.mul(status=statnb, property={"002758": 0}, **ioconf) # print(hl_m2.fundtradeobj[2].cftable) assert round(hl_m2.fundtradeobj[2].cftable.iloc[1]["share"], 2) == -926.0
def test_mul_properties(): hl_m = xa.mul(status=statnb, **ioconf) assert (round( hl_m.totcftable[hl_m.totcftable["date"] == "2020-03-06"].iloc[0] ["cash"], 2) == 339.89) assert round(hl_m.fundtradeobj[2].cftable.iloc[1]["cash"], 2) == 1000 d = hl_m.get_portfolio_holdings(date="20190801") d2 = hl_m.get_industry_holdings(date="20190201") assert round(d["stock"], 2) == 299.85 assert round(d2["银行"], 2) == 48.29 hl_m2 = xa.mul(status=statnb, property={"002758": 0}, **ioconf) # print(hl_m2.fundtradeobj[2].cftable) assert round(hl_m2.fundtradeobj[2].cftable.iloc[1]["share"], 2) == -926.0
def test_ttjj_oversea_trade(): stt = pd.DataFrame({ "date": ["20200921"], "100032": [1000], "968012": [1034] }) s = xa.mul(status=xa.record(stt)) df = s.summary("2020-09-30") assert df[df["基金代码"] == "968012"].iloc[0]["基金收益总额"] == -20.01
def test_imul(): c = xa.imul(status=ir) assert round(c.combsummary("20200309").iloc[0]["投资收益率"], 2) == -1.39 c.v_positions() c = xa.mul(cm_t, status=orc, istatus=ir, **ioconf) assert round(c.combsummary("20200309").iloc[0]["投资收益率"], 2) == 0.49 c.v_category_positions() c.get_stock_holdings(date="2020-04-08") c.get_portfolio(date="20200501")
def test_imul(): c = xa.imul(status=ir) assert round(c.combsummary("20200309").iloc[0]["投资收益率"], 2) == -1.39 c.v_positions() c = xa.mul(status=orc, istatus=ir, **ioconf) assert round(c.combsummary("20200309").iloc[0]["投资收益率"], 2) == 0.49