krx-cli 1.7.1 → 1.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/SKILL.md CHANGED
@@ -7,7 +7,7 @@ install: npm install -g krx-cli
7
7
  binary: krx
8
8
  metadata:
9
9
  author: kyo504
10
- version: "1.7.1"
10
+ version: "1.7.2"
11
11
  invariants:
12
12
  - Always use YYYYMMDD format for --date (e.g., 20260310)
13
13
  - Data is T-1 (previous trading day), available from 2010 onwards
package/dist/cli.js CHANGED
@@ -48889,7 +48889,8 @@ async function executeCommand(options) {
48889
48889
  process.exit(EXIT_CODES.AUTH_FAILURE);
48890
48890
  }
48891
48891
  const parentOpts = program3.opts();
48892
- const finalParams = parentOpts.code ? { ...params, isuCd: parentOpts.code } : params;
48892
+ const finalParams = params;
48893
+ const codeFilter = parentOpts.code;
48893
48894
  if (parentOpts.dryRun) {
48894
48895
  writeOutput(
48895
48896
  JSON.stringify(
@@ -48897,6 +48898,7 @@ async function executeCommand(options) {
48897
48898
  method: "POST",
48898
48899
  endpoint,
48899
48900
  params: finalParams,
48901
+ clientFilter: codeFilter ? { ISU_CD: codeFilter } : void 0,
48900
48902
  headers: { AUTH_KEY: "***" }
48901
48903
  },
48902
48904
  null,
@@ -48966,6 +48968,9 @@ async function executeCommand(options) {
48966
48968
  }
48967
48969
  data = result.data;
48968
48970
  }
48971
+ if (codeFilter) {
48972
+ data = data.filter((row) => row["ISU_CD"] === codeFilter);
48973
+ }
48969
48974
  if (data.length === 0) {
48970
48975
  writeError(noDataMessage ?? "No data");
48971
48976
  process.exit(EXIT_CODES.NO_DATA);
@@ -60662,21 +60667,19 @@ function createCategoryTool(categoryId) {
60662
60667
  err instanceof Error ? err.message : "Invalid date format"
60663
60668
  );
60664
60669
  }
60665
- const extraParams = {};
60666
- if (isuCd) {
60667
- extraParams["isuCd"] = isuCd;
60668
- }
60669
60670
  const rangeResult = await fetchDateRange({
60670
60671
  endpoint: endpoint.path,
60671
60672
  from: dateFrom,
60672
60673
  to: dateTo,
60673
- apiKey,
60674
- extraParams
60674
+ apiKey
60675
60675
  });
60676
60676
  if (!rangeResult.success) {
60677
60677
  return errorResult(rangeResult.error ?? "Date range fetch failed");
60678
60678
  }
60679
60679
  let data2 = rangeResult.data;
60680
+ if (isuCd) {
60681
+ data2 = data2.filter((row) => row["ISU_CD"] === isuCd);
60682
+ }
60680
60683
  const filterExpr = args.filter;
60681
60684
  const sortField2 = args.sort;
60682
60685
  const sortDirection2 = args.sort_direction ?? "desc";
@@ -60704,9 +60707,6 @@ function createCategoryTool(categoryId) {
60704
60707
  );
60705
60708
  }
60706
60709
  const params = { basDd: dateStr };
60707
- if (isuCd) {
60708
- params["isuCd"] = isuCd;
60709
- }
60710
60710
  const result = await krxFetch({
60711
60711
  endpoint: endpoint.path,
60712
60712
  params,
@@ -60721,6 +60721,9 @@ function createCategoryTool(categoryId) {
60721
60721
  const offsetN = args.offset;
60722
60722
  const limitN = args.limit;
60723
60723
  let data = result.data;
60724
+ if (isuCd) {
60725
+ data = data.filter((row) => row["ISU_CD"] === isuCd);
60726
+ }
60724
60727
  data = applyPipeline(data, {
60725
60728
  filter: filterExpr2,
60726
60729
  sort: sortField,