def __init__(self, mongo_db=None, log=logtoscreen("mongoPositionLimitData")): super().__init__(log=log) self._mongo_data = mongoDataWithMultipleKeys( POSITION_LIMIT_STATUS_COLLECTION, mongo_db=mongo_db)
def __init__( self, mongo_db=None, log=logtoscreen("arcticFuturesMultiplePricesData") ): super().__init__(log=log) self._arctic = arcticData(MULTIPLE_COLLECTION, mongo_db=mongo_db)
def dynamic_system( data: dataBlob, config_filename: str, log=logtoscreen("futures_system"), notional_trading_capital: float = arg_not_supplied, base_currency: str = arg_not_supplied, ) -> System: log_level = "on" sim_data = get_sim_data_object_for_production(data) config = set_up_config(data, config_filename) # Overwrite capital and base currency if notional_trading_capital is not arg_not_supplied: config.notional_trading_capital = notional_trading_capital if base_currency is not arg_not_supplied: config.base_currency = base_currency system = futures_system(data=sim_data, config=config) system._log = log system.set_logging_level(log_level) return system
def __init__(self, mongo_db=None, log=logtoscreen("mongoRollStateData")): super().__init__(log=log) self._mongo_data = mongoDataWithSingleKey(ROLL_STATUS_COLLECTION, ROLL_KEY, mongo_db=mongo_db)
def __init__(self, mongo_db=arg_not_supplied, log=logtoscreen("mongoCapitalData")): super().__init__(log=log) self._mongo_data = mongoDataWithMultipleKeys(self._collection_name, mongo_db=mongo_db)
def __init__(self, mongo_db=None, log=logtoscreen("mongoEmailControlData")): super().__init__(log=log) self._mongo_data = mongoDataWithMultipleKeys(EMAIL_CONTROL_COLLECTION, mongo_db=mongo_db)
def __init__(self, start_date=None, end_date=None, log=logtoscreen("csvFuturesSimTestData")): data = dataBlob( log=log, csv_data_paths=dict( csvFuturesAdjustedPricesData="data.test.adjusted_prices_csv", csvFuturesInstrumentData="data.test.csvconfig", ), class_list=[ csvFuturesAdjustedPricesData, csvFuturesMultiplePricesData, csvFuturesInstrumentData, csvFxPricesData, csvRollParametersData, ], ) super().__init__(data=data) if start_date is not None: self._start_date = start_date else: self._start_date = ARBITRARY_START if end_date is not None: self._end_date = end_date else: self._end_date = self.DEFAULT_END_DATE
def __init__(self, mongo_db=None, log=logtoscreen("arcticFuturesAdjustedPrices")): super().__init__(log=log) self._arctic = arcticData(ADJPRICE_COLLECTION, mongo_db=mongo_db)
def __init__(self, mongo_db=arg_not_supplied, log=logtoscreen("mongoRollParametersData")): super().__init__(log=log) self._mongo_data = mongoDataWithSingleKey(ROLL_COLLECTION, "instrument_code", mongo_db=mongo_db)
def __init__(self, mongo_db=arg_not_supplied, log=logtoscreen("mongotemporaryCloseData")): super().__init__(log=log) self._mongo_data = mongoDataWithSingleKey(TEMPORARY_CLOSE_COLLECTION, "instrument_code", mongo_db=mongo_db)
def __init__(self, mongo_db: mongoDb = arg_not_supplied, log=logtoscreen("mongoLogData")): self._mongo_data = mongoDataWithSingleKey( collection_name=LOG_COLLECTION_NAME, key_name=LOG_RECORD_ID, mongo_db=mongo_db) super().__init__(log=log)
def __init__(self, mongo_db=None, log=logtoscreen("arcticFuturesContractPriceData")): super().__init__(log=log) self._arctic_connection = arcticData(CONTRACT_COLLECTION, mongo_db=mongo_db)
def __init__(self, datapath=arg_not_supplied, log=logtoscreen("csvRollCalendarData")): super().__init__(log=log) if datapath is arg_not_supplied: datapath = CSV_ROLL_CALENDAR_DIRECTORY self._datapath = datapath
def __init__(self, mongo_db=arg_not_supplied, log=logtoscreen("mongoFuturesInstrumentData")): super().__init__(log=log) self._mongo_data = mongoDataWithSingleKey(INSTRUMENT_COLLECTION, "instrument_code", mongo_db=mongo_db)
def __init__(self, mongo_db=None, log=logtoscreen("mongoOrderStackData")): # Not needed as we don't store anything in _state attribute used in parent class # If we did have _state would risk breaking if we forgot to override methods # super().__init__() collection_name = self._collection_name() self._mongo_data = mongoDataWithSingleKey(collection_name, "order_id", mongo_db=mongo_db) super().__init__(log=log)
def __init__(self, mongo_db=arg_not_supplied, log=logtoscreen("mongoLockData")): super().__init__(log=log) self._mongo_data = mongoDataWithSingleKey(LOCK_STATUS_COLLECTION, "instrument_code", mongo_db=mongo_db)
def __init__( self, idoffset=arg_not_supplied, log=logtoscreen("brokerClientIdTracker"), ): if idoffset is arg_not_supplied: _notused_ipaddress, _notused_port, idoffset = ib_defaults() super().__init__(log=log, idoffset=idoffset)
def __init__( self, idoffset: int = 0, log=logtoscreen("brokerClientIdTracker"), ): super().__init__(log=log) self._idoffset = idoffset
def __init__(self, datapath=arg_not_supplied, log=logtoscreen("csvFuturesContractData")): super().__init__(log=log) if datapath is arg_not_supplied: raise Exception("Need to pass datapath") self._datapath = datapath
def __init__( self, mongo_db=arg_not_supplied, idoffset=arg_not_supplied, log=logtoscreen("mongoIDTracker"), ): super().__init__(log=log, idoffset=idoffset) self._mongo_data = mongoDataWithSingleKey(IB_CLIENT_COLLECTION, IB_ID_REF, mongo_db)
def __init__(self, mongo_db=arg_not_supplied, log=logtoscreen("mongoFuturesContractData")): super().__init__(log=log) mongo_data = mongoDataWithSingleKey(CONTRACT_COLLECTION, "contract_key", mongo_db=mongo_db) self._mongo_data = mongo_data
def __init__( self, mongo_db=arg_not_supplied, log=logtoscreen("mongoMarginData"), ): self._mongo_data = mongoDataWithSingleKey(MARGIN_COLLECTION, STRATEGY_REF, mongo_db) self._log = log
def __init__(self, datapath=arg_not_supplied, log=logtoscreen("csvRollStateData")): super().__init__(log=log) if datapath is arg_not_supplied: raise Exception("Datapath needs to be passed") self._config_file = get_filename_for_package(datapath, "roll_state.csv") self.name = "Roll state data from %s" % self._config_file
def __init__(self, mongo_db=arg_not_supplied, log=logtoscreen("mongoControlProcessData")): super().__init__(log=log) self._mongo_data = mongoDataWithSingleKey(PROCESS_CONTROL_COLLECTION, PROCESS_CONTROL_KEY, mongo_db=mongo_db)
def __init__(self, log=logtoscreen("baseData")): """ simData socket base class >>> data = baseData() >>> data simData object """ self._log = log
def __init__(self, net_returns: returnsForOptimisation, log: logger = logtoscreen("optimiser"), method="handcraft", **weighting_args): self._net_returns = net_returns self._log = log self._weighting_args = weighting_args self._method = method
def __init__(self, datapath: str = arg_not_supplied, log=logtoscreen("csvFuturesMultiplePricesData")): super().__init__(log=log) if datapath is arg_not_supplied: datapath = CSV_MULTIPLE_PRICE_DIRECTORY self._datapath = datapath
def __init__(self, datapath=arg_not_supplied, log=logtoscreen("csvOptimalPositionData")): super().__init__(log=log) if datapath is None: raise Exception("Need to provide datapath") self._datapath = datapath
def __init__(self, log=logtoscreen("csvRollParametersData"), datapath=arg_not_supplied): super().__init__(log=log) if datapath is arg_not_supplied: datapath = ROLLS_DATAPATH config_file = get_filename_for_package(datapath, ROLLS_CONFIG_FILE) self._config_file = config_file
def _avoid_pacing_violation(last_call_datetime: datetime.datetime, log: logger = logtoscreen("")): printed_warning_already = False while _pause_for_pacing(last_call_datetime): if not printed_warning_already: log.msg( "Pausing %f seconds to avoid pacing violation" % (datetime.datetime.now() - last_call_datetime).total_seconds()) printed_warning_already = True pass