Comments (6)
Great callout @trecchia . I will get working on this after all additional endpoints are supported.
from coinbasepro-python.
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()
from coinbasepro-python.
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.
from coinbasepro-python.
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.
from coinbasepro-python.
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:
if self.type == "subscribe":
sub_params['product_ids'] = self.products
elif self.type == "heartbeat":
sub_params['on'] = "true"
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 self.ws.send(json.dumps(sub_params))
twice- once for the product subscription and another for the heartbeat. Let me know if this makes sense/helps!
from coinbasepro-python.
Yep this did it- working on my end with these changes. Thank you!
from coinbasepro-python.
Related Issues (20)
- AuthenticatedClient.place_stop_order Returning Invalid HOT 3
- pro.coinbase.com/orders - request timestamp expired HOT 1
- get_account-is returning '1inch' as my main currency instead of USD HOT 1
- convert_stablecoin not updated in pip HOT 2
- Retrieve high, low close price over last hour HOT 1
- Transfer History Ticker label HOT 1
- Problem with the Order Entry's Effect on the Available Balance
- Orders simply not placing? HOT 1
- AttributeError: partially initialized module 'cbpro' has no attribute 'public_client' (most likely due to a circular import) HOT 1
- 'pip install cbpro' does not install the same version as 'pip install git+git://github.com/danpaquin/coinbasepro-python.git' HOT 4
- Activating stop orders before it hits the limit price HOT 1
- get_product_trades method hangs
- Trailing Stop - Dynamically updating existing positions HOT 2
- Cannot create PublicClient with Python 3.10
- Incompatible problens
- Withdraw Route to Coinbase Account is Incorrect
- websocket connection resets every two minutes HOT 1
- Coinbase API change HOT 3
- Dependency issue with Six version 1.10 vs 1.12 HOT 1
- Repo does not have option to view transfer ID's.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coinbasepro-python.