Beispiel #1
0
 def __init__(self):
     super(CtaStrategyInfoPlugin, self).__init__()
     LoggerMixin.__init__(self)
     self._etcd_url = handle_url(os.environ.get("ETCD_URL",
                                                "http://localhost:2379"),
                                 default_path=self.ETCD_URL_PATH)
     self.ctaEngine = None
Beispiel #2
0
 def __init__(self, parent, symbol, size=None):
     LoggerMixin.__init__(self)
     BarUtilsMixin.__init__(self)
     self._parent = proxy(parent)
     self._symbol = symbol
     self._callback = {}
     self._high_freqs = OrderedDict() # higher frequencys than 1min(contains 1min).
     self._low_freqs = OrderedDict() # lower frequencys than 1min(contains 1min).
     self._size = size or self.default_size
     self.init()
Beispiel #3
0
 def __init__(self, mainEngine, eventEngine):
     super(CtaEngineWithPlugins, self).__init__(mainEngine, eventEngine)
     LoggerMixin.__init__(self)
     self._plugin = {}
     self._preTickEventHandlers = []
     self._postTickEventHandlers = []
     self._prePositionEventHandlers = []
     self._postPositionEventHandlers = []
     self._preOrderEventHandlers = []
     self._postOrderEventHandlers = []
     self._preTradeEventHandlers = []
     self._postTradeEventHandlers = []
     self._preAccountEventHandlers = []
     self._postAccountEventHandlers = []
Beispiel #4
0
 def __init__(self):
     super(CtaStrategyInfoPlugin, self).__init__()
     LoggerMixin.__init__(self)
     self._etcd_url = os.environ.get("ETCD_URL",
                                     "http://localhost:2379/v3beta/kv/put")
     self.ctaEngine = None
Beispiel #5
0
 def __init__(self, engine, mode=None, size=None):
     self._engine = proxy(engine)
     self._mode = mode or self.MODE.ON_TICK
     self._logger = LoggerMixin()
     self._size = size
     self.init()
Beispiel #6
0
import numpy as np
from dateutil.parser import parse
from vnpy.trader.vtObject import VtBarData
from vnpy.trader.utils import LoggerMixin
from vnpy.trader.vtConstant import VN_SEPARATOR
from vnpy.trader.utils.datetime import *
from vnpy.trader.utils.datetime import _freq_re_str

from .arraymanager import ArrayManager
from .utils import BarTimer, BarUtilsMixin
from ..ctaPlugin import CtaEnginePlugin
from ...ctaBase import ENGINETYPE_BACKTESTING, ENGINETYPE_TRADING

_on_bar_re = re.compile("^on%sBar$" % _freq_re_str)
logger = LoggerMixin()


class SymbolBarManager(LoggerMixin, BarUtilsMixin):
    default_size = 100

    def __init__(self, parent, symbol, size=None):
        LoggerMixin.__init__(self)
        BarUtilsMixin.__init__(self)
        self._parent = proxy(parent)
        self._symbol = symbol
        self._callback = {}
        self._high_freqs = OrderedDict() # higher frequencys than 1min(contains 1min).
        self._low_freqs = OrderedDict() # lower frequencys than 1min(contains 1min).
        self._size = size or self.default_size
        self.init()