Skip to content

Commit

Permalink
log.terse() -> log.info()
Browse files Browse the repository at this point in the history
log.warn() -> log.warning()
  • Loading branch information
bug-or-feature committed Jun 12, 2023
1 parent 6b9d9c6 commit f1c7ea2
Show file tree
Hide file tree
Showing 59 changed files with 145 additions and 157 deletions.
2 changes: 1 addition & 1 deletion dashboard/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def visible_on_lan() -> bool:
visible = visible_on_lan()
if visible:
data = dataBlob()
data.log.warn(
data.log.warning(
"Starting dashboard with web page visible to all - security implications!!!!"
)
app.run(
Expand Down
6 changes: 3 additions & 3 deletions sysbrokers/IB/config/ib_fx_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def get_ib_config_from_file(log) -> pd.DataFrame:
try:
config_data = pd.read_csv(IB_CCY_CONFIG_FILE)
except BaseException:
log.warn("Can't read file %s" % IB_CCY_CONFIG_FILE)
log.warning("Can't read file %s" % IB_CCY_CONFIG_FILE)
config_data = missing_file

return config_data
Expand All @@ -28,7 +28,7 @@ def get_ib_config_from_file(log) -> pd.DataFrame:
def config_info_for_code(config_data: pd.DataFrame, currency_code, log) -> ibFXConfig:
new_log = log.setup(**{CURRENCY_CODE_LOG_LABEL: currency_code})
if config_data is missing_file:
new_log.warn(
new_log.warning(
"Can't get IB FX config for %s as config file missing" % currency_code
)

Expand All @@ -45,7 +45,7 @@ def config_info_for_code(config_data: pd.DataFrame, currency_code, log) -> ibFXC

def get_list_of_codes(log, config_data: pd.DataFrame) -> list:
if config_data is missing_file:
log.warn("Can't get list of fxcodes for IB as config file missing")
log.warning("Can't get list of fxcodes for IB as config file missing")
return []

list_of_codes = list(config_data.CODE)
Expand Down
10 changes: 6 additions & 4 deletions sysbrokers/IB/config/ib_instrument_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def read_ib_config_from_file(log: pst_logger = logtoscreen("")) -> IBconfig:
try:
df = pd.read_csv(IB_FUTURES_CONFIG_FILE)
except BaseException:
log.warn("Can't read file %s" % IB_FUTURES_CONFIG_FILE)
log.warning("Can't read file %s" % IB_FUTURES_CONFIG_FILE)
return missing_file

return IBconfig(df)
Expand All @@ -43,7 +43,7 @@ def get_instrument_object_from_config(
config = read_ib_config_from_file()

if config is missing_file:
new_log.warn(
new_log.warning(
"Can't get config for instrument %s as IB configuration file missing"
% instrument_code
)
Expand All @@ -53,7 +53,9 @@ def get_instrument_object_from_config(
try:
assert instrument_code in list_of_instruments
except:
new_log.warn("Instrument %s is not in IB configuration file" % instrument_code)
new_log.warning(
"Instrument %s is not in IB configuration file" % instrument_code
)
raise missingInstrument

futures_instrument_with_ib_data = _get_instrument_object_from_valid_config(
Expand Down Expand Up @@ -200,7 +202,7 @@ def get_instrument_list_from_ib_config(
config: IBconfig, log: pst_logger = logtoscreen("")
):
if config is missing_file:
log.warn("Can't get list of instruments because IB config file missing")
log.warning("Can't get list of instruments because IB config file missing")
return []

instrument_list = list(config.Instrument)
Expand Down
4 changes: 2 additions & 2 deletions sysbrokers/IB/ib_Fx_prices_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _get_fx_prices_without_checking(self, currency_code: str) -> fxPrices:
ib_config_for_code = self._get_config_info_for_code(currency_code)
except missingInstrument:
log = self.log.setup(**{CURRENCY_CODE_LOG_LABEL: currency_code})
log.warn("Can't get prices as missing IB config for %s" % currency_code)
log.warning("Can't get prices as missing IB config for %s" % currency_code)
return fxPrices.create_empty()

data = self._get_fx_prices_with_ib_config(currency_code, ib_config_for_code)
Expand All @@ -63,7 +63,7 @@ def _get_fx_prices_with_ib_config(
log = self.log.setup(**{CURRENCY_CODE_LOG_LABEL: currency_code})

if len(raw_fx_prices_as_series) == 0:
log.warn(
log.warning(
"No available IB prices for %s %s"
% (currency_code, str(ib_config_for_code))
)
Expand Down
2 changes: 1 addition & 1 deletion sysbrokers/IB/ib_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def close_connection(self):
# Try and disconnect IB client
self.ib.disconnect()
except BaseException:
self.log.warn(
self.log.warning(
"Trying to disconnect IB client failed... ensure process is killed"
)

Expand Down
2 changes: 1 addition & 1 deletion sysbrokers/IB/ib_futures_contract_price_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def _get_prices_at_frequency_for_contract_object_no_checking_with_expiry_flag(
)
)
except missingContract:
new_log.warn("Can't get data for %s" % str(futures_contract_object))
new_log.warning("Can't get data for %s" % str(futures_contract_object))
raise missingData

price_data = self._get_prices_at_frequency_for_ibcontract_object_no_checking(
Expand Down
4 changes: 2 additions & 2 deletions sysbrokers/IB/ib_futures_contracts_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def get_actual_expiry_date_for_single_contract(
"""
log = futures_contract.specific_log(self.log)
if futures_contract.is_spread_contract():
log.warn("Can't find expiry for multiple leg contract here")
log.warning("Can't find expiry for multiple leg contract here")
raise missingContract

contract_object_with_ib_data = self.get_contract_object_with_IB_data(
Expand All @@ -116,7 +116,7 @@ def _get_actual_expiry_date_given_single_contract_with_ib_metadata(
) -> expiryDate:
log = futures_contract_with_ib_data.specific_log(self.log)
if futures_contract_with_ib_data.is_spread_contract():
log.warn("Can't find expiry for multiple leg contract here")
log.warning("Can't find expiry for multiple leg contract here")
raise missingContract

expiry_date = self.ib_client.broker_get_single_contract_expiry_date(
Expand Down
6 changes: 3 additions & 3 deletions sysbrokers/IB/ib_orders.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def _create_broker_control_order_object(
instrument_code=instrument_code,
)
except ibOrderCouldntCreateException:
self.log.warn(
self.log.warning(
"Couldn't create order from ib returned order %s, usual behaviour for FX and equities trades"
% str(trade_with_contract_from_ib)
)
Expand Down Expand Up @@ -317,7 +317,7 @@ def _send_broker_order_to_IB(self, broker_order: brokerOrder) -> tradeWithContra
limit_price=limit_price,
)
if placed_broker_trade_object is missing_order:
log.warn("Couldn't submit order")
log.warning("Couldn't submit order")
return missing_order

log.debug("Order submitted to IB")
Expand Down Expand Up @@ -381,7 +381,7 @@ def cancel_order_on_stack(self, broker_order: brokerOrder):
self.match_db_broker_order_to_control_order_from_brokers(broker_order)
)
if matched_control_order is missing_order:
log.warn("Couldn't cancel non existent order")
log.warning("Couldn't cancel non existent order")
return None

self.cancel_order_given_control_object(matched_control_order)
Expand Down
8 changes: 5 additions & 3 deletions syscontrol/run_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def _finish_control_process(self):
result_of_finish = self.data_control.finish_process(self.process_name)

if result_of_finish is failure:
self.log.warn(
self.log.warning(
"Process %s won't finish in process control as already close: weird!"
% self.process_name
)
Expand Down Expand Up @@ -300,11 +300,13 @@ def _check_if_okay_to_wait_before_starting_process(

log = process_to_run.log
if okay_to_run is process_running:
log.warn("Can't start process %s at all since already running" % process_name)
log.warning(
"Can't start process %s at all since already running" % process_name
)
return False

elif okay_to_run is process_stop:
log.warn(
log.warning(
"Can't start process %s at all since STOPPED by control" % process_name
)
return False
Expand Down
2 changes: 1 addition & 1 deletion sysdata/csv/csv_adjusted_prices.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _get_adjusted_prices_without_checking(
try:
instrpricedata = pd_readcsv(filename)
except OSError:
self.log.warn("Can't find adjusted price file %s" % filename)
self.log.warning("Can't find adjusted price file %s" % filename)
return futuresAdjustedPrices.create_empty()

instrpricedata.columns = ["price"]
Expand Down
2 changes: 1 addition & 1 deletion sysdata/csv/csv_futures_contract_prices.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def _get_prices_at_frequency_for_contract_object_no_checking(
)
except OSError:
log = futures_contract_object.log(self.log)
log.warn("Can't find adjusted price file %s" % filename)
log.warning("Can't find adjusted price file %s" % filename)
return futuresContractPrices.create_empty()

instrpricedata = instrpricedata.groupby(level=0).last()
Expand Down
2 changes: 1 addition & 1 deletion sysdata/csv/csv_multiple_prices.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def _read_instrument_prices(self, instrument_code: str) -> pd.DataFrame:
try:
instr_all_price_data = pd_readcsv(filename, date_index_name=DATE_INDEX_NAME)
except OSError:
self.log.warn(
self.log.warning(
"Can't find multiple price file %s or error reading" % filename,
instrument_code=instrument_code,
)
Expand Down
2 changes: 1 addition & 1 deletion sysdata/csv/csv_roll_calendars.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _get_roll_calendar_without_checking(self, instrument_code: str) -> rollCalen

roll_calendar = pd_readcsv(filename, date_index_name=DATE_INDEX_NAME)
except OSError:
self.log.warn("Can't find roll calendar file %s" % filename)
self.log.warning("Can't find roll calendar file %s" % filename)
return rollCalendar.create_empty()

roll_calendar = rollCalendar(roll_calendar)
Expand Down
2 changes: 1 addition & 1 deletion sysdata/csv/csv_roll_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _add_roll_parameters_without_checking_for_existing_entry(
)
all_parameters.write_to_file(self.config_file)

self.log.warn(
self.log.warning(
"*** WRITTEN NEW ROLL PARAMETERS TO %s - copy to /data/futures/csvconfig/rollconfig.csv NOW ***"
% self.config_file
)
Expand Down
2 changes: 1 addition & 1 deletion sysdata/csv/csv_spot_fx.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def _get_fx_prices_without_checking(self, code: str) -> fxPrices:
filename, date_format=date_format, date_index_name=date_column
)
except OSError:
self.log.warn(
self.log.warning(
"Can't find currency price file %s" % filename,
**{CURRENCY_CODE_LOG_LABEL: code},
)
Expand Down
2 changes: 1 addition & 1 deletion sysdata/csv/csv_spreads.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _get_spreads_without_checking(
try:
spreads_from_pd = pd_readcsv(filename, date_index_name=DATE_INDEX_NAME)
except OSError:
self.log.warn("Can't find spread file %s" % filename)
self.log.warning("Can't find spread file %s" % filename)
return spreadsForInstrument()

spreads_as_series = pd.Series(spreads_from_pd[SPREAD_COLUMN_NAME])
Expand Down
2 changes: 1 addition & 1 deletion sysdata/data_blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def _get_csv_paths_for_class(self, class_object) -> str:

datapath = csv_data_paths.get(class_name, "")
if datapath == "":
self.log.warn(
self.log.warning(
"No key for %s in csv_data_paths, will use defaults (may break in production, should be fine in sim)"
% class_name
)
Expand Down
6 changes: 3 additions & 3 deletions sysdata/futures/adjusted_prices.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ def delete_adjusted_prices(self, instrument_code: str, are_you_sure: bool = Fals
self._delete_adjusted_prices_without_any_warning_be_careful(
instrument_code
)
self.log.terse(
self.log.info(
"Deleted adjusted price data for %s" % instrument_code,
instrument_code=instrument_code,
)

else:
# doesn't exist anyway
self.log.warn(
self.log.warning(
"Tried to delete non existent adjusted prices for %s"
% instrument_code,
instrument_code=instrument_code,
Expand Down Expand Up @@ -89,7 +89,7 @@ def add_adjusted_prices(
instrument_code, adjusted_price_data
)

self.log.terse(
self.log.info(
"Added data for instrument %s" % instrument_code,
instrument_code=instrument_code,
)
Expand Down
8 changes: 4 additions & 4 deletions sysdata/futures/contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ def delete_contract_data(
self._delete_contract_data_without_any_warning_be_careful(
instrument_code, contract_date
)
log.terse("Deleted contract %s/%s" % (instrument_code, contract_date))
log.info("Deleted contract %s/%s" % (instrument_code, contract_date))
else:
# doesn't exist anyway
log.warn("Tried to delete non existent contract")
log.warning("Tried to delete non existent contract")
else:
log.error("You need to call delete_contract_data with a flag to be sure")

Expand Down Expand Up @@ -88,14 +88,14 @@ def add_contract_data(
if ignore_duplication:
pass
else:
log.warn(
log.warning(
"There is already %s in the data, you have to delete it first"
% (contract_object.key)
)
return None

self._add_contract_object_without_checking_for_existing_entry(contract_object)
log.terse("Added contract %s %s" % (instrument_code, contract_date))
log.info("Added contract %s %s" % (instrument_code, contract_date))

def get_list_of_contract_dates_for_instrument_code(
self, instrument_code: str, allow_expired: bool = False
Expand Down
12 changes: 7 additions & 5 deletions sysdata/futures/futures_per_contract_prices.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def write_merged_prices_for_contract_object(
if not_ignoring_duplication:
if self.has_merged_price_data_for_contract(futures_contract_object):
log = futures_contract_object.log(self.log)
log.warn(
log.warning(
"There is already existing data for %s"
% futures_contract_object.key
)
Expand Down Expand Up @@ -332,7 +332,7 @@ def write_prices_at_frequency_for_contract_object(
contract_object=futures_contract_object, frequency=frequency
):
log = futures_contract_object.log(self.log)
log.warn(
log.warning(
"There is already existing data for %s"
% futures_contract_object.key
)
Expand Down Expand Up @@ -390,7 +390,9 @@ def update_prices_at_frequency_for_contract(
new_log.debug("No existing or additional data")
return 0
else:
new_log.debug("No additional data since %s " % str(old_prices.index[-1]))
new_log.debug(
"No additional data since %s " % str(old_prices.index[-1])
)
return 0

# We have guaranteed no duplication
Expand Down Expand Up @@ -428,7 +430,7 @@ def delete_merged_prices_for_contract_object(
)
else:
log = futures_contract_object.log(self.log)
log.warn("Tried to delete non existent contract")
log.warning("Tried to delete non existent contract")

def delete_prices_at_frequency_for_contract_object(
self,
Expand All @@ -453,7 +455,7 @@ def delete_prices_at_frequency_for_contract_object(
)
else:
log = futures_contract_object.log(self.log)
log.warn(
log.warning(
"Tried to delete non existent contract at frequency %s" % frequency
)

Expand Down
6 changes: 3 additions & 3 deletions sysdata/futures/instruments.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ def delete_instrument_data(self, instrument_code: str, are_you_sure: bool = Fals
self._delete_instrument_data_without_any_warning_be_careful(
instrument_code
)
self.log.terse("Deleted instrument object %s" % instrument_code)
self.log.info("Deleted instrument object %s" % instrument_code)

else:
# doesn't exist anyway
self.log.warn("Tried to delete non existent instrument")
self.log.warning("Tried to delete non existent instrument")
else:
self.log.error(
"You need to call delete_instrument_data with a flag to be sure"
Expand Down Expand Up @@ -137,7 +137,7 @@ def add_instrument_data(

self._add_instrument_data_without_checking_for_existing_entry(instrument_object)

self.log.terse("Added instrument object %s" % instrument_object.instrument_code)
self.log.info("Added instrument object %s" % instrument_object.instrument_code)

def get_list_of_instruments(self):
raise NotImplementedError(USE_CHILD_CLASS_ERROR)
Expand Down
Loading

0 comments on commit f1c7ea2

Please sign in to comment.