Fix worker cancelled on worker + Cache tickers

This commit is contained in:
2025-04-30 13:19:03 +07:00
parent df4392b17e
commit bc1ef78747
11 changed files with 116 additions and 55 deletions

View File

@@ -196,7 +196,6 @@ export const openGmxPositionImpl = async (
const marketInfo = getMarketInfoFromTicker(ticker, marketsInfoData);
const collateralToken = getTokenDataFromTicker("USDC", tokensData); // Using USDC as collateral
console.log('collateralToken', collateralToken)
// Calculate the collateral amount in USDC (quantity * price)
const collateralAmount = BigInt(Math.floor((quantity || 0) * (price || 0) * 1e6)); // USDC has 6 decimals
@@ -325,8 +324,6 @@ export const cancelGmxOrdersImpl = async (
tokensData
});
console.log('ordersData', ordersData)
// Extract order keys for the specified ticker
const orderKeys = Object.values(ordersData.ordersInfoData)
.filter(order => {
@@ -341,8 +338,6 @@ export const cancelGmxOrdersImpl = async (
return true; // No orders to cancel
}
console.log('orderKeys', orderKeys)
// Cancel orders using the batch method
await sdk.orders.cancelOrders(orderKeys);
@@ -455,8 +450,6 @@ export const closeGmxPositionImpl = async (
showPnlInLeverage: true
});
console.log('positionsInfo', positionsInfo)
console.log('direction', direction)
// Find the specific position to close
const positionKey = Object.keys(positionsInfo).find(key => {
const position = positionsInfo[key];
@@ -503,8 +496,6 @@ export const closeGmxPositionImpl = async (
triggerPrice: position.markPrice,
}
//console.log('params', params)
const params2 = {
marketInfo,
marketsInfoData,