Exemple #1
0
 def __init__(self):
     spec = {
         TS_INPUT: {
             'input_': TS_MULTI_SCALAR
         },
     }
     TimeSeriesUnit.__init__(self, self.action, spec)
Exemple #2
0
    def __init__(self,
                 trading_user,
                 strategy_id,
                 strategy_run_id,
                 ts_name,
                 cassandra,
                 jsonifier=lambda x: json.dumps(x),
                 name=None):

        spec = {
            TS_INPUT: {
                'input_ts': TS_MULTI_SCALAR
            },
        }
        TimeSeriesUnit.__init__(self, self.action, spec)
        self._trading_user = trading_user
        self._strategy_id = strategy_id
        self._strategy_run_id = strategy_run_id
        self._ts_name = ts_name
        self._cassandra = cassandra
        self._cassandra.connect(keyspace='strategydata')
        self._insert_query = cassandra.session.prepare(_INSERT_QUERY)

        # for debugging
        self._name = name

        self._jsonifier = jsonifier
Exemple #3
0
 def __init__(self, keys, key_func=lambda v: v, strict_keys=True):
     outputs = {key: TS_SCALAR for key in keys}
     spec = {TS_INPUT: {'input_': TS_MULTI_SCALAR}, TS_OUTPUT: outputs}
     TimeSeriesUnit.__init__(self, self.action, spec)
     self._key_func = key_func
     self._strict_keys = strict_keys
     self._logger = get_logger(__name__)
Exemple #4
0
 def __init__(self, push_port, name=None):
     spec = {
         TS_INPUT: {
             'input_': TS_MULTI_SCALAR
         },
     }
     TimeSeriesUnit.__init__(self, self.action, spec, name=name)
     self._push_port = push_port
Exemple #5
0
 def __init__(self, delay=1, name=None):
     spec = {
         TS_INPUT: {
             'delayed': TS_MULTI_SCALAR
         },
     }
     TimeSeriesUnit.__init__(self, self.action, spec, name=name)
     self._delay = delay
Exemple #6
0
 def __init__(self, name=None):
     spec = {
         TS_INPUT: {
             'value': TS_MULTI_SCALAR
         },
     }
     TimeSeriesUnit.__init__(self, self.action, spec, name=name)
     self._last_action_timestamp = None
     self._delay_ms = 1
Exemple #7
0
 def __init__(self, prefix, ts_type=TS_SCALAR):
     self._logger = getLogger(prefix)
     spec = {TS_INPUT: {'input': TS_SCALAR}}
     TimeSeriesUnit.__init__(self, self.action, spec)
Exemple #8
0
 def __init__(self, timeseries):
     self._ts = timeseries
     self._index = 0
     spec = {TS_INPUT: {'tick': TS_SCALAR}}
     TimeSeriesUnit.__init__(self, self.action, spec)