Comments (7)
Hello @yogamurthy --
Thanks for letting us know. Would you please share with us the environment details as well as the fill script you are running? Thanks!
from coinbasepro-python.
OS: Windows 7
Python: tried in both 2.7 and 3.6
The following is the complete script im using now
import GDAX, time
class myWebsocketClient(GDAX.WebsocketClient):
def onOpen(self):
self.url = "wss://ws-feed.gdax.com/"
self.products = ["LTC-USD"]
self.MessageCount = 0
print("Lets count the messages!")
def onMessage(self, msg):
print("Message type:", msg["type"], "\t@ %.3f" % float(msg["price"]))
self.MessageCount += 1
if(self.MessageCount >= 100):
exit()
def onClose(self):
print("-- Goodbye! --")
wsClient = myWebsocketClient()
wsClient.start()
print(wsClient.url, wsClient.products)
while (wsClient.MessageCount < 500):
print("\nMessageCount =", "%i \n" % wsClient.MessageCount)
time.sleep(1)
from coinbasepro-python.
Hi @yogamurthy - Firstly, I would like to state I did not encounter this issue on my current Python interpreters, but I will do my best to help you out given the information on hand.
Under initial inspection of your script, it seems as though you are missing the last line here:
wsClient.close()
...but you said it exits with the 'Goodbye!' message, so I'm going to assume you have this line. Additionally, it would be better practice to change the onMessage method to the code following. While it didn't change the behavior, it might be a better way to implement a fix to your issue. The message count & close logic was to show how you might share variables between threads so feel free to modify this to suit your needs.
self.MessageCount += 1
if self.MessageCount >= 100 and 'type' in msg:
print("Message type:", msg)
Please let me know if you have any additional questions!
from coinbasepro-python.
I have been getting a similar issue on my mac
from coinbasepro-python.
Hi @jwlondon98 thank you for sharing your issue! Hopefully we can get this cleared up ASAP. Did the fixes above work? Are you getting the same error? What version of the project are you running?
from coinbasepro-python.
My scripts have also been crashing near the end of any implementations of WebsocketClient.
I had been receiving a segmentation fault (core dump) error.
It happened most of the time but not all of the time. So probably a multithreading issue.
I think sometimes it was possible for the websocket connection in WebsocketClient to be called (in the secondary thread) after the socket had already closed (in the main thread).
If we join to the second thread after self.stop = True,but before self.ws.close(), the websocket connection can't close while the secondary thread is running.
In def close(self) of WebsocketClient.py:
Old code:
def close(self):
...
self.onClose()
self.stop = True
# self.thread = None
self.ws.close()
Proposed code:
def close(self):
...
self.onClose()
self.stop = True
# self.thread = None
self.thread.join()
self.ws.close()
from coinbasepro-python.
This has been implemented in the most recent update to PyPI
@yogamurthy I will be closing this out within the next week -- please let us know if you encounter the same error with these changes.
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.