1
- from polygon import RESTClient
1
+ from mocks import BaseTest
2
2
from polygon .rest .models import (
3
3
Agg ,
4
4
GroupedDailyAgg ,
5
5
DailyOpenCloseAgg ,
6
6
PreviousCloseAgg ,
7
7
)
8
- from mocks import BaseTest
9
8
10
9
11
10
class AggsTest (BaseTest ):
12
11
def test_get_aggs (self ):
13
- c = RESTClient ("" )
14
- aggs = c .get_aggs ("AAPL" , 1 , "day" , "2005-04-01" , "2005-04-04" )
12
+ aggs = self .c .get_aggs ("AAPL" , 1 , "day" , "2005-04-01" , "2005-04-04" )
15
13
expected = [
16
14
Agg (
17
15
open = 1.5032 ,
@@ -37,8 +35,7 @@ def test_get_aggs(self):
37
35
self .assertEqual (aggs , expected )
38
36
39
37
def test_get_grouped_daily_aggs (self ):
40
- c = RESTClient ("" )
41
- aggs = c .get_grouped_daily_aggs ("2005-04-04" , True )
38
+ aggs = self .c .get_grouped_daily_aggs ("2005-04-04" , True )
42
39
expected = [
43
40
GroupedDailyAgg (
44
41
ticker = "GIK" ,
@@ -55,8 +52,7 @@ def test_get_grouped_daily_aggs(self):
55
52
self .assertEqual (aggs , expected )
56
53
57
54
def test_get_daily_open_close_agg (self ):
58
- c = RESTClient ("" )
59
- aggs = c .get_daily_open_close_agg ("AAPL" , "2005-04-01" , True )
55
+ aggs = self .c .get_daily_open_close_agg ("AAPL" , "2005-04-01" , True )
60
56
expected = [
61
57
DailyOpenCloseAgg (
62
58
after_hours = 123 ,
@@ -74,8 +70,7 @@ def test_get_daily_open_close_agg(self):
74
70
self .assertEqual (aggs , expected )
75
71
76
72
def test_get_previous_close_agg (self ):
77
- c = RESTClient ("" )
78
- aggs = c .get_previous_close_agg ("AAPL" )
73
+ aggs = self .c .get_previous_close_agg ("AAPL" )
79
74
expected = [
80
75
PreviousCloseAgg (
81
76
ticker = "AAPL" ,
0 commit comments