diff --git a/src/Managing.Web3Proxy/src/plugins/custom/gmx.ts b/src/Managing.Web3Proxy/src/plugins/custom/gmx.ts index 37cffd1c..492d9e5c 100644 --- a/src/Managing.Web3Proxy/src/plugins/custom/gmx.ts +++ b/src/Managing.Web3Proxy/src/plugins/custom/gmx.ts @@ -631,6 +631,7 @@ declare module 'fastify' { swapGmxTokens: typeof swapGmxTokens; estimatePositionGasFee: typeof estimatePositionGasFee; getPositionHistory: typeof getPositionHistory; + getSpotPositionHistory: typeof getSpotPositionHistory; } } diff --git a/src/Managing.Web3Proxy/src/routes/api/gmx/index.ts b/src/Managing.Web3Proxy/src/routes/api/gmx/index.ts index 52abeebb..2a16284d 100644 --- a/src/Managing.Web3Proxy/src/routes/api/gmx/index.ts +++ b/src/Managing.Web3Proxy/src/routes/api/gmx/index.ts @@ -234,6 +234,42 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => { ) }) + // Define route to get spot position history + fastify.get('/spot-position-history', { + schema: { + querystring: Type.Object({ + account: Type.String(), + pageIndex: Type.Optional(Type.Integer()), + pageSize: Type.Optional(Type.Integer()), + ticker: Type.Optional(Type.String()), + fromDateTime: Type.Optional(Type.String()), + toDateTime: Type.Optional(Type.String()) + }), + response: { + 200: Type.Object({ + success: Type.Boolean(), + positions: Type.Optional(Type.Array(Type.Any())), + pageIndex: Type.Optional(Type.Integer()), + pageSize: Type.Optional(Type.Integer()), + count: Type.Optional(Type.Integer()), + error: Type.Optional(Type.String()) + }) + } + } + }, async (request, reply) => { + const { account, pageIndex, pageSize, ticker, fromDateTime, toDateTime } = request.query + + return request.getSpotPositionHistory( + reply, + account, + pageIndex, + pageSize, + ticker, + fromDateTime, + toDateTime + ) + }) + // Define route to get gas fee estimation for opening a position fastify.get('/gas-fee', { schema: {