Chagen
Chagen

Reputation: 45

missing 1 required positional argument: '....'

I'm fairly new in python and was wondering why I get this error message:

AlphaVantage() missing 1 required positional argument: 'symbol'

The program is meant to fetch API data that I want to be updated every 10 seconds. 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)

Upvotes: 0

Views: 1358

Answers (1)

Gocht
Gocht

Reputation: 10256

From schedule documentation:

schedule.every().seconds.do(AlphaVantage, symbol='AMD')

Upvotes: 2

Related Questions