File tree Expand file tree Collapse file tree 2 files changed +39
-4
lines changed Expand file tree Collapse file tree 2 files changed +39
-4
lines changed Original file line number Diff line number Diff line change 2
2
3
3
# A Python client library for Polgyon's WebSocket and RESTful APIs
4
4
5
- Currently this repo only supports the WebSocket API
6
-
7
5
## Getting Started
8
6
9
7
For a basic product overview, check out our [ setup and use documentation] ( https://polygon.io/sockets )
10
8
11
9
12
- ## Simple Demo
10
+ ## Simple WebSocket Demo
13
11
``` python
14
12
import time
15
13
16
14
17
- from polygon_client import WebSocketClient, STOCKS_CLUSTER
15
+ from polygon import WebSocketClient, STOCKS_CLUSTER
18
16
19
17
20
18
def my_customer_process_message (message ):
@@ -36,3 +34,27 @@ if __name__ == "__main__":
36
34
main()
37
35
38
36
```
37
+
38
+ ## Simple REST Demo
39
+ ``` python
40
+ from polygon import RESTClient
41
+
42
+
43
+ def main ():
44
+ key = " your api key"
45
+ client = RESTClient(key)
46
+
47
+ resp = client.stocks_equities_daily_open_close(" AAPL" , " 2018-3-2" )
48
+ print (f " On: { resp.from_} Apple opened at { resp.open} and closed at { resp.close} " )
49
+
50
+
51
+ if __name__ == ' __main__' :
52
+ main()
53
+ ```
54
+
55
+
56
+ ## Notes about the REST Client
57
+
58
+ We use swagger as our API spec and we used this swagger to generate most of the code that defines the REST client.
59
+ We made this decision due to the size of our API, many endpoints and object definitions, and to accommodate future changes.
60
+
Original file line number Diff line number Diff line change
1
+ from polygon import RESTClient
2
+
3
+
4
+ def main ():
5
+ key = "your api key"
6
+ client = RESTClient (key )
7
+
8
+ resp = client .stocks_equities_daily_open_close ("AAPL" , "2018-3-2" )
9
+ print (f"On: { resp .from_ } Apple opened at { resp .open } and closed at { resp .close } " )
10
+
11
+
12
+ if __name__ == '__main__' :
13
+ main ()
You can’t perform that action at this time.
0 commit comments