diff --git a/vnpy/trader/gateway.py b/vnpy/trader/gateway.py index 598120c3..2442f990 100644 --- a/vnpy/trader/gateway.py +++ b/vnpy/trader/gateway.py @@ -36,6 +36,8 @@ class BaseGateway(ABC): # How to implement a gateway: + --- + ## Basics A gateway should satisfies: * this class should be thread-safe: * all methods should be thread-safe @@ -44,10 +46,12 @@ class BaseGateway(ABC): * satisfies all requirements written in docstring for every method and callbacks. * automatically reconnect if connection lost. - methods must implements: + --- + ## methods must implements: all @abstractmethod - callbacks must response manually: + --- + ## callbacks must response manually: * on_tick * on_trade * on_order @@ -55,6 +59,13 @@ class BaseGateway(ABC): * on_account * on_contract + All the XxxData passed to callback should be constant, which means that + the object should not be modified after passing to on_xxxx. + So if you use a cache to store reference of data, use copy.copy to create a new object + before passing that data into on_xxxx + + + """ # Fields required in setting dict for connect function.