mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 20:42:26 +00:00
[Feature] Add Relative Rotation To openbb-technical and openbb-charting (#6277)
* add relative rotation * router examples * docstring * test params * black * name of test functions * router example description * fix NoneType is not iterable * clear print * linting * black * revert that one place, it can stay None * forgot that file in the commit * some cleanup * improving the get_type_name funciton a bit * query_params types * pylint --------- Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> Co-authored-by: Henrique Joaquim <henriquecjoaquim@gmail.com> Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>
This commit is contained in:
@@ -926,3 +926,45 @@ def test_technical_ema(params, data_type, obb):
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
|
||||
|
||||
@parametrize(
|
||||
"params",
|
||||
[
|
||||
(
|
||||
{
|
||||
"data": "",
|
||||
"study": "price",
|
||||
"benchmark": "SPY",
|
||||
"long_period": 252,
|
||||
"short_period": 21,
|
||||
"window": 21,
|
||||
"trading_periods": 252,
|
||||
"chart_params": {"show_tails": False},
|
||||
}
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_technical_relative_rotation(params, obb):
|
||||
params["data"] = obb.equity.price.historical(
|
||||
"AAPL,MSFT,GOOGL,AMZN,SPY",
|
||||
provider="yfinance",
|
||||
start_date="2022-01-01",
|
||||
end_date="2024-01-01",
|
||||
).results
|
||||
result = obb.technical.relative_rotation(
|
||||
data=params["data"],
|
||||
benchmark=params["benchmark"],
|
||||
study=params["study"],
|
||||
long_period=params["long_period"],
|
||||
short_period=params["short_period"],
|
||||
window=params["window"],
|
||||
trading_periods=params["trading_periods"],
|
||||
)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert hasattr(result.results, "rs_ratios")
|
||||
assert len(result.results.rs_ratios) > 0 # type: ignore
|
||||
assert hasattr(result.results, "rs_momentum")
|
||||
assert len(result.results.rs_momentum) > 0 # type: ignore
|
||||
|
||||
Reference in New Issue
Block a user