-
Notifications
You must be signed in to change notification settings - Fork 741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No option for heartbeat subscription #28
Comments
Great callout @trecchia . I will get working on this after all additional endpoints are supported. |
… is not displaying. See issue #28.
Please see the commit mentioned here. I have added this functionality, but when I send the message to the websocket server, no responses are received. |
Hi @trecchia -- After making this change, I am still having trouble receiving messages. I attempted this in my original testing, but have committed this for your review. I apologize for the late response and not tagging the most recent commit with this issue. |
Hey @danpaquin, so I think the problem is using "is" for equality comparison. Because "is" is an identity comparison, I believe it won't consider those two strings to be True and thus neither condition is actually met. Try changing it to:
That said, another thing I noticed when attempting to get this to work myself was that you need to send two separate messages to GDAX in order for it to work. So you'd need to do a |
This has been completed. Thank you for your help @trecchia. See below for my implementation. I will be closing this out in 48 hours if there are no more issues. import GDAX, time
class myWebsocketClient(GDAX.WebsocketClient):
def onOpen(self):
self.type = "heartbeat"
self.url = "wss://ws-feed.gdax.com/"
self.products = ["BTC-USD", "ETH-USD"]
self.MessageCount = 0
print "Lets count the messages!"
def onMessage(self, msg):
if msg['type'] == "heartbeat":
print(msg)
#else:
#print "Message type:", msg["type"], "\t@ %.3f" % float(msg["price"])
self.MessageCount += 1
def onClose(self):
print("-- Goodbye! --")
wsClient = myWebsocketClient()
wsClient.start()
#print (wsClient.url, wsClient.products)
# Do some logic with the data
while (wsClient.MessageCount < 500 and not wsClient.stop):
time.sleep(1)
print ("\nMessageCount =", "%i \n" % wsClient.MessageCount)
wsClient.close() |
Yep this did it- working on my end with these changes. Thank you! |
Are there any plans to extend the class to include the ability to subscribe to heartbeats? As of now I see no way to handle this.
The text was updated successfully, but these errors were encountered: