Hi knite, nice to see the code being used / looked at and thanks for your comments. I'll comment on some of them...
- Is there a reason for using the urllib2 module? The requests module is much nicer.
No, not from my side. This (coding traidor) was the first time I did any requesting in python. Tried urllib (didn't work for some reason), the tried urllib2 (worked) so I just stuck with that.
- Why aren't you using the logging module instead of print statements?
Forgive my ignorance of the logging module, will take a look next time I need to dump some info.
On a more general note: there are never reasons for
not doing something, there can only be reasons for
doing something . Why do you not believe in the flying spaghetti monster?
- Consider making your SocketIO classes more generic and creating an MTGox sub-class which inherits from it, passing in event handlers (on_connect, on_msg, etc). This will make things easier if and when other exchanges add streaming APIs.
Consider this considered. However, when thinking about integrating other exchanges, there is a lot more work on other parts of my code to be done. I've been wanting to do this for a while now but decided if I would do it, I'd reimplement in another language that better suits my experience. Let me point you to Goncalo Pinheira (goncalopp, don't know if on forum, he mailed me, will give you his email upon request in pm), who has been asking me about this and if he could use my code (been asking for lgpl) and who seems to want to do exactly that (exchange abstraction)
- I strongly recommend reducing your client heartbeat interval. I've set mine to 85% of the value given by the server, rounded down.
done