Refactor user settings management to remove IsGmxEnabled and DefaultExchange from updatable fields, introducing GmxSlippage instead. Update UserController, UserService, and related DTOs to reflect these changes, ensuring proper handling of user settings. Adjust database schema and migrations to accommodate the new GmxSlippage property, enhancing user customization options for trading configurations.

This commit is contained in:
2025-12-30 07:19:08 +07:00
parent aa3b06bbe4
commit 21d87efeee
23 changed files with 1908 additions and 32 deletions

View File

@@ -23,7 +23,8 @@ public interface IExchangeProcessor
DateTime? currentDate = null,
bool ioc = true,
decimal? stopLossPrice = null,
decimal? takeProfitPrice = null);
decimal? takeProfitPrice = null,
decimal? allowedSlippage = null);
Task<decimal> GetBalance(Account account, bool isForPaperTrading = false);
Task<List<Balance>> GetBalances(Account account, bool isForPaperTrading = false);
Task<decimal> GetPrice(Account account, Ticker ticker, DateTime date);

View File

@@ -46,10 +46,11 @@ namespace Managing.Infrastructure.Exchanges
DateTime? currentDate = null,
bool ioc = true,
decimal? stopLossPrice = null,
decimal? takeProfitPrice = null)
decimal? takeProfitPrice = null,
decimal? allowedSlippage = null)
{
_logger.LogDebug(
$"OpenMarketTrade - {ticker} - Type: {tradeType} - {direction} - Price: {price} - Quantity: {quantity} - Leverage: {leverage} - SL: {stopLossPrice} - TP: {takeProfitPrice}");
$"OpenMarketTrade - {ticker} - Type: {tradeType} - {direction} - Price: {price} - Quantity: {quantity} - Leverage: {leverage} - SL: {stopLossPrice} - TP: {takeProfitPrice} - Slippage: {allowedSlippage}");
if (isForPaperTrading)
{
@@ -60,7 +61,7 @@ namespace Managing.Infrastructure.Exchanges
var processor = GetProcessor(account);
return await processor.OpenTrade(account, ticker, direction, price, quantity, leverage, tradeType,
reduceOnly, isForPaperTrading, currentDate, ioc, stopLossPrice, takeProfitPrice);
reduceOnly, isForPaperTrading, currentDate, ioc, stopLossPrice, takeProfitPrice, allowedSlippage);
}
private IExchangeProcessor GetProcessor(Account account)

View File

@@ -35,7 +35,8 @@ namespace Managing.Infrastructure.Exchanges.Exchanges
DateTime? currentDate = null,
bool ioc = true,
decimal? stopLossPrice = null,
decimal? takeProfitPrice = null);
decimal? takeProfitPrice = null,
decimal? allowedSlippage = null);
public abstract Orderbook GetOrderbook(Account account, Ticker ticker);
public abstract Task<List<Balance>> GetBalances(Account account, bool isForPaperTrading = false);
public abstract Task<List<Trade>> GetOrders(Account account, Ticker ticker);

View File

@@ -174,7 +174,8 @@ public class EvmProcessor : BaseProcessor
DateTime? currentDate = null,
bool ioc = true,
decimal? stopLossPrice = null,
decimal? takeProfitPrice = null)
decimal? takeProfitPrice = null,
decimal? allowedSlippage = null)
{
Trade trade;
if (reduceOnly)
@@ -197,7 +198,7 @@ public class EvmProcessor : BaseProcessor
else
{
trade = await _evmManager.IncreasePosition(account, ticker, direction, price, quantity, leverage,
stopLossPrice, takeProfitPrice);
stopLossPrice, takeProfitPrice, allowedSlippage);
}
return trade;