[英]missing 1 required positional argument: '....'
我是 Python 新手,想知道為什么會收到此錯誤消息:
AlphaVantage() missing 1 required positional argument: 'symbol'
該程序旨在獲取我希望每 10 秒更新一次的 API 數據。 這就是我嘗試使用調度程序的原因。 提前致謝。
代碼如下:
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.