Skip to content

Commit 1f5ec1d

Browse files
authored
Add previous_day_bar
1 parent d10c505 commit 1f5ec1d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

alpaca_trade_api/polygon/rest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Exchange, SymbolTypeMap, ConditionMap,
77
Company, Dividends, Splits, Earnings, Financials, NewsList, Ticker
88
)
9+
from ..entity import Bar
910
from alpaca_trade_api.common import get_polygon_credentials
1011

1112

@@ -106,6 +107,11 @@ def last_quote(self, symbol):
106107
raw = self.get(path)
107108
# TODO status check
108109
return Quote(raw['last'])
110+
111+
def previous_day_bar(self, symbol):
112+
path = '/aggs/ticker/{}/prev'.format(symbol)
113+
raw = self.get(path, version='v2')['results'][0]
114+
return Bar(raw)
109115

110116
def condition_map(self, ticktype='trades'):
111117
path = '/meta/conditions/{}'.format(ticktype)

0 commit comments

Comments
 (0)