File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -270,6 +270,15 @@ Alpaca's API key ID can be used to access Polygon API whose document is found [h
270270This python SDK wraps their API service and seamlessly integrates with Alpaca API.
271271` alpaca_trade_api.REST.polygon ` will be the ` REST ` object for Polygon.
272272
273+ The example below gives AAPL daily OHLCV data in a DataFrame format.
274+
275+ ``` py
276+ import alpaca_trade_api as tradeapi
277+
278+ api = tradeapi.REST()
279+ aapl = api.polygon.historic_agg(' day' , ' AAPL' , limit = 1000 ).df
280+ ```
281+
273282## polygon/REST
274283It is initialized through alpaca ` REST ` object.
275284
Original file line number Diff line number Diff line change @@ -70,6 +70,8 @@ def df(self):
7070 df .set_index ('day' , inplace = True )
7171 df .index = pd .to_datetime (
7272 df .index ).tz_localize (NY )
73+
74+ df .sort_index (inplace = True )
7375 self ._df = df
7476
7577 return self ._df
@@ -119,7 +121,9 @@ def df(self):
119121 utc = True ,
120122 ).tz_convert (NY )
121123
124+ df .sort_index (inplace = True )
122125 self ._df = df
126+
123127 return self ._df
124128
125129
You can’t perform that action at this time.
0 commit comments