アプリケーションの初期設定

MagicTradeBot を起動する前に、管理バックエンドおよびコアボットインスタンスの設定が必要です。 以下に、各コンポーネントの設定例と重要なポイントを示します。

🖥️ ASP.NET Core 管理アプリ (appsettings.json)

場所: /management/appsettings.json


// appsettings.json (v1.2)
{
  "ConnectionStrings": {
    "SQLLight": "Data Source=Data/MTManagementDB.db",
    "SQLSERVER": "",
    "Postge": "",
    "MySQL": ""
  },
  "ApplicationSettings": {
    "Author": "MagicTradeBot",
    "PageCaption": "MagicTradeBot 管理アプリケーション",
    "Environment": "Development",
    "IsDemo": true,
    "Domain": {
      "Backend": "https://localhost:44353",
      "Frontend": "http://localhost:4200"
    },
    "Localization": {
      "DefaultCulture": "en",
      "Timezone": "America/Los_Angeles",
      "Currency": "USD"
    },
    "Pagination": {
      "DefaultPageSize": 18,
      "MaxPageSize": 100,
      "VisiblePageCount": 5
    },
    "Caching": {
      "Enabled": true,
      "Duration": 3600,
      "MaxCacheSize": "500MB"
    },
    "MaximumUrlCharacters": 60
  },
  "JwtSettings": {
    "SecretKey": "{JWT_SECRET}",
    "Issuer": "$ApplicationSettings:Domain.Backend",
    "Audience": "$ApplicationSettings:Domain.Frontend",
    "Expiration": {
      "AccessToken": "15m",
      "RefreshToken": "7d"
    }
  },
  "SecurityHeaders": {
    "StrictTransportSecurity": "max-age=31536000; includeSubDomains",
    "ContentSecurityPolicy": "",
    "XContentTypeOptions": "nosniff",
    "ReferrerPolicy": "strict-origin-when-cross-origin"
  },
  "Secrets": {
    "Database": {
      "Host": "",
      "Name": "",
      "User": "",
      "Password": ""
    }
  },
  "AllowedHosts": [
    "http://localhost:4200",
    "https://magictradebot.com",
    "*.magictradebot.com"
  ]
}

💡 ワンポイントアドバイス

  • JwtSettings:SecretKeySecrets のような機密キーは、本番環境では環境変数に移動してください。
  • Domain.Backend がデプロイされた API のベースURLと一致していることを確認してください。
  • 本番環境では "Environment": "Production" を使用して、パフォーマンスとセキュリティを向上させてください。

🤖 Golang ボット設定 (config.yaml)


server:
  botName: "Bybit_Mainnet_Trading_Bot"
  licenseKey: "hRnWOLo91ESUiZ8SkN986w"
  isDemo: true
  api: "https://localhost:7225/"
  refreshRate: 5
  totalConcurrentTrades: 0
  maxLoss: 0
  maxProfit: 0
  exchangeId: 0
  templateId: 0
  strategy: 0
  strategyMaxCount: 55
  timeZone: "UTC"

debug: true

💡 ワンポイントアドバイス

  • テスト中は isDemo: true に設定して実際の取引を回避してください。
  • 各ボットインスタンスには一意の botName を使用してログの識別を容易にしてください。
  • licenseKeyapi の値が管理アプリの設定と一致していることを確認してください。
  • strategyMaxCount は、マーチンゲールなどのループベース戦略での過剰取引を制限します。

📎 Related Topics