Skip to content

Trader: support multiple trading configurations at the same time - #276

Open
konard wants to merge 3 commits into
mainfrom
issue-194-a519f419
Open

Trader: support multiple trading configurations at the same time#276
konard wants to merge 3 commits into
mainfrom
issue-194-a519f419

Conversation

@konard

@konard konard commented Sep 11, 2025

Copy link
Copy Markdown
Member

Summary

  • Implements support for multiple trading configurations running simultaneously
  • Enables trading the same instrument on different broker accounts with different settings
  • Allows testing different trading parameters at the same time
  • Supports trading multiple instruments simultaneously
  • Maintains backward compatibility with existing single configuration format

Key Features

  • Multiple configurations: Define an array of trading configurations in MultiTradingConfiguration
  • Named configurations: Each configuration has a unique name for identification in logs
  • Independent API clients: Each configuration uses its own InvestApiClient instance
  • Concurrent execution: All trading services run simultaneously as hosted services
  • Backward compatibility: Existing single configuration files continue to work

Configuration Examples

Multiple Configurations

{
  "MultiTradingConfiguration": {
    "Configurations": [
      {
        "Name": "TMON_Account1",
        "InvestApiSettings": { "AccessToken": "...", "AppName": "..." },
        "TradingSettings": { "Ticker": "TMON@", "AccountIndex": 0, ... }
      },
      {
        "Name": "TMON_Account2", 
        "InvestApiSettings": { "AccessToken": "...", "AppName": "..." },
        "TradingSettings": { "Ticker": "TMON@", "AccountIndex": 1, ... }
      }
    ]
  }
}

Legacy Single Configuration (still supported)

{
  "InvestApiSettings": { "AccessToken": "...", "AppName": "..." },
  "TradingSettings": { "Ticker": "TMON@", ... }
}

Files Changed

  • Program.cs: Updated to support both single and multiple configuration modes
  • TradingService.cs: Enhanced with configuration name logging prefixes
  • TradingConfiguration.cs: New wrapper classes for multiple configurations
  • appsettings.MultipleConfigurations.json: Example configuration file
  • README.MultipleConfigurations.md: Comprehensive documentation

Use Cases

  1. Same instrument, different accounts: Trade TMON@ on Account 1 and Account 2 with different settings
  2. Multiple instruments: Trade TMON@ and TRUR simultaneously
  3. A/B testing: Test different trading parameters on the same instrument
  4. Risk diversification: Spread trading across multiple broker accounts

Testing

  • ✅ Builds successfully with no compilation errors
  • ✅ Maintains backward compatibility with existing configurations
  • ✅ Proper dependency injection for multiple service instances
  • ✅ Clear logging with configuration name prefixes

🤖 Generated with Claude Code


Resolves #194

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #194
@konard konard self-assigned this Sep 11, 2025
konard and others added 2 commits September 11, 2025 13:00
- Add TradingConfiguration wrapper class to support multiple configs
- Update Program.cs to handle both single and multiple configuration modes
- Enhance TradingService with configuration name prefixes in logs
- Create example multi-configuration JSON file
- Maintain backward compatibility with existing single configuration format
- Enable trading same instrument on different accounts with different settings
- Support simultaneous trading of multiple instruments

Resolves issue #194 - Trader: support multiple trading configurations at the same time

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Trader: support multiple trading configurations at the same time Trader: support multiple trading configurations at the same time Sep 11, 2025
@konard
konard marked this pull request as ready for review September 11, 2025 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trader: support multiple trading configurations at the same time

1 participant