mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-30 14:02:06 +00:00
Fixes portfolio_model.py tests (#2071)
* fix portfolio tests * run black on test file * remove unused argument
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
,Portfolio,Benchmark
|
||||
mtd,"TotalHoldings NaN
|
||||
dtype: float64","Adj Close NaN
|
||||
dtype: float64"
|
||||
qtd,"TotalHoldings NaN
|
||||
dtype: float64","Adj Close NaN
|
||||
dtype: float64"
|
||||
ytd,"TotalHoldings 0.759
|
||||
dtype: float64","Adj Close 0.722
|
||||
dtype: float64"
|
||||
3m,"TotalHoldings 0.612
|
||||
dtype: float64","Adj Close 0.553
|
||||
dtype: float64"
|
||||
6m,"TotalHoldings 0.766
|
||||
dtype: float64","Adj Close 0.718
|
||||
dtype: float64"
|
||||
1y,"TotalHoldings 0.59
|
||||
dtype: float64","Adj Close 0.489
|
||||
dtype: float64"
|
||||
3y,"TotalHoldings -1.13
|
||||
dtype: float64","Adj Close -0.766
|
||||
dtype: float64"
|
||||
5y,"TotalHoldings -1.308
|
||||
dtype: float64","Adj Close -1.483
|
||||
dtype: float64"
|
||||
10y,"TotalHoldings -1.308
|
||||
dtype: float64","Adj Close -1.483
|
||||
dtype: float64"
|
||||
all,"TotalHoldings -1.308
|
||||
dtype: float64","Adj Close -1.483
|
||||
dtype: float64"
|
||||
|
@@ -1,31 +0,0 @@
|
||||
,Portfolio,Benchmark
|
||||
mtd,"TotalHoldings 1.0
|
||||
dtype: float64","Adj Close 1.0
|
||||
dtype: float64"
|
||||
qtd,"TotalHoldings 1.0
|
||||
dtype: float64","Adj Close 1.0
|
||||
dtype: float64"
|
||||
ytd,"TotalHoldings 0.845
|
||||
dtype: float64","Adj Close 0.831
|
||||
dtype: float64"
|
||||
3m,"TotalHoldings 0.758
|
||||
dtype: float64","Adj Close 0.702
|
||||
dtype: float64"
|
||||
6m,"TotalHoldings 0.851
|
||||
dtype: float64","Adj Close 0.824
|
||||
dtype: float64"
|
||||
1y,"TotalHoldings 0.923
|
||||
dtype: float64","Adj Close 0.926
|
||||
dtype: float64"
|
||||
3y,"TotalHoldings 0.908
|
||||
dtype: float64","Adj Close 0.799
|
||||
dtype: float64"
|
||||
5y,"TotalHoldings 0.882
|
||||
dtype: float64","Adj Close 0.81
|
||||
dtype: float64"
|
||||
10y,"TotalHoldings 0.882
|
||||
dtype: float64","Adj Close 0.81
|
||||
dtype: float64"
|
||||
all,"TotalHoldings 0.882
|
||||
dtype: float64","Adj Close 0.81
|
||||
dtype: float64"
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# IMPORTATION THIRDPARTY
|
||||
from pathlib import Path
|
||||
import pandas as pd
|
||||
import pytest
|
||||
|
||||
# IMPORTATION INTERNAL
|
||||
from openbb_terminal.portfolio import portfolio_model
|
||||
@@ -27,6 +28,7 @@ benchmark_returns["Date"] = pd.to_datetime(benchmark_returns["Date"])
|
||||
benchmark_returns = benchmark_returns.set_index("Date")
|
||||
|
||||
|
||||
@pytest.mark.vcr(record_mode="none")
|
||||
def test_tracking_error(recorder):
|
||||
result_df, _ = portfolio_model.get_tracking_error(
|
||||
portfolio_returns, benchmark_returns
|
||||
@@ -35,6 +37,7 @@ def test_tracking_error(recorder):
|
||||
recorder.capture(result_df)
|
||||
|
||||
|
||||
@pytest.mark.vcr(record_mode="none")
|
||||
def test_information_ratio(recorder):
|
||||
result_df, _ = portfolio_model.get_information_ratio(
|
||||
portfolio_returns, benchmark_returns
|
||||
@@ -43,17 +46,19 @@ def test_information_ratio(recorder):
|
||||
recorder.capture(result_df)
|
||||
|
||||
|
||||
def test_tail_ratio(recorder):
|
||||
@pytest.mark.vcr(record_mode="none")
|
||||
def test_tail_ratio():
|
||||
result_df, _, _ = portfolio_model.get_tail_ratio(
|
||||
portfolio_returns, benchmark_returns
|
||||
)
|
||||
|
||||
recorder.capture(result_df)
|
||||
assert isinstance(result_df, pd.DataFrame)
|
||||
|
||||
|
||||
def test_common_sense_ratio(recorder):
|
||||
@pytest.mark.vcr(record_mode="none")
|
||||
def test_common_sense_ratio():
|
||||
result_df = portfolio_model.get_common_sense_ratio(
|
||||
portfolio_returns, benchmark_returns
|
||||
)
|
||||
|
||||
recorder.capture(result_df)
|
||||
assert isinstance(result_df, pd.DataFrame)
|
||||
|
||||
Reference in New Issue
Block a user