diff --git a/algo.py b/algo.py index b52342a..64404c8 100644 --- a/algo.py +++ b/algo.py @@ -1,7 +1,7 @@ import alpaca_trade_api as tradeapi import requests import time -from ta import macd +import ta import numpy as np from datetime import datetime, timedelta from pytz import timezone @@ -224,7 +224,7 @@ async def handle_second_bar(conn, channel, data): volume_today[symbol] > 30000 ): # check for a positive, increasing MACD - hist = macd( + hist = ta.trend.macd( minute_history[symbol]['close'].dropna(), n_fast=12, n_slow=26 @@ -234,7 +234,7 @@ async def handle_second_bar(conn, channel, data): not (hist[-3] < hist[-2] < hist[-1]) ): return - hist = macd( + hist = ta.trend.macd( minute_history[symbol]['close'].dropna(), n_fast=40, n_slow=60 @@ -287,7 +287,7 @@ async def handle_second_bar(conn, channel, data): # Sell for a loss if it's fallen below our stop price # Sell for a loss if it's below our cost basis and MACD < 0 # Sell for a profit if it's above our target price - hist = macd( + hist = ta.trend.macd( minute_history[symbol]['close'].dropna(), n_fast=13, n_slow=21