From 5d951a3cb2188cd0cdc56ea9c90987ef38d7b75e Mon Sep 17 00:00:00 2001 From: Andrew Mcdonald Date: Fri, 1 Apr 2022 09:44:32 -0400 Subject: [PATCH] Use preconfigured timeframe units --- pylivetrader/backend/alpaca.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pylivetrader/backend/alpaca.py b/pylivetrader/backend/alpaca.py index ced1d67..b63698f 100644 --- a/pylivetrader/backend/alpaca.py +++ b/pylivetrader/backend/alpaca.py @@ -15,7 +15,7 @@ import alpaca_trade_api as tradeapi from alpaca_trade_api import Stream -from alpaca_trade_api.rest import APIError, TimeFrame, TimeFrameUnit +from alpaca_trade_api.rest import APIError, TimeFrame from alpaca_trade_api.entity import Order from requests.exceptions import HTTPError import numpy as np @@ -646,8 +646,7 @@ def wrapper(): to = params['to'] size = params['size'] - timeframe = TimeFrame(1, TimeFrameUnit.Minute) if size == "minute"\ - else TimeFrame(1, TimeFrameUnit.Day) + timeframe = TimeFrame.Minute if size == "minute" else TimeFrame.Day # Using V2 api to get the data. we cannot do 1 api call for all # symbols because the v1 `limit` was per symbol, where v2 it's for