Improve naming of variable

This commit is contained in:
Matthias
2023-08-31 06:39:26 +02:00
parent 4ed46ef6b3
commit 02bd052e45
+5 -5
View File
@@ -920,7 +920,7 @@ class Exchange:
max_slippage_val = rate * ((1 + slippage) if side == 'buy' else (1 - slippage)) max_slippage_val = rate * ((1 + slippage) if side == 'buy' else (1 - slippage))
remaining_amount = amount remaining_amount = amount
filled_amount = 0.0 filled_value = 0.0
book_entry_price = 0.0 book_entry_price = 0.0
for book_entry in orderbook[ob_type]: for book_entry in orderbook[ob_type]:
book_entry_price = book_entry[0] book_entry_price = book_entry[0]
@@ -928,17 +928,17 @@ class Exchange:
if remaining_amount > 0: if remaining_amount > 0:
if remaining_amount < book_entry_coin_volume: if remaining_amount < book_entry_coin_volume:
# Orderbook at this slot bigger than remaining amount # Orderbook at this slot bigger than remaining amount
filled_amount += remaining_amount * book_entry_price filled_value += remaining_amount * book_entry_price
break break
else: else:
filled_amount += book_entry_coin_volume * book_entry_price filled_value += book_entry_coin_volume * book_entry_price
remaining_amount -= book_entry_coin_volume remaining_amount -= book_entry_coin_volume
else: else:
break break
else: else:
# If remaining_amount wasn't consumed completely (break was not called) # If remaining_amount wasn't consumed completely (break was not called)
filled_amount += remaining_amount * book_entry_price filled_value += remaining_amount * book_entry_price
forecast_avg_filled_price = max(filled_amount, 0) / amount forecast_avg_filled_price = max(filled_value, 0) / amount
# Limit max. slippage to specified value # Limit max. slippage to specified value
if side == 'buy': if side == 'buy':
forecast_avg_filled_price = min(forecast_avg_filled_price, max_slippage_val) forecast_avg_filled_price = min(forecast_avg_filled_price, max_slippage_val)