Update healthcheck and display pnl on trades

This commit is contained in:
2025-04-26 14:48:23 +07:00
parent 741b2c3bb0
commit 1121a7c6d3
6 changed files with 92 additions and 36 deletions

View File

@@ -131,11 +131,17 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
const marketsInfo = await sdk.markets.getMarketsInfo();
const responseTime = Date.now() - startTime;
// Get the uiFeeFactor
const uiFeeFactor = await sdk.utils.getUiFeeFactor();
if (!marketsInfo.marketsInfoData || Object.keys(marketsInfo.marketsInfoData).length === 0) {
return {
status: 'degraded',
message: 'GMX SDK returned empty markets info data',
data: { responseTimeMs: responseTime }
data: {
responseTimeMs: responseTime,
uiFeeFactor: uiFeeFactor.toString()
}
};
}
@@ -168,7 +174,8 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
message: 'ETH market not found in GMX markets data',
data: {
availableMarkets: marketInfoDetails,
responseTimeMs: responseTime
responseTimeMs: responseTime,
uiFeeFactor: uiFeeFactor.toString()
}
};
}
@@ -179,7 +186,8 @@ const plugin: FastifyPluginAsyncTypebox = async (fastify) => {
data: {
marketCount: Object.keys(marketsInfo.marketsInfoData).length,
responseTimeMs: responseTime,
sampleMarkets: marketInfoDetails.slice(0, 3) // Just include first 3 markets for brevity
sampleMarkets: marketInfoDetails.slice(0, 3), // Just include first 3 markets for brevity
uiFeeFactor: uiFeeFactor.toString()
}
};
} catch (error) {