bludnic / opentrader

Powerful open-source crypto trading bot - BETA
Apache License 2.0
121 stars 16 forks source link

Rewrite the context to support cross exchange strategy #26

Closed bludnic closed 1 month ago

bludnic commented 5 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 4 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 1 month ago

See PR #55