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 22
33# A Python client library for Polgyon's WebSocket and RESTful APIs
44
5- Currently this repo only supports the WebSocket API
6-
75## Getting Started
86
97For a basic product overview, check out our [ setup and use documentation] ( https://polygon.io/sockets )
108
119
12- ## Simple Demo
10+ ## Simple WebSocket Demo
1311``` python
1412import time
1513
1614
17- from polygon_client import WebSocketClient, STOCKS_CLUSTER
15+ from polygon import WebSocketClient, STOCKS_CLUSTER
1816
1917
2018def my_customer_process_message (message ):
@@ -36,3 +34,27 @@ if __name__ == "__main__":
3634 main()
3735
3836```
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