Skip to content

Commit

Permalink
Removed bad type hints.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sinbad-The-Sailor committed Feb 24, 2024
1 parent 05b6db8 commit ff9f1b0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/abacus/utils/portfolio.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
from typing import NoReturn



Expand All @@ -11,7 +10,7 @@ def __init__(self, holdings: dict[str:int]=None, weights: dict[str:float]=None,
self._cash = cash

@property
def weights(self) -> dict[str:float] | NoReturn:
def weights(self) -> dict[str:float]:
if not self._weights:
raise ValueError("No weights are available.")
return self._weights
Expand All @@ -21,7 +20,7 @@ def weights(self, new):
self._weights = new

@property
def holdings(self) -> dict[str:int] | NoReturn:
def holdings(self) -> dict[str:int]:
if not self._weights:
raise ValueError("No holdings are available.")
return self._holdings
Expand All @@ -31,7 +30,7 @@ def holdings(self, new):
self._holdings = new

@property
def cash(self) -> float | NoReturn:
def cash(self) -> float:
if not self._cash:
raise ValueError("No cash is available.")
return self._cash
Expand All @@ -48,15 +47,15 @@ def weights_from_holdings(self) -> dict[str:float]:
return {ticker: holding/total_holdings for ticker, holding in self._holdings.items()}

@property
def indices(self) -> list[int] | NoReturn:
def indices(self) -> list[int]:
if self._holdings:
return [instrument.id for instrument in self._holdings]
elif self._weights:
return [instrument.id for instrument in self._weights]
raise ValueError("Portfolio has no instruments.")

@property
def instruments(self) -> list[str] | NoReturn:
def instruments(self) -> list[str]:
if self._holdings:
return self._holdings.keys()
elif self._weights:
Expand Down

0 comments on commit ff9f1b0

Please sign in to comment.