Skip to content

Commit

Permalink
fix: make pyright happy
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorozenko committed Apr 30, 2024
1 parent 9da9a08 commit 954a149
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion stock_app_tapyr/view/root/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def get_data():
return get_ticker().history(start=dates[0], end=dates[1])

@reactive.calc
def get_change():
def get_change() -> float:
close = get_data()["Close"]
return close.iloc[-1] - close.iloc[-2]

Expand Down
6 changes: 5 additions & 1 deletion stock_app_tapyr/view/root/ui.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import date
from pathlib import Path

import pandas as pd
Expand All @@ -9,7 +10,10 @@

# Default to the last 6 months
end = pd.Timestamp.now()
start = end - pd.Timedelta(weeks=26)
start_td = end - pd.Timedelta(weeks=26)
if not isinstance(start_td, date):
raise ValueError("This will never happen")
start = start_td.date()

app_dir = Path(__file__).parent

Expand Down

0 comments on commit 954a149

Please sign in to comment.