juliapycall

Parameter of Python function call is reserved word in Julia


I am playing around with the yfinance package (https://pypi.org/project/yfinance/) to learn Julia and ran into an issue with a parameter that is also a reserved word in Julia.

using PyCall

y = pyimport("yfinance")
data = y.download("SPY AAPL", start="2017-01-01", end="2017-04-30") # does not work
#data = y.download("SPY", start="2018-01-01")   #works

Error message:

LoadError: syntax: unexpected "end"
in expression starting at C:\Users\user\Github\julia\using_python.jl:6
top-level scope at using_python.jl:6

Does anybody have an idea how I can solve this?

Thanks!


Solution

  • Interpolating a dictionary should work:

    data = y.download("SPY AAPL"; Dict(:start => "2017-01-01", :end => "2017-04-30")...)