diff --git a/src/Managing.Api/Controllers/DataController.cs b/src/Managing.Api/Controllers/DataController.cs
index d349429..2cd2504 100644
--- a/src/Managing.Api/Controllers/DataController.cs
+++ b/src/Managing.Api/Controllers/DataController.cs
@@ -429,7 +429,7 @@ public class DataController : ControllerBase
return new UserStrategyDetailsViewModel
{
Name = strategy.Name,
- StrategyName = strategy.Config.ScenarioName,
+ ScenarioName = strategy.Config.ScenarioName,
State = strategy.GetStatus() == BotStatus.Up.ToString() ? "RUNNING" :
strategy.GetStatus() == BotStatus.Down.ToString() ? "STOPPED" : "UNUSED",
PnL = pnl,
diff --git a/src/Managing.Api/Models/Responses/UserStrategyDetailsViewModel.cs b/src/Managing.Api/Models/Responses/UserStrategyDetailsViewModel.cs
index ef16023..bf4313b 100644
--- a/src/Managing.Api/Models/Responses/UserStrategyDetailsViewModel.cs
+++ b/src/Managing.Api/Models/Responses/UserStrategyDetailsViewModel.cs
@@ -12,11 +12,6 @@ namespace Managing.Api.Models.Responses
///
public string Name { get; set; }
- ///
- /// Strategy identifier
- ///
- public string StrategyName { get; set; }
-
///
/// Current state of the strategy (RUNNING, STOPPED, UNUSED)
///
@@ -73,5 +68,6 @@ namespace Managing.Api.Models.Responses
public List Positions { get; set; } = new List();
public string Identifier { get; set; }
+ public string ScenarioName { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Managing.Bootstrap/WorkersBootstrap.cs b/src/Managing.Bootstrap/WorkersBootstrap.cs
index f226b64..cd9dea7 100644
--- a/src/Managing.Bootstrap/WorkersBootstrap.cs
+++ b/src/Managing.Bootstrap/WorkersBootstrap.cs
@@ -72,6 +72,11 @@ public static class WorkersBootstrap
return services;
}
+ private static IServiceCollection AddWorkers(this IServiceCollection services, IConfiguration configuration)
+ {
+ return services;
+ }
+
private static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
{
// Database
diff --git a/src/Managing.Web3Proxy/src/generated/gmxsdk/modules/orders/helpers.ts b/src/Managing.Web3Proxy/src/generated/gmxsdk/modules/orders/helpers.ts
index 11bdc45..4903367 100644
--- a/src/Managing.Web3Proxy/src/generated/gmxsdk/modules/orders/helpers.ts
+++ b/src/Managing.Web3Proxy/src/generated/gmxsdk/modules/orders/helpers.ts
@@ -6,7 +6,7 @@ import {getByKey} from "../../utils/objects.js";
import {createFindSwapPath, findAllSwapPaths, getWrappedAddress} from "../../utils/swap/swapPath.js";
import {convertToUsd, getIsUnwrap, getIsWrap, getTokensRatioByPrice} from "../../utils/tokens.js";
import {getIncreasePositionAmounts} from "../../utils/trade/amounts.js";
-import {getAcceptablePriceInfo, getOrderThresholdType} from "../../utils/prices.js";
+import {getAcceptablePriceInfo, getDefaultAcceptablePriceImpactBps, getOrderThresholdType} from "../../utils/prices.js";
import type {GmxSdk} from "../..";
import {createSwapEstimator, getMarketsGraph} from "../../utils/swap/swapRouting.js";
@@ -164,13 +164,24 @@ export async function increaseOrderHelper(
if (params.stopLossPrice) {
const stopLossCollateralDeltaUsd = convertToUsd(increaseAmounts.collateralDeltaAmount, collateralToken.decimals, params.stopLossPrice);
+ // Use a higher acceptable price impact buffer for stop loss orders to ensure execution
+ const stopLossAcceptablePriceImpactBps = params.fixedAcceptablePriceImpactBps ??
+ getDefaultAcceptablePriceImpactBps({
+ isIncrease: false,
+ isLong: params.isLong,
+ indexPrice: params.stopLossPrice,
+ sizeDeltaUsd: increaseAmounts.sizeDeltaUsd,
+ priceImpactDeltaUsd: 0n, // We'll calculate this based on current market conditions
+ acceptablePriceImapctBuffer: params.acceptablePriceImpactBuffer ?? 100, // Default 1% buffer for SL orders
+ });
+
const acceptablePriceInfo = getAcceptablePriceInfo({
marketInfo,
isIncrease: false,
isLong: params.isLong,
indexPrice: params.stopLossPrice,
sizeDeltaUsd: increaseAmounts.sizeDeltaUsd,
- maxNegativePriceImpactBps: marketInfo.maxPositionImpactFactorForLiquidations,
+ maxNegativePriceImpactBps: stopLossAcceptablePriceImpactBps,
});
stopLossDecreaseAmounts = {
@@ -241,13 +252,24 @@ export async function increaseOrderHelper(
if (params.takeProfitPrice) {
const takeProfitCollateralDeltaUsd = convertToUsd(increaseAmounts.collateralDeltaAmount, collateralToken.decimals, params.takeProfitPrice);
+ // Use a higher acceptable price impact buffer for take profit orders to ensure execution
+ const takeProfitAcceptablePriceImpactBps = params.fixedAcceptablePriceImpactBps ??
+ getDefaultAcceptablePriceImpactBps({
+ isIncrease: false,
+ isLong: params.isLong,
+ indexPrice: params.takeProfitPrice,
+ sizeDeltaUsd: increaseAmounts.sizeDeltaUsd,
+ priceImpactDeltaUsd: 0n, // We'll calculate this based on current market conditions
+ acceptablePriceImapctBuffer: params.acceptablePriceImpactBuffer ?? 100, // Default 1% buffer for TP orders
+ });
+
const acceptablePriceInfo = getAcceptablePriceInfo({
marketInfo,
isIncrease: false,
isLong: params.isLong,
indexPrice: params.takeProfitPrice,
sizeDeltaUsd: increaseAmounts.sizeDeltaUsd,
- maxNegativePriceImpactBps: marketInfo.maxPositionImpactFactorForLiquidations,
+ maxNegativePriceImpactBps: takeProfitAcceptablePriceImpactBps,
});
takeProfitDecreaseAmounts = {
diff --git a/src/Managing.Web3Proxy/src/plugins/custom/gmx.ts b/src/Managing.Web3Proxy/src/plugins/custom/gmx.ts
index f3faf97..5b122c8 100644
--- a/src/Managing.Web3Proxy/src/plugins/custom/gmx.ts
+++ b/src/Managing.Web3Proxy/src/plugins/custom/gmx.ts
@@ -212,12 +212,13 @@ export const openGmxPositionImpl = async (
marketAddress: marketInfo.marketTokenAddress,
payTokenAddress: collateralToken.address,
collateralTokenAddress: collateralToken.address,
- allowedSlippageBps: 50, // 0.5% slippage
+ allowedSlippageBps: 100, // 0.5% slippage
leverage: leverageBps,
skipSimulation: true,
referralCodeForTxn: encodeReferralCode("kaigen_ai"),
stopLossPrice: stopLossPrice ? numberToBigint(stopLossPrice, 30) : undefined,
- takeProfitPrice: takeProfitPrice ? numberToBigint(takeProfitPrice, 30) : undefined
+ takeProfitPrice: takeProfitPrice ? numberToBigint(takeProfitPrice, 30) : undefined,
+ acceptablePriceImpactBuffer: 150,
};
if (direction === TradeDirection.Long) {
diff --git a/src/Managing.WebApp/src/generated/ManagingApi.ts b/src/Managing.WebApp/src/generated/ManagingApi.ts
index 37a1dd4..59c2eba 100644
--- a/src/Managing.WebApp/src/generated/ManagingApi.ts
+++ b/src/Managing.WebApp/src/generated/ManagingApi.ts
@@ -1132,7 +1132,7 @@ export class DataClient extends AuthorizedApiBase {
return Promise.resolve(null as any);
}
- data_GetAgentBalances(agentName: string | null | undefined, startDate: Date | undefined, endDate: Date | null | undefined): Promise {
+ data_GetAgentBalances(agentName: string | null | undefined, startDate: Date | undefined, endDate: Date | null | undefined): Promise {
let url_ = this.baseUrl + "/Data/GetAgentBalances?";
if (agentName !== undefined && agentName !== null)
url_ += "agentName=" + encodeURIComponent("" + agentName) + "&";
@@ -1158,13 +1158,13 @@ export class DataClient extends AuthorizedApiBase {
});
}
- protected processData_GetAgentBalances(response: Response): Promise {
+ protected processData_GetAgentBalances(response: Response): Promise {
const status = response.status;
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
if (status === 200) {
return response.text().then((_responseText) => {
let result200: any = null;
- result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as AgentBalance[];
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as AgentBalanceHistory;
return result200;
});
} else if (status !== 200 && status !== 204) {
@@ -1172,7 +1172,7 @@ export class DataClient extends AuthorizedApiBase {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
});
}
- return Promise.resolve(null as any);
+ return Promise.resolve(null as any);
}
data_GetBestAgents(startDate: Date | undefined, endDate: Date | null | undefined, page: number | undefined, pageSize: number | undefined): Promise {
@@ -3212,7 +3212,6 @@ export interface StrategyPerformance {
export interface UserStrategyDetailsViewModel {
name?: string | null;
- strategyName?: string | null;
state?: string | null;
pnL?: number;
roiPercentage?: number;
@@ -3225,6 +3224,7 @@ export interface UserStrategyDetailsViewModel {
losses?: number;
positions?: Position[] | null;
identifier?: string | null;
+ scenarioName?: string | null;
}
export interface PlatformSummaryViewModel {
@@ -3251,6 +3251,11 @@ export interface AgentSummaryViewModel {
volumeLast24h?: number;
}
+export interface AgentBalanceHistory {
+ agentName?: string | null;
+ agentBalances?: AgentBalance[] | null;
+}
+
export interface AgentBalance {
agentName?: string | null;
totalValue?: number;
@@ -3268,21 +3273,6 @@ export interface BestAgentsResponse {
totalPages?: number;
}
-export interface AgentBalanceHistory {
- agentName?: string | null;
- totalValue?: number;
- totalAccountUsdValue?: number;
- botsAllocationUsdValue?: number;
- pnL?: number;
- time?: Date;
- pnLHistory?: PnLPoint[] | null;
-}
-
-export interface PnLPoint {
- time?: Date;
- value?: number;
-}
-
export enum RiskLevel {
Low = "Low",
Medium = "Medium",