mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 04:52:07 +00:00
Update the quantitative extension to make more sense (#6087)
* Split out a rolling submenu for the rolling functions * Make a performance and a stats submenu. * Test the statistics functions * lint * lint * dupe test * pylint * ruff * Try tests quick * black magic signature funcs * fix my custom tests * Fix the existing imports/urls * push the api update * okay I figured out whats going on * this should be all of them * Correct docstringing examples --------- Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
This commit is contained in:
@@ -117,11 +117,11 @@ def test_quantitative_capm(params, data_type, obb):
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_quantitative_omega_ratio(params, data_type, obb):
|
||||
def test_quantitative_performance_omega_ratio(params, data_type, obb):
|
||||
params = {p: v for p, v in params.items() if v}
|
||||
params["data"] = get_data(data_type)
|
||||
|
||||
result = obb.quantitative.omega_ratio(**params)
|
||||
result = obb.quantitative.performance.omega_ratio(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
|
||||
@@ -134,11 +134,11 @@ def test_quantitative_omega_ratio(params, data_type, obb):
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_quantitative_kurtosis(params, data_type, obb):
|
||||
def test_quantitative_rolling_kurtosis(params, data_type, obb):
|
||||
params = {p: v for p, v in params.items() if v}
|
||||
params["data"] = get_data(data_type)
|
||||
|
||||
result = obb.quantitative.kurtosis(**params)
|
||||
result = obb.quantitative.rolling.kurtosis(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
@@ -203,11 +203,11 @@ def test_quantitative_unitroot_test(params, data_type, obb):
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_quantitative_sharpe_ratio(params, data_type, obb):
|
||||
def test_quantitative_performance_sharpe_ratio(params, data_type, obb):
|
||||
params = {p: v for p, v in params.items() if v}
|
||||
params["data"] = get_data(data_type)
|
||||
|
||||
result = obb.quantitative.sharpe_ratio(**params)
|
||||
result = obb.quantitative.performance.sharpe_ratio(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
|
||||
@@ -240,11 +240,11 @@ def test_quantitative_sharpe_ratio(params, data_type, obb):
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_quantitative_sortino_ratio(params, data_type, obb):
|
||||
def test_quantitative_performance_sortino_ratio(params, data_type, obb):
|
||||
params = {p: v for p, v in params.items() if v}
|
||||
params["data"] = get_data(data_type)
|
||||
|
||||
result = obb.quantitative.sortino_ratio(**params)
|
||||
result = obb.quantitative.performance.sortino_ratio(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
|
||||
@@ -256,11 +256,11 @@ def test_quantitative_sortino_ratio(params, data_type, obb):
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_quantitative_skewness(params, data_type, obb):
|
||||
def test_quantitative_rolling_skew(params, data_type, obb):
|
||||
params = {p: v for p, v in params.items() if v}
|
||||
params["data"] = get_data(data_type)
|
||||
|
||||
result = obb.quantitative.skewness(**params)
|
||||
result = obb.quantitative.rolling.skew(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
@@ -292,11 +292,11 @@ def test_quantitative_skewness(params, data_type, obb):
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_quantitative_quantile(params, data_type, obb):
|
||||
def test_quantitative_rolling_quantile(params, data_type, obb):
|
||||
params = {p: v for p, v in params.items() if v}
|
||||
params["data"] = get_data(data_type)
|
||||
|
||||
result = obb.quantitative.quantile(**params)
|
||||
result = obb.quantitative.rolling.quantile(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
@@ -317,3 +317,228 @@ def test_quantitative_summary(params, data_type, obb):
|
||||
result = obb.quantitative.summary(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
|
||||
|
||||
@parametrize(
|
||||
"params, data_type",
|
||||
[
|
||||
(
|
||||
{
|
||||
"data": "",
|
||||
"target": "close",
|
||||
"window": "10",
|
||||
"quantile_pct": "",
|
||||
"index": "date",
|
||||
},
|
||||
"equity",
|
||||
),
|
||||
(
|
||||
{
|
||||
"data": "",
|
||||
"target": "high",
|
||||
"window": "50",
|
||||
"quantile_pct": "0.6",
|
||||
"index": "date",
|
||||
},
|
||||
"crypto",
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_quantitative_rolling_stdev(params, data_type, obb):
|
||||
params = {p: v for p, v in params.items() if v}
|
||||
params["data"] = get_data(data_type)
|
||||
|
||||
result = obb.quantitative.rolling.stdev(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
|
||||
|
||||
@parametrize(
|
||||
"params, data_type",
|
||||
[
|
||||
(
|
||||
{
|
||||
"data": "",
|
||||
"target": "close",
|
||||
"window": "10",
|
||||
"quantile_pct": "",
|
||||
"index": "date",
|
||||
},
|
||||
"equity",
|
||||
),
|
||||
(
|
||||
{
|
||||
"data": "",
|
||||
"target": "high",
|
||||
"window": "50",
|
||||
"quantile_pct": "0.6",
|
||||
"index": "date",
|
||||
},
|
||||
"crypto",
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_quantitative_rolling_mean(params, data_type, obb):
|
||||
params = {p: v for p, v in params.items() if v}
|
||||
params["data"] = get_data(data_type)
|
||||
|
||||
result = obb.quantitative.rolling.mean(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
|
||||
|
||||
@parametrize(
|
||||
"params, data_type",
|
||||
[
|
||||
(
|
||||
{
|
||||
"data": "",
|
||||
"target": "close",
|
||||
"window": "10",
|
||||
"quantile_pct": "",
|
||||
"index": "date",
|
||||
},
|
||||
"equity",
|
||||
),
|
||||
(
|
||||
{
|
||||
"data": "",
|
||||
"target": "high",
|
||||
"window": "50",
|
||||
"quantile_pct": "0.6",
|
||||
"index": "date",
|
||||
},
|
||||
"crypto",
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_quantitative_rolling_variance(params, data_type, obb):
|
||||
params = {p: v for p, v in params.items() if v}
|
||||
params["data"] = get_data(data_type)
|
||||
|
||||
result = obb.quantitative.rolling.variance(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
|
||||
|
||||
@parametrize(
|
||||
"params, data_type",
|
||||
[
|
||||
({"data": "", "target": "close"}, "equity"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_quantitative_stats_skew(params, data_type, obb):
|
||||
params = {p: v for p, v in params.items() if v}
|
||||
params["data"] = get_data(data_type)
|
||||
|
||||
result = obb.quantitative.stats.skew(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
|
||||
|
||||
@parametrize(
|
||||
"params, data_type",
|
||||
[
|
||||
({"data": "", "target": "close"}, "equity"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_quantitative_stats_kurtosis(params, data_type, obb):
|
||||
params = {p: v for p, v in params.items() if v}
|
||||
params["data"] = get_data(data_type)
|
||||
|
||||
result = obb.quantitative.stats.kurtosis(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
|
||||
|
||||
@parametrize(
|
||||
"params, data_type",
|
||||
[
|
||||
({"data": "", "target": "close"}, "equity"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_quantitative_stats_variance(params, data_type, obb):
|
||||
params = {p: v for p, v in params.items() if v}
|
||||
params["data"] = get_data(data_type)
|
||||
|
||||
result = obb.quantitative.stats.variance(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
|
||||
|
||||
@parametrize(
|
||||
"params, data_type",
|
||||
[
|
||||
({"data": "", "target": "close"}, "equity"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_quantitative_stats_stdev(params, data_type, obb):
|
||||
params = {p: v for p, v in params.items() if v}
|
||||
params["data"] = get_data(data_type)
|
||||
|
||||
result = obb.quantitative.stats.stdev(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
|
||||
|
||||
@parametrize(
|
||||
"params, data_type",
|
||||
[
|
||||
({"data": "", "target": "close"}, "equity"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_quantitative_stats_mean(params, data_type, obb):
|
||||
params = {p: v for p, v in params.items() if v}
|
||||
params["data"] = get_data(data_type)
|
||||
|
||||
result = obb.quantitative.stats.mean(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
|
||||
|
||||
@parametrize(
|
||||
"params, data_type",
|
||||
[
|
||||
(
|
||||
{
|
||||
"data": "",
|
||||
"target": "close",
|
||||
"quantile_pct": "",
|
||||
},
|
||||
"equity",
|
||||
),
|
||||
(
|
||||
{
|
||||
"data": "",
|
||||
"target": "close",
|
||||
"quantile_pct": "0.6",
|
||||
},
|
||||
"crypto",
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_quantitative_stats_quantile(params, data_type, obb):
|
||||
params = {p: v for p, v in params.items() if v}
|
||||
params["data"] = get_data(data_type)
|
||||
|
||||
result = obb.quantitative.stats.quantile(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
|
||||
Reference in New Issue
Block a user