stock-sdk 2.2.2 → 2.4.0

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.
Files changed (66) hide show
  1. package/README.md +7 -2
  2. package/dist/{adapters-BiH4keVd.d.cts → adapters-CZUNRbxi.d.cts} +29 -1
  3. package/dist/{adapters-BiH4keVd.d.ts → adapters-CZUNRbxi.d.ts} +29 -1
  4. package/dist/cache.cjs +1 -1
  5. package/dist/cache.d.cts +35 -3
  6. package/dist/cache.d.ts +35 -3
  7. package/dist/cache.js +1 -1
  8. package/dist/chip-BbA23rr1.d.cts +113 -0
  9. package/dist/chip-BbA23rr1.d.ts +113 -0
  10. package/dist/chunk-46ECBWOQ.cjs +1 -0
  11. package/dist/chunk-4RN7AVFQ.js +1 -0
  12. package/dist/chunk-6FZNYDNN.cjs +1 -0
  13. package/dist/chunk-6MCPZDKN.cjs +1 -0
  14. package/dist/chunk-H5FDXQRK.js +1 -0
  15. package/dist/chunk-HKREKO2F.js +1 -0
  16. package/dist/chunk-LDYRNH4X.cjs +1 -0
  17. package/dist/chunk-OPCBE3NR.js +1 -0
  18. package/dist/chunk-R7M3BHS4.cjs +1 -0
  19. package/dist/chunk-SMCYQ6NL.js +1 -0
  20. package/dist/chunk-USZUOBM2.cjs +1 -0
  21. package/dist/chunk-VKXPLWPL.js +1 -0
  22. package/dist/chunk-W625VPPB.js +1 -0
  23. package/dist/chunk-WJOFTWZL.cjs +1 -0
  24. package/dist/cli.cjs +16 -16
  25. package/dist/cli.js +16 -16
  26. package/dist/index.cjs +1 -1
  27. package/dist/index.d.cts +24 -7
  28. package/dist/index.d.ts +24 -7
  29. package/dist/index.js +1 -1
  30. package/dist/indicators.cjs +1 -1
  31. package/dist/indicators.d.cts +1 -0
  32. package/dist/indicators.d.ts +1 -0
  33. package/dist/indicators.js +1 -1
  34. package/dist/mcp.cjs +83 -5
  35. package/dist/mcp.d.cts +29 -2
  36. package/dist/mcp.d.ts +29 -2
  37. package/dist/mcp.js +83 -5
  38. package/dist/screener.cjs +1 -1
  39. package/dist/screener.d.cts +51 -16
  40. package/dist/screener.d.ts +51 -16
  41. package/dist/screener.js +1 -1
  42. package/dist/{sdk-CmYFd7V2.d.ts → sdk-DGgSDZRx.d.ts} +200 -21
  43. package/dist/{sdk-BOfyUDzu.d.cts → sdk-RzQ-drS4.d.cts} +200 -21
  44. package/dist/signals.d.cts +3 -42
  45. package/dist/signals.d.ts +3 -42
  46. package/dist/symbols.cjs +1 -1
  47. package/dist/symbols.d.cts +2 -2
  48. package/dist/symbols.d.ts +2 -2
  49. package/dist/symbols.js +1 -1
  50. package/dist/types-7n5rSHbd.d.cts +42 -0
  51. package/dist/types-7n5rSHbd.d.ts +42 -0
  52. package/package.json +2 -1
  53. package/dist/chunk-3VUFYFFD.js +0 -1
  54. package/dist/chunk-6ZSZEHZW.js +0 -1
  55. package/dist/chunk-C4CA7QBB.cjs +0 -1
  56. package/dist/chunk-DU7MCVLJ.js +0 -1
  57. package/dist/chunk-EDUJJOAJ.js +0 -1
  58. package/dist/chunk-F3KZXCVO.js +0 -1
  59. package/dist/chunk-JP3ZPNWP.cjs +0 -1
  60. package/dist/chunk-KKGWFS2M.cjs +0 -1
  61. package/dist/chunk-LCX5Q36O.js +0 -1
  62. package/dist/chunk-T5CH7H3X.cjs +0 -1
  63. package/dist/chunk-TVIEKKDQ.cjs +0 -1
  64. package/dist/chunk-USK6JHLG.cjs +0 -1
  65. package/dist/chunk-WCBK5KYA.cjs +0 -1
  66. package/dist/chunk-ZZ2IBUMV.js +0 -1
