Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed yahoo datavendor and added example to equitiesdata #50

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 7 additions & 18 deletions findatapy/market/datavendorweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,10 +774,6 @@ def download_daily(self, md_request):
data_frame = None

ticker_list = ' '.join(md_request.tickers)
# data_frame = yf.download(ticker_list,
# start=md_request.start_date,
# end=md_request.finish_date)

while (trials < 5):

try:
Expand All @@ -799,25 +795,18 @@ def download_daily(self, md_request):
logger.error("Couldn't download from Yahoo after several attempts!")

if data_frame is not None:
if len(md_request.tickers) == 1:
data_frame.columns = [md_request.tickers[0] + "." + x for
x in data_frame.columns]
else:
fields = data_frame.columns.levels[0]
tickers = data_frame.columns.levels[1]

new_cols = []
fields = data_frame.columns.levels[0]
tickers = data_frame.columns.levels[1]

for fi in fields:
for ti in tickers:
new_cols.append(ti + "." + fi)
new_cols = []

data_frame.columns = new_cols
for fi in fields:
for ti in tickers:
new_cols.append(ti + "." + fi)

data_frame.columns = new_cols

# if len(md_request.tickers) == 1:
# data_frame.columns = [x + '/' + md_request.tickers[0] for
# x in data_frame.columns]

return data_frame

Expand Down
265 changes: 108 additions & 157 deletions findatapy_examples/notebooks/equitiesdata_example.ipynb

Large diffs are not rendered by default.