File tree Expand file tree Collapse file tree 8 files changed +54
-23
lines changed
Expand file tree Collapse file tree 8 files changed +54
-23
lines changed Original file line number Diff line number Diff line change 33Aggs
44==========
55
6+ ===========
7+ List aggs
8+ ===========
9+
10+ - `Stocks aggs `_
11+ - `Options aggs `_
12+ - `Forex aggs `_
13+ - `Crypto aggs `_
14+
15+ .. automethod :: polygon.RESTClient.list_aggs
16+
617===========
718Get aggs
819===========
Original file line number Diff line number Diff line change 22
33# docs
44# https://polygon.io/docs/crypto/get_v2_aggs_ticker__cryptoticker__range__multiplier___timespan___from___to
5- # https://polygon-api-client.readthedocs.io/en/latest/Aggs.html#polygon.RESTClient.get_aggs
5+ # https://polygon-api-client.readthedocs.io/en/latest/Aggs.html#polygon.RESTClient.list_aggs
66
77# API key injected below for easy use. If not provided, the script will attempt
88# to use the environment variable "POLYGON_API_KEY".
1616# client = RESTClient("XXXXXX") # hardcoded api_key is used
1717client = RESTClient () # POLYGON_API_KEY environment variable is used
1818
19- aggs = client .get_aggs (
19+ aggs = []
20+ for a in client .list_aggs (
2021 "X:BTCUSD" ,
2122 1 ,
2223 "day" ,
2324 "2023-01-30" ,
2425 "2023-02-03" ,
25- )
26+ limit = 50000 ,
27+ ):
28+ aggs .append (a )
2629
2730print (aggs )
Original file line number Diff line number Diff line change 22
33# docs
44# https://polygon.io/docs/forex/get_v2_aggs_ticker__forexticker__range__multiplier___timespan___from___to
5- # https://polygon-api-client.readthedocs.io/en/latest/Aggs.html#polygon.RESTClient.get_aggs
5+ # https://polygon-api-client.readthedocs.io/en/latest/Aggs.html#polygon.RESTClient.list_aggs
66
77# API key injected below for easy use. If not provided, the script will attempt
88# to use the environment variable "POLYGON_API_KEY".
1616# client = RESTClient("XXXXXX") # hardcoded api_key is used
1717client = RESTClient () # POLYGON_API_KEY environment variable is used
1818
19- aggs = client .get_aggs (
19+ aggs = []
20+ for a in client .list_aggs (
2021 "C:EURUSD" ,
2122 1 ,
2223 "day" ,
2324 "2023-01-30" ,
2425 "2023-02-03" ,
25- )
26+ limit = 50000 ,
27+ ):
28+ aggs .append (a )
2629
2730print (aggs )
Original file line number Diff line number Diff line change 22
33# docs
44# https://polygon.io/docs/indices/get_v2_aggs_ticker__indicesticker__range__multiplier___timespan___from___to
5- # https://polygon-api-client.readthedocs.io/en/latest/Aggs.html#polygon.RESTClient.get_aggs
5+ # https://polygon-api-client.readthedocs.io/en/latest/Aggs.html#polygon.RESTClient.list_aggs
66
77# API key injected below for easy use. If not provided, the script will attempt
88# to use the environment variable "POLYGON_API_KEY".
1616# client = RESTClient("XXXXXX") # hardcoded api_key is used
1717client = RESTClient () # POLYGON_API_KEY environment variable is used
1818
19- aggs = client .get_aggs (
19+ aggs = []
20+ for a in client .list_aggs (
2021 "I:SPX" ,
2122 1 ,
2223 "day" ,
2324 "2023-03-10" ,
24- "2023-03-10" ,
25- )
25+ "2023-05-12" ,
26+ limit = 50000 ,
27+ ):
28+ aggs .append (a )
2629
2730print (aggs )
Original file line number Diff line number Diff line change 22
33# docs
44# https://polygon.io/docs/options/get_v2_aggs_ticker__optionsticker__range__multiplier___timespan___from___to
5- # https://polygon-api-client.readthedocs.io/en/latest/Aggs.html#polygon.RESTClient.get_aggs
5+ # https://polygon-api-client.readthedocs.io/en/latest/Aggs.html#polygon.RESTClient.list_aggs
66
77# API key injected below for easy use. If not provided, the script will attempt
88# to use the environment variable "POLYGON_API_KEY".
1616# client = RESTClient("XXXXXX") # hardcoded api_key is used
1717client = RESTClient () # POLYGON_API_KEY environment variable is used
1818
19- aggs = client .get_aggs (
19+ aggs = []
20+ for a in client .list_aggs (
2021 "O:SPY251219C00650000" ,
2122 1 ,
2223 "day" ,
2324 "2023-01-30" ,
2425 "2023-02-03" ,
25- )
26+ limit = 50000 ,
27+ ):
28+ aggs .append (a )
2629
2730print (aggs )
Original file line number Diff line number Diff line change 22
33# docs
44# https://polygon.io/docs/stocks/get_v2_aggs_ticker__stocksticker__range__multiplier___timespan___from___to
5- # https://polygon-api-client.readthedocs.io/en/latest/Aggs.html#polygon.RESTClient.get_aggs
5+ # https://polygon-api-client.readthedocs.io/en/latest/Aggs.html#polygon.RESTClient.list_aggs
66
77# API key injected below for easy use. If not provided, the script will attempt
88# to use the environment variable "POLYGON_API_KEY".
1616# client = RESTClient("XXXXXX") # hardcoded api_key is used
1717client = RESTClient () # POLYGON_API_KEY environment variable is used
1818
19- aggs = client .get_aggs (
19+ aggs = []
20+ for a in client .list_aggs (
2021 "AAPL" ,
2122 1 ,
22- "day " ,
23- "2023 -01-30 " ,
23+ "minute " ,
24+ "2022 -01-01 " ,
2425 "2023-02-03" ,
25- )
26+ limit = 50000 ,
27+ ):
28+ aggs .append (a )
2629
2730print (aggs )
Original file line number Diff line number Diff line change 1616
1717# docs
1818# https://polygon.io/docs/stocks/get_v2_aggs_ticker__stocksticker__range__multiplier___timespan___from___to
19- # https://polygon-api-client.readthedocs.io/en/latest/Aggs.html#polygon.RESTClient.get_aggs
19+ # https://polygon-api-client.readthedocs.io/en/latest/Aggs.html#polygon.RESTClient.list_aggs
2020
2121# client = RESTClient("XXXXXX") # hardcoded api_key is used
2222client = RESTClient () # POLYGON_API_KEY environment variable is used
2323
24- aggs = client .get_aggs (
24+ aggs = []
25+ for a in client .list_aggs (
2526 "AAPL" ,
2627 1 ,
2728 "hour" ,
2829 "2023-01-30" ,
2930 "2023-02-03" ,
30- )
31+ limit = 50000 ,
32+ ):
33+ aggs .append (a )
3134
3235print (aggs )
3336
Original file line number Diff line number Diff line change 7070
7171client = RESTClient () # POLYGON_API_KEY environment variable is used
7272
73- aggs = client .get_aggs (
73+ aggs = []
74+ for a in client .list_aggs (
7475 "AAPL" ,
7576 1 ,
7677 "day" ,
7778 "2019-01-01" ,
7879 "2023-02-16" ,
7980 limit = 50000 ,
80- )
81+ ):
82+ aggs .append (a )
8183
8284# print(aggs)
8385
You can’t perform that action at this time.
0 commit comments