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 3
3
Aggs
4
4
==========
5
5
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
+
6
17
===========
7
18
Get aggs
8
19
===========
Original file line number Diff line number Diff line change 2
2
3
3
# docs
4
4
# 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
6
6
7
7
# API key injected below for easy use. If not provided, the script will attempt
8
8
# to use the environment variable "POLYGON_API_KEY".
16
16
# client = RESTClient("XXXXXX") # hardcoded api_key is used
17
17
client = RESTClient () # POLYGON_API_KEY environment variable is used
18
18
19
- aggs = client .get_aggs (
19
+ aggs = []
20
+ for a in client .list_aggs (
20
21
"X:BTCUSD" ,
21
22
1 ,
22
23
"day" ,
23
24
"2023-01-30" ,
24
25
"2023-02-03" ,
25
- )
26
+ limit = 50000 ,
27
+ ):
28
+ aggs .append (a )
26
29
27
30
print (aggs )
Original file line number Diff line number Diff line change 2
2
3
3
# docs
4
4
# 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
6
6
7
7
# API key injected below for easy use. If not provided, the script will attempt
8
8
# to use the environment variable "POLYGON_API_KEY".
16
16
# client = RESTClient("XXXXXX") # hardcoded api_key is used
17
17
client = RESTClient () # POLYGON_API_KEY environment variable is used
18
18
19
- aggs = client .get_aggs (
19
+ aggs = []
20
+ for a in client .list_aggs (
20
21
"C:EURUSD" ,
21
22
1 ,
22
23
"day" ,
23
24
"2023-01-30" ,
24
25
"2023-02-03" ,
25
- )
26
+ limit = 50000 ,
27
+ ):
28
+ aggs .append (a )
26
29
27
30
print (aggs )
Original file line number Diff line number Diff line change 2
2
3
3
# docs
4
4
# 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
6
6
7
7
# API key injected below for easy use. If not provided, the script will attempt
8
8
# to use the environment variable "POLYGON_API_KEY".
16
16
# client = RESTClient("XXXXXX") # hardcoded api_key is used
17
17
client = RESTClient () # POLYGON_API_KEY environment variable is used
18
18
19
- aggs = client .get_aggs (
19
+ aggs = []
20
+ for a in client .list_aggs (
20
21
"I:SPX" ,
21
22
1 ,
22
23
"day" ,
23
24
"2023-03-10" ,
24
- "2023-03-10" ,
25
- )
25
+ "2023-05-12" ,
26
+ limit = 50000 ,
27
+ ):
28
+ aggs .append (a )
26
29
27
30
print (aggs )
Original file line number Diff line number Diff line change 2
2
3
3
# docs
4
4
# 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
6
6
7
7
# API key injected below for easy use. If not provided, the script will attempt
8
8
# to use the environment variable "POLYGON_API_KEY".
16
16
# client = RESTClient("XXXXXX") # hardcoded api_key is used
17
17
client = RESTClient () # POLYGON_API_KEY environment variable is used
18
18
19
- aggs = client .get_aggs (
19
+ aggs = []
20
+ for a in client .list_aggs (
20
21
"O:SPY251219C00650000" ,
21
22
1 ,
22
23
"day" ,
23
24
"2023-01-30" ,
24
25
"2023-02-03" ,
25
- )
26
+ limit = 50000 ,
27
+ ):
28
+ aggs .append (a )
26
29
27
30
print (aggs )
Original file line number Diff line number Diff line change 2
2
3
3
# docs
4
4
# 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
6
6
7
7
# API key injected below for easy use. If not provided, the script will attempt
8
8
# to use the environment variable "POLYGON_API_KEY".
16
16
# client = RESTClient("XXXXXX") # hardcoded api_key is used
17
17
client = RESTClient () # POLYGON_API_KEY environment variable is used
18
18
19
- aggs = client .get_aggs (
19
+ aggs = []
20
+ for a in client .list_aggs (
20
21
"AAPL" ,
21
22
1 ,
22
- "day " ,
23
- "2023 -01-30 " ,
23
+ "minute " ,
24
+ "2022 -01-01 " ,
24
25
"2023-02-03" ,
25
- )
26
+ limit = 50000 ,
27
+ ):
28
+ aggs .append (a )
26
29
27
30
print (aggs )
Original file line number Diff line number Diff line change 16
16
17
17
# docs
18
18
# 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
20
20
21
21
# client = RESTClient("XXXXXX") # hardcoded api_key is used
22
22
client = RESTClient () # POLYGON_API_KEY environment variable is used
23
23
24
- aggs = client .get_aggs (
24
+ aggs = []
25
+ for a in client .list_aggs (
25
26
"AAPL" ,
26
27
1 ,
27
28
"hour" ,
28
29
"2023-01-30" ,
29
30
"2023-02-03" ,
30
- )
31
+ limit = 50000 ,
32
+ ):
33
+ aggs .append (a )
31
34
32
35
print (aggs )
33
36
Original file line number Diff line number Diff line change 70
70
71
71
client = RESTClient () # POLYGON_API_KEY environment variable is used
72
72
73
- aggs = client .get_aggs (
73
+ aggs = []
74
+ for a in client .list_aggs (
74
75
"AAPL" ,
75
76
1 ,
76
77
"day" ,
77
78
"2019-01-01" ,
78
79
"2023-02-16" ,
79
80
limit = 50000 ,
80
- )
81
+ ):
82
+ aggs .append (a )
81
83
82
84
# print(aggs)
83
85
You can’t perform that action at this time.
0 commit comments