Skip to content

Commit

Permalink
Use preconfigured timeframe units
Browse files Browse the repository at this point in the history
  • Loading branch information
drew887 committed Apr 1, 2022
1 parent e193f21 commit 5d951a3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pylivetrader/backend/alpaca.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5d951a3

Please sign in to comment.