How to use the xalpha.mul 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_trade.py View on Github external
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
github refraction-ray / xalpha / tests / test_i.py View on Github external
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
    c.v_category_positions()
    c.get_stock_holdings(date="2020-04-08")
    c.get_portfolio(date="20200501")
github refraction-ray / xalpha / tests / test_trade.py View on Github external
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