Skip to content

Commit 3b5c9c4

Browse files
committed
fix: clarify signup for 2FA, simulation progress bar
1 parent c15b97c commit 3b5c9c4

File tree

4 files changed

+25
-18
lines changed

4 files changed

+25
-18
lines changed

examples/full_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@
501501
hide_amounts=False,
502502
hide_root=False,
503503
show_data=False,
504-
check_budget=True,
504+
check_budget=False,
505505
sidecars=[
506506
Sidecar("[ideal]", "[delta]", render_folders=False),
507507
Sidecar("[delta]", render_folders=False),

finalynx/assistant.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from rich.columns import Columns
3232
from rich.console import Console
3333
from rich.panel import Panel
34+
from rich.progress import track
3435
from rich.text import Text
3536
from rich.tree import Tree
3637

@@ -282,7 +283,7 @@ def simulate(self) -> Tree:
282283
if not (self.simulation and self._timeline and not self._timeline.is_finished):
283284
raise ValueError("Nothing to simulate, have you added events?")
284285

285-
console.log(f"Running simulation until {self._timeline.end_date}...")
286+
console.log("Launching simulation...")
286287
tree = Tree("\n[bold]Worth", guide_style=TH().TREE_BRANCH)
287288

288289
# Utility function to append a new formatted line to the tree
@@ -291,13 +292,16 @@ def append_worth(year: int, amount: float) -> None:
291292

292293
# Run the simulation and append the results to the tree every `step_years`
293294
append_worth(date.today().year, self.portfolio.get_amount())
294-
for year in range(
295-
date.today().year + self.simulation.step_years,
296-
self._timeline.end_date.year,
297-
self.simulation.step_years,
295+
for year in track(
296+
range(date.today().year + 1, self._timeline.end_date.year),
297+
description=f"Simulating until [{TH().ACCENT} bold]{self._timeline.end_date}[/]...",
298298
):
299299
self._timeline.goto(date(year, 12, 31))
300-
append_worth(year, self.portfolio.get_amount())
300+
301+
if (year - date.today().year) % self.simulation.step_years == 0:
302+
append_worth(year, self.portfolio.get_amount())
303+
304+
# Run until the end date and append the final result
301305
self._timeline.run()
302306
append_worth(self._timeline.current_date.year, self.portfolio.get_amount())
303307
console.log(f" Portfolio will be worth [{TH().ACCENT}]{self.portfolio.get_amount():.0f} €[/]")

finalynx/fetch/source_finary.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,13 @@ def _authenticate(self) -> Optional[Session]:
122122

123123
# Login to Finary with the existing cookies file or credentials in environment variables and retrieve data
124124
if os.environ.get("FINARY_EMAIL") and os.environ.get("FINARY_PASSWORD"):
125-
with console.status(f"[bold {TH().ACCENT}]Signing in to Finary...", spinner_style=TH().ACCENT):
125+
self._log("Signing in to Finary...")
126+
with console.status(
127+
f"""[bold {TH().ACCENT}]Signing in to Finary...[/] """
128+
"""[dim white](Type your 2FA code if prompted and press [italic]Enter[/], """
129+
"""it will remain invisible while you type)""",
130+
spinner_style=TH().ACCENT,
131+
):
126132
result = ff.signin()
127133
self._log("Signed in to Finary.")
128134

finalynx/simulator/timeline.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
from typing import Optional
88

99
from finalynx.analyzer.investment_state import AnalyzeInvestmentStates
10-
from finalynx.config import get_active_theme as TH
11-
from finalynx.console import console
1210
from finalynx.portfolio.bucket import Bucket
1311
from finalynx.portfolio.envelope import EnvelopeState
1412
from finalynx.portfolio.folder import Portfolio
@@ -80,14 +78,13 @@ def run(self) -> None:
8078

8179
def goto(self, target_date: date) -> None:
8280
"""Step until the target date is reached (in the future or past)."""
83-
with console.status(f"[bold {TH().ACCENT}]Moving timeline until {target_date}...", spinner_style=TH().ACCENT):
84-
if target_date == self.current_date:
85-
return
86-
elif target_date > self.current_date:
87-
self.step_until(target_date)
88-
else:
89-
self.unstep_until(target_date)
90-
self.current_date = target_date
81+
if target_date == self.current_date:
82+
return
83+
elif target_date > self.current_date:
84+
self.step_until(target_date)
85+
else:
86+
self.unstep_until(target_date)
87+
self.current_date = target_date
9188

9289
def step_until(self, target_date: date) -> None:
9390
"""Execute all events until the specified date is reached."""

0 commit comments

Comments
 (0)