Deduction before splitting for fees
This commit is contained in:
5
bot.py
5
bot.py
@@ -187,9 +187,10 @@ def run_cycle(config: Config) -> bool:
|
||||
return bool(closed)
|
||||
|
||||
to_buy = opportunities[:num_to_buy]
|
||||
# Deduct fee reserve before splitting so each order has room for Kraken's taker fee
|
||||
# Deduct fee reserve before splitting so each order has room for Kraken's taker fee.
|
||||
# Floor to the nearest cent so floating point never pushes us over the available balance.
|
||||
fee_multiplier = 1 - (config.taker_fee_pct / 100)
|
||||
alloc_per_asset = (balance * fee_multiplier) / num_to_buy
|
||||
alloc_per_asset = math.floor((balance * fee_multiplier / num_to_buy) * 100) / 100
|
||||
log.info(
|
||||
"Buying %d asset(s) @ $%.2f each (total $%.2f, %.1f%% fee reserve applied)",
|
||||
num_to_buy, alloc_per_asset, alloc_per_asset * num_to_buy, config.taker_fee_pct,
|
||||
|
||||
Reference in New Issue
Block a user