I’ve created a watchlist of specific stocks I want to trade. The program is supposed to loop through various socks in the watchlist and make a trade once my conditions are met. Here is what I have for the watch list:
from alpaca.trading.client import TradingClient
from alpaca.trading.requests import MarketOrderRequest
from alpaca.trading.enums import OrderSide, TimeInForce
import requests
import pandas as pd
from config import *
Establish a connection to the Alpaca broker API
trading_client = TradingClient(API_KEY, SECRET_KEY, paper=True)
Create a list of stock symbols to trade
symbols = [‘TSLA’, ‘AAPL’, AMZN, ‘NFLX’, ‘META’]
Add the symbols to the Alpaca watchlist
watchlist_name = “My Watchlist”
for symbol in symbols:
trading_client.add_to_watchlist(watchlist_name, symbol)
However, I am getting an errror that states, “AttributeError: ‘TradingClient’ object has no attribute ‘add_to_watchlist’. Did you mean: ‘create_watchlist’?”
Where can I find information on creating a watchlist with Alpaca. I did not see any in the documentation.