I am new to OOP and am writing a small tool in Python that checks Bitcoin prices using a JSON load from the web Bitcoin() class
, it monitors the prices Monitor()
, notifies the user when thresholds are met Notify()
and uses a console-interface Interface()
for now to do so.
I have created a Bitcoin()
class that can read the prices and volumes from the JSON load. The __init__
definition connects to the web using socket. Since every instance of this class would result in a new socket, I would only need/want one instance of this class running.
- Is a class still the best way to approach this?
- What is the best way to get other classes and instances to interact with my
Bitcoin()
instance? - Should I global a
Bitcoin()
instance? Pass the instance as an argument to every class that needs it?