Fixed problem with position size in ConfidenceIntervalDesiredOrdersBuilder.

This commit is contained in:
Geoff Taylor 2021-07-26 16:16:00 +01:00
parent 38b08bdb6d
commit 2818fb46d2
1 changed files with 2 additions and 1 deletions

View File

@ -47,7 +47,8 @@ class ConfidenceIntervalDesiredOrdersBuilder(DesiredOrdersBuilder):
quote_tokens: mango.TokenValue = mango.TokenValue.find_by_token(inventory, price.market.quote)
total = (base_tokens.value * price.mid_price) + quote_tokens.value
position_size = total * self.position_size_ratio
position_size_value = total * self.position_size_ratio
position_size = position_size_value / price.mid_price
# From Daffy on 26th July 2021: max(pyth_conf * 2, price * min_charge)
min_charge = max(price.confidence * 2, price.mid_price * self.min_price_ratio)