JuliaQuant / MarketData.jl

Time series market data
https://juliaquant.github.io/MarketData.jl/stable/
Other
149 stars 21 forks source link

extracting data with Symbol IUSA.DE (germany) #75

Closed korilium closed 2 years ago

korilium commented 2 years ago

I want to extract data from a stock exchange in Germany but the Symbol always gets an error due to the DE at the end. From this stock, I want to extract the data: https://finance.yahoo.com/quote/IUSA.DE?p=IUSA.DE&.tsrc=fin-srch My code looks like this:

using MarketData 
ETF_SP500 = yahoo(:IUSA.DE) 

This is the error I get

LoadError: type Symbol has no field DE
Stacktrace:
 [1] getproperty(x::Symbol, f::Symbol)
   @ Base .\Base.jl:42
 [2] top-level scope
   @ c:\Users\ignac\Documents\GitHub\pecon\coding\portfolio.jl:48
in expression starting at c:\Users\ignac\Documents\GitHub\pecon\coding\portfolio.jl:48

Is there a workaround?

Thanks in advance.

Arkoniak commented 2 years ago

The problem is in Julia parser. :IUSA.DE is treated by Julia as a call to a field DE of the symbol :IUSA. You should either use long form of symbol construction Symbol("IUSA.DE")) or just use strings instead of symbols.

So, both of this should work

using MarketData

ETF_SP500 = yahoo(Symbol("IUSA.DE"))
ETF_SP500 = yahoo("IUSA.DE")