Fix position gas fee
This commit is contained in:
@@ -427,11 +427,12 @@ public class TradingBotBase : ITradingBot
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!internalPosition.Status.Equals(PositionStatus.New))
|
||||
// No position on the broker, the position have been closed by the exchange
|
||||
if (internalPosition.Status.Equals(PositionStatus.Filled))
|
||||
{
|
||||
internalPosition.Status = PositionStatus.Filled;
|
||||
internalPosition.Status = PositionStatus.Finished;
|
||||
|
||||
// Update Open trade status when position becomes Filled
|
||||
// Update Open trade status when position becomes Finished
|
||||
if (internalPosition.Open != null)
|
||||
{
|
||||
internalPosition.Open.SetStatus(TradeStatus.Filled);
|
||||
|
||||
@@ -46,6 +46,8 @@ namespace Managing.Application.Trading.Handlers
|
||||
|
||||
// Gas fee check for EVM exchanges
|
||||
decimal gasFeeUsd = 0;
|
||||
if (!request.IsForPaperTrading)
|
||||
{
|
||||
if (account.Exchange == TradingExchanges.Evm || account.Exchange == TradingExchanges.GmxV2)
|
||||
{
|
||||
gasFeeUsd = await exchangeService.GetFee(account);
|
||||
@@ -56,6 +58,12 @@ namespace Managing.Application.Trading.Handlers
|
||||
InsufficientFundsType.InsufficientEth);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gasFeeUsd = Constants.GMX.Config.GasFeePerTransaction;
|
||||
}
|
||||
|
||||
|
||||
var price = request.IsForPaperTrading && request.Price.HasValue
|
||||
? request.Price.Value
|
||||
|
||||
Reference in New Issue
Block a user