feat: implement complete automation system with real trading connection

This commit is contained in:
mindesbunister
2025-07-18 20:02:45 +02:00
parent 74b0087f17
commit 892c2c845f
18 changed files with 1930 additions and 16 deletions

View File

@@ -0,0 +1,68 @@
const { automationService } = require('./lib/automation-service-simple.ts');
async function testAutomationConnection() {
console.log('🧪 Testing Automation Service Connection...');
try {
// Test configuration
const testConfig = {
userId: 'test-user-123',
mode: 'SIMULATION',
symbol: 'SOLUSD',
timeframe: '1h',
tradingAmount: 10, // $10 for simulation
maxLeverage: 2,
stopLossPercent: 2,
takeProfitPercent: 6,
maxDailyTrades: 5,
riskPercentage: 1
};
console.log('📋 Config:', testConfig);
// Test starting automation
console.log('\n🚀 Starting automation...');
const startResult = await automationService.startAutomation(testConfig);
console.log('✅ Start result:', startResult);
// Test getting status
console.log('\n📊 Getting status...');
const status = await automationService.getStatus();
console.log('✅ Status:', status);
// Test getting learning insights
console.log('\n🧠 Getting learning insights...');
const insights = await automationService.getLearningInsights(testConfig.userId);
console.log('✅ Learning insights:', insights);
// Test pausing
console.log('\n⏸ Pausing automation...');
const pauseResult = await automationService.pauseAutomation();
console.log('✅ Pause result:', pauseResult);
// Test resuming
console.log('\n▶ Resuming automation...');
const resumeResult = await automationService.resumeAutomation();
console.log('✅ Resume result:', resumeResult);
// Test stopping
console.log('\n🛑 Stopping automation...');
const stopResult = await automationService.stopAutomation();
console.log('✅ Stop result:', stopResult);
console.log('\n🎉 All automation tests passed!');
} catch (error) {
console.error('❌ Test failed:', error);
process.exit(1);
}
}
// Run the test
testAutomationConnection().then(() => {
console.log('✅ Test completed successfully');
process.exit(0);
}).catch(error => {
console.error('❌ Test failed:', error);
process.exit(1);
});