Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename methods and variable #1169

Merged
merged 1 commit into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pypmanager/helpers/portfolio.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ async def async_async_get_holdings() -> list[Holding]:

# Fetch transaction data
transaction_registry_obj = TransactionRegistry()
df_transaction_registry_current_holding = (
await transaction_registry_obj.async_get_current_holding()
df_transaction_registry_full_portfolio = (
await transaction_registry_obj.async_get_full_portfolio()
)
df_transaction_registry_all = await transaction_registry_obj.async_get_registry()

Expand All @@ -58,7 +58,7 @@ async def async_async_get_holdings() -> list[Holding]:

df_market_data = await async_get_last_market_data_df()

for _, row in df_transaction_registry_current_holding.iterrows():
for _, row in df_transaction_registry_full_portfolio.iterrows():
# We only want to include securities with an ISIN code
if (isin_code := row[TransactionRegistryColNameValues.SOURCE_ISIN.value]) in [
"nan",
Expand Down
4 changes: 2 additions & 2 deletions pypmanager/ingest/transaction/transaction_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,9 @@ async def async_get_registry(self) -> pd.DataFrame:
"""Get registry."""
return self.all_calculations_run

async def async_get_current_holding(self) -> pd.DataFrame:
async def async_get_full_portfolio(self) -> pd.DataFrame:
"""
Get all current holdings.
Get all current and historical holdings in the portfolio.

The returned DataFrame contains rows even if everything has been sold.
"""
Expand Down
6 changes: 3 additions & 3 deletions tests/ingest/transaction/test_transaction_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ async def test_transaction_registry(


@pytest.mark.asyncio
async def test_transaction_registry__async_get_current_holding(
async def test_transaction_registry__async_get_full_portfolio(
data_factory: type[DataFactory],
) -> None:
"""Test function async_get_current_holding."""
"""Test function async_get_full_portfolio."""
factory = data_factory()
mocked_transactions = (
# US1234567890
Expand Down Expand Up @@ -81,7 +81,7 @@ async def test_transaction_registry__async_get_current_holding(
return_value=mocked_transactions,
),
):
registry = await TransactionRegistry().async_get_current_holding()
registry = await TransactionRegistry().async_get_full_portfolio()
assert len(registry) == 3
assert registry.index[0] == datetime(
2021, 1, 3, tzinfo=Settings.system_time_zone
Expand Down
Loading