Update SpotBot tolerance calculation to 0.6% to better account for slippage; adjust logging to reflect new tolerance value for position synchronization checks.
This commit is contained in:
@@ -231,7 +231,7 @@ public class SpotBot : TradingBotBase
|
|||||||
|
|
||||||
if (positionQuantity > 0)
|
if (positionQuantity > 0)
|
||||||
{
|
{
|
||||||
var tolerance = positionQuantity * 0.003m; // 0.3% tolerance
|
var tolerance = positionQuantity * 0.006m; // 0.6% tolerance to account for slippage
|
||||||
var difference = Math.Abs(tokenBalanceAmount - positionQuantity);
|
var difference = Math.Abs(tokenBalanceAmount - positionQuantity);
|
||||||
|
|
||||||
if (difference > tolerance)
|
if (difference > tolerance)
|
||||||
@@ -242,7 +242,7 @@ public class SpotBot : TradingBotBase
|
|||||||
$"Position Quantity: `{positionQuantity:F5}`\n" +
|
$"Position Quantity: `{positionQuantity:F5}`\n" +
|
||||||
$"Token Balance: `{tokenBalanceAmount:F5}`\n" +
|
$"Token Balance: `{tokenBalanceAmount:F5}`\n" +
|
||||||
$"Difference: `{difference:F5}`\n" +
|
$"Difference: `{difference:F5}`\n" +
|
||||||
$"Tolerance (0.1%): `{tolerance:F5}`\n" +
|
$"Tolerance (0.6%): `{tolerance:F5}`\n" +
|
||||||
$"Token balance does not match position amount within tolerance\n" +
|
$"Token balance does not match position amount within tolerance\n" +
|
||||||
$"Skipping position synchronization");
|
$"Skipping position synchronization");
|
||||||
return; // Skip processing if amounts don't match
|
return; // Skip processing if amounts don't match
|
||||||
|
|||||||
Reference in New Issue
Block a user