Hi,
I am trying to download headlines data with the ek.get_news_headlines function. Yet, I am running into the error: ValueError: Parser must be a string or character stream, not Timestamp when passing datetime values like below. Or running into "TypeError: datetime64 values must have a unit specified" when passing string values. Have you any idea how to resolve? Thanks!
import eikon as ek
import pandas as pd
print(ek.__version__)
ek.set_app_key('hidden')
range_of_dates = pd.to_datetime([d.strftime('%Y-%m-%dT%H:%M:%S') for d in pd.date_range(start='1/1/2024', end='11/1/2024')])
print(range_of_dates)
print(type((range_of_dates[0])))
stocks = ["AAPL.O", "NVDA.O", "MSFT.O", "GOOGL.O", "AMZN.O"]
df_list = []
for d in range(len(range_of_dates)-1):
for s in stocks:
headlines = ek.get_news_headlines(query=s,
count=100,
date_from=range_of_dates[d],
date_to=range_of_dates[d+1],)
df.append(headlines)
df = pd.concat(df_list)
df.to_csv("df_test.csv")