Skip to content

Commit

Permalink
Raise missingData in capitalData.get_date_of_last_entry_for_strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
todd committed Feb 2, 2023
1 parent 774b4d8 commit 28cc156
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions sysdata/production/TEMP_old_capital_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,7 @@ def get_current_capital_for_strategy(self, strategy_name: str) -> float:
def get_date_of_last_entry_for_strategy(
self, strategy_name: str
) -> datetime.datetime:
try:
current_capital_entry = self.get_last_entry_for_strategy(strategy_name)
except missingData:
return missing_data

current_capital_entry = self.get_last_entry_for_strategy(strategy_name)
entry_date = current_capital_entry.date

return entry_date
Expand Down Expand Up @@ -234,8 +230,11 @@ def delete_recent_capital_for_strategy(
):
have_capital_to_delete = True
while have_capital_to_delete:
last_date_in_data = self.get_date_of_last_entry_for_strategy(strategy_name)
if last_date_in_data is missing_data:
try:
last_date_in_data = self.get_date_of_last_entry_for_strategy(
strategy_name
)
except missingData:
## gone to the start, nothing left
break
if last_date_in_data < start_date:
Expand Down

0 comments on commit 28cc156

Please sign in to comment.