Postgres (#30)
* Add postgres * Migrate users * Migrate geneticRequest * Try to fix Concurrent call * Fix asyncawait * Fix async and concurrent * Migrate backtests * Add cache for user by address * Fix backtest migration * Fix not open connection * Fix backtest command error * Fix concurrent * Fix all concurrency * Migrate TradingRepo * Fix scenarios * Migrate statistic repo * Save botbackup * Add settings et moneymanagement * Add bot postgres * fix a bit more backups * Fix bot model * Fix loading backup * Remove cache market for read positions * Add workers to postgre * Fix workers api * Reduce get Accounts for workers * Migrate synth to postgre * Fix backtest saved * Remove mongodb * botservice decorrelation * Fix tradingbot scope call * fix tradingbot * fix concurrent * Fix scope for genetics * Fix account over requesting * Fix bundle backtest worker * fix a lot of things * fix tab backtest * Remove optimized moneymanagement * Add light signal to not use User and too much property * Make money management lighter * insert indicators to awaitable * Migrate add strategies to await * Refactor scenario and indicator retrieval to use asynchronous methods throughout the application * add more async await * Add services * Fix and clean * Fix bot a bit * Fix bot and add message for cooldown * Remove fees * Add script to deploy db * Update dfeeploy script * fix script * Add idempotent script and backup * finish script migration * Fix did user and agent name on start bot
This commit is contained in:
@@ -222,7 +222,10 @@ export async function getClientForAddress(
|
||||
"0x0e46941F9bfF8d0784BFfa3d0D7883CDb82D7aE7": {
|
||||
isListed: false,
|
||||
},
|
||||
"0x9c060B2fA953b5f69879a8B7B81f62BFfEF360be": {
|
||||
"0x4C0Bb704529Fa49A26bD854802d70206982c6f1B": {
|
||||
isListed: false,
|
||||
},
|
||||
"0x672fEA44f4583DdaD620d60C1Ac31021F47558Cb": {
|
||||
isListed: false,
|
||||
},
|
||||
}
|
||||
@@ -512,7 +515,7 @@ export const closeGmxPositionImpl = async (
|
||||
): Promise<string> => {
|
||||
try {
|
||||
// Get markets and tokens data from GMX SDK with cache
|
||||
const {marketsInfoData, tokensData} = await getMarketsInfoWithCache(sdk);
|
||||
const {marketsInfoData, tokensData} = await sdk.markets.getMarketsInfo();
|
||||
|
||||
if (!marketsInfoData || !tokensData) {
|
||||
throw new Error("No markets or tokens info data");
|
||||
@@ -758,7 +761,7 @@ export async function getGmxTrade(
|
||||
export const getGmxPositionsImpl = async (
|
||||
sdk: GmxSdk
|
||||
): Promise<Position[]> => {
|
||||
const {marketsInfoData, tokensData} = await getMarketsInfoWithCache(sdk);
|
||||
const {marketsInfoData, tokensData} = await sdk.markets.getMarketsInfo();
|
||||
|
||||
const positionsInfo = await sdk.positions.getPositionsInfo({
|
||||
marketsInfoData,
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import {test} from 'node:test'
|
||||
import assert from 'node:assert'
|
||||
import {closeGmxPositionImpl, getClientForAddress} from '../../src/plugins/custom/gmx'
|
||||
import {Ticker, TradeDirection} from '../../src/generated/ManagingApiTypes'
|
||||
import {TradeDirection} from '../../src/generated/ManagingApiTypes'
|
||||
|
||||
test('GMX Position Closing', async (t) => {
|
||||
await t.test('should close a long position for BTC', async () => {
|
||||
const sdk = await getClientForAddress('0xbBA4eaA534cbD0EcAed5E2fD6036Aec2E7eE309f')
|
||||
const sdk = await getClientForAddress('0x932167388dD9aad41149b3cA23eBD489E2E2DD78')
|
||||
|
||||
const result = await closeGmxPositionImpl(
|
||||
sdk,
|
||||
Ticker.SOL,
|
||||
TradeDirection.Long
|
||||
"SUI",
|
||||
TradeDirection.Short
|
||||
)
|
||||
console.log('Position closing result:', result)
|
||||
assert.ok(result, 'Position closing result should be defined')
|
||||
|
||||
Reference in New Issue
Block a user