Skip to content

Commit 1871e1b

Browse files
authored
Merge pull request #132 from lirenz/master
Channel change merged
2 parents de5f62b + 79fa546 commit 1871e1b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

gdax/websocket_client.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616
from pymongo import MongoClient
1717

1818
class WebsocketClient(object):
19-
def __init__(self, url="wss://ws-feed.gdax.com", products=None,
20-
message_type="subscribe", mongo_collection=None, should_print=True,
21-
auth=False, api_key="", api_secret="", api_passphrase=""):
19+
def __init__(self, url="wss://ws-feed.gdax.com", products=None, message_type="subscribe", mongo_collection=None,
20+
should_print=True, auth=False, api_key="", api_secret="", api_passphrase="", channels=None):
21+
2222
self.url = url
2323
self.products = products
24+
self.channels = channels
2425
self.type = message_type
2526
self.stop = False
2627
self.error = None
@@ -53,7 +54,12 @@ def _connect(self):
5354
if self.url[-1] == "/":
5455
self.url = self.url[:-1]
5556

56-
sub_params = {'type': 'subscribe', 'product_ids': self.products}
57+
if self.channels is None:
58+
sub_params = {'type': 'subscribe', 'product_ids': self.products}
59+
else:
60+
sub_params = {'type': 'subscribe', 'product_ids': self.products, 'channels': self.channels}
61+
62+
5763
if self.auth:
5864
timestamp = str(time.time())
5965
message = timestamp + 'GET' + '/users/self'

0 commit comments

Comments
 (0)