コード例 #1
0
 def __init__(self, sys_config: SystemConfiguration):
     MyCacheObjectApi.__init__(self)
     self.sys_config = sys_config
     self.detector = None
     self.pattern_data = None
     self.last_refresh_ts = None
     self.period_aggregation_ts = self.sys_config.period_aggregation * 60
コード例 #2
0
 def add_ticker(self, ticker: Ticker):
     api = MyCacheObjectApi()
     api.valid_until_ts = MyDate.get_epoch_seconds_from_datetime(
     ) + self._cache_seconds
     api.key = ticker.ticker_id
     api.object = ticker
     self.add_cache_object(api)
コード例 #3
0
 def __add_data_frame_to_cache__(
         self, df: pd.DataFrame,
         data_fetcher_cache_key: DataFetcherCacheKey):
     cache_api = MyCacheObjectApi()
     cache_api.key = data_fetcher_cache_key.key
     cache_api.object = df
     cache_api.valid_until_ts = data_fetcher_cache_key.valid_until_ts
     self._df_cache.add_cache_object(cache_api)
コード例 #4
0
 def __init__(self, sys_config: SystemConfiguration):
     MyCacheObjectApi.__init__(self)
     self.sys_config = sys_config
     self.detector = None
     self.pattern_data = None
     self.last_refresh_ts = None
     self.period_aggregation_ts = self.sys_config.period_aggregation * 60
     self.trade_test = TradeTest(TP.TRADE_REPLAY, self.sys_config)
     self._selected_row_index = -1
     self.detector_for_replay = None
     self.graph_api_for_replay = None
     self.trade_handler_for_replay = None
     self.test_case_for_replay = None
     self.test_case_value_pair_index = -1
     self.graph_for_replay = None
コード例 #5
0
 def get_cache_object_api(key: str, cache_object: object, period: str, refresh_interval: int) -> MyCacheObjectApi:
     api = MyCacheObjectApi()
     api.key = key
     api.object = cache_object
     if period == PRD.INTRADAY:
         api.valid_until_ts = MyDate.time_stamp_now() + refresh_interval
     else:
         api.valid_until_ts = MyDate.time_stamp_now() + 10 * 60 * 60  # 10 hours
     return api
コード例 #6
0
 def init_by_balance_list(self, balances: list, dedicated_symbol=''):
     api = MyCacheObjectApi()
     api.valid_until_ts = MyDate.get_epoch_seconds_from_datetime(
     ) + self._cache_seconds
     for balance in balances:
         api.key = balance.asset
         api.object = balance
         self.add_cache_object(api)
     if dedicated_symbol != '' and self.get_cached_object_by_key(
             dedicated_symbol) is None:
         api.key = dedicated_symbol
         api.object = Balance('exchange', dedicated_symbol, 0, 0)
         self.add_cache_object(api)