Fixed logging
This commit is contained in:
parent
b55a7ad3e0
commit
684e08de04
|
@ -232,7 +232,7 @@ def run_auto_sell(
|
||||||
|
|
||||||
if initial_rounds_to_skip > 0:
|
if initial_rounds_to_skip > 0:
|
||||||
initial_rounds_to_skip -= 1
|
initial_rounds_to_skip -= 1
|
||||||
logger.info('skipping this round')
|
logger.info('Skipping this round')
|
||||||
elif input_amount_available > 0:
|
elif input_amount_available > 0:
|
||||||
amount_to_sell = sample_from_range(rng, config.input_amount_range)
|
amount_to_sell = sample_from_range(rng, config.input_amount_range)
|
||||||
amount_to_sell = min(input_amount_available, amount_to_sell)
|
amount_to_sell = min(input_amount_available, amount_to_sell)
|
||||||
|
@ -241,14 +241,13 @@ def run_auto_sell(
|
||||||
rounding=ROUND_DOWN,
|
rounding=ROUND_DOWN,
|
||||||
)
|
)
|
||||||
logger.info(
|
logger.info(
|
||||||
'Attempting to sell %s %s',
|
'Selling %s %s',
|
||||||
amount_to_sell,
|
amount_to_sell,
|
||||||
config.input_asset,
|
config.input_asset.raw_short_name(),
|
||||||
)
|
)
|
||||||
|
|
||||||
order_details = config.seller.place_market_order(
|
order_details = config.seller.place_market_order(
|
||||||
config.input_asset,
|
fin_defs.AssetAmount(config.input_asset, amount_to_sell),
|
||||||
amount_to_sell,
|
|
||||||
config.output_asset,
|
config.output_asset,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -26,18 +26,24 @@ class CsvFileLogger:
|
||||||
'raw_order_details',
|
'raw_order_details',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Select data to write
|
||||||
|
d = {
|
||||||
|
'executed_time': trade_order.executed_time,
|
||||||
|
'input_asset': trade_order.input.asset,
|
||||||
|
'input_amount': trade_order.input.amount,
|
||||||
|
'output_asset': trade_order.output.asset,
|
||||||
|
'output_amount': trade_order.output.amount,
|
||||||
|
'fee_asset': trade_order.fee.asset,
|
||||||
|
'fee_amount': trade_order.fee.amount,
|
||||||
|
'order_id': trade_order.order_id,
|
||||||
|
'raw_order_details': trade_order.raw_order_details,
|
||||||
|
}
|
||||||
|
|
||||||
# Ensure that directory exists
|
# Ensure that directory exists
|
||||||
self.path.parent.mkdir(parents=True, exist_ok=True)
|
self.path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Write row in CSV file
|
# Write row in CSV file
|
||||||
with open(self.path, 'a') as f:
|
with open(self.path, 'a') as f:
|
||||||
writer = csv.DictWriter(f, fieldnames=fieldnames)
|
writer = csv.DictWriter(f, fieldnames=fieldnames)
|
||||||
d = trade_order.__dict__
|
|
||||||
d['input_asset'] = d['input'].asset
|
|
||||||
d['input_amount'] = d['input'].amount
|
|
||||||
d['output_asset'] = d['output'].asset
|
|
||||||
d['output_amount'] = d['output'].amount
|
|
||||||
d['fee_asset'] = d['fee'].asset
|
|
||||||
d['fee_amount'] = d['fee'].amount
|
|
||||||
del d['fee'], d['input'], d['output']
|
|
||||||
writer.writerow(d)
|
writer.writerow(d)
|
||||||
|
del d
|
||||||
|
|
Loading…
Reference in New Issue
Block a user