yfinance icon indicating copy to clipboard operation
yfinance copied to clipboard

Selecting two pairs together: pair = ['EURSUD=X', 'DX=F']

Open anglosachs opened this issue 2 years ago • 10 comments

when calling these pairs into a df I'm getting Nan values and duplicates, first time I've encountered this since 13 Jan 2023. Also, there seems to be different lengths of values when I call the method len() to count the number of observations for each pair. This is affecting my ML & Ai model in tf given the X, y variables have different lengths or the values don't match!

anglosachs avatar Jan 25 '23 18:01 anglosachs

I have sympathy for your ML but you didn't read the New Issue default message.

ValueRaider avatar Jan 25 '23 18:01 ValueRaider

Who crums, what was the message????

anglosachs avatar Jan 25 '23 18:01 anglosachs

https://github.com/ranaroussi/yfinance/issues/new?assignees=&labels=&template=bug_report.md&title=

ValueRaider avatar Jan 25 '23 18:01 ValueRaider

Delete this default message and submit your bug report here, providing the following as best you can:

  • Simple code that reproduces your problem
  • Error message, with traceback if shown
  • Info about your system:
    • yfinance version
    • operating system

-Sample Code:

Date. DX-F. EURUSD=X 2004-01-01 00:00:00 | NaN | 1.258194 2004-01-02 00:00:00 | NaN | 1.258194 2004-01-02 05:00:00 | 86.930000 | NaN 2004-01-05 00:00:00 | NaN | 1.268698 2004-01-05 05:00:00 | 86.349998 | NaN

  • latest version
  • Mac OS

anglosachs avatar Jan 25 '23 18:01 anglosachs

That's not code. Good luck!

ValueRaider avatar Jan 25 '23 18:01 ValueRaider

pairs = ['EURUSD=X', DX=F] data = yf.download(pairs, '2004-01-01')['Adj Close'] data.index = pd.to_datetime(data.index)

df1 = pd.DataFrame(data) df1 = df1.tz_localize(None)

df1.head()

``

anglosachs avatar Jan 25 '23 18:01 anglosachs

'DX=F'

anglosachs avatar Jan 25 '23 18:01 anglosachs

I have sympathy for your ML but you didn't read the New Issue default message.

The stuff you have to deal with :-) Impressed by your efforts with all of this!

HeadbangerFinance avatar Jan 26 '23 21:01 HeadbangerFinance

Hi anglosachs, unrelated to code itself but I would recommend using the cash ticker for the US Dollar index (DX-Y.NYB) instead of using the front-month futures (DX=F). The front month futures suffers from gaps at each roll.

PatrickDionne avatar Jan 28 '23 15:01 PatrickDionne

Set ignore_tz=True. Read the README

ValueRaider avatar Jan 28 '23 16:01 ValueRaider