bludnic / opentrader

🤖 Powerful open-source crypto trading bot. Give it a ⭐ to support the project!
Apache License 2.0
218 stars 24 forks source link

Rewrite the context to support cross exchange strategy #26

Closed bludnic closed 3 months ago

bludnic commented 6 months ago

Current context:

type TBotContext<T extends IBotConfiguration> = {
  control: IBotControl;
  config: T;
  command: "start" | "stop" | "process";
  onStart: boolean;
  onStop: boolean;
  onProcess: boolean;
}

Exchanges config sample:

{
  OKX: {
    name: "OKX Account",
    apiKey: "your-api-key",
    secretKey: "your-secret",
    password: "your-password",
  },
  BYBIT: {
    name: "ByBit Account",
    apiKey: "your-api-key",
    secretKey: "your-secret",
  },
  BYBIT2: {
    name: "ByBit Account #2",
    apiKey: "your-api-key",
    secretKey: "your-secret",
  },
}
bludnic commented 6 months ago

Proposed Context

type TBotContext<T extends IBotConfiguration> = {
  params: P; // strategy params
  config: T; // bot config
  store: S; // persistent state
  command: "start" | "stop" | "process";
  onStart: boolean;
  onStop: boolean;
  onProcess: boolean;
}
bludnic commented 3 months ago

See PR #55