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

Function parseMarketCommand

src/cli/command-parser.ts:164–181  ·  view source on GitHub ↗
(
  action: string,
  options: Record<string, string | boolean>,
  common: CommandCommonOptions & { help?: boolean }
)

Source from the content-addressed store, hash-verified

162}
163
164function parseMarketCommand(
165 action: string,
166 options: Record<string, string | boolean>,
167 common: CommandCommonOptions & { help?: boolean }
168): ParsedCliCommand {
169 assertAllowedOptions(options, new Set([...GLOBAL_OPTION_NAMES, "levels", "interval", "limit"]));
170 if (action === "ticker") return { kind: "market-ticker", ...common };
171 if (action === "depth") {
172 const levels = readNumberOption(options, ["levels"]);
173 return { kind: "market-depth", levels, ...common };
174 }
175 if (action === "kline") {
176 const interval = requireStringOption(options, ["interval"], "Missing required option --interval");
177 const limit = readNumberOption(options, ["limit"]);
178 return { kind: "market-kline", interval, limit, ...common };
179 }
180 throw new CommandParseError(`Unsupported market action '${action}'`);
181}
182
183function parseAccountCommand(
184 action: string,

Callers 1

parseCommandArgvFunction · 0.85

Calls 3

assertAllowedOptionsFunction · 0.85
readNumberOptionFunction · 0.85
requireStringOptionFunction · 0.85

Tested by

no test coverage detected