MCPcopy Create free account
hub / github.com/danpaquin/coinbasepro-python / MyWebsocketClient

Class MyWebsocketClient

cbpro/websocket_client.py:151–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149
150
151 class MyWebsocketClient(cbpro.WebsocketClient):
152 def on_open(self):
153 self.url = "wss://ws-feed.pro.coinbase.com/"
154 self.products = ["BTC-USD", "ETH-USD"]
155 self.message_count = 0
156 print("Let's count the messages!")
157
158 def on_message(self, msg):
159 print(json.dumps(msg, indent=4, sort_keys=True))
160 self.message_count += 1
161
162 def on_close(self):
163 print("-- Goodbye! --")
164
165
166 wsClient = MyWebsocketClient()

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected