3

我正在使用 yfinance 包 ( https://pypi.org/project/yfinance/ ) 来学习 Julia,但遇到了一个参数问题,该参数也是 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

错误信息:

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

有人知道我该如何解决这个问题吗?

谢谢!

4

1 回答 1

4

插值字典应该有效:

data = y.download("SPY AAPL"; Dict(:start => "2017-01-01", :end => "2017-04-30")...)
于 2020-02-19T16:59:56.430 回答