[英]missing 1 required positional argument: '....'
I'm fairly new in python and was wondering why I get this error message:我是 Python 新手,想知道为什么会收到此错误消息:
AlphaVantage() missing 1 required positional argument: 'symbol'
The program is meant to fetch API data that I want to be updated every 10 seconds.该程序旨在获取我希望每 10 秒更新一次的 API 数据。 That's why I'm trying to use the scheduler.
这就是我尝试使用调度程序的原因。 Thanks, in advance.
提前致谢。
Code is below:代码如下:
import schedule
import time
from alpha_vantage.timeseries import TimeSeries
from alpha_vantage.techindicators import TechIndicators
import matplotlib.pyplot as plt
print("Updating stocks...")
#Your Key
key = ''
def AlphaVantage(symbol):
ts = TimeSeries(key)
data = ts.get_intraday(symbol, interval='1min')
print(str(data))
#What Stock
AlphaVantage('AMD')
def job():
print("I'm working...")
#Timer on updates
schedule.every(10).seconds.do(AlphaVantage)
while 1:
schedule.run_pending()
time.sleep(1)
从schedule
文件:
schedule.every().seconds.do(AlphaVantage, symbol='AMD')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.