You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+93-77Lines changed: 93 additions & 77 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,114 +1,103 @@
1
1
# GDAX-Python
2
-
The Python client for the [GDAX API](https://docs.gdax.com/) (formerly known as the Coinbase Exchange API)
2
+
The Python client for the [GDAX API](https://docs.gdax.com/) (formerly known as
3
+
the Coinbase Exchange API)
3
4
4
5
##### Provided under MIT License by Daniel Paquin.
5
-
*Note: this library may be subtly broken or buggy. The code is released under the MIT License – please take the following message to heart:*
6
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6
+
*Note: this library may be subtly broken or buggy. The code is released under
7
+
the MIT License – please take the following message to heart:*
8
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
10
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
11
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
12
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
13
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7
14
8
15
## Benefits
9
16
- A simple to use python wrapper for both public and authenticated endpoints.
10
-
- In about 10 minutes, you could be programmatically trading on one of the largest Bitcoin exchanges in the *world*!
11
-
- Do not worry about handling the nuances of the API with easy-to-use methods for every API endpoint.
12
-
- Gain an advantage in the market by getting under the hood of GDAX to learn what and who is *really* behind every tick.
17
+
- In about 10 minutes, you could be programmatically trading on one of the
18
+
largest Bitcoin exchanges in the *world*!
19
+
- Do not worry about handling the nuances of the API with easy-to-use methods
20
+
for every API endpoint.
21
+
- Gain an advantage in the market by getting under the hood of GDAX to learn
22
+
what and who is *really* behind every tick.
13
23
14
24
## Under Development
15
-
- Test Scripts **on dev branch**
16
-
- Additional Functionality for *WebsocketClient*, including a real-time order book
25
+
- Testing
26
+
- Additional Functionality for *WebsocketClient*, including a real-time order
27
+
book
17
28
- FIX API Client **Looking for support**
18
29
19
30
## Getting Started
20
-
This README is documentation on the syntax of the python client presented in this repository. **In order to use this wrapper to its full potential, you must familiarize yourself with the official GDAX documentation.**
31
+
This README is documentation on the syntax of the python client presented in
32
+
this repository. See function docstrings for full syntax details.
33
+
**This API attempts to present a clean interface to GDAX, but n order to use it
34
+
to its full potential, you must familiarize yourself with the official GDAX
35
+
documentation.**
21
36
22
37
-https://docs.gdax.com/
23
38
24
39
- You may manually install the project or use ```pip```:
25
40
```python
26
-
pip install GDAX
41
+
pip install gdax
27
42
```
28
43
29
44
### Public Client
30
-
Only some endpoints in the API are available to everyone. The public endpoints can be reached using ```PublicClient```
45
+
Only some endpoints in the API are available to everyone. The public endpoints
Only available for the `PublicClient`, you may pass any function above raw JSON data. This may be useful for some applications of the project and should not hinder performance, but we are looking into this. *Do you love or hate this? Please share your thoughts within the issue tab!*
Some calls are [paginated](https://docs.gdax.com/#pagination), meaning multiple calls must be made to receive the full set of data. Each page/request is a list of dict objects that are then appended to a master list, making it easy to navigate pages (e.g. ```request[0]``` would return the first page of data in the example below). *This feature is under consideration for redesign. Please provide feedback if you have issues or suggestions*
123
+
Some calls are [paginated](https://docs.gdax.com/#pagination), meaning multiple
124
+
calls must be made to receive the full set of data. Each page/request is a list
125
+
of dict objects that are then appended to a master list, making it easy to
126
+
navigate pages (e.g. ```request[0]``` would return the first page of data in the
127
+
example below). *This feature is under consideration for redesign. Please
128
+
provide feedback if you have issues or suggestions*
133
129
```python
134
130
request = auth_client.get_fills(limit=100)
135
131
request[0] # Page 1 always present
136
132
request[1] # Page 2+ present only if the data exists
137
133
```
138
-
It should be noted that limit does not behave exactly as the official documentation specifies. If you request a limit and that limit is met, additional pages will not be returned. This is to ensure speedy response times when less data is prefered.
134
+
It should be noted that limit does not behave exactly as the official
135
+
documentation specifies. If you request a limit and that limit is met,
136
+
additional pages will not be returned. This is to ensure speedy response times
The ```WebsocketClient``` subscribes in a separate thread upon initialization. There are three methods which you could overwrite (before initialization) so it can react to the data streaming in. The current client is a template used for illustration purposes only.
244
-
245
-
- onOpen - called once, *immediately before* the socket connection is made, this is where you want to add inital parameters.
246
-
- onMessage - called once for every message that arrives and accepts one argument that contains the message of dict type.
244
+
The ```WebsocketClient``` subscribes in a separate thread upon initialization.
245
+
There are three methods which you could overwrite (before initialization) so it
246
+
can react to the data streaming in. The current client is a template used for
247
+
illustration purposes only.
248
+
249
+
- onOpen - called once, *immediately before* the socket connection is made, this
250
+
is where you want to add inital parameters.
251
+
- onMessage - called once for every message that arrives and accepts one
252
+
argument that contains the message of dict type.
247
253
- onClose - called once after the websocket has been closed.
248
254
- close - call this method to close the websocket connection (do not overwrite).
249
255
```python
@@ -257,7 +263,8 @@ class myWebsocketClient(gdax.WebsocketClient):
@@ -269,9 +276,17 @@ while (wsClient.message_count < 500):
269
276
time.sleep(1)
270
277
wsClient.close()
271
278
```
279
+
## Testing
280
+
A test suite is under development. To run the tests, start in the project
281
+
directory and run
282
+
```
283
+
python -m pytest
284
+
```
272
285
273
286
### Real-time OrderBook
274
-
The ```OrderBook``` subscribes to a websocket and keeps a real-time record of the orderbook for the product_id input. Please provide your feedback for future improvements.
287
+
The ```OrderBook``` subscribes to a websocket and keeps a real-time record of
288
+
the orderbook for the product_id input. Please provide your feedback for future
289
+
improvements.
275
290
276
291
```python
277
292
import gdax, time
@@ -293,7 +308,8 @@ order_book.close()
293
308
- Added additional API functionality such as cancelAll() and ETH withdrawal.
294
309
295
310
*0.2.1*
296
-
- Allowed ```WebsocketClient``` to operate intuitively and restructured example workflow.
311
+
- Allowed ```WebsocketClient``` to operate intuitively and restructured example
0 commit comments