@@ -1 +0,0 @@
1
- import{e as E,f as x}from"./chunk-UBIQBXQ7.js";function $(e){if(e.startsWith("92")||/^[48]/.test(e))return"BSE";let r=e[0];return r==="6"||r==="5"||r==="9"?"SSE":"SZSE"}var y={SHFE:{market:"CN",exchange:"SHFE"},DCE:{market:"CN",exchange:"DCE"},CZCE:{market:"CN",exchange:"CZCE"},INE:{market:"CN",exchange:"INE"},CFFEX:{market:"CN",exchange:"CFFEX"},GFEX:{market:"CN",exchange:"GFEX"},COMEX:{market:"GLOBAL",exchange:"COMEX"},NYMEX:{market:"GLOBAL",exchange:"NYMEX"},CBOT:{market:"GLOBAL",exchange:"CBOT"},LME:{market:"GLOBAL",exchange:"LME"}};function I(e){let r=e.match(/^([A-Za-z]+)/);return(r?r[1]:e).toUpperCase()}var w={market:"CN",exchange:"CSI",secidPrefix:"2"},F=[/^93\d{4}$/,/^H\d{5}$/],O={HSHCI:{market:"HK",exchange:"HSI",secidPrefix:"124"},GDAXI:{market:"GLOBAL",exchange:"DAX",secidPrefix:"100"}},R=[[w.exchange,w.market],...Object.values(O).map(e=>[e.exchange,e.market])];function u(e){let r=e.toUpperCase();if(F.some(c=>c.test(r)))return{...w,code:r};let i=O[r];return i?{...i,code:r}:void 0}var A={sh:{market:"CN",exchange:"SSE"},sz:{market:"CN",exchange:"SZSE"},bj:{market:"CN",exchange:"BSE"},hk:{market:"HK",exchange:"HKEX"},us:{market:"US",exchange:"US"}},P=Object.keys(A),_={0:{market:"CN",exchange:"SZSE"},1:{market:"CN",exchange:"SSE"},116:{market:"HK",exchange:"HKEX"},105:{market:"US",exchange:"NASDAQ"},106:{market:"US",exchange:"NYSE"},107:{market:"US",exchange:"AMEX"}},B={0:["SZSE","BSE"]},D={SSE:"CN",SZSE:"CN",BSE:"CN",HKEX:"HK",NASDAQ:"US",NYSE:"US",AMEX:"US",US:"US",...Object.fromEntries(R),...Object.fromEntries(Object.values(y).map(e=>[e.exchange,e.market]))};function L(e,r,i,c){let n=c??[r.exchange],f=e.toLowerCase();for(let d of P){if(!f.startsWith(d)||e.length<=d.length)continue;let m=e.slice(d.length);if(!/^\d+$/.test(m))continue;let s=A[d];if(s.market!==r.market||!n.includes(s.exchange))throw new x(`${i} (prefix '${d}' conflicts with resolved ${r.market}/${r.exchange})`);return{code:m,exchange:s.exchange}}return{code:e,exchange:r.exchange}}function K(e,r){let i=typeof e=="string"?{code:e}:{...e},c=typeof e=="string"?e:e.code,n=String(i.code??"").trim(),f=i.market??r?.market,d=i.assetType??r?.assetType,m=i.exchange??r?.exchange;if(!n)throw new x(String(c));let s=(t,o,a,S,C,h={})=>{if(f&&f!==t)throw new x(`${c} (market hint '${f}' conflicts with resolved market ${t})`);if(m){let l=D[m];if(l&&l!==t)throw new x(`${c} (exchange hint '${m}' belongs to market ${l}, conflicts with resolved market ${t})`);if(h.exchange&&m!==o)throw new x(`${c} (exchange hint '${m}' conflicts with resolved exchange ${o})`)}if(d&&d!==S){if(h.assetType)throw new x(`${c} (assetType hint '${d}' conflicts with resolved assetType ${S})`);if(d==="board"||d==="futures")throw new x(`${c} (assetType hint '${d}' conflicts with a ${S}-shaped code)`)}return{market:t,exchange:m??o,assetType:d??S,code:a,variety:C,input:c}},T=t=>s(t.market,t.exchange,t.code,"index",void 0,{exchange:!0,assetType:!0}),b=(t,o)=>o==="HK"&&/^\d+$/.test(t)?t.padStart(5,"0"):o==="US"?t.toUpperCase():t;if(n.includes(".")){let t=n.indexOf("."),o=n.slice(0,t),a=n.slice(t+1),S=o.toUpperCase(),C=a.toUpperCase(),h=u(a);if(h&&h.secidPrefix===o)return T(h);if(/^\d+$/.test(o)&&_[o]){let p=_[o],g=B[o],N=L(a,p,c,g),X=N.exchange,H=!0;if(g&&N.code===a&&/^\d+$/.test(N.code)){let M=$(N.code);g.includes(M)&&(X=M),H=!1}return s(p.market,X,b(N.code,p.market),"stock",void 0,{exchange:H})}let l=a.toLowerCase(),k=Object.prototype.hasOwnProperty.call(A,l)?A[l]:void 0;if(k){if(k.market==="CN"||k.market==="HK"){let g=u(o);if(g)throw new x(`${c} (special index code '${g.code}' conflicts with exchange suffix '${a}'; use bare '${g.code}' or secid '${g.secidPrefix}.${g.code}')`)}let p=L(o,k,c);return s(k.market,p.exchange,b(p.code,k.market),"stock",void 0,{exchange:p.exchange!=="US"})}if(y[S]){let p=y[S];return s(p.market,p.exchange,C,"futures",I(a),{exchange:!0,assetType:!0})}if(o==="90")return s("CN","SSE",a,"board",void 0,{exchange:!0,assetType:!0})}let z=n.toLowerCase();for(let t of P)if(z.startsWith(t)&&n.length>t.length){let o=n.slice(t.length),a=A[t];if(a.market==="CN"?/^\d+$/.test(o):/^[0-9A-Za-z]+$/.test(o)){if(a.market==="CN"||a.market==="HK"){let h=u(o);if(h)throw new x(`${c} (special index code '${h.code}' conflicts with exchange prefix '${t}'; use bare '${h.code}' or secid '${h.secidPrefix}.${h.code}')`)}let C=a.market==="HK"?o.padStart(5,"0"):a.market==="US"?o.toUpperCase():o;return s(a.market,a.exchange,C,"stock",void 0,{exchange:a.exchange!=="US"})}}let U=u(n);if(U)return T(U);if(/^\d+$/.test(n))return f==="US"?s("US","US",n,"stock"):f==="CN"?s("CN",$(n),n,"stock"):f==="HK"||n.length===5||n.length===4?s("HK","HKEX",n.padStart(5,"0"),"stock",void 0,{exchange:!0}):s("CN",$(n),n,"stock");if((d==="futures"||f==="GLOBAL")&&/[A-Za-z]/.test(n)){let t=m;if(!t&&f==="GLOBAL")throw new x(`${c} (GLOBAL futures require an explicit exchange, e.g. { exchange: 'COMEX' })`);let o=t?y[String(t).toUpperCase()]?.market:void 0;return s(f??o??"CN",t??"SHFE",n.toUpperCase(),"futures",I(n),{assetType:!0})}if(/^[A-Za-z][A-Za-z.\-]*$/.test(n))return s("US","US",n.toUpperCase(),"stock");throw new x(String(c))}function Z(e){try{return K(e).market}catch{return}}var G={SSE:"1",SZSE:"0",BSE:"0",HKEX:"116",NASDAQ:"105",NYSE:"106",AMEX:"107",US:"105"},j={SSE:"sh",SZSE:"sz",BSE:"bj"};function v(e){if(e.assetType==="board"||e.assetType==="futures"||e.assetType==="option")throw new E(`Tencent quote symbol does not support assetType '${e.assetType}'`,{assetType:e.assetType,code:e.code});switch(e.market){case"CN":{let r=j[e.exchange];if(!r)throw new E(`Cannot map to Tencent symbol: unsupported CN exchange '${e.exchange}'`,{exchange:e.exchange,code:e.code});return`${r}${e.code}`}case"HK":if(!/^\d+$/.test(e.code))throw new E(`Cannot map to Tencent symbol: HK code '${e.code}' is not numeric`,{market:e.market,code:e.code});return`hk${e.code.padStart(5,"0")}`;case"US":return`us${e.code}`;default:throw new E(`Cannot map to Tencent symbol: unsupported market '${e.market}'`,{market:e.market,code:e.code})}}function Y(e){if(e.assetType==="board")return`90.${e.code}`;if(e.assetType==="futures"||e.assetType==="option")throw new E(`Eastmoney secid for assetType '${e.assetType}' uses a separate scheme; use the dedicated futures/options provider instead of toEastmoneySecid`,{assetType:e.assetType,exchange:e.exchange,code:e.code});if(e.assetType==="index"){let i=u(e.code);if(i&&i.exchange===e.exchange)return`${i.secidPrefix}.${i.code}`}if(e.market==="HK")return`116.${e.code.padStart(5,"0")}`;let r=G[e.exchange];if(!r)throw new E(`Cannot map to Eastmoney secid: unsupported exchange '${e.exchange}' (market=${e.market})`,{exchange:e.exchange,market:e.market,code:e.code});return`${r}.${e.code}`}function Q(e){return e.code}export{$ as a,y as b,I as c,u as d,K as e,Z as f,G as g,v as h,Y as i,Q as j};