fix: resolve container networking issues for automation system

- Fixed internal API URLs from localhost:9001 to localhost:3000 in automation core files
- Updated lib/simple-automation.js: Fixed 5 baseUrl references for internal container calls
- Updated app/api/drift/consolidate-position/route.js: Fixed positions API fetch URL
- Updated app/api/drift/scale-position/route.js: Fixed 2 internal API calls (positions and orders)
- Updated lib/position-consolidator.js: Fixed 3 internal API calls (cancel-all-orders, place-order, positions)

This resolves 'Network Error' and 'fetch failed' issues that prevented automation
cycles from executing properly within Docker container environment.

Root cause: Automation was making fetch calls to external port (9001) from within
container instead of internal port (3000), causing connection failures.

Result: Automation cycles now execute successfully with proper internal API connectivity.
This commit is contained in:
mindesbunister
2025-07-28 01:19:37 +02:00
parent 236e2b0d31
commit abb8c8d7f1
4 changed files with 217 additions and 83 deletions

View File

@@ -10,7 +10,7 @@ export async function POST(request) {
console.log(`AI Analysis: ${analysis ? 'Provided - Using AI optimal levels' : 'Not provided - Using adaptive levels'}`);
// Get current position data
const positionsResponse = await fetch('http://localhost:9001/api/drift/positions');
const positionsResponse = await fetch('http://localhost:3000/api/drift/positions');
const positionsData = await positionsResponse.json();
if (!positionsData.success || !positionsData.positions.length) {