Skip to content

Commit

Permalink
Get rid of dates_as_str
Browse files Browse the repository at this point in the history
  • Loading branch information
ymyke committed Apr 6, 2022
1 parent 81ffe6a commit 4cf3727
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pypme/mod_investpy_pme.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,17 @@ def investpy_verbose_pme(
"""Calculate PME return vebose information, retrieving PME price information from
Investing.com in real time.
"""
dates_as_str = [x.strftime("%d/%m/%Y") for x in sorted(dates)]
pmedf = get_historical_data(
pme_ticker,
pme_type,
country=pme_country,
from_date=dates_as_str[0],
to_date=dates_as_str[-1],
from_date=dates[0].strftime("%d/%m/%Y"),
to_date=dates[-1].strftime("%d/%m/%Y"),
)
# Pick the nearest price if there is no price for an exact date:
pme_prices = [
pmedf.iloc[pmedf.index.get_indexer([x], method="nearest")[0]]["Close"]
for x in dates_as_str
for x in dates
]
return verbose_xpme(dates, cashflows, prices, pme_prices)

Expand Down

0 comments on commit 4cf3727

Please sign in to comment.