MCPcopy Create free account
hub / github.com/discountry/ritmex-bot / parseStrategyCommand

Function parseStrategyCommand

src/cli/command-parser.ts:253–269  ·  view source on GitHub ↗
(
  action: string,
  bag: ParsedOptionBag,
  common: CommandCommonOptions & { help?: boolean }
)

Source from the content-addressed store, hash-verified

251}
252
253function parseStrategyCommand(
254 action: string,
255 bag: ParsedOptionBag,
256 common: CommandCommonOptions & { help?: boolean }
257): ParsedCliCommand {
258 if (action !== "run") {
259 throw new CommandParseError(`Unsupported strategy action '${action}'`);
260 }
261 assertAllowedOptions(bag.options, new Set([...GLOBAL_OPTION_NAMES, "strategy", "silent"]));
262 const strategyInput = readStringOption(bag.options, ["strategy"]) ?? bag.positionals[0];
263 if (!strategyInput) {
264 throw new CommandParseError("Missing required option --strategy for strategy run");
265 }
266 const strategy = normalizeStrategy(strategyInput);
267 const silent = readBooleanOption(bag.options, ["silent"], false);
268 return { kind: "strategy-run", strategy, silent, ...common };
269}
270
271function parseOrderCreatePayload(options: Record<string, string | boolean>): OrderCreatePayload {
272 const side = normalizeSide(requireStringOption(options, ["side"], "Missing required option --side"));

Callers 1

parseCommandArgvFunction · 0.85

Calls 4

assertAllowedOptionsFunction · 0.85
readStringOptionFunction · 0.85
normalizeStrategyFunction · 0.85
readBooleanOptionFunction · 0.85

Tested by

no test coverage detected