stock-sdk 2.0.0-beta.0 → 2.0.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.
- package/README.md +27 -23
- package/dist/{adapters-C0s5bM8O.d.cts → adapters-BvE63CMd.d.cts} +16 -1
- package/dist/{adapters-C0s5bM8O.d.ts → adapters-BvE63CMd.d.ts} +16 -1
- package/dist/{addIndicators-TPEcddTW.d.cts → addIndicators-DwEr9RKK.d.cts} +207 -191
- package/dist/{addIndicators-TPEcddTW.d.ts → addIndicators-DwEr9RKK.d.ts} +207 -191
- package/dist/cache.cjs +1 -1
- package/dist/cache.js +1 -1
- package/dist/chunk-2PYGJ5I5.cjs +1 -0
- package/dist/chunk-3NSUE34F.cjs +1 -0
- package/dist/chunk-4PVVFEOQ.js +1 -0
- package/dist/chunk-C4CA7QBB.cjs +1 -0
- package/dist/chunk-D2MGPO3R.js +1 -0
- package/dist/{chunk-JYHHLB34.js → chunk-DU7MCVLJ.js} +1 -1
- package/dist/{chunk-SPLQXFFF.js → chunk-F3KZXCVO.js} +1 -1
- package/dist/chunk-G5KF73BW.js +1 -0
- package/dist/chunk-GBHWMR2O.js +1 -0
- package/dist/chunk-LCX5Q36O.js +1 -0
- package/dist/chunk-PMERLSCU.cjs +1 -0
- package/dist/{chunk-DOOAXFSS.cjs → chunk-TVIEKKDQ.cjs} +1 -1
- package/dist/{chunk-BGZ4ZUAF.cjs → chunk-WCBK5KYA.cjs} +1 -1
- package/dist/chunk-YR2SVSXB.cjs +1 -0
- package/dist/cli.cjs +17 -16
- package/dist/cli.js +17 -16
- package/dist/errors.d.cts +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/{index-B0PXWAkv.d.cts → index-mlzPfoON.d.cts} +12 -0
- package/dist/{index-B0PXWAkv.d.ts → index-mlzPfoON.d.ts} +12 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +1 -1
- package/dist/indicators.cjs +1 -1
- package/dist/indicators.d.cts +55 -5
- package/dist/indicators.d.ts +55 -5
- package/dist/indicators.js +1 -1
- package/dist/mcp.cjs +5 -5
- package/dist/mcp.d.cts +3 -3
- package/dist/mcp.d.ts +3 -3
- package/dist/mcp.js +5 -5
- package/dist/screener.cjs +1 -1
- package/dist/screener.js +1 -1
- package/dist/{sdk-CGd_HgIM.d.ts → sdk-Cg_jTmTk.d.cts} +21 -527
- package/dist/{sdk-C_Agv5AV.d.cts → sdk-DOz03n_v.d.ts} +21 -527
- package/dist/signals.cjs +1 -1
- package/dist/signals.d.cts +1 -1
- package/dist/signals.d.ts +1 -1
- package/dist/signals.js +1 -1
- package/dist/symbols.cjs +1 -1
- package/dist/symbols.d.cts +2 -2
- package/dist/symbols.d.ts +2 -2
- package/dist/symbols.js +1 -1
- package/package.json +6 -10
- package/dist/chunk-333W3ADG.js +0 -1
- package/dist/chunk-4RR2H3DC.js +0 -1
- package/dist/chunk-66NWE54C.cjs +0 -1
- package/dist/chunk-6JEP4QK7.cjs +0 -1
- package/dist/chunk-HFN6G5M4.js +0 -1
- package/dist/chunk-LRE63M2C.js +0 -1
- package/dist/chunk-NMRUSAWS.cjs +0 -1
- package/dist/chunk-PVSDXLQP.cjs +0 -1
- package/dist/chunk-XVLG3G7T.cjs +0 -1
- package/dist/chunk-ZAQ7DTRY.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as Pn,v as Dn,w as ct}from"./chunk-G5KF73BW.js";import{d as Z,e as An,f as On,h as J}from"./chunk-D2MGPO3R.js";import{b as te}from"./chunk-DU7MCVLJ.js";import{a as C,b as $,c as V,d as at,e as h,g as ut,h as lt,k as X,l as ve}from"./chunk-UBIQBXQ7.js";import{a as st}from"./chunk-WOT6VMZA.js";function dt(t){return new TextDecoder("gbk").decode(t)}function pt(t){let e=t.split(";").map(r=>r.trim()).filter(Boolean),n=[];for(let r of e){let o=r.indexOf("=");if(o<0)continue;let i=r.slice(0,o).trim();i.startsWith("v_")&&(i=i.slice(2));let a=r.slice(o+1).trim();a.startsWith('"')&&a.endsWith('"')&&(a=a.slice(1,-1));let u=a.split("~");n.push({key:i,fields:u})}return n}function mt(t){let e=t.trim();return e===""||e==="-"||e==="--"}function f(t){if(!t||t==="")return 0;let e=parseFloat(t);return Number.isNaN(e)?0:e}function _(t){if(!t||mt(t))return null;let e=parseFloat(t);return Number.isNaN(e)?null:e}function m(t){if(!t||mt(t))return null;let e=parseFloat(t);return Number.isNaN(e)?null:e}function s(t){return t==null?null:m(String(t))}function j(t){if(t==null)return null;if(typeof t=="number")return Number.isFinite(t)?t:null;if(mt(t))return null;let e=Number(t);return Number.isFinite(e)?e:null}var Fo=new Set(["daily","weekly","monthly"]),wo=new Set(["1","5","15","30","60"]),Uo=new Set(["","qfq","hfq"]);function Q(t,e){if(!Number.isFinite(t)||!Number.isInteger(t)||t<=0)throw new h(`${e} must be a positive integer`,{argument:e,value:t})}function H(t){if(!Fo.has(t))throw new h("period must be one of: daily, weekly, monthly",{argument:"period",value:t})}function gt(t){if(!wo.has(t))throw new h("period must be one of: 1, 5, 15, 30, 60",{argument:"period",value:t})}function G(t){if(!Uo.has(t))throw new h("adjust must be one of: '', 'qfq', 'hfq'",{argument:"adjust",value:t})}function Ke(t){if(t!=="north"&&t!=="south")throw new h("direction must be one of: 'north', 'south'",{argument:"direction",value:t})}function se(t,e){Q(e,"chunkSize");let n=[];for(let r=0;r<t.length;r+=e)n.push(t.slice(r,r+e));return n}async function ae(t,e,n=!1){if(Q(e,"concurrency"),t.length===0)return[];let r=n?new Array(t.length):[],o=0,i=Array.from({length:Math.min(e,t.length)},async()=>{for(;;){let a=o++;if(a>=t.length)return;let u=await t[a]();n?r[a]=u:r.push(u)}});return await Promise.all(i),r}function q(t){return{daily:"101",weekly:"102",monthly:"103"}[t]}function Y(t){return{"":"0",qfq:"1",hfq:"2"}[t]}var xo=typeof document<"u"&&typeof window<"u",vo=0;function In(){return`__stock_sdk_jsonp_${Date.now()}_${vo++}`}function Be(t){let e=t,n=e.indexOf("*/");n!==-1&&(e=e.slice(n+2).trim());let r=e.indexOf("(");if(r===-1)throw new C({code:"PARSE_ERROR",message:"Invalid JSONP response: no opening parenthesis found"});let o=e.lastIndexOf(")");if(o===-1||o<=r)throw new C({code:"PARSE_ERROR",message:"Invalid JSONP response: no closing parenthesis found"});let i=e.slice(r+1,o);try{return JSON.parse(i)}catch(a){throw new C({code:"PARSE_ERROR",message:"Invalid JSONP response: payload is not valid JSON",cause:a})}}function Ko(t,e){let{timeout:n=15e3,callbackParam:r="callback",callbackMode:o="query"}=e;return new Promise((i,a)=>{let u=In(),l;if(o==="path")l=t.replace("{callback}",u);else{let R=t.includes("?")?"&":"?";l=`${t}${R}${r}=${u}`}let c=document.createElement("script"),d=!1,T=window,p=()=>{c.parentNode&&c.parentNode.removeChild(c),delete T[u]},y=setTimeout(()=>{d||(d=!0,p(),a(new C({code:"TIMEOUT",message:`JSONP request timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}})))},n);T[u]=R=>{d||(d=!0,clearTimeout(y),p(),i(R))},c.onerror=()=>{d||(d=!0,clearTimeout(y),p(),a(new C({code:"NETWORK_ERROR",message:`JSONP script load failed: ${t}`,url:t})))},c.src=l,document.head.appendChild(c)})}async function Bo(t,e){let{timeout:n=15e3,callbackParam:r="callback",callbackMode:o="query"}=e,i=In(),a;if(o==="path")a=t.replace("{callback}",i);else{let c=t.includes("?")?"&":"?";a=`${t}${c}${r}=${i}`}let u=new AbortController,l=setTimeout(()=>u.abort(),n);try{let c=await fetch(a,{signal:u.signal});if(!c.ok)throw new $(c.status,c.statusText,t);let d=await c.text();return Be(d)}catch(c){throw c instanceof DOMException&&c.name==="AbortError"?new C({code:"TIMEOUT",message:`JSONP request timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}}):c instanceof C?c:new C({code:"NETWORK_ERROR",message:`JSONP request failed: ${c instanceof Error?c.message:String(c)}`,url:t,cause:c})}finally{clearTimeout(l)}}function F(t,e={}){return xo?Ko(t,e):Bo(t,e)}var bn=new Map;async function ue(t,e){let r=(bn.get(t)??Promise.resolve()).then(e,e);return bn.set(t,r.then(()=>{},()=>{})),r}function Ho(){return typeof document<"u"&&typeof window<"u"}var qo=15e3,zo="jsVars";async function le(t,e,n={}){let r=n.timeout??qo;return Ho()?ue(zo,()=>$o(t,e,r)):Qo(t,e,r,n.headers,n.client)}function ft(t,e){let n={};for(let r of e){let o=jo(t,r);o!==void 0&&(n[r]=o)}return n}function $o(t,e,n){return new Promise((r,o)=>{let i=document.createElement("script"),a=!1,u=()=>{i.parentNode&&i.parentNode.removeChild(i)},l=setTimeout(()=>{a||(a=!0,u(),o(new C({code:"TIMEOUT",message:`fetchJsVars timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}})))},n);i.onload=()=>{if(a)return;a=!0,clearTimeout(l);let c=window,d={};for(let T of e)if(T in c){d[T]=c[T];try{delete c[T]}catch{}}u(),r(d)},i.onerror=()=>{a||(a=!0,clearTimeout(l),u(),o(new C({code:"NETWORK_ERROR",message:`fetchJsVars script load failed: ${t}`,url:t})))},i.src=t,document.head.appendChild(i)})}async function Qo(t,e,n,r,o){if(o){let u=await o.get(t,{responseType:"text"});return ft(u,e)}let i=new AbortController,a=setTimeout(()=>i.abort(),n);try{let u=await fetch(t,{signal:i.signal,headers:r});if(!u.ok)throw new $(u.status,u.statusText,t);let l=await u.text();return ft(l,e)}catch(u){throw u instanceof DOMException&&u.name==="AbortError"?new C({code:"TIMEOUT",message:`fetchJsVars timed out after ${n}ms: ${t}`,url:t,details:{timeout:n}}):u instanceof C?u:new C({code:"NETWORK_ERROR",message:`fetchJsVars failed: ${u instanceof Error?u.message:String(u)}`,url:t,cause:u})}finally{clearTimeout(a)}}function jo(t,e){let r=new RegExp(`(?:^|[^\\w$])(?:var|let|const)\\s+${Go(e)}\\s*=\\s*`,"m").exec(t);if(!r)return;let o=r.index+r[0].length,i=Yo(t,o),a=t.slice(o,i).trim();try{return JSON.parse(a)}catch{return}}function Go(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Yo(t,e){let n=0,r=null;for(let o=e;o<t.length;o++){let i=t[o];if(r){if(i==="\\"){o++;continue}i===r&&(r=null);continue}if(i==='"'||i==="'"){r=i;continue}if(i==="["||i==="{"||i==="("){n++;continue}if(i==="]"||i==="}"||i===")"){n--;continue}if(i===";"&&n===0)return o}return t.length}var E={CN:"Asia/Shanghai",HK:"Asia/Hong_Kong",US:"America/New_York"};function Wo(t){if(!t)return null;let e=t.trim();if(!e)return null;let n=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?$/.exec(e);if(n)return{year:+n[1],month:+n[2],day:+n[3],hour:+n[4],minute:+n[5],second:n[6]?+n[6]:0};let r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);return r?{year:+r[1],month:+r[2],day:+r[3],hour:0,minute:0,second:0}:/^\d{14}$/.test(e)?{year:+e.slice(0,4),month:+e.slice(4,6),day:+e.slice(6,8),hour:+e.slice(8,10),minute:+e.slice(10,12),second:+e.slice(12,14)}:/^\d{8}$/.test(e)?{year:+e.slice(0,4),month:+e.slice(4,6),day:+e.slice(6,8),hour:0,minute:0,second:0}:null}var Vo={wallParts:{locale:"en-US",keyPrefix:"en-US|",options:{hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}},svDisplay:{locale:"sv-SE",keyPrefix:"sv-SE|",options:{hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}},dateOnly:{locale:"en-CA",keyPrefix:"en-CA|",options:{year:"numeric",month:"2-digit",day:"2-digit"}}},Mn=new Map;function Tt(t,e){let n=Vo[t],r=n.keyPrefix+e,o=Mn.get(r);return o||(o=new Intl.DateTimeFormat(n.locale,{timeZone:e,...n.options}),Mn.set(r,o)),o}function ce(t,e){let r=Tt("wallParts",e).formatToParts(new Date(t)),o={};for(let a of r)a.type!=="literal"&&(o[a.type]=a.value);let i=parseInt(o.hour??"0",10);return i===24&&(i=0),Date.UTC(parseInt(o.year??"0",10),parseInt(o.month??"1",10)-1,parseInt(o.day??"1",10),i,parseInt(o.minute??"0",10),parseInt(o.second??"0",10))}var Nn=new Map;function kn(t,e){return ce(t,e)-t}function Xo(t,e){let n=`${t}|${e}`,r=Nn.get(n);if(r===void 0){let o=kn(Date.UTC(e,0,1,12),t);for(let i=1;i<12;i++)if(kn(Date.UTC(e,i,1,12),t)!==o){o=null;break}r=o,Nn.set(n,r)}return r}function Ln(t,e){if(!(t.month===1&&t.day<=2||t.month===12&&t.day>=30)){let a=Xo(e,t.year);if(a!==null)return Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second)-a}let r=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second),o=2*r-ce(r,e);if(ce(o,e)===r)return o;let i=r-ce(o,e)+o;return ce(i,e)===r?i:o}function Zo(t,e){let n=(t||"").trim(),r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(n)??/^(\d{4})(\d{2})(\d{2})$/.exec(n);if(!r)return null;let o=/^(\d{2}):(\d{2})(?::(\d{2}))?$/.exec((e||"").trim());return o?{year:+r[1],month:+r[2],day:+r[3],hour:+o[1],minute:+o[2],second:o[3]?+o[3]:0}:null}function He(t,e){let n=Wo(t);return n?Ln(n,e):NaN}function de(t){return Number.isNaN(t)?null:t}function N(t,e){return{timestamp:de(He(t,e)),tz:e}}function pe(t,e){let[n,r,o]=t.split("-").map(Number);return new Date(Date.UTC(n,r-1,o+e)).toISOString().slice(0,10)}function yt(t,e,n){let r=Zo(t,e);return r?{timestamp:de(Ln(r,n)),tz:n}:{timestamp:null,tz:n}}function ht(t,e){if(t==null||!Number.isFinite(t))return"";let n=Tt("svDisplay",e).format(new Date(t)),r=n.match(/^(\d{4}-\d{2}-\d{2})[ T](\d{2}):(\d{2})/);if(!r)return n;let o=r[2]==="24"?"00":r[2];return`${r[1]} ${o}:${r[3]}`}function W(t,e=Date.now()){return Tt("dateOnly",t).format(new Date(e))}var St="https://qt.gtimg.cn",Et="https://web.ifzq.gtimg.cn/appstock/app/minute/query",Rt="https://assets.linkdiary.cn/shares/zh_a_list.json",_t="https://assets.linkdiary.cn/shares/us_list.json",Ct="https://assets.linkdiary.cn/shares/hk_list.json",qe="https://assets.linkdiary.cn/shares/fund_list",At="https://assets.linkdiary.cn/shares/trade-data-list.txt",ze="https://push2his.eastmoney.com/api/qt/stock/kline/get",Ot="https://push2his.eastmoney.com/api/qt/stock/trends2/get",$e="https://33.push2his.eastmoney.com/api/qt/stock/kline/get",Qe="https://63.push2his.eastmoney.com/api/qt/stock/kline/get",Pt="https://33.push2his.eastmoney.com/api/qt/stock/trends2/get",Dt="https://63.push2his.eastmoney.com/api/qt/stock/trends2/get",It="https://17.push2.eastmoney.com/api/qt/clist/get",bt="https://91.push2.eastmoney.com/api/qt/stock/get",Mt="https://29.push2.eastmoney.com/api/qt/clist/get",Nt="https://7.push2his.eastmoney.com/api/qt/stock/kline/get",kt="https://push2his.eastmoney.com/api/qt/stock/trends2/get",Lt="https://79.push2.eastmoney.com/api/qt/clist/get",Ft="https://91.push2.eastmoney.com/api/qt/stock/get",wt="https://29.push2.eastmoney.com/api/qt/clist/get",Ut="https://91.push2his.eastmoney.com/api/qt/stock/kline/get",xt="https://push2his.eastmoney.com/api/qt/stock/trends2/get",vt="https://datacenter-web.eastmoney.com/api/data/v1/get",me="https://push2his.eastmoney.com/api/qt/stock/fflow/daykline/get",Kt="https://push2.eastmoney.com/api/qt/clist/get",Bt="https://push2.eastmoney.com/api/qt/kamtbs.rtmin/get",ge="https://push2ex.eastmoney.com",k="7eea3edcaed734bea9cbfc24409ed989",z="b2884a393a59ad64002292a3e90d46a5",fe="https://push2his.eastmoney.com/api/qt/stock/kline/get",Ht="https://futsseapi.eastmoney.com/list/COMEX,NYMEX,COBOT,SGX,NYBOT,LME,MDEX,TOCOM,IPE",Te="58b2fa8f54638b60b87d69b31969089c",qt={SHFE:113,DCE:114,CZCE:115,INE:142,CFFEX:220,GFEX:225},oe={cu:"SHFE",al:"SHFE",zn:"SHFE",pb:"SHFE",au:"SHFE",ag:"SHFE",rb:"SHFE",wr:"SHFE",fu:"SHFE",ru:"SHFE",bu:"SHFE",hc:"SHFE",ni:"SHFE",sn:"SHFE",sp:"SHFE",ss:"SHFE",ao:"SHFE",br:"SHFE",c:"DCE",a:"DCE",b:"DCE",m:"DCE",y:"DCE",p:"DCE",l:"DCE",v:"DCE",j:"DCE",jm:"DCE",i:"DCE",jd:"DCE",pp:"DCE",cs:"DCE",eg:"DCE",eb:"DCE",pg:"DCE",lh:"DCE",WH:"CZCE",CF:"CZCE",SR:"CZCE",TA:"CZCE",OI:"CZCE",MA:"CZCE",FG:"CZCE",RM:"CZCE",SF:"CZCE",SM:"CZCE",ZC:"CZCE",AP:"CZCE",CJ:"CZCE",UR:"CZCE",SA:"CZCE",PF:"CZCE",PK:"CZCE",PX:"CZCE",SH:"CZCE",sc:"INE",nr:"INE",lu:"INE",bc:"INE",ec:"INE",IF:"CFFEX",IC:"CFFEX",IH:"CFFEX",IM:"CFFEX",TS:"CFFEX",TF:"CFFEX",T:"CFFEX",TL:"CFFEX",si:"GFEX",lc:"GFEX",ps:"GFEX",pt:"GFEX",pd:"GFEX"},je={HG:101,GC:101,SI:101,QI:101,QO:101,MGC:101,CL:102,NG:102,RB:102,HO:102,PA:102,PL:102,ZW:103,ZM:103,ZS:103,ZC:103,ZL:103,ZR:103,YM:103,NQ:103,ES:103,SB:108,CT:108,LCPT:109,LZNT:109,LALT:109},ye="https://stock.finance.sina.com.cn/futures/api/openapi.php/OptionService.getOptionData",he="https://stock.finance.sina.com.cn/futures/api/jsonp.php/{callback}/FutureOptionAllService.getOptionDayline",zt="https://stock.finance.sina.com.cn/futures/api/openapi.php/StockOptionService.getStockName",Ge="https://stock.finance.sina.com.cn/futures/api/openapi.php/StockOptionService.getRemainderDay",$t="https://stock.finance.sina.com.cn/futures/api/openapi.php/StockOptionDaylineService.getOptionMinline",Qt="https://stock.finance.sina.com.cn/futures/api/jsonp_v2.php/{callback}/StockOptionDaylineService.getSymbolInfo",jt="https://stock.finance.sina.com.cn/futures/api/openapi.php/StockOptionDaylineService.getFiveDayLine",Gt="https://futsseapi.eastmoney.com/list/option/221",Yt="https://datacenter-web.eastmoney.com/api/data/get";var Ye={au:{product:"au_o",exchange:"shfe"},ag:{product:"ag_o",exchange:"shfe"},cu:{product:"cu_o",exchange:"shfe"},al:{product:"al_o",exchange:"shfe"},zn:{product:"zn_o",exchange:"shfe"},ru:{product:"ru_o",exchange:"shfe"},sc:{product:"sc_o",exchange:"ine"},m:{product:"m_o",exchange:"dce"},c:{product:"c_o",exchange:"dce"},i:{product:"i_o",exchange:"dce"},p:{product:"p_o",exchange:"dce"},pp:{product:"pp_o",exchange:"dce"},l:{product:"l_o",exchange:"dce"},v:{product:"v_o",exchange:"dce"},pg:{product:"pg_o",exchange:"dce"},y:{product:"y_o",exchange:"dce"},a:{product:"a_o",exchange:"dce"},b:{product:"b_o",exchange:"dce"},eg:{product:"eg_o",exchange:"dce"},eb:{product:"eb_o",exchange:"dce"},SR:{product:"SR_o",exchange:"czce"},CF:{product:"CF_o",exchange:"czce"},TA:{product:"TA_o",exchange:"czce"},MA:{product:"MA_o",exchange:"czce"},RM:{product:"RM_o",exchange:"czce"},OI:{product:"OI_o",exchange:"czce"},PK:{product:"PK_o",exchange:"czce"},PF:{product:"PF_o",exchange:"czce"},SA:{product:"SA_o",exchange:"czce"},UR:{product:"UR_o",exchange:"czce"}},Wt=3e4,Se=500,Ee=500,Re=7,Vt=3,Xt=1e3,Zt=3e4,Jt=2,en=[408,429,500,502,503,504];var We=class{constructor(e={}){this.acquireChain=Promise.resolve();let n=e.requestsPerSecond??5;this.maxTokens=e.maxBurst??n,this.tokens=this.maxTokens,this.refillRate=n/1e3,this.lastRefillTime=Date.now()}refill(){let e=Date.now(),r=(e-this.lastRefillTime)*this.refillRate;this.tokens=Math.min(this.maxTokens,this.tokens+r),this.lastRefillTime=e}tryAcquire(){return this.refill(),this.tokens>=1?(this.tokens-=1,!0):!1}getWaitTime(){if(this.refill(),this.tokens>=1)return 0;let e=1-this.tokens;return Math.ceil(e/this.refillRate)}async acquire(){let e=this.acquireChain,n;this.acquireChain=new Promise(r=>{n=r});try{await e;let r=this.getWaitTime();r>0&&await this.sleep(r),this.refill(),this.tokens-=1}finally{n()}}sleep(e){return new Promise(n=>setTimeout(n,e))}getAvailableTokens(){return this.refill(),this.tokens}};var Fn=["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:121.0) Gecko/20100101 Firefox/121.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Safari/605.1.15","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0"],tn=0;function Jo(){return typeof window<"u"&&typeof window.document<"u"}function wn(){if(Jo())return;let t=Fn[tn];return tn=(tn+1)%Fn.length,t}var ie=class extends C{constructor(e="Circuit breaker is OPEN"){super({code:"CIRCUIT_OPEN",message:e}),this.name="CircuitBreakerError"}},Ve=class{constructor(e={}){this.state="CLOSED";this.failureCount=0;this.lastFailureTime=0;this.halfOpenSuccessCount=0;this.halfOpenProbeStartedAt=[];this.failureThreshold=e.failureThreshold??5,this.resetTimeout=e.resetTimeout??3e4,this.halfOpenRequests=e.halfOpenRequests??1,this.probeRecycleTimeout=e.probeRecycleTimeout??Math.max(this.resetTimeout*4,12e4),this.onStateChange=e.onStateChange}getState(){return this.checkStateTransition(),this.state}canRequest(){switch(this.checkStateTransition(),this.state){case"CLOSED":return!0;case"OPEN":return!1;case"HALF_OPEN":{let e=Date.now();for(;this.halfOpenProbeStartedAt.length>0&&e-this.halfOpenProbeStartedAt[0]>=this.probeRecycleTimeout;)this.halfOpenProbeStartedAt.shift();return this.halfOpenProbeStartedAt.length+this.halfOpenSuccessCount>=this.halfOpenRequests?!1:(this.halfOpenProbeStartedAt.push(e),!0)}}}releaseProbe(){this.state==="HALF_OPEN"&&this.halfOpenProbeStartedAt.shift()}recordSuccess(){this.checkStateTransition(),this.state==="HALF_OPEN"?(this.halfOpenProbeStartedAt.shift(),this.halfOpenSuccessCount++,this.halfOpenSuccessCount>=this.halfOpenRequests&&this.transitionTo("CLOSED")):this.state==="CLOSED"&&(this.failureCount=0)}recordFailure(){this.lastFailureTime=Date.now(),this.state==="HALF_OPEN"?(this.halfOpenProbeStartedAt.shift(),this.transitionTo("OPEN")):this.state==="CLOSED"&&(this.failureCount++,this.failureCount>=this.failureThreshold&&this.transitionTo("OPEN"))}checkStateTransition(){this.state==="OPEN"&&Date.now()-this.lastFailureTime>=this.resetTimeout&&this.transitionTo("HALF_OPEN")}transitionTo(e){if(this.state===e)return;let n=this.state;this.state=e,e==="CLOSED"?(this.failureCount=0,this.halfOpenSuccessCount=0,this.halfOpenProbeStartedAt=[]):e==="HALF_OPEN"&&(this.halfOpenSuccessCount=0,this.halfOpenProbeStartedAt=[]),this.onStateChange?.(n,e)}reset(){this.transitionTo("CLOSED"),this.failureCount=0,this.halfOpenSuccessCount=0,this.halfOpenProbeStartedAt=[],this.lastFailureTime=0}async execute(e){if(!this.canRequest())throw new ie;try{let n=await e();return this.recordSuccess(),n}catch(n){throw this.recordFailure(),n}}getStats(){return{state:this.getState(),failureCount:this.failureCount,lastFailureTime:this.lastFailureTime,halfOpenSuccessCount:this.halfOpenSuccessCount}}};var ei=3e4,ti=1,Un=["push2his.eastmoney.com","7.push2his.eastmoney.com","33.push2his.eastmoney.com","63.push2his.eastmoney.com","91.push2his.eastmoney.com"],xn=["17.push2.eastmoney.com","29.push2.eastmoney.com","79.push2.eastmoney.com","91.push2.eastmoney.com"];function ni(t,e){return e!=="eastmoney"?[t]:t.includes("push2his.eastmoney.com")?Un:t.includes("push2.eastmoney.com")?xn:[t]}function ri(t){return Array.from(new Set(t))}var Xe=class{constructor(e=ei,n=ti){this.cooldownMs=e;this.failureThreshold=n;this.states=new Map}getCandidateUrls(e,n){let r;try{r=new URL(e)}catch{return[e]}let o=Date.now(),i=ni(r.hostname,n);if(i.length<=1)return[e];let a=i.filter(c=>{let d=this.states.get(c);return!d||d.cooldownUntil<=o}),u=i.filter(c=>{let d=this.states.get(c);return d&&d.cooldownUntil>o});return ri([...a.includes(r.hostname)?[r.hostname]:[],...a.filter(c=>c!==r.hostname),...u.includes(r.hostname)?[r.hostname]:[],...u.filter(c=>c!==r.hostname)]).map(c=>{let d=new URL(e);return d.hostname=c,d.toString()})}recordSuccess(e){let n=this.safeGetHost(e);if(!n)return;let r=this.getState(n);r.failureCount=0,r.cooldownUntil=0,r.successCount++,r.lastErrorCode=void 0}recordFailure(e,n){let r=this.safeGetHost(e);if(!r)return;let o=this.getState(r);o.failureCount++,o.lastFailureAt=Date.now(),o.lastErrorCode=X(n),o.failureCount>=this.failureThreshold&&(o.cooldownUntil=Date.now()+this.cooldownMs)}shouldFallback(e){let n=X(e);return n==="NETWORK_ERROR"||n==="TIMEOUT"||n==="PARSE_ERROR"?!0:e instanceof $?e.status===408||e.status===429||e.status>=500:!1}getStats(e){let n=Array.from(this.states.values()).map(o=>({...o}));if(!e)return n;if(e!=="eastmoney")return[];let r=new Set([...Un,...xn]);return n.filter(o=>r.has(o.host))}safeGetHost(e){try{return new URL(e).hostname}catch{return null}}getState(e){let n=this.states.get(e);if(n)return n;let r={host:e,failureCount:0,successCount:0,cooldownUntil:0,lastFailureAt:0};return this.states.set(e,r),r}};function oi(t){return{maxRetries:t?.maxRetries??Vt,baseDelay:t?.baseDelay??Xt,maxDelay:t?.maxDelay??Zt,backoffMultiplier:t?.backoffMultiplier??Jt,retryableStatusCodes:t?.retryableStatusCodes??en,retryOnNetworkError:t?.retryOnNetworkError??!0,retryOnTimeout:t?.retryOnTimeout??!0,onRetry:t?.onRetry}}function ii(t,e){let n={...t??{}};return e&&(Object.keys(n).some(o=>o.toLowerCase()==="user-agent")||(n["User-Agent"]=e)),n}function vn(t,e){return e?{timeout:e.timeout??t.timeout,retry:e.retry?{...t.retry??{},...e.retry}:t.retry?{...t.retry}:void 0,headers:{...t.headers??{},...e.headers??{}},userAgent:e.userAgent??t.userAgent,rateLimit:e.rateLimit?{...t.rateLimit??{},...e.rateLimit}:t.rateLimit?{...t.rateLimit}:void 0,rotateUserAgent:e.rotateUserAgent??t.rotateUserAgent,circuitBreaker:e.circuitBreaker?{...t.circuitBreaker??{},...e.circuitBreaker}:t.circuitBreaker?{...t.circuitBreaker}:void 0}:{...t,headers:{...t.headers??{}},retry:t.retry?{...t.retry}:void 0,rateLimit:t.rateLimit?{...t.rateLimit}:void 0,circuitBreaker:t.circuitBreaker?{...t.circuitBreaker}:void 0}}function nn(t={}){return{timeout:t.timeout??Wt,retry:oi(t.retry),headers:ii(t.headers,t.userAgent),rotateUserAgent:t.rotateUserAgent??!1,rateLimit:t.rateLimit?{...t.rateLimit}:void 0,circuitBreaker:t.circuitBreaker?{...t.circuitBreaker}:void 0}}function Kn(t,e){if(e)return e;try{let n=new URL(t).hostname;if(n.includes("eastmoney.com"))return"eastmoney";if(n.includes("gtimg.cn"))return"tencent";if(n.includes("sina.com.cn"))return"sina";if(n.includes("linkdiary.cn"))return"linkdiary"}catch{return"unknown"}return"unknown"}function Bn(t){if(t instanceof DOMException&&t.name==="AbortError")return!0;if(t instanceof Error){if(t.name==="AbortError")return!0;let e=t.cause;if((e instanceof Error||e instanceof DOMException)&&e.name==="AbortError")return!0}return!1}var rn=()=>{};function si(t){let e=t.filter(u=>!!u);if(e.length===0)return{signal:void 0,cleanup:rn};if(e.length===1)return{signal:e[0],cleanup:rn};let n=AbortSignal.any;if(typeof n=="function")return{signal:n(e),cleanup:rn};let r=new AbortController,o=u=>{r.signal.aborted||r.abort(u)},i=[];for(let u of e){if(u.aborted){o(u.reason);break}let l=()=>o(u.reason);u.addEventListener("abort",l,{once:!0}),i.push({s:u,handler:l})}let a=()=>{for(let{s:u,handler:l}of i)u.removeEventListener("abort",l)};return{signal:r.signal,cleanup:a}}async function ai(t,e){if(!t)return e;if(Promise.resolve(e).catch(()=>{}),t.aborted)return Promise.race([e,Promise.reject(t.reason)]);let n,r=new Promise((o,i)=>{n=()=>i(t.reason),t.addEventListener("abort",n,{once:!0})});try{return await Promise.race([e,r])}finally{t.removeEventListener("abort",n)}}var _e=class{constructor(e={}){this.baseUrl=e.baseUrl??St;let n={timeout:e.timeout,retry:e.retry,headers:e.headers,userAgent:e.userAgent,rateLimit:e.rateLimit,rotateUserAgent:e.rotateUserAgent,circuitBreaker:e.circuitBreaker};this.defaultPolicy=nn(n),this.providerPolicies={},this.runtimeStates=new Map,this.fallbackManager=new Xe,this.fetchImpl=e.fetchImpl,this.clientSignal=e.signal,this.hooks=e.hooks;for(let[r,o]of Object.entries(e.providerPolicies??{})){let i=vn(n,o);this.providerPolicies[r]=nn(i)}}getProviderState(e){let n=this.runtimeStates.get(e);if(n)return n;let r=this.providerPolicies[e]??this.defaultPolicy,o={policy:r,rateLimiter:r.rateLimit?new We(r.rateLimit):null,circuitBreaker:r.circuitBreaker?new Ve(r.circuitBreaker):null};return this.runtimeStates.set(e,o),o}getTimeout(){return this.defaultPolicy.timeout}getHostHealth(e){return this.fallbackManager.getStats(e)}safe(e){try{e()}catch{}}toSdkError(e){return e instanceof C?e:new C({code:X(e)??"NETWORK_ERROR",message:e.message,provider:e.provider,url:e.url,status:e.status,details:e.details,cause:e})}calculateDelay(e,n){return Math.min(n.baseDelay*Math.pow(n.backoffMultiplier,e),n.maxDelay)+Math.random()*100}sleep(e){return new Promise(n=>setTimeout(n,e))}shouldRetry(e,n,r){if(n>=r.maxRetries)return!1;let o=X(e);return o==="ABORTED"?!1:o==="TIMEOUT"?r.retryOnTimeout:o==="NETWORK_ERROR"?r.retryOnNetworkError:e instanceof $?r.retryableStatusCodes.includes(e.status):!1}async executeWithRetry(e,n,r,o=0){try{return await e(o)}catch(i){let a=ve(i,r),u={provider:r.provider,url:r.url,timeout:r.timeout,attempt:o,responseType:r.responseType};if(this.safe(()=>this.hooks?.onError?.(u,this.toSdkError(a))),this.safe(()=>this.hooks?.trace?.("error",u)),this.shouldRetry(a,o,n)){let l=this.calculateDelay(o,n);return n.onRetry&&n.onRetry(o+1,a,l),this.safe(()=>this.hooks?.onRetry?.(u,this.toSdkError(a),l)),this.safe(()=>this.hooks?.trace?.("retry",u)),await this.sleep(l),this.executeWithRetry(e,n,r,o+1)}throw a}}async performRequest(e,n,r,o="text",i={},a=0){n.rateLimiter&&await n.rateLimiter.acquire();let u=new AbortController,l=new DOMException(`Request timed out after ${n.policy.timeout}ms`,"AbortError"),c=setTimeout(()=>u.abort(l),n.policy.timeout),{signal:d,cleanup:T}=si([u.signal,i.signal,this.clientSignal]),p=i.fetchImpl??this.fetchImpl??globalThis.fetch,y={...n.policy.headers};if(n.policy.rotateUserAgent){let S=wn();if(S){for(let O of Object.keys(y))O.toLowerCase()==="user-agent"&&delete y[O];y["User-Agent"]=S}}let R={provider:r,url:e,timeout:n.policy.timeout,attempt:a,responseType:o};this.safe(()=>this.hooks?.onRequest?.(R)),this.safe(()=>this.hooks?.trace?.("request",R));let P=Date.now();try{let S=await ai(d,p(e,{signal:d,headers:y}));if(this.safe(()=>this.hooks?.onResponse?.(R,{status:S.status,durationMs:Date.now()-P})),this.safe(()=>this.hooks?.trace?.("response",R)),!S.ok)throw new $(S.status,S.statusText,e,r);switch(o){case"json":try{return await S.json()}catch(O){throw new C({code:"PARSE_ERROR",message:`Failed to parse JSON response from ${e}`,provider:r,url:e,cause:O})}case"arraybuffer":return await S.arrayBuffer();default:return await S.text()}}catch(S){let O=M=>M?.aborted?S===M.reason?!0:S instanceof Error&&S.cause===M.reason:!1;if(!O(u.signal)){let M=i.signal?.aborted||this.clientSignal?.aborted;if(O(i.signal)||O(this.clientSignal)||M&&Bn(S))throw new lt("Request aborted by external signal",r,e);if(u.signal.aborted&&Bn(S))throw l}throw S}finally{clearTimeout(c),T()}}async get(e,n={}){let r=Kn(e,n.provider),o=this.getProviderState(r);if(o.circuitBreaker&&!o.circuitBreaker.canRequest())throw new ie("Circuit breaker is OPEN, request rejected");let i={fetchImpl:n.fetchImpl,signal:n.signal},a=this.fallbackManager.getCandidateUrls(e,r),u;for(let l=0;l<a.length;l++){let c=a[l],d=l===0?o.policy.retry:{...o.policy.retry,maxRetries:0};try{let T=await this.executeWithRetry(p=>this.performRequest(c,o,r,n.responseType,i,p),d,{provider:r,url:c,timeout:o.policy.timeout,responseType:n.responseType});return o.circuitBreaker?.recordSuccess(),this.fallbackManager.recordSuccess(c),T}catch(T){let p=ve(T,{provider:r,url:c,timeout:o.policy.timeout});u=p;let y=X(p)==="ABORTED";if(y?o.circuitBreaker?.releaseProbe():this.fallbackManager.recordFailure(c,p),l<a.length-1&&this.fallbackManager.shouldFallback(p)){this.safe(()=>this.hooks?.trace?.("fallback",{provider:r,url:c,timeout:o.policy.timeout,attempt:0,responseType:n.responseType}));continue}throw y||o.circuitBreaker?.recordFailure(),this.toSdkError(p)}}throw o.circuitBreaker?.recordFailure(),u?this.toSdkError(u):new ie("Request failed without a concrete error")}async getTencentQuote(e){let n=`${this.baseUrl}/?q=${encodeURIComponent(e)}`,r=await this.get(n,{responseType:"arraybuffer",provider:"tencent"}),o=dt(r);return pt(o)}};var w=(t,e)=>t*60+e,ui={A:{tz:E.CN,open:[[w(9,30),w(11,30)],[w(13,0),w(15,0)]],lunchBreak:[w(11,30),w(13,0)],tradingWeekdays:[1,2,3,4,5]},HK:{tz:E.HK,open:[[w(9,30),w(12,0)],[w(13,0),w(16,0)]],lunchBreak:[w(12,0),w(13,0)],tradingWeekdays:[1,2,3,4,5]},US:{tz:E.US,open:[[w(9,30),w(16,0)]],tradingWeekdays:[1,2,3,4,5]}};function on(t,e){if(t==null)return W(e);if(t instanceof Date)return W(e,t.getTime());let n=t.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(n))return n;if(/^\d{8}$/.test(n))return`${n.slice(0,4)}-${n.slice(4,6)}-${n.slice(6,8)}`;let r=new Date(n);if(!Number.isNaN(r.getTime()))return W(e,r.getTime());throw new h(`Unsupported date input: ${JSON.stringify(t)}. Expected 'YYYY-MM-DD', 'YYYYMMDD', or Date.`)}function li(t,e){let n=new Intl.DateTimeFormat("en-US",{timeZone:e,hour12:!1,weekday:"short",hour:"2-digit",minute:"2-digit"}),r={};for(let l of n.formatToParts(t))l.type!=="literal"&&(r[l.type]=l.value);let o=parseInt(r.hour??"0",10);o===24&&(o=0);let i=parseInt(r.minute??"0",10),u={Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6,Sun:7}[r.weekday??""]??0;return{minutes:o*60+i,weekday:u}}function sn(t,e){let n=0,r=t.length;for(;n<r;){let o=n+r>>>1;t[o]<e?n=o+1:r=o}return n}var Ce=class{constructor(e){this.quoteService=e}async isTradingDay(e){let n=on(e,E.CN),r=await this.quoteService.getTradingCalendar(),o=sn(r,n);return o<r.length&&r[o]===n}async nextTradingDay(e){let n=on(e,E.CN),r=await this.quoteService.getTradingCalendar(),o=sn(r,n);if(o<r.length&&r[o]===n&&(o+=1),o>=r.length)throw new h(`nextTradingDay: ${n} \u4E4B\u540E\u6CA1\u6709\u53EF\u7528\u4EA4\u6613\u65E5 (\u65E5\u5386\u6700\u5927\u65E5\u671F ${r[r.length-1]??"N/A"})`);return r[o]}async prevTradingDay(e){let n=on(e,E.CN),r=await this.quoteService.getTradingCalendar(),i=sn(r,n)-1;if(i<0)throw new h(`prevTradingDay: ${n} \u4E4B\u524D\u6CA1\u6709\u53EF\u7528\u4EA4\u6613\u65E5 (\u65E5\u5386\u6700\u5C0F\u65E5\u671F ${r[0]??"N/A"})`);return r[i]}getMarketStatus(e="A",n=new Date){let r=ui[e],{minutes:o,weekday:i}=li(n,r.tz);if(!r.tradingWeekdays.includes(i))return"closed";let a=r.open[0][0],u=r.open[r.open.length-1][1];if(o<a)return"pre_market";if(o>=u)return"after_hours";for(let[l,c]of r.open)if(o>=l&&o<c)return"open";return r.lunchBreak&&o>=r.lunchBreak[0]&&o<r.lunchBreak[1]?"lunch_break":"closed"}};var I={};st(I,{getAShareCodeList:()=>Gn,getAllHKQuotesByCodes:()=>Xn,getAllQuotesByCodes:()=>Vn,getAllUSQuotesByCodes:()=>Zn,getFullQuotes:()=>Ze,getFundCodeList:()=>Jn,getFundFlow:()=>qn,getFundQuotes:()=>$n,getHKCodeList:()=>Wn,getHKQuotes:()=>Je,getPanelLargeOrder:()=>zn,getSimpleQuotes:()=>Hn,getTodayTimeline:()=>Qn,getTradingCalendar:()=>er,getUSCodeList:()=>Yn,getUSQuotes:()=>et,parseFullQuote:()=>an,parseFundFlow:()=>ln,parseFundQuote:()=>mn,parseHKQuote:()=>dn,parsePanelLargeOrder:()=>cn,parseSimpleQuote:()=>un,parseUSQuote:()=>pn,search:()=>nr});function an(t){let e=[];for(let i=0;i<5;i++)e.push({price:f(t[9+i*2]),volume:f(t[10+i*2])});let n=[];for(let i=0;i<5;i++)n.push({price:f(t[19+i*2]),volume:f(t[20+i*2])});let r=t[30]??"",o=N(r,E.CN);return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:f(t[3]),prevClose:f(t[4]),open:f(t[5]),volume:f(t[6]),outerVolume:f(t[7]),innerVolume:f(t[8]),bid:e,ask:n,time:r,timestamp:o.timestamp,tz:o.tz,change:f(t[31]),changePercent:f(t[32]),high:f(t[33]),low:f(t[34]),volume2:f(t[36]),amount:f(t[37]),turnoverRate:_(t[38]),pe:_(t[39]),amplitude:_(t[43]),circulatingMarketCap:_(t[44]),totalMarketCap:_(t[45]),pb:_(t[46]),limitUp:_(t[47]),limitDown:_(t[48]),volumeRatio:_(t[49]),avgPrice:_(t[51]),peStatic:_(t[52]),peDynamic:_(t[53]),high52w:_(t[67]),low52w:_(t[68]),circulatingShares:_(t[72]),totalShares:_(t[73]),market:"CN",assetType:"stock",source:"tencent"}}function un(t){return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:f(t[3]),change:f(t[4]),changePercent:f(t[5]),volume:f(t[6]),amount:f(t[7]),marketCap:_(t[9]),marketType:t[10]??"",market:"CN",assetType:"stock",source:"tencent"}}function ln(t){let e=t[13]??"",n=N(e,E.CN);return{code:t[0]??"",mainInflow:f(t[1]),mainOutflow:f(t[2]),mainNet:f(t[3]),mainNetRatio:f(t[4]),retailInflow:f(t[5]),retailOutflow:f(t[6]),retailNet:f(t[7]),retailNetRatio:f(t[8]),totalFlow:f(t[9]),name:t[12]??"",date:e,timestamp:n.timestamp,tz:n.tz}}function cn(t){return{buyLargeRatio:f(t[0]),buySmallRatio:f(t[1]),sellLargeRatio:f(t[2]),sellSmallRatio:f(t[3])}}function dn(t){let e=t[30]??"",n=N(e,E.HK);return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:f(t[3]),prevClose:f(t[4]),open:f(t[5]),volume:f(t[6]),time:e,timestamp:n.timestamp,tz:n.tz,change:f(t[31]),changePercent:f(t[32]),high:f(t[33]),low:f(t[34]),amount:f(t[37]),lotSize:_(t[40]),circulatingMarketCap:_(t[44]),totalMarketCap:_(t[45]),currency:t[t.length-3]??"",market:"HK",assetType:"stock",source:"tencent"}}function pn(t){let e=t[30]??"",n=N(e,E.US);return{marketId:t[0]??"",name:t[1]??"",code:t[2]??"",price:f(t[3]),prevClose:f(t[4]),open:f(t[5]),volume:f(t[6]),time:e,timestamp:n.timestamp,tz:n.tz,change:f(t[31]),changePercent:f(t[32]),high:f(t[33]),low:f(t[34]),amount:f(t[37]),turnoverRate:_(t[38]),pe:_(t[39]),amplitude:_(t[43]),totalMarketCap:_(t[45]),pb:_(t[47]),high52w:_(t[48]),low52w:_(t[49]),market:"US",assetType:"stock",source:"tencent"}}function mn(t){let e=t[8]??"",n=N(e,E.CN);return{code:t[0]??"",name:t[1]??"",nav:f(t[5]),accNav:f(t[6]),change:f(t[7]),navDate:e,timestamp:n.timestamp,tz:n.tz,market:"CN",assetType:"fund",source:"tencent"}}async function Ze(t,e){if(!e||e.length===0)return[];let n=await t.getTencentQuote(e.join(",")),r=new Set(e);return n.filter(o=>r.has(o.key)&&o.fields&&o.fields.length>5&&o.fields[0]!=="").map(o=>an(o.fields))}async function Hn(t,e){if(!e||e.length===0)return[];let n=e.map(i=>`s_${i}`),r=await t.getTencentQuote(n.join(",")),o=new Set(n);return r.filter(i=>o.has(i.key)&&i.fields&&i.fields.length>5&&i.fields[0]!=="").map(i=>un(i.fields))}async function qn(t,e){if(!e||e.length===0)return[];let n=e.map(i=>`ff_${i}`),r=await t.getTencentQuote(n.join(",")),o=new Set(n);return r.filter(i=>o.has(i.key)&&i.fields&&i.fields.length>=14&&i.fields[0]!=="").map(i=>ln(i.fields))}async function zn(t,e){if(!e||e.length===0)return[];let n=e.map(i=>`s_pk${i}`),r=await t.getTencentQuote(n.join(",")),o=new Set(n);return r.filter(i=>o.has(i.key)&&i.fields&&i.fields.length>=4&&i.fields[0]!=="").map(i=>cn(i.fields))}async function Je(t,e){if(!e||e.length===0)return[];let n=e.map(i=>`hk${i}`),r=await t.getTencentQuote(n.join(",")),o=new Set(n);return r.filter(i=>o.has(i.key)&&i.fields&&i.fields.length>5&&i.fields[0]!=="").map(i=>dn(i.fields))}async function et(t,e){if(!e||e.length===0)return[];let n=e.map(i=>`us${i}`),r=await t.getTencentQuote(n.join(",")),o=new Set(n);return r.filter(i=>o.has(i.key)&&i.fields&&i.fields.length>5&&i.fields[0]!=="").map(i=>pn(i.fields))}async function $n(t,e){if(!e||e.length===0)return[];let n=e.map(i=>`jj${i}`),r=await t.getTencentQuote(n.join(",")),o=new Set(n);return r.filter(i=>o.has(i.key)&&i.fields&&i.fields.length>=9&&i.fields[0]!=="").map(i=>mn(i.fields))}async function Qn(t,e){let n=`${Et}?code=${encodeURIComponent(e)}`,r=await t.get(n,{responseType:"json",provider:"tencent"});if(r.code!==0)throw new ut(r.msg||"API error","tencent",n);let o=r.data?.[e];if(!o){let p=N("",E.CN);return{code:e,date:"",timestamp:p.timestamp,tz:p.tz,preClose:0,data:[]}}let i=o.data?.data??[],a=o.data?.date??"",u=o.qt?.[e]??[],l=parseFloat(u[4]??"")||0,c=!1;for(let p of i){let y=p.split(" "),R=parseFloat(y[1])||0,P=parseInt(y[2],10)||0,S=parseFloat(y[3])||0;if(P>0&&R>0){S/P>R*50&&(c=!0);break}}let d=i.map(p=>{let y=p.split(" "),R=y[0],P=`${R.slice(0,2)}:${R.slice(2,4)}`,S=parseInt(y[2],10)||0,O=parseFloat(y[3])||0,M=c?S*100:S,B=M>0?O/M:0,U=yt(a,P,E.CN);return{time:P,timestamp:U.timestamp,tz:U.tz,price:parseFloat(y[1])||0,volume:M,amount:O,avgPrice:Math.round(B*100)/100}}),T=N(a,E.CN);return{code:e,date:a,timestamp:T.timestamp,tz:T.tz,preClose:l,data:d}}var jn=te("tencent:code-lists",{defaultTTL:360*60*1e3,maxSize:16});async function gn(t,e,n){return jn.getOrFetch(e,async()=>{let r=await t.get(n,{responseType:"json"}),o=r?.list;if(r?.success===!1||!Array.isArray(o)||o.length===0)throw new V(`\u4EE3\u7801\u5217\u8868\u63A5\u53E3\u8FD4\u56DE\u7A7A\u6570\u636E: ${e}`,"tencent",n);return o})}function ci(t,e){let n=t.replace(/^(sh|sz|bj)/,"");switch(e){case"sh":return n.startsWith("6");case"sz":return n.startsWith("0")||n.startsWith("3");case"bj":return n.startsWith("4")||n.startsWith("8")||n.startsWith("92");case"kc":return n.startsWith("688");case"cy":return n.startsWith("30");default:return!0}}async function Gn(t,e){let n=e?.simple??!1,r=e?.market,i=await gn(t,"a-share:full",Rt);return r&&(i=i.filter(a=>ci(a,r))),n?i.map(a=>a.replace(/^(sh|sz|bj)/,"")):i.slice()}async function Yn(t,e){let n=e?.simple??!1,r=e?.market,i=(await gn(t,"us:full",_t)).slice();if(r){let a=`${On[r]}.`;i=i.filter(u=>u.startsWith(a))}return n?i.map(a=>a.replace(/^\d{3}\./,"")):i}async function Wn(t){return(await gn(t,"hk:full",Ct)).slice()}async function Vn(t,e,n={}){let{batchSize:r=Se,concurrency:o=Re,onProgress:i}=n;Q(r,"batchSize"),Q(o,"concurrency");let a=Math.min(r,Ee),u=se(e,a),l=u.length,c=0,d=u.map(p=>async()=>{let y=await Ze(t,p);return c++,i&&i(c,l),y});return(await ae(d,o,!0)).flat()}async function Xn(t,e,n={}){let{batchSize:r=Se,concurrency:o=Re,onProgress:i}=n;Q(r,"batchSize"),Q(o,"concurrency");let a=Math.min(r,Ee),u=se(e,a),l=u.length,c=0,d=u.map(p=>async()=>{let y=await Je(t,p);return c++,i&&i(c,l),y});return(await ae(d,o,!0)).flat()}async function Zn(t,e,n={}){let{batchSize:r=Se,concurrency:o=Re,onProgress:i}=n;Q(r,"batchSize"),Q(o,"concurrency");let a=Math.min(r,Ee),u=se(e,a),l=u.length,c=0,d=u.map(p=>async()=>{let y=await et(t,p);return c++,i&&i(c,l),y});return(await ae(d,o,!0)).flat()}async function Jn(t){return(await jn.getOrFetch("fund:full",async()=>{let o=(await t.get(qe,{responseType:"text"})??"").split(",").slice(1).filter(i=>i.trim());if(o.length===0)throw new V("\u57FA\u91D1\u4EE3\u7801\u5217\u8868\u63A5\u53E3\u8FD4\u56DE\u7A7A\u6570\u636E","tencent",qe);return o})).slice()}var di=te("tencent:trade-calendar",{defaultTTL:720*60*1e3,maxSize:4});async function er(t){return(await di.getOrFetch("a-share",async()=>{let r=(await t.get(At)??"").trim().split(",").map(o=>o.trim()).filter(o=>o.length>0);if(r.length===0)throw new V("\u4EA4\u6613\u65E5\u5386\u63A5\u53E3\u8FD4\u56DE\u7A7A\u6570\u636E","tencent",At);return r})).slice()}var tr="https://smartbox.gtimg.cn/s3/";function pi(t){return t.replace(/\\u([0-9a-fA-F]{4})/g,(e,n)=>String.fromCharCode(parseInt(n,16)))}function mi(t){let e=t.toUpperCase();return e.startsWith("QDII")||e.startsWith("ETF")||e.startsWith("LOF")||e.startsWith("KJ")||e.startsWith("JJ")||e.includes("FUND")?"fund":e.startsWith("GP")||e.includes("STOCK")?"stock":e==="ZS"||e.includes("INDEX")?"index":e.startsWith("ZQ")||e.includes("BOND")?"bond":e.startsWith("QH")||e.includes("FUTURE")?"futures":e.startsWith("QZ")||e.includes("OPTION")?"option":"other"}function gi(t){return!t||t==="N"?[]:t.split("^").filter(Boolean).map(n=>{let r=n.split("~"),o=r[0]||"",i=r[1]||"",a=pi(r[2]||""),u=r[4]||"";return{code:o+i,name:a,market:o,type:u,category:mi(u)}})}function fi(t){return new Promise((e,n)=>{let r=`${tr}?v=2&t=all&q=${encodeURIComponent(t)}`;window.v_hint="";let o=document.createElement("script");o.src=r,o.charset="utf-8",o.onload=()=>{let i=window.v_hint||"";document.body.removeChild(o),e(i)},o.onerror=()=>{document.body.removeChild(o),n(new C({code:"NETWORK_ERROR",message:"Network error calling Smartbox",url:r}))},document.body.appendChild(o)})}async function Ti(t,e){let n=`${tr}?v=2&t=all&q=${encodeURIComponent(e)}`,o=(await t.get(n)).match(/v_hint="([^"]*)"/);return o?o[1]:""}function yi(){return typeof window<"u"&&typeof document<"u"}async function nr(t,e){if(!e||!e.trim())return[];let n;return yi()?n=await fi(e):n=await Ti(t,e),gi(n)}var g={};st(g,{extractVariety:()=>Sn,fetchDatacenter:()=>Tn,fetchDatacenterList:()=>A,getBlockTradeDailyStat:()=>So,getBlockTradeDetail:()=>ho,getBlockTradeMarketStat:()=>yo,getBoardChanges:()=>uo,getCFFEXOptionQuotes:()=>Kr,getComexInventory:()=>$r,getConceptConstituents:()=>Or,getConceptKline:()=>Pr,getConceptList:()=>Cr,getConceptMinuteKline:()=>Dr,getConceptSpot:()=>Ar,getDividendDetail:()=>Ir,getDragonTigerBranchRank:()=>go,getDragonTigerDetail:()=>co,getDragonTigerInstitution:()=>mo,getDragonTigerStockSeatDetail:()=>fo,getDragonTigerStockStats:()=>po,getFundDividendList:()=>Mr,getFundEstimate:()=>Lr,getFundFlowRank:()=>Xr,getFundNavHistory:()=>kr,getFundRankHistory:()=>Fr,getFuturesHistoryKline:()=>Ur,getFuturesInventory:()=>zr,getFuturesInventorySymbols:()=>qr,getFuturesMarketCode:()=>En,getGlobalFuturesKline:()=>vr,getGlobalFuturesSpot:()=>xr,getHKHistoryKline:()=>ar,getHKMinuteKline:()=>ur,getHistoryKline:()=>ir,getIndividualFundFlow:()=>Wr,getIndustryConstituents:()=>Er,getIndustryKline:()=>Rr,getIndustryList:()=>hr,getIndustryMinuteKline:()=>_r,getIndustrySpot:()=>Sr,getMarginAccountInfo:()=>Eo,getMarginTargetList:()=>Ro,getMarketFundFlow:()=>Vr,getMinuteKline:()=>sr,getNorthboundFlowSummary:()=>no,getNorthboundHistory:()=>oo,getNorthboundHoldingRank:()=>ro,getNorthboundIndividual:()=>io,getNorthboundMinute:()=>to,getOptionLHB:()=>Br,getSectorFundFlowHistory:()=>Jr,getSectorFundFlowRank:()=>Zr,getStockChanges:()=>ao,getUSHistoryKline:()=>lr,getUSMinuteKline:()=>cr,getZTPool:()=>so});function b(t){return/^\d{8}$/.test(t)?`${t.slice(0,4)}-${t.slice(4,6)}-${t.slice(6,8)}`:t}function rr(t,e){let n=i=>b(i.replace("T"," ").trim()).slice(0,16),r=n(t),o=n(e);return o.length===10&&(o+=" 23:59"),{start:r,end:o}}function or(t,e,n=0){let r=a=>{if(!a)return;let u=/^(\d{4})-?(\d{2})-?(\d{2})/.exec(a.trim());return u?`${u[1]}${u[2]}${u[3]}`:void 0},o=r(t)??"0",i=r(e);return i!==void 0&&n>0&&(i=pe(`${i.slice(0,4)}-${i.slice(4,6)}-${i.slice(6,8)}`,n).replace(/-/g,"")),{beg:o,end:i??"20500000"}}async function fn(t,e,n,r,o=100,i){let a=[],u=1,l=0;do{let c=new URLSearchParams({...n,pn:String(u),pz:String(o),fields:r}),d=`${e}?${c.toString()}`,p=(await t.get(d,{responseType:"json"}))?.data;if(!p||!Array.isArray(p.diff))break;u===1&&(l=p.total??0);let y=p.diff.map((R,P)=>i(R,a.length+P+1));if(a.push(...y),y.length===0)break;u++}while(a.length<l);return a}function x(t){let[e,n,r,o,i,a,u,l,c,d,T]=t.split(",");return{date:e,open:m(n),close:m(r),high:m(o),low:m(i),volume:m(a),amount:m(u),amplitude:m(l),changePercent:m(c),change:m(d),turnoverRate:m(T)}}async function v(t,e,n){let r=`${e}?${n.toString()}`,o=await t.get(r,{responseType:"json"});return{klines:o?.data?.klines||[],name:o?.data?.name,code:o?.data?.code}}function hi(t){let[e,n,r,o,i,a,u,l]=t.split(",");return{time:e,open:m(n),close:m(r),high:m(o),low:m(i),volume:m(a),amount:m(u),avgPrice:m(l)}}function tt(t,e){let n=r=>{let o=He(r,E.CN);return{time:ht(o,t)||r,timestamp:de(o)}};return{mapTrendRow:({time:r,...o},i)=>({...n(r),tz:t,...o,currency:e,code:i.code}),mapKlineRow:({date:r,...o},i)=>({...n(r),tz:t,...o,currency:e,code:i.code})}}function ee(t){return async function(n,r,o={}){let i=o.period??t.defaultPeriod;gt(i),t.fqt==="option"&&G(o.adjust??"qfq");let a=t.resolveTarget(r),u=t.window,l=p=>{if(u.mode==="full")return p;let{start:y,end:R}=rr(o.startDate??"1979-09-01 09:32:00",o.endDate??"2222-01-01 09:32:00");return p.filter(P=>P.time>=y&&P.time<=R)};if(i==="1"){let p=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13",fields2:"f51,f52,f53,f54,f55,f56,f57,f58",...t.includeUt?{ut:k}:{},ndays:t.ndays==="option"?String(o.ndays??1):t.ndays.fixed,iscr:"0",secid:a.secid}),y=`${t.trendsUrl}?${p.toString()}`,P=(await n.get(y,{responseType:"json"}))?.data?.trends;return!Array.isArray(P)||P.length===0?[]:l(P.map(S=>t.mapTrendRow(hi(S),a)))}let c=u.mode==="filter"?or(o.startDate,o.endDate,u.endExtraDays??0):{beg:u.beg,end:u.end},d=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",...t.includeUt?{ut:k}:{},klt:i,fqt:t.fqt==="option"?Y(o.adjust??"qfq"):t.fqt.fixed,secid:a.secid,beg:c.beg,end:c.end,...t.extraKlineParams??{}}),{klines:T}=await v(n,t.klineUrl,d);return!Array.isArray(T)||T.length===0?[]:l(T.map(p=>t.mapKlineRow(x(p),a)))}}async function ir(t,e,n={}){let{period:r="daily",adjust:o="qfq",startDate:i="19700101",endDate:a="20500101"}=n;H(r),G(o);let u=Z(e,{market:"CN"}),l=J(u),c=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f116",ut:k,klt:q(r),fqt:Y(o),secid:l,beg:i,end:a}),d=ze,{klines:T}=await v(t,d,c);return T.length===0?[]:T.map(p=>{let y=x(p),R=N(y.date,E.CN);return{...y,timestamp:R.timestamp,tz:R.tz,code:u.code}})}var Si=ee({trendsUrl:Ot,klineUrl:ze,resolveTarget:t=>{let e=Z(t,{market:"CN"});return{secid:J(e),code:e.code}},defaultPeriod:"1",ndays:{fixed:"5"},fqt:"option",includeUt:!0,window:{mode:"filter"},mapTrendRow:({time:t,...e})=>{let n=N(t,E.CN);return{time:t,timestamp:n.timestamp,tz:n.tz,...e}},mapKlineRow:t=>{let e=N(t.date,E.CN);return{...t,time:t.date,timestamp:e.timestamp,tz:e.tz}}});async function sr(t,e,n={}){return Si(t,e,n)}function nt(t){return async function(n,r,o={}){let{period:i="daily",adjust:a="qfq",startDate:u="19700101",endDate:l="20500101"}=o;H(i),G(a);let c=t.normalizeSymbol(r),d=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",ut:k,klt:q(i),fqt:Y(a),secid:c.secid,beg:u,end:l,lmt:"1000000"}),{klines:T,name:p,code:y}=await v(n,t.url,d);if(T.length===0)return[];let R=t.resolveResultMeta?t.resolveResultMeta(r,c,{code:y,name:p}):{code:y||c.fallbackCode,name:p||""};return T.map(P=>{let S=x(P),O=N(S.date,t.tz),M={...S,timestamp:O.timestamp,tz:O.tz,code:R.code,name:R.name};return t.enrichItem(M)})}}var Ei=nt({url:$e,tz:E.HK,normalizeSymbol:t=>{let e=Z(t,{market:"HK"});return{secid:J(e),fallbackCode:e.code}},enrichItem:t=>({...t,currency:"HKD",lotSize:null})});async function ar(t,e,n={}){return Ei(t,e,n)}var Ri=ee({trendsUrl:Pt,klineUrl:$e,resolveTarget:t=>{let e=Z(t,{market:"HK"});return{secid:J(e),code:e.code}},defaultPeriod:"1",ndays:"option",fqt:"option",includeUt:!0,window:{mode:"filter"},...tt(E.HK,"HKD")});async function ur(t,e,n={}){return Ri(t,e,n)}var _i=nt({url:Qe,tz:E.US,normalizeSymbol:t=>({secid:t,fallbackCode:t.split(".")[1]||t}),resolveResultMeta:(t,e,n)=>({code:n.code||e.fallbackCode,name:n.name||""}),enrichItem:t=>({...t,currency:"USD"})});async function lr(t,e,n={}){return _i(t,e,n)}var Ci=ee({trendsUrl:Dt,klineUrl:Qe,resolveTarget:t=>({secid:t,code:t.split(".")[1]||t}),defaultPeriod:"1",ndays:"option",fqt:"option",includeUt:!0,window:{mode:"filter",endExtraDays:1},...tt(E.US,"USD")});async function cr(t,e,n={}){return Ci(t,e,n)}function pr(t){let e=te(`eastmoney:board-code-map:${t.type}`,{defaultTTL:36e5,maxSize:4});return{async getCode(n,r,o){if(r.startsWith("BK"))return r;let a=(await e.getOrFetch("name-code-map",async()=>{let u=await o(n);if(u.length===0)throw new V(`${t.errorPrefix}: \u677F\u5757\u5217\u8868\u63A5\u53E3\u8FD4\u56DE\u7A7A\u6570\u636E`,"eastmoney");return Object.fromEntries(u.map(l=>[l.name,l.code]))}))[r];if(!a)throw new at(`${t.errorPrefix}: ${r}`,"eastmoney");return a}}}async function mr(t,e){let n={po:"1",np:"1",ut:"bd1d9ddb04089700cf9c27f6f7426281",fltt:"2",invt:"2",fid:e.type==="concept"?"f12":"f3",fs:e.fsFilter},r=e.type==="concept"?"f2,f3,f4,f8,f12,f14,f15,f16,f17,f18,f20,f21,f24,f25,f22,f33,f11,f62,f128,f124,f107,f104,f105,f136":"f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f26,f22,f33,f11,f62,f128,f136,f115,f152,f124,f107,f104,f105,f140,f141,f207,f208,f209,f222",o=await fn(t,e.listUrl,n,r,100,(i,a)=>({rank:a,name:String(i.f14??""),code:String(i.f12??""),price:s(i.f2),change:s(i.f4),changePercent:s(i.f3),totalMarketCap:s(i.f20),turnoverRate:s(i.f8),riseCount:s(i.f104),fallCount:s(i.f105),leadingStock:i.f128?String(i.f128):null,leadingStockChangePercent:s(i.f136)}));return o.sort((i,a)=>(a.changePercent??0)-(i.changePercent??0)),o.forEach((i,a)=>{i.rank=a+1}),o}async function gr(t,e,n){let r=new URLSearchParams({fields:"f43,f44,f45,f46,f47,f48,f170,f171,f168,f169",mpi:"1000",invt:"2",fltt:"1",secid:`90.${e}`}),o=`${n}?${r.toString()}`,a=(await t.get(o,{responseType:"json"}))?.data;return a?[{key:"f43",name:"\u6700\u65B0",divide:!0},{key:"f44",name:"\u6700\u9AD8",divide:!0},{key:"f45",name:"\u6700\u4F4E",divide:!0},{key:"f46",name:"\u5F00\u76D8",divide:!0},{key:"f47",name:"\u6210\u4EA4\u91CF",divide:!1},{key:"f48",name:"\u6210\u4EA4\u989D",divide:!1},{key:"f170",name:"\u6DA8\u8DCC\u5E45",divide:!0},{key:"f171",name:"\u632F\u5E45",divide:!0},{key:"f168",name:"\u6362\u624B\u7387",divide:!0},{key:"f169",name:"\u6DA8\u8DCC\u989D",divide:!0}].map(({key:l,name:c,divide:d})=>{let T=a[l],p=null;return typeof T=="number"&&!isNaN(T)&&(p=d?T/100:T),{item:c,value:p}}):[]}async function fr(t,e,n){let r={po:"1",np:"1",ut:"bd1d9ddb04089700cf9c27f6f7426281",fltt:"2",invt:"2",fid:"f3",fs:`b:${e} f:!50`};return fn(t,n,r,"f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152,f45",100,(i,a)=>({rank:a,code:String(i.f12??""),name:String(i.f14??""),price:s(i.f2),changePercent:s(i.f3),change:s(i.f4),volume:s(i.f5),amount:s(i.f6),amplitude:s(i.f7),high:s(i.f15),low:s(i.f16),open:s(i.f17),prevClose:s(i.f18),turnoverRate:s(i.f8),pe:s(i.f9),pb:s(i.f23)}))}async function Tr(t,e,n,r={}){let{period:o="daily",adjust:i="",startDate:a="19700101",endDate:u="20500101"}=r;H(o),G(i);let l=new URLSearchParams({secid:`90.${e}`,fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61",klt:q(o),fqt:Y(i),beg:a,end:u,smplmt:"10000",lmt:"1000000"}),{klines:c}=await v(t,n,l);return c.length===0?[]:c.map(d=>x(d))}var dr=new Map;async function yr(t,e,n,r,o={}){let i=`${n}|${r}`,a=dr.get(i);return a||(a=ee({trendsUrl:r,klineUrl:n,resolveTarget:u=>({secid:`90.${u}`,code:u}),defaultPeriod:"5",ndays:{fixed:"1"},fqt:{fixed:"1"},includeUt:!1,window:{mode:"full",beg:"0",end:"20500101"},extraKlineParams:{smplmt:"10000",lmt:"1000000"},mapTrendRow:({avgPrice:u,...l})=>({...l,price:u}),mapKlineRow:u=>({time:u.date,open:u.open,close:u.close,high:u.high,low:u.low,changePercent:u.changePercent,change:u.change,volume:u.volume,amount:u.amount,amplitude:u.amplitude,turnoverRate:u.turnoverRate})}),dr.set(i,a)),a(t,e,o)}function rt(t){let e=pr(t);async function n(o){return mr(o,t)}async function r(o,i){return e.getCode(o,i,n)}return{async getList(o){return n(o)},async getSpot(o,i){let a=await r(o,i);return gr(o,a,t.spotUrl)},async getConstituents(o,i){let a=await r(o,i);return fr(o,a,t.consUrl)},async getKline(o,i,a={}){let u=await r(o,i);return Tr(o,u,t.klineUrl,a)},async getMinuteKline(o,i,a={}){let u=await r(o,i);return yr(o,u,t.klineUrl,t.trendsUrl,a)}}}var Ai={type:"industry",fsFilter:"m:90 t:2 f:!50",listUrl:It,spotUrl:bt,consUrl:Mt,klineUrl:Nt,trendsUrl:kt,errorPrefix:"\u672A\u627E\u5230\u884C\u4E1A\u677F\u5757"},Ae=rt(Ai);async function hr(t){return Ae.getList(t)}async function Sr(t,e){return Ae.getSpot(t,e)}async function Er(t,e){return Ae.getConstituents(t,e)}async function Rr(t,e,n={}){return Ae.getKline(t,e,n)}async function _r(t,e,n={}){return Ae.getMinuteKline(t,e,n)}var Oi={type:"concept",fsFilter:"m:90 t:3 f:!50",listUrl:Lt,spotUrl:Ft,consUrl:wt,klineUrl:Ut,trendsUrl:xt,errorPrefix:"\u672A\u627E\u5230\u6982\u5FF5\u677F\u5757"},Oe=rt(Oi);async function Cr(t){return Oe.getList(t)}async function Ar(t,e){return Oe.getSpot(t,e)}async function Or(t,e){return Oe.getConstituents(t,e)}async function Pr(t,e,n={}){return Oe.getKline(t,e,n)}async function Dr(t,e,n={}){return Oe.getMinuteKline(t,e,n)}async function Tn(t,e,n){let{reportName:r,columns:o="ALL",filter:i,sortColumns:a,sortTypes:u,pageSize:l=500,startPage:c=1,fetchAllPages:d=!0,maxPages:T=1e3,quoteColumns:p,quoteType:y,extraParams:R}=e,P=[],S=c,O=1,M=0,B=0;do{let U=new URLSearchParams({reportName:r,columns:o,pageSize:String(l),pageNumber:String(S),source:"WEB",client:"WEB"});if(i&&U.set("filter",i),a&&U.set("sortColumns",a),u&&U.set("sortTypes",u),p&&U.set("quoteColumns",p),y&&U.set("quoteType",y),R)for(let[ot,it]of Object.entries(R))U.set(ot,it);let ko=`${vt}?${U.toString()}`,re=(await t.get(ko,{responseType:"json"}))?.result;if(!re||!Array.isArray(re.data))break;S===c&&(O=re.pages??1,M=re.count??re.data.length);let Lo=re.data.map((ot,it)=>n(ot,P.length+it));if(P.push(...Lo),S++,B++,!d)break}while(S<=O&&B<T);return d&&B>=T&&S<=O&&console.warn(`[stock-sdk] fetchDatacenter("${r}") truncated at maxPages=${T} (server reports ${O} pages). Pass a larger \`maxPages\` to fetch the full dataset.`),{data:P,total:M,pages:O}}async function A(t,e,n){return(await Tn(t,e,n)).data}function L(t){if(t==null)return"";let e=String(t),n=e.match(/^(\d{4}-\d{2}-\d{2})/);return n?n[1]:e}function ne(t){if(!t)return null;let e=t.match(/^(\d{4}-\d{2}-\d{2})/);return e?e[1]:null}function Pi(t){return{code:t.SECURITY_CODE??"",name:t.SECURITY_NAME_ABBR??"",reportDate:ne(t.REPORT_DATE),planNoticeDate:ne(t.PLAN_NOTICE_DATE),disclosureDate:ne(t.PUBLISH_DATE??t.PLAN_NOTICE_DATE),assignTransferRatio:t.BONUS_IT_RATIO??null,bonusRatio:t.BONUS_RATIO??null,transferRatio:t.IT_RATIO??null,dividendPretax:t.PRETAX_BONUS_RMB??null,dividendDesc:t.IMPL_PLAN_PROFILE??null,dividendYield:t.DIVIDENT_RATIO??null,eps:t.BASIC_EPS??null,bps:t.BVPS??null,capitalReserve:t.PER_CAPITAL_RESERVE??null,unassignedProfit:t.PER_UNASSIGN_PROFIT??null,netProfitYoy:t.PNP_YOY_RATIO??null,totalShares:t.TOTAL_SHARES??null,equityRecordDate:ne(t.EQUITY_RECORD_DATE),exDividendDate:ne(t.EX_DIVIDEND_DATE),payDate:ne(t.PAY_DATE),assignProgress:t.ASSIGN_PROGRESS??null,noticeDate:ne(t.NOTICE_DATE)}}async function Ir(t,e){let n=e.replace(/^(sh|sz|bj)/,"");return A(t,{reportName:"RPT_SHAREBONUS_DET",sortColumns:"REPORT_DATE",sortTypes:"-1",pageSize:500,filter:`(SECURITY_CODE="${n}")`},r=>Pi(r))}var Di="https://fund.eastmoney.com/Data/funddataIndex_Interface.aspx",br="https://fund.eastmoney.com/pingzhongdata",Ii="https://fundgz.1234567.com.cn/js";function bi(){return typeof document<"u"&&typeof window<"u"}var Mi=1e4;function Ni(){return Number(W(E.CN).slice(0,4))}function ki(t,e){let n=new URLSearchParams({dt:"8",page:String(e),rank:t.rank??"FSRQ",sort:t.sort??"desc",gs:"",ftype:t.fundType??"",year:String(t.year??Ni())});return`${Di}?${n.toString()}`}function yn(t){if(!t)return null;let e=t.trim().match(/^(\d{4}-\d{2}-\d{2})/);return e?e[1]:null}function Li(t){return{code:t[0]??"",name:t[1]??"",equityRecordDate:yn(t[2]),exDividendDate:yn(t[3]),dividendPerShare:j(t[4]),payDate:yn(t[5]),dividendType:t[6]?.trim()?t[6].trim():null}}async function hn(t,e,n){let r=ki(e,n),o=await le(r,["pageinfo","jjfh_data"],{client:t}),i=o.pageinfo??[0,0,n],[a=0,u=0,l=n]=i;return{items:(o.jjfh_data??[]).map(Li),totalPages:a,pageSize:u,currentPage:l}}async function Mr(t,e={}){if(e.page==="all"){let o=await hn(t,e,1),i=o.items;for(let a=2;a<=o.totalPages;a++){let u=await hn(t,e,a);i=i.concat(u.items)}return e.code&&(i=i.filter(a=>a.code===e.code)),{items:i,totalPages:o.totalPages,pageSize:o.pageSize,currentPage:-1}}let n=e.page??1,r=await hn(t,e,n);return e.code?{...r,items:r.items.filter(o=>o.code===e.code)}:r}function Nr(t){return new Date(t).toISOString().slice(0,10)}async function kr(t,e){let n=`${br}/${encodeURIComponent(e)}.js`,r=await le(n,["fS_code","fS_name","Data_netWorthTrend","Data_ACWorthTrend"],{client:t}),o=r.Data_netWorthTrend??[],i=new Map;for(let u of r.Data_ACWorthTrend??[])Array.isArray(u)&&u.length>=2&&i.set(u[0],u[1]);let a=o.map(u=>({date:Nr(u.x),timestamp:u.x,nav:u.y,accNav:i.has(u.x)?i.get(u.x):null,dailyReturn:j(u.equityReturn),unitMoney:u.unitMoney??""}));return{code:r.fS_code??e,name:r.fS_name??null,items:a}}function Fi(t,e,n=Mi){let r=`${Ii}/${encodeURIComponent(e)}.js?rt=${Date.now()}`;return bi()?ue("fundgz:jsonpgz",()=>wi(r,n)):Ui(t,r)}function wi(t,e){return new Promise((n,r)=>{let o=document.createElement("script"),i=window,a=i.jsonpgz,u=!1,l=()=>{if(o.parentNode&&o.parentNode.removeChild(o),a===void 0)try{delete i.jsonpgz}catch{}else i.jsonpgz=a},c=setTimeout(()=>{u||(u=!0,l(),r(new C({code:"TIMEOUT",message:`fundgz JSONP timed out after ${e}ms: ${t}`,url:t,details:{timeout:e}})))},e);i.jsonpgz=d=>{u||(u=!0,clearTimeout(c),l(),n(d??{}))},o.onerror=()=>{u||(u=!0,clearTimeout(c),l(),r(new C({code:"NETWORK_ERROR",message:`fundgz JSONP script load failed: ${t}`,url:t})))},o.src=t,document.head.appendChild(o)})}async function Ui(t,e){let r=(await t.get(e,{responseType:"text",provider:"eastmoney"})).trim();if(!r)return{};try{return Be(r)}catch{return{}}}async function Lr(t,e){let n=await Fi(t,e);return{code:n.fundcode??e,name:n.name??null,navDate:n.jzrq?.trim()?n.jzrq.trim():null,nav:j(n.dwjz),estimatedNav:j(n.gsz),estimatedChangePercent:j(n.gszzl),estimateTime:n.gztime?.trim()?n.gztime.trim():null}}async function Fr(t,e){let n=`${br}/${encodeURIComponent(e)}.js`,r=await le(n,["fS_code","fS_name","Data_rateInSimilarType","Data_rateInSimilarPersent"],{client:t}),o=r.Data_rateInSimilarType??[],i=new Map;for(let u of r.Data_rateInSimilarPersent??[])Array.isArray(u)&&u.length>=2&&i.set(u[0],u[1]);let a=o.map(u=>({date:Nr(u.x),timestamp:u.x,rank:j(u.y),total:j(u.sc),percentile:i.has(u.x)?i.get(u.x):null}));return{code:r.fS_code??e,name:r.fS_name??null,items:a}}function Sn(t){let e=t.match(/^([a-zA-Z]+)/);if(!e)throw new h(`Invalid futures symbol: "${t}". Expected format: variety + contract (e.g., rb2605, RBM, IF2604)`);return e[1]}function wr(t){return oe[t]??oe[t.toLowerCase()]??oe[t.toUpperCase()]}function En(t){let e=wr(t);if(!e&&t.length>1&&t.endsWith("M")&&(e=wr(t.slice(0,-1))),!e){let r=Object.keys(oe).join(", ");throw new h(`Unknown futures variety: "${t}". Supported varieties: ${r}`)}let n=qt[e];if(n===void 0)throw new h(`No market code found for exchange: ${e}`);return n}function xi(t){let e=x(t),n=t.split(",");return{...e,openInterest:n.length>12?m(n[12]):null}}async function Ur(t,e,n={}){let{period:r="daily",startDate:o="19700101",endDate:i="20500101"}=n;H(r);let a=Sn(e),l=`${En(a)}.${e}`,c=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64",ut:k,klt:q(r),fqt:"0",secid:l,beg:o,end:i}),{klines:d,name:T,code:p}=await v(t,fe,c);return d.length===0?[]:d.map(y=>({...xi(y),code:p||e,name:T||""}))}async function xr(t,e={}){let n=e.pageSize??20,r=[],o=0,i=0,a=1e3;do{let u=new URLSearchParams({orderBy:"dm",sort:"desc",pageSize:String(n),pageIndex:String(o),token:Te,field:"dm,sc,name,p,zsjd,zde,zdf,f152,o,h,l,zjsj,vol,wp,np,ccl",blockName:"callback"}),l=`${Ht}?${u.toString()}`,c=await t.get(l,{responseType:"json"});if(!c||!Array.isArray(c.list))break;o===0&&(i=c.total??0);let d=c.list.map(vi);if(r.push(...d),d.length===0)break;o++}while(r.length<i&&o<a);return r}function vi(t){return{code:t.dm||"",name:t.name||"",price:m(String(t.p)),change:m(String(t.zde)),changePercent:m(String(t.zdf)),open:m(String(t.o)),high:m(String(t.h)),low:m(String(t.l)),prevSettle:m(String(t.zjsj)),volume:m(String(t.vol)),buyVolume:m(String(t.wp)),sellVolume:m(String(t.np)),openInterest:m(String(t.ccl))}}function Ki(t){let e=x(t),n=t.split(",");return{...e,openInterest:n.length>12?m(n[12]):null}}function Bi(t){let e=t.match(/^([A-Z]+)/);if(!e)throw new h(`Invalid global futures symbol: "${t}". Expected format like HG00Y, CL2507`);return e[1]}async function vr(t,e,n={}){let{period:r="daily",startDate:o="19700101",endDate:i="20500101"}=n;H(r);let a=n.marketCode;if(a===void 0){let p=Bi(e);if(a=je[p],a===void 0){let y=Object.keys(je).join(", ");throw new h(`Unknown global futures variety: "${p}". Supported: ${y}. Or specify marketCode manually via options.`)}}let u=`${a}.${e}`,l=new URLSearchParams({fields1:"f1,f2,f3,f4,f5,f6",fields2:"f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64",ut:k,klt:q(r),fqt:"0",secid:u,beg:o,end:i}),{klines:c,name:d,code:T}=await v(t,fe,l);return c.length===0?[]:c.map(p=>({...Ki(p),code:T||e,name:d||""}))}async function Kr(t,e={}){let{pageSize:n=2e4}=e,r=new URLSearchParams({orderBy:"zdf",sort:"desc",pageSize:String(n),pageIndex:"0",token:Te,field:"dm,sc,name,p,zsjd,zde,zdf,f152,vol,cje,ccl,xqj,syr,rz,zjsj,o"}),o=`${Gt}?${r.toString()}`,a=(await t.get(o,{responseType:"json"}))?.list;return Array.isArray(a)?a.map(u=>({code:String(u.dm??""),name:String(u.name??""),price:s(u.p),change:s(u.zde),changePercent:s(u.zdf),volume:s(u.vol),amount:s(u.cje),openInterest:s(u.ccl),strikePrice:s(u.xqj),remainDays:s(u.syr),dailyChange:s(u.rz),prevSettle:s(u.zjsj),open:s(u.o)})):[]}async function Br(t,e,n){let r=new URLSearchParams({type:"RPT_IF_BILLBOARD_TD",sty:"ALL",p:"1",ps:"200",source:"IFBILLBOARD",client:"WEB",ut:z,filter:`(SECURITY_CODE="${e}")(TRADE_DATE='${n}')`}),o=`${Yt}?${r.toString()}`,a=(await t.get(o,{responseType:"json"}))?.result?.data;if(!Array.isArray(a))return[];function u(l){if(!l)return"";let c=String(l),d=c.match(/^(\d{4}-\d{2}-\d{2})/);return d?d[1]:c}return a.map(l=>({tradeType:String(l.TRADE_TYPE??""),date:u(l.TRADE_DATE),symbol:String(l.SECURITY_CODE??""),targetName:String(l.TARGET_NAME??""),memberName:String(l.MEMBER_NAME_ABBR??""),rank:s(l.MEMBER_RANK)??0,sellVolume:s(l.SELL_VOLUME),sellVolumeChange:s(l.SELL_VOLUME_CHANGE),netSellVolume:s(l.NET_SELL_VOLUME),sellVolumeRatio:s(l.SELL_VOLUME_RATIO),buyVolume:s(l.BUY_VOLUME),buyVolumeChange:s(l.BUY_VOLUME_CHANGE),netBuyVolume:s(l.NET_BUY_VOLUME),buyVolumeRatio:s(l.BUY_VOLUME_RATIO),sellPosition:s(l.SELL_POSITION),sellPositionChange:s(l.SELL_POSITION_CHANGE),netSellPosition:s(l.NET_SELL_POSITION),sellPositionRatio:s(l.SELL_POSITION_RATIO),buyPosition:s(l.BUY_POSITION),buyPositionChange:s(l.BUY_POSITION_CHANGE),netBuyPosition:s(l.NET_BUY_POSITION),buyPositionRatio:s(l.BUY_POSITION_RATIO)}))}var Hi={gold:"EMI00069026",silver:"EMI00069027"};function Hr(t){if(!t)return"";let e=String(t),n=e.match(/^(\d{4}-\d{2}-\d{2})/);return n?n[1]:e}async function qr(t){return A(t,{reportName:"RPT_FUTU_POSITIONCODE",columns:"TRADE_MARKET_CODE,TRADE_CODE,TRADE_TYPE",filter:'(IS_MAINCODE="1")',pageSize:500,fetchAllPages:!1},e=>({code:String(e.TRADE_CODE??""),name:String(e.TRADE_TYPE??""),marketCode:String(e.TRADE_MARKET_CODE??"")}))}async function zr(t,e,n={}){let{startDate:r="2020-10-28",pageSize:o=500}=n,i=e.toUpperCase();return A(t,{reportName:"RPT_FUTU_STOCKDATA",columns:"SECURITY_CODE,TRADE_DATE,ON_WARRANT_NUM,ADDCHANGE",filter:`(SECURITY_CODE="${i}")(TRADE_DATE>='${b(r)}')`,pageSize:o,sortColumns:"TRADE_DATE",sortTypes:"-1"},a=>({code:String(a.SECURITY_CODE??e),date:Hr(a.TRADE_DATE),inventory:s(a.ON_WARRANT_NUM),change:s(a.ADDCHANGE)}))}async function $r(t,e,n={}){let r=Hi[e];if(!r)throw new h(`Invalid COMEX symbol: "${e}". Must be "gold" or "silver".`);let{pageSize:o=500}=n,i={gold:"\u9EC4\u91D1",silver:"\u767D\u94F6"};return A(t,{reportName:"RPT_FUTUOPT_GOLDSIL",sortColumns:"REPORT_DATE",sortTypes:"-1",pageSize:o,filter:`(INDICATOR_ID1="${r}")(@STORAGE_TON<>"NULL")`},a=>({date:Hr(a.REPORT_DATE),name:i[e]??e,storageTon:s(a.STORAGE_TON),storageOunce:s(a.STORAGE_OUNCE)}))}var Qr={daily:"101",weekly:"102",monthly:"103"},Rn="f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64,f65";function jr(t){let e=t.split(",");return{date:e[0]??"",mainNetInflow:m(e[1]),smallNetInflow:m(e[2]),mediumNetInflow:m(e[3]),largeNetInflow:m(e[4]),superLargeNetInflow:m(e[5]),mainNetInflowPercent:m(e[6]),smallNetInflowPercent:m(e[7]),mediumNetInflowPercent:m(e[8]),largeNetInflowPercent:m(e[9]),superLargeNetInflowPercent:m(e[10]),close:m(e[11]),changePercent:m(e[12])}}function qi(t){let e=t.split(",");return{date:e[0]??"",mainNetInflow:m(e[1]),smallNetInflow:m(e[2]),mediumNetInflow:m(e[3]),largeNetInflow:m(e[4]),superLargeNetInflow:m(e[5]),mainNetInflowPercent:m(e[6]),smallNetInflowPercent:m(e[7]),mediumNetInflowPercent:m(e[8]),largeNetInflowPercent:m(e[9]),superLargeNetInflowPercent:m(e[10]),shClose:m(e[11]),shChangePercent:m(e[12]),szClose:m(e[13]),szChangePercent:m(e[14])}}var Gr={today:{fid:"f62",fields:"f12,f14,f2,f3,f62,f184,f66,f69,f72,f75,f78,f81,f84,f87,f124",changePercentField:"f3",mainNet:"f62",mainPct:"f184",superLargeNet:"f66",superLargePct:"f69",largeNet:"f72",largePct:"f75",mediumNet:"f78",mediumPct:"f81",smallNet:"f84",smallPct:"f87"},"3day":{fid:"f267",fields:"f12,f14,f2,f127,f267,f268,f269,f270,f271,f272,f273,f274,f275,f276,f124",changePercentField:"f127",mainNet:"f267",mainPct:"f268",superLargeNet:"f269",superLargePct:"f270",largeNet:"f271",largePct:"f272",mediumNet:"f273",mediumPct:"f274",smallNet:"f275",smallPct:"f276"},"5day":{fid:"f164",fields:"f12,f14,f2,f109,f164,f165,f166,f167,f168,f169,f170,f171,f172,f173,f124",changePercentField:"f109",mainNet:"f164",mainPct:"f165",superLargeNet:"f166",superLargePct:"f167",largeNet:"f168",largePct:"f169",mediumNet:"f170",mediumPct:"f171",smallNet:"f172",smallPct:"f173"},"10day":{fid:"f174",fields:"f12,f14,f2,f160,f174,f175,f176,f177,f178,f179,f180,f181,f182,f183,f124",changePercentField:"f160",mainNet:"f174",mainPct:"f175",superLargeNet:"f176",superLargePct:"f177",largeNet:"f178",largePct:"f179",mediumNet:"f180",mediumPct:"f181",smallNet:"f182",smallPct:"f183"}},zi={industry:"m:90+t:2",concept:"m:90+t:3",region:"m:90+t:1"},$i="m:0+t:6+f:!2,m:0+t:13+f:!2,m:0+t:80+f:!2,m:1+t:2+f:!2,m:1+t:23+f:!2,m:0+t:7+f:!2,m:1+t:3+f:!2";async function Yr(t,e,n=100,r=1e3){let o=[],i=1,a=0;do{let u=new URLSearchParams({...e,pn:String(i),pz:String(n)}),l=`${Kt}?${u.toString()}`,d=(await t.get(l,{responseType:"json"}))?.data;if(!d||!Array.isArray(d.diff)||(i===1&&(a=d.total??0),o.push(...d.diff),o.length>=a||d.diff.length<n))break;i++}while(o.length<a&&i<=r);return i>r&&o.length<a&&console.warn(`[stock-sdk] fetchClistAllPages truncated at maxPages=${r} (server reports total=${a}, fetched=${o.length}). Pass a larger \`maxPages\` to fetch the full dataset.`),o}async function Wr(t,e,n={}){let{period:r="daily"}=n,o=Qr[r];if(!o)throw new h(`Invalid period: ${r}. Must be daily/weekly/monthly.`);let i=J(Z(e,{market:"CN"})),a=new URLSearchParams({lmt:"0",klt:o,secid:i,fields1:"f1,f2,f3,f7",fields2:Rn,ut:z}),u=`${me}?${a.toString()}`,c=(await t.get(u,{responseType:"json"}))?.data?.klines;return!Array.isArray(c)||c.length===0?[]:c.map(jr)}async function Vr(t){let e=new URLSearchParams({lmt:"0",klt:"101",secid:"1.000001",secid2:"0.399001",fields1:"f1,f2,f3,f7",fields2:Rn,ut:z}),n=`${me}?${e.toString()}`,o=(await t.get(n,{responseType:"json"}))?.data?.klines;return!Array.isArray(o)||o.length===0?[]:o.map(qi)}async function Xr(t,e={}){let{indicator:n="today"}=e,r=Gr[n];if(!r)throw new h(`Invalid indicator: ${n}.`);let o={fid:r.fid,po:"1",np:"1",fltt:"2",invt:"2",ut:z,fs:$i,fields:r.fields};return(await Yr(t,o,100)).map(a=>({code:String(a.f12??""),name:String(a.f14??""),price:s(a.f2),changePercent:s(a[r.changePercentField]),mainNetInflow:s(a[r.mainNet]),mainNetInflowPercent:s(a[r.mainPct]),superLargeNetInflow:s(a[r.superLargeNet]),superLargeNetInflowPercent:s(a[r.superLargePct]),largeNetInflow:s(a[r.largeNet]),largeNetInflowPercent:s(a[r.largePct]),mediumNetInflow:s(a[r.mediumNet]),mediumNetInflowPercent:s(a[r.mediumPct]),smallNetInflow:s(a[r.smallNet]),smallNetInflowPercent:s(a[r.smallPct])}))}async function Zr(t,e={}){let{indicator:n="today",sectorType:r="industry"}=e,o=Gr[n];if(!o)throw new h(`Invalid indicator: ${n}.`);let i=zi[r];if(!i)throw new h(`Invalid sectorType: ${r}.`);let a=`${o.fields},f204,f205`,u={fid:o.fid,po:"1",np:"1",fltt:"2",invt:"2",ut:z,fs:i,fields:a};return(await Yr(t,u,100)).map(c=>({code:String(c.f12??""),name:String(c.f14??""),changePercent:s(c[o.changePercentField]),mainNetInflow:s(c[o.mainNet]),mainNetInflowPercent:s(c[o.mainPct]),superLargeNetInflow:s(c[o.superLargeNet]),largeNetInflow:s(c[o.largeNet]),mediumNetInflow:s(c[o.mediumNet]),smallNetInflow:s(c[o.smallNet]),topStockCode:c.f204?String(c.f204):void 0,topStockName:c.f205?String(c.f205):void 0}))}async function Jr(t,e,n={}){let{period:r="daily"}=n,o=Qr[r];if(!o)throw new h(`Invalid period: ${r}. Must be daily/weekly/monthly.`);let i=e.includes(".")?e:`90.${e}`,a=new URLSearchParams({lmt:"0",klt:o,secid:i,fields1:"f1,f2,f3,f7",fields2:Rn,ut:z}),u=`${me}?${a.toString()}`,c=(await t.get(u,{responseType:"json"}))?.data?.klines;return!Array.isArray(c)||c.length===0?[]:c.map(jr)}var Qi={today:"1","3day":"3","5day":"5","10day":"10",month:"M",quarter:"Q",year:"Y"},ji={shanghai:"001",shenzhen:"003"};function eo(t,e){let n=t.split(",");return{date:e,time:n[0]??"",shanghaiNetInflow:m(n[1]),shenzhenNetInflow:m(n[3]),totalNetInflow:m(n[5])}}async function to(t,e="north"){Ke(e);let n=new URLSearchParams({fields1:"f1,f2,f3,f4",fields2:"f51,f54,f52,f58,f53,f62,f56,f57,f60,f61",ut:z}),r=`${Bt}?${n.toString()}`,i=(await t.get(r,{responseType:"json"}))?.data;if(!i)return[];if(e==="south"){let l=i.n2s??[],c=i.n2sDate??"";return l.map(d=>eo(d,b(c)))}let a=i.s2n??[],u=i.s2nDate??"";return a.map(l=>eo(l,b(u)))}async function no(t){return A(t,{reportName:"RPT_MUTUAL_QUOTA",columns:"TRADE_DATE,MUTUAL_TYPE,BOARD_TYPE,MUTUAL_TYPE_NAME,FUNDS_DIRECTION,INDEX_CODE,INDEX_NAME,BOARD_CODE",quoteColumns:"status~07~BOARD_CODE,dayNetAmtIn~07~BOARD_CODE,dayAmtRemain~07~BOARD_CODE,dayAmtThreshold~07~BOARD_CODE,f104~07~BOARD_CODE,f105~07~BOARD_CODE,f106~07~BOARD_CODE,f3~03~INDEX_CODE~INDEX_f3,netBuyAmt~07~BOARD_CODE",quoteType:"0",sortColumns:"MUTUAL_TYPE",sortTypes:"1",pageSize:2e3,fetchAllPages:!1},e=>({date:L(e.TRADE_DATE),type:String(e.MUTUAL_TYPE??""),boardName:String(e.MUTUAL_TYPE_NAME??""),direction:String(e.FUNDS_DIRECTION??""),status:String(e.status??""),netBuyAmount:s(e.netBuyAmt),netInflow:s(e.dayNetAmtIn),remainAmount:s(e.dayAmtRemain),upCount:s(e.f104),flatCount:s(e.f106),downCount:s(e.f105),indexCode:String(e.INDEX_CODE??""),indexName:String(e.INDEX_NAME??""),indexChangePercent:s(e.INDEX_f3)}))}async function ro(t,e={}){let{market:n="all",period:r="5day",date:o}=e,i=Qi[r];if(!i)throw new h(`Invalid period: ${r}.`);let a=[`(INTERVAL_TYPE="${i}")`];return o&&a.push(`(TRADE_DATE='${o}')`),n!=="all"&&a.push(`(MUTUAL_TYPE="${ji[n]}")`),A(t,{reportName:"RPT_MUTUAL_STOCK_NORTHSTA",columns:"ALL",sortColumns:"ADD_MARKET_CAP",sortTypes:"-1",pageSize:500,filter:a.join("")},u=>({date:L(u.TRADE_DATE),code:String(u.SECURITY_CODE??""),name:String(u.SECURITY_NAME??u.SECURITY_NAME_ABBR??""),close:s(u.CLOSE_PRICE),changePercent:s(u.CHANGE_RATE),holdShares:s(u.HOLD_SHARES),holdMarketValue:s(u.HOLD_MARKET_CAP),holdRatioFloat:s(u.HOLD_RATIO),holdRatioTotal:s(u.A_SHARES_RATIO),addShares:s(u.ADD_SHARES),addMarketValue:s(u.ADD_MARKET_CAP),addMarketValuePercent:s(u.ADD_MARKET_CAP_PROPORTION),sector:String(u.BOARD_NAME??"")}))}async function oo(t,e="north",n={}){Ke(e);let{startDate:r,endDate:o}=n,i=[e==="north"?'(BOARD_TYPE="1")':'(BOARD_TYPE="0")'];return r&&i.push(`(TRADE_DATE>='${b(r)}')`),o&&i.push(`(TRADE_DATE<='${b(o)}')`),A(t,{reportName:"RPT_MUTUAL_DEAL_HISTORY",columns:"ALL",sortColumns:"TRADE_DATE",sortTypes:"-1",pageSize:500,filter:i.join("")},a=>({date:L(a.TRADE_DATE),netBuyAmount:s(a.NET_DEAL_AMT),buyAmount:s(a.BUY_AMT),sellAmount:s(a.SELL_AMT),accNetBuyAmount:s(a.ACCUM_DEAL_AMT),netInflow:s(a.FUND_INFLOW),remainAmount:s(a.QUOTA_BALANCE),topStockCode:a.LEAD_STOCKS_CODE?String(a.LEAD_STOCKS_CODE):null,topStockName:a.LEAD_STOCKS_NAME?String(a.LEAD_STOCKS_NAME):null,topStockChangePercent:s(a.LS_CHANGE_RATE)}))}async function io(t,e,n={}){let r=e.replace(/^(sh|sz|bj)/i,""),{startDate:o,endDate:i}=n,a=[`(SECURITY_CODE="${r}")`];return o&&a.push(`(TRADE_DATE>='${b(o)}')`),i&&a.push(`(TRADE_DATE<='${b(i)}')`),A(t,{reportName:"RPT_MUTUAL_HOLDSTOCKNORTH_STA",columns:"ALL",sortColumns:"TRADE_DATE",sortTypes:"-1",pageSize:500,filter:a.join("")},u=>({date:L(u.TRADE_DATE),holdShares:s(u.HOLD_SHARES),holdMarketValue:s(u.HOLD_MARKET_CAP),holdRatioFloat:s(u.HOLD_RATIO),holdRatioTotal:s(u.A_SHARES_RATIO),close:s(u.CLOSE_PRICE),changePercent:s(u.CHANGE_RATE)}))}var Gi={zt:{path:"/getTopicZTPool",sort:"fbt:asc"},yesterday:{path:"/getYesterdayZTPool",sort:"zs:desc"},strong:{path:"/getTopicQSPool",sort:"zdp:desc"},sub_new:{path:"/getTopicCXPool",sort:"ods:asc"},broken:{path:"/getTopicZBPool",sort:"fbt:asc"},dt:{path:"/getTopicDTPool",sort:"fund:asc"}},Yi={rocket_launch:"8201",quick_rebound:"8202",large_buy:"8193",limit_up_seal:"4",limit_down_open:"32",big_buy_order:"64",auction_up:"8207",high_open_5d:"8209",gap_up:"8211",high_60d:"8213",surge_60d:"8215",accelerate_down:"8204",high_dive:"8203",large_sell:"8194",limit_down_seal:"8",limit_up_open:"16",big_sell_order:"128",auction_down:"8208",low_open_5d:"8210",gap_down:"8212",low_60d:"8214",drop_60d:"8216"},Wi={8201:"\u706B\u7BAD\u53D1\u5C04",8202:"\u5FEB\u901F\u53CD\u5F39",8193:"\u5927\u7B14\u4E70\u5165",4:"\u5C01\u6DA8\u505C\u677F",32:"\u6253\u5F00\u8DCC\u505C\u677F",64:"\u6709\u5927\u4E70\u76D8",8207:"\u7ADE\u4EF7\u4E0A\u6DA8",8209:"\u9AD8\u5F005\u65E5\u7EBF",8211:"\u5411\u4E0A\u7F3A\u53E3",8213:"60\u65E5\u65B0\u9AD8",8215:"60\u65E5\u5927\u5E45\u4E0A\u6DA8",8204:"\u52A0\u901F\u4E0B\u8DCC",8203:"\u9AD8\u53F0\u8DF3\u6C34",8194:"\u5927\u7B14\u5356\u51FA",8:"\u5C01\u8DCC\u505C\u677F",16:"\u6253\u5F00\u6DA8\u505C\u677F",128:"\u6709\u5927\u5356\u76D8",8208:"\u7ADE\u4EF7\u4E0B\u8DCC",8210:"\u4F4E\u5F005\u65E5\u7EBF",8212:"\u5411\u4E0B\u7F3A\u53E3",8214:"60\u65E5\u65B0\u4F4E",8216:"60\u65E5\u5927\u5E45\u4E0B\u8DCC"};function _n(t){if(t==null)return"";let e=String(t).padStart(6,"0");return`${e.slice(0,2)}:${e.slice(2,4)}:${e.slice(4,6)}`}function Vi(t){if(!t||typeof t!="object")return"";let e=t;return`${e.days??""}/${e.ct??""}`}function Xi(t){let e=s(t.p),n=s(t.tp);return{code:String(t.c??t.m??""),name:String(t.n??""),price:e!==null?e/1e3:null,changePercent:s(t.zdp),limitPrice:n!==null?n/1e3:null,amount:s(t.amount??t.zb),floatMarketValue:s(t.ltsz),totalMarketValue:s(t.tshare),turnoverRate:s(t.hs),continuousBoardCount:s(t.lbc),firstBoardTime:t.fbt!==void 0&&t.fbt!==null?_n(t.fbt):null,lastBoardTime:t.lbt!==void 0&&t.lbt!==null?_n(t.lbt):null,boardAmount:s(t.fund),sealAmount:s(t.fund),failedCount:s(t.zbc),industry:String(t.hybk??""),ztStatistics:Vi(t.zttj),amplitude:s(t.zf),speed:s(t.zs)}}function Zi(t){if(t)return/^\d{8}$/.test(t)?t:t.replace(/-/g,"")}function Ji(){return W(E.CN).replace(/-/g,"")}async function so(t,e="zt",n){let r=Gi[e];if(!r)throw new h(`Invalid ZTPool type: ${e}.`);let o=Zi(n)??Ji(),i=new URLSearchParams({ut:k,dpt:"wz.ztzt",Pageindex:"0",pagesize:"10000",sort:r.sort,date:o}),a=`${ge}${r.path}?${i.toString()}`,l=(await t.get(a,{responseType:"json"}))?.data?.pool;return!Array.isArray(l)||l.length===0?[]:l.map(Xi)}async function ao(t,e="large_buy"){let n=Yi[e];if(!n)throw new h(`Invalid StockChangeType: ${e}.`);let r=new URLSearchParams({type:n,pageindex:"0",pagesize:"5000",ut:k,dpt:"wzchanges"}),o=`${ge}/getAllStockChanges?${r.toString()}`,a=(await t.get(o,{responseType:"json"}))?.data?.allstock;return!Array.isArray(a)||a.length===0?[]:a.map(u=>{let l=String(u.t??n);return{time:_n(u.tm),code:String(u.c??""),name:String(u.n??""),changeType:e,changeTypeLabel:Wi[l]??"",info:String(u.i??"")}})}async function uo(t){let e=new URLSearchParams({ut:k,dpt:"wzchanges",pageindex:"0",pagesize:"5000"}),n=`${ge}/getAllBKChanges?${e.toString()}`,o=(await t.get(n,{responseType:"json"}))?.data?.allbk;return!Array.isArray(o)||o.length===0?[]:o.map(i=>{let a=i.ms??{},u=a.m===0?"\u5927\u7B14\u4E70\u5165":a.m===1?"\u5927\u7B14\u5356\u51FA":"",l={},c=i.bkdf??i.bkdfdis;if(c&&typeof c=="object")for(let[d,T]of Object.entries(c))l[d]=Number(T)||0;return{name:String(i.bkn??""),changePercent:s(i.bkz),mainNetInflow:s(i.bkj),totalChangeCount:s(i.bkc),topStockCode:String(a.c??""),topStockName:String(a.n??""),topStockDirection:u,changeTypeDistribution:l}})}var lo={"1month":"01","3month":"02","6month":"03","1year":"04"};async function co(t,e){let n=b(e.startDate),r=b(e.endDate);return A(t,{reportName:"RPT_DAILYBILLBOARD_DETAILSNEW",columns:"SECURITY_CODE,SECUCODE,SECURITY_NAME_ABBR,TRADE_DATE,EXPLAIN,CLOSE_PRICE,CHANGE_RATE,BILLBOARD_NET_AMT,BILLBOARD_BUY_AMT,BILLBOARD_SELL_AMT,BILLBOARD_DEAL_AMT,ACCUM_AMOUNT,DEAL_NET_RATIO,DEAL_AMOUNT_RATIO,TURNOVERRATE,FREE_MARKET_CAP,EXPLANATION,D1_CLOSE_ADJCHRATE,D2_CLOSE_ADJCHRATE,D5_CLOSE_ADJCHRATE,D10_CLOSE_ADJCHRATE",sortColumns:"SECURITY_CODE,TRADE_DATE",sortTypes:"1,-1",pageSize:5e3,filter:`(TRADE_DATE<='${r}')(TRADE_DATE>='${n}')`},o=>({code:String(o.SECURITY_CODE??""),name:String(o.SECURITY_NAME_ABBR??""),date:L(o.TRADE_DATE),close:s(o.CLOSE_PRICE),changePercent:s(o.CHANGE_RATE),netBuyAmount:s(o.BILLBOARD_NET_AMT),buyAmount:s(o.BILLBOARD_BUY_AMT),sellAmount:s(o.BILLBOARD_SELL_AMT),dealAmount:s(o.BILLBOARD_DEAL_AMT),totalAmount:s(o.ACCUM_AMOUNT),netBuyRatio:s(o.DEAL_NET_RATIO),dealAmountRatio:s(o.DEAL_AMOUNT_RATIO),turnoverRate:s(o.TURNOVERRATE),floatMarketValue:s(o.FREE_MARKET_CAP),reason:String(o.EXPLANATION??o.EXPLAIN??""),afterChange1d:s(o.D1_CLOSE_ADJCHRATE),afterChange2d:s(o.D2_CLOSE_ADJCHRATE),afterChange5d:s(o.D5_CLOSE_ADJCHRATE),afterChange10d:s(o.D10_CLOSE_ADJCHRATE)}))}async function po(t,e="1month"){let n=lo[e];if(!n)throw new h(`Invalid period: ${e}.`);return A(t,{reportName:"RPT_BILLBOARD_TRADEALL",columns:"ALL",sortColumns:"BILLBOARD_TIMES,LATEST_TDATE,SECURITY_CODE",sortTypes:"-1,-1,1",pageSize:5e3,filter:`(STATISTICS_CYCLE="${n}")`},r=>({code:String(r.SECURITY_CODE??""),name:String(r.SECURITY_NAME_ABBR??""),latestDate:L(r.LATEST_TDATE),close:s(r.CLOSE_PRICE),changePercent:s(r.CHANGE_RATE),count:s(r.BILLBOARD_TIMES),totalBuyAmount:s(r.BILLBOARD_BUY_AMT),totalSellAmount:s(r.BILLBOARD_SELL_AMT),totalNetAmount:s(r.BILLBOARD_NET_AMT),totalDealAmount:s(r.BILLBOARD_DEAL_AMT),buyOrgCount:s(r.ORG_BUY_TIMES),sellOrgCount:s(r.ORG_SELL_TIMES)}))}async function mo(t,e){let n=b(e.startDate),r=b(e.endDate);return A(t,{reportName:"RPT_ORGANIZATION_TRADE_DETAILS",columns:"ALL",sortColumns:"TRADE_DATE,SECURITY_CODE",sortTypes:"-1,1",pageSize:5e3,filter:`(TRADE_DATE<='${r}')(TRADE_DATE>='${n}')`},o=>({code:String(o.SECURITY_CODE??""),name:String(o.SECURITY_NAME_ABBR??""),date:L(o.TRADE_DATE),close:s(o.CLOSE_PRICE),changePercent:s(o.CHANGE_RATE),buyOrgCount:s(o.BUY_TIMES),sellOrgCount:s(o.SELL_TIMES),orgBuyAmount:s(o.BUY_AMT),orgSellAmount:s(o.SELL_AMT),orgNetAmount:s(o.NET_AMT)}))}async function go(t,e="1month"){let n=lo[e];if(!n)throw new h(`Invalid period: ${e}.`);return A(t,{reportName:"RPT_BILLBOARD_TRADEDETAILS",columns:"ALL",sortColumns:"TOTAL_BUYER_SALESTIMES",sortTypes:"-1",pageSize:5e3,filter:`(STATISTICS_CYCLE="${n}")`},r=>({code:String(r.OPERATEDEPT_CODE??""),name:String(r.OPERATEDEPT_NAME??""),totalBuyAmount:s(r.TOTAL_BUYAMT??r.BUY_AMT),totalSellAmount:s(r.TOTAL_SELLAMT??r.SELL_AMT),buyCount:s(r.TOTAL_BUYER_SALESTIMES??r.BUY_TIMES),sellCount:s(r.TOTAL_SELLER_SALESTIMES??r.SELL_TIMES),totalCount:s(r.TOTAL_TIMES)}))}async function fo(t,e,n){let r=e.replace(/^(sh|sz|bj)/i,""),o=b(n),i=`(SECURITY_CODE="${r}")(TRADE_DATE='${o}')`,[a,u]=await Promise.all([A(t,{reportName:"RPT_BILLBOARD_DAILYDETAILSBUY",columns:"ALL",sortColumns:"BUY_AMT_REAL",sortTypes:"-1",pageSize:100,filter:i},(l,c)=>({rank:s(l.RANK)??c+1,branchName:String(l.OPERATEDEPT_NAME??""),buyAmount:s(l.BUY_AMT_REAL??l.BUY_AMT),buyAmountRatio:s(l.BUY_RATIO_TOTAL??l.BUY_AMT_RATIO),sellAmount:s(l.SELL_AMT_REAL??l.SELL_AMT),sellAmountRatio:s(l.SELL_RATIO_TOTAL??l.SELL_AMT_RATIO),netAmount:s(l.NET_AMT),side:"buy"})),A(t,{reportName:"RPT_BILLBOARD_DAILYDETAILSSELL",columns:"ALL",sortColumns:"SELL_AMT_REAL",sortTypes:"-1",pageSize:100,filter:i},(l,c)=>({rank:s(l.RANK)??c+1,branchName:String(l.OPERATEDEPT_NAME??""),buyAmount:s(l.BUY_AMT_REAL??l.BUY_AMT),buyAmountRatio:s(l.BUY_RATIO_TOTAL??l.BUY_AMT_RATIO),sellAmount:s(l.SELL_AMT_REAL??l.SELL_AMT),sellAmountRatio:s(l.SELL_RATIO_TOTAL??l.SELL_AMT_RATIO),netAmount:s(l.NET_AMT),side:"sell"}))]);return[...a,...u]}function To(t){if(!t)return"";let e=t.startDate?b(t.startDate):void 0,n=t.endDate?b(t.endDate):void 0,r=[];return e&&r.push(`(TRADE_DATE>='${e}')`),n&&r.push(`(TRADE_DATE<='${n}')`),r.join("")}async function yo(t){return A(t,{reportName:"PRT_BLOCKTRADE_MARKET_STA",columns:"ALL",sortColumns:"TRADE_DATE",sortTypes:"-1",pageSize:500},e=>({date:L(e.TRADE_DATE),shClose:s(e.CLOSE_PRICE??e.SH_CLOSE_PRICE),shChangePercent:s(e.CHANGE_RATE??e.SH_CHANGE_RATE),totalAmount:s(e.TURNOVER??e.TOTAL_AMOUNT),premiumAmount:s(e.PREMIUM_TURNOVER??e.PREMIUM_AMOUNT),premiumRatio:s(e.PREMIUM_RATIO),discountAmount:s(e.DISCOUNT_TURNOVER??e.DISCOUNT_AMOUNT),discountRatio:s(e.DISCOUNT_RATIO)}))}async function ho(t,e={}){let n=To(e);return A(t,{reportName:"RPT_BLOCK_TRADE_DETAIL",columns:"ALL",sortColumns:"TRADE_DATE,SECURITY_CODE",sortTypes:"-1,1",pageSize:5e3,filter:n||void 0},r=>({code:String(r.SECURITY_CODE??""),name:String(r.SECURITY_NAME_ABBR??""),date:L(r.TRADE_DATE),close:s(r.CLOSE_PRICE),changePercent:s(r.CHANGE_RATE),dealPrice:s(r.DEAL_PRICE??r.PRICE),dealVolume:s(r.DEAL_VOLUME??r.VOLUME),dealAmount:s(r.DEAL_AMT??r.TURNOVER),premiumRate:s(r.PREMIUM_RATIO??r.PREMIUM_RATE),buyBranch:String(r.BUYER_DEPT??r.BUYER_OPERATEDEPT_NAME??""),sellBranch:String(r.SELLER_DEPT??r.SELLER_OPERATEDEPT_NAME??"")}))}async function So(t,e={}){let n=To(e);return A(t,{reportName:"RPT_BLOCK_TRADE_STA",columns:"ALL",sortColumns:"TRADE_DATE,DEAL_AMT",sortTypes:"-1,-1",pageSize:5e3,filter:n||void 0},r=>({code:String(r.SECURITY_CODE??""),name:String(r.SECURITY_NAME_ABBR??""),date:L(r.TRADE_DATE),changePercent:s(r.CHANGE_RATE),close:s(r.CLOSE_PRICE),dealCount:s(r.DEAL_NUM??r.DEAL_COUNT),dealTotalAmount:s(r.DEAL_AMT??r.TOTAL_AMOUNT),dealTotalVolume:s(r.DEAL_VOLUME??r.TOTAL_VOLUME),premiumAmount:s(r.PREMIUM_AMT??r.PREMIUM_AMOUNT),discountAmount:s(r.DISCOUNT_AMT??r.DISCOUNT_AMOUNT)}))}async function Eo(t){return A(t,{reportName:"RPTA_WEB_MARGIN_DAILYTRADE",columns:"ALL",sortColumns:"STATISTICS_DATE",sortTypes:"-1",pageSize:500},e=>({date:L(e.STATISTICS_DATE??e.TRADE_DATE),finBalance:s(e.FIN_BALANCE),loanBalance:s(e.LOAN_BALANCE),finBuyAmount:s(e.FIN_BUY_AMT),loanSellAmount:s(e.LOAN_SELL_AMT),investorCount:s(e.OPERATE_INVESTOR_NUM??e.INVESTOR_NUM),liabilityInvestorCount:s(e.MARGIN_INVESTOR_NUM),totalGuarantee:s(e.TOTAL_GUARANTEE),avgGuaranteeRatio:s(e.AVG_GUARANTEE_RATIO)}))}async function Ro(t,e){let n=e?`(TRADE_DATE='${e}')`:void 0;return A(t,{reportName:"RPT_MARGIN_TRADE_DETAIL",columns:"ALL",sortColumns:"FIN_BALANCE",sortTypes:"-1",pageSize:5e3,filter:n},r=>({code:String(r.SECURITY_CODE??""),name:String(r.SECURITY_NAME_ABBR??""),date:L(r.TRADE_DATE),finBalance:s(r.FIN_BALANCE),finBuyAmount:s(r.FIN_BUY_AMT),finRepayAmount:s(r.FIN_REPAY_AMT),loanBalance:s(r.LOAN_BALANCE),loanSellVolume:s(r.LOAN_SELL_VOLUME),loanRepayVolume:s(r.LOAN_REPAY_VOLUME)}))}var K={};st(K,{getCommodityOptionKline:()=>No,getCommodityOptionSpot:()=>Mo,getETFOption5DayMinute:()=>bo,getETFOptionDailyKline:()=>Io,getETFOptionExpireDay:()=>Oo,getETFOptionMinute:()=>Do,getETFOptionMonths:()=>Ao,getIndexOptionKline:()=>Co,getIndexOptionSpot:()=>_o});function es(t){return{buyVolume:s(t[0]),buyPrice:s(t[1]),price:s(t[2]),askPrice:s(t[3]),askVolume:s(t[4]),openInterest:s(t[5]),change:s(t[6]),strikePrice:s(t[7]),symbol:t[8]??""}}function ts(t){return{buyVolume:s(t[0]),buyPrice:s(t[1]),price:s(t[2]),askPrice:s(t[3]),askVolume:s(t[4]),openInterest:s(t[5]),change:s(t[6]),strikePrice:null,symbol:t[7]??""}}async function _o(t,e){let n=`${ye}?type=futures&product=${t}&exchange=cffex&pinzhong=${e}`,r=await F(n),o=r?.result?.data?.up??[],i=r?.result?.data?.down??[];return{calls:o.map(es),puts:i.map(ts)}}async function Co(t){let e=`${he}?symbol=${t}`,n=await F(e,{callbackMode:"path"});return Array.isArray(n)?n.map(r=>({date:r.d,open:s(r.o),high:s(r.h),low:s(r.l),close:s(r.c),volume:s(r.v)})):[]}async function Ao(t){let e=`${zt}?exchange=null&cate=${encodeURIComponent(t)}`,r=(await F(e))?.result?.data,o=r?.contractMonth??[];return{months:o.length>1?o.slice(1):o,stockId:r?.stockId??"",cateId:r?.cateId??"",cateList:r?.cateList??[]}}async function Oo(t,e){let n=`${Ge}?exchange=null&cate=${encodeURIComponent(t)}&date=${e}`,r=await F(n),o=r?.result?.data?.remainderDays;if(typeof o=="number"&&o<0){let a=`${Ge}?exchange=null&cate=${encodeURIComponent("XD"+t)}&date=${e}`;r=await F(a)}let i=r?.result?.data;return{expireDay:i?.expireDay??"",remainderDays:i?.remainderDays??0,stockId:i?.stockId??"",name:i?.other?.name??""}}function Po(t){let e="";return t.map(n=>(n.d&&(e=n.d),{time:n.i,date:e,price:s(n.p),volume:s(n.v),openInterest:s(n.t),avgPrice:s(n.a)}))}async function Do(t){let e=`CON_OP_${t}`,n=`${$t}?symbol=${e}`,o=(await F(n))?.result?.data;return Array.isArray(o)?Po(o):[]}async function Io(t){let e=`CON_OP_${t}`,n=`${Qt}?symbol=${e}`,r=await F(n,{callbackMode:"path"});return Array.isArray(r)?r.map(o=>({date:o.d,open:s(o.o),high:s(o.h),low:s(o.l),close:s(o.c),volume:s(o.v)})):[]}async function bo(t){let e=`CON_OP_${t}`,n=`${jt}?symbol=${e}`,o=(await F(n))?.result?.data;if(!Array.isArray(o))return[];let i=[];for(let a of o)Array.isArray(a)&&i.push(...Po(a));return i}function ns(t){return{buyVolume:s(t[0]),buyPrice:s(t[1]),price:s(t[2]),askPrice:s(t[3]),askVolume:s(t[4]),openInterest:s(t[5]),change:s(t[6]),strikePrice:s(t[7]),symbol:t[8]??""}}function rs(t){return{buyVolume:s(t[0]),buyPrice:s(t[1]),price:s(t[2]),askPrice:s(t[3]),askVolume:s(t[4]),openInterest:s(t[5]),change:s(t[6]),strikePrice:null,symbol:t[7]??""}}async function Mo(t,e){let n=Ye[t];if(!n)throw new h(`Unknown commodity option variety: "${t}". Available: ${Object.keys(Ye).join(", ")}`);let r=`${ye}?type=futures&product=${n.product}&exchange=${n.exchange}&pinzhong=${e}`,o=await F(r),i=o?.result?.data?.up??[],a=o?.result?.data?.down??[];return{calls:i.map(ns),puts:a.map(rs)}}async function No(t){let e=`${he}?symbol=${t}`,n=await F(e,{callbackMode:"path"});return Array.isArray(n)?n.map(r=>({date:r.d,open:s(r.o),high:s(r.h),low:s(r.l),close:s(r.c),volume:s(r.v)})):[]}var D=class{constructor(e){this.client=e}};var Pe=class extends D{constructor(e){super(e)}getFundDividendList(e){return g.getFundDividendList(this.client,e)}getFundNavHistory(e){return g.getFundNavHistory(this.client,e)}getFundEstimate(e){return g.getFundEstimate(this.client,e)}getFundRankHistory(e){return g.getFundRankHistory(this.client,e)}};var De=class extends D{constructor(e){super(e)}getFullQuotes(e){return I.getFullQuotes(this.client,e)}getSimpleQuotes(e){return I.getSimpleQuotes(this.client,e)}getHKQuotes(e){return I.getHKQuotes(this.client,e)}getUSQuotes(e){return I.getUSQuotes(this.client,e)}getFundQuotes(e){return I.getFundQuotes(this.client,e)}getFundFlow(e){return I.getFundFlow(this.client,e)}getPanelLargeOrder(e){return I.getPanelLargeOrder(this.client,e)}getTodayTimeline(e){return I.getTodayTimeline(this.client,e)}search(e){return I.search(this.client,e)}getAShareCodeList(e){return I.getAShareCodeList(this.client,e)}getUSCodeList(e){return I.getUSCodeList(this.client,e)}getHKCodeList(){return I.getHKCodeList(this.client)}getFundCodeList(){return I.getFundCodeList(this.client)}async getAllAShareQuotes(e={}){let{market:n,...r}=e,o=await this.getAShareCodeList({market:n});return I.getAllQuotesByCodes(this.client,o,r)}async getAllHKShareQuotes(e={}){let n=await this.getHKCodeList();return I.getAllHKQuotesByCodes(this.client,n,e)}async getAllUSShareQuotes(e={}){let{market:n,...r}=e,o=await this.getUSCodeList({simple:!0,market:n});return I.getAllUSQuotesByCodes(this.client,o,r)}getAllQuotesByCodes(e,n={}){return I.getAllQuotesByCodes(this.client,e,n)}batchRaw(e){return this.client.getTencentQuote(e)}getTradingCalendar(){return I.getTradingCalendar(this.client)}getDividendDetail(e){return g.getDividendDetail(this.client,e)}};var Ie=class extends D{constructor(e){super(e)}getIndustryList(){return g.getIndustryList(this.client)}getIndustrySpot(e){return g.getIndustrySpot(this.client,e)}getIndustryConstituents(e){return g.getIndustryConstituents(this.client,e)}getIndustryKline(e,n){return g.getIndustryKline(this.client,e,n)}getIndustryMinuteKline(e,n){return g.getIndustryMinuteKline(this.client,e,n)}getConceptList(){return g.getConceptList(this.client)}getConceptSpot(e){return g.getConceptSpot(this.client,e)}getConceptConstituents(e){return g.getConceptConstituents(this.client,e)}getConceptKline(e,n){return g.getConceptKline(this.client,e,n)}getConceptMinuteKline(e,n){return g.getConceptMinuteKline(this.client,e,n)}};var be=class extends D{constructor(e){super(e)}getHistoryKline(e,n){return g.getHistoryKline(this.client,e,n)}getMinuteKline(e,n){return g.getMinuteKline(this.client,e,n)}getHKHistoryKline(e,n){return g.getHKHistoryKline(this.client,e,n)}getHKMinuteKline(e,n){return g.getHKMinuteKline(this.client,e,n)}getUSHistoryKline(e,n){return g.getUSHistoryKline(this.client,e,n)}getUSMinuteKline(e,n){return g.getUSMinuteKline(this.client,e,n)}};var Me=class extends D{constructor(e){super(e)}getFuturesKline(e,n){return g.getFuturesHistoryKline(this.client,e,n)}getGlobalFuturesSpot(e){return g.getGlobalFuturesSpot(this.client,e)}getGlobalFuturesKline(e,n){return g.getGlobalFuturesKline(this.client,e,n)}getFuturesInventorySymbols(){return g.getFuturesInventorySymbols(this.client)}getFuturesInventory(e,n){return g.getFuturesInventory(this.client,e,n)}getComexInventory(e,n){return g.getComexInventory(this.client,e,n)}};var Ne=class extends D{constructor(e){super(e)}getIndexOptionSpot(e,n){return K.getIndexOptionSpot(e,n)}getIndexOptionKline(e){return K.getIndexOptionKline(e)}getCFFEXOptionQuotes(e){return g.getCFFEXOptionQuotes(this.client,e)}getETFOptionMonths(e){return K.getETFOptionMonths(e)}getETFOptionExpireDay(e,n){return K.getETFOptionExpireDay(e,n)}getETFOptionMinute(e){return K.getETFOptionMinute(e)}getETFOptionDailyKline(e){return K.getETFOptionDailyKline(e)}getETFOption5DayMinute(e){return K.getETFOption5DayMinute(e)}getCommodityOptionSpot(e,n){return K.getCommodityOptionSpot(e,n)}getCommodityOptionKline(e){return K.getCommodityOptionKline(e)}getOptionLHB(e,n){return g.getOptionLHB(this.client,e,n)}};var os=500,is=15,ke=class{constructor(e,n){this.klineService=e;this.quoteService=n}detectMarket(e){let n=An(e);return n==="HK"?"HK":n==="US"?"US":"A"}calcActualStartDate(e,n,r=1.5){let o=this.toCompactDate(e),i=Math.ceil(n*r),a=new Date(parseInt(o.slice(0,4)),parseInt(o.slice(4,6))-1,parseInt(o.slice(6,8)));a.setDate(a.getDate()-i);let u=a.getFullYear(),l=String(a.getMonth()+1).padStart(2,"0"),c=String(a.getDate()).padStart(2,"0");return`${u}${l}${c}`}calcActualStartDateByCalendar(e,n,r){if(!r||r.length===0)return;let o=r.findIndex(a=>a>=e);o===-1&&(o=r.length-1);let i=Math.max(0,o-n);return this.toCompactDate(r[i])}tryNormalizeDate(e){let n=e.trim();return/^\d{4}-\d{2}-\d{2}/.test(n)?n.slice(0,10):/^\d{8}$/.test(n)?`${n.slice(0,4)}-${n.slice(4,6)}-${n.slice(6,8)}`:null}normalizeUserDate(e){let n=this.tryNormalizeDate(e);if(n===null)throw new h(`\u65E5\u671F\u683C\u5F0F\u5E94\u4E3A 'YYYY-MM-DD' \u6216 'YYYYMMDD',\u5F97\u5230 '${e}'`,{argument:"date",value:e});return n}normalizeRowDate(e){return this.tryNormalizeDate(e)??e}toCompactDate(e){return e.replace(/-/g,"")}async getKlineWithIndicators(e,n={}){let{indicators:r={}}=n,o=n.startDate?this.normalizeUserDate(n.startDate):void 0,i=n.endDate?this.normalizeUserDate(n.endDate):void 0,a=n.market??this.detectMarket(e),{requiredBars:u,maxRecursiveLookback:l}=Dn(r),c={A:1.5,HK:1.46,US:1.45},d;if(o)if(a==="A")try{let O=await this.quoteService.getTradingCalendar();d=this.calcActualStartDateByCalendar(o,u,O)??this.calcActualStartDate(o,u,c[a])}catch{d=this.calcActualStartDate(o,u,c[a])}else d=this.calcActualStartDate(o,u,c[a]);let T={period:n.period,adjust:n.adjust,startDate:d,endDate:i?this.toCompactDate(i):void 0},p;switch(a){case"HK":p=await this.klineService.getHKHistoryKline(e,T);break;case"US":p=await this.klineService.getUSHistoryKline(e,T);break;default:p=await this.klineService.getHistoryKline(e,T)}let y=n.period??"daily",R=30+(y==="weekly"?7:y==="monthly"?31:0),P=p.length===0||d===void 0||this.normalizeRowDate(p[0].date)<=pe(this.normalizeRowDate(d),R),S=!1;if(o&&p.length<u&&P)switch(S=!0,a){case"HK":p=await this.klineService.getHKHistoryKline(e,{...T,startDate:void 0});break;case"US":p=await this.klineService.getUSHistoryKline(e,{...T,startDate:void 0});break;default:p=await this.klineService.getHistoryKline(e,{...T,startDate:void 0})}if(o){let O=p.findIndex(B=>this.normalizeRowDate(B.date)>=o);if(O===-1)return[];let M=p;if(S&&!Pn(r)){let B=l>0?Math.max(u,os,is*l):u;M=p.slice(Math.max(0,O-B))}return ct(M,r).filter(B=>{let U=this.normalizeRowDate(B.date);return U>=o&&(i===void 0||U<=i)})}return ct(p,r)}};var Le=class extends D{constructor(e){super(e)}getIndividualFundFlow(e,n){return g.getIndividualFundFlow(this.client,e,n)}getMarketFundFlow(){return g.getMarketFundFlow(this.client)}getFundFlowRank(e){return g.getFundFlowRank(this.client,e)}getSectorFundFlowRank(e){return g.getSectorFundFlowRank(this.client,e)}getSectorFundFlowHistory(e,n){return g.getSectorFundFlowHistory(this.client,e,n)}};var Fe=class extends D{constructor(e){super(e)}getNorthboundMinute(e){return g.getNorthboundMinute(this.client,e)}getNorthboundFlowSummary(){return g.getNorthboundFlowSummary(this.client)}getNorthboundHoldingRank(e){return g.getNorthboundHoldingRank(this.client,e)}getNorthboundHistory(e,n){return g.getNorthboundHistory(this.client,e,n)}getNorthboundIndividual(e,n){return g.getNorthboundIndividual(this.client,e,n)}};var we=class extends D{constructor(e){super(e)}getZTPool(e,n){return g.getZTPool(this.client,e,n)}getStockChanges(e){return g.getStockChanges(this.client,e)}getBoardChanges(){return g.getBoardChanges(this.client)}};var Ue=class extends D{constructor(e){super(e)}getDragonTigerDetail(e){return g.getDragonTigerDetail(this.client,e)}getDragonTigerStockStats(e){return g.getDragonTigerStockStats(this.client,e)}getDragonTigerInstitution(e){return g.getDragonTigerInstitution(this.client,e)}getDragonTigerBranchRank(e){return g.getDragonTigerBranchRank(this.client,e)}getDragonTigerStockSeatDetail(e,n){return g.getDragonTigerStockSeatDetail(this.client,e,n)}};var xe=class extends D{constructor(e){super(e)}getBlockTradeMarketStat(){return g.getBlockTradeMarketStat(this.client)}getBlockTradeDetail(e){return g.getBlockTradeDetail(this.client,e)}getBlockTradeDailyStat(e){return g.getBlockTradeDailyStat(this.client,e)}getMarginAccountInfo(){return g.getMarginAccountInfo(this.client)}getMarginTargetList(e){return g.getMarginTargetList(this.client,e)}};var Cn=class{constructor(e={}){this._ns={};this.client=new _e(e),this.quoteService=new De(this.client),this.boardService=new Ie(this.client),this.klineService=new be(this.client),this.futuresService=new Me(this.client),this.optionsService=new Ne(this.client),this.indicatorService=new ke(this.klineService,this.quoteService),this.fundFlowService=new Le(this.client),this.northboundService=new Fe(this.client),this.marketEventService=new we(this.client),this.dragonTigerService=new Ue(this.client),this.dataService=new xe(this.client),this.tradingCalendarService=new Ce(this.quoteService),this.fundService=new Pe(this.client)}memoNs(e,n){let r=this._ns[e];return r===void 0&&(r=n(),this._ns[e]=r),r}get quotes(){return this.memoNs("quotes",()=>{let e=this.quoteService;return{cn:e.getFullQuotes.bind(e),cnSimple:e.getSimpleQuotes.bind(e),hk:e.getHKQuotes.bind(e),us:e.getUSQuotes.bind(e),fund:e.getFundQuotes.bind(e),fundFlow:e.getFundFlow.bind(e),largeOrder:e.getPanelLargeOrder.bind(e),timeline:e.getTodayTimeline.bind(e)}})}get codes(){return this.memoNs("codes",()=>{let e=this.quoteService;return{cn:e.getAShareCodeList.bind(e),us:e.getUSCodeList.bind(e),hk:e.getHKCodeList.bind(e),fund:e.getFundCodeList.bind(e)}})}get batch(){return this.memoNs("batch",()=>{let e=this.quoteService;return{cn:e.getAllAShareQuotes.bind(e),hk:e.getAllHKShareQuotes.bind(e),us:e.getAllUSShareQuotes.bind(e),byCodes:e.getAllQuotesByCodes.bind(e),raw:e.batchRaw.bind(e)}})}get kline(){return this.memoNs("kline",()=>{let e=this.klineService,n=this.indicatorService;return{cn:e.getHistoryKline.bind(e),cnMinute:e.getMinuteKline.bind(e),hk:e.getHKHistoryKline.bind(e),hkMinute:e.getHKMinuteKline.bind(e),us:e.getUSHistoryKline.bind(e),usMinute:e.getUSMinuteKline.bind(e),withIndicators:n.getKlineWithIndicators.bind(n)}})}get board(){return this.memoNs("board",()=>{let e=this.boardService;return{industry:{list:e.getIndustryList.bind(e),spot:e.getIndustrySpot.bind(e),constituents:e.getIndustryConstituents.bind(e),kline:e.getIndustryKline.bind(e),minuteKline:e.getIndustryMinuteKline.bind(e)},concept:{list:e.getConceptList.bind(e),spot:e.getConceptSpot.bind(e),constituents:e.getConceptConstituents.bind(e),kline:e.getConceptKline.bind(e),minuteKline:e.getConceptMinuteKline.bind(e)}}})}get options(){return this.memoNs("options",()=>{let e=this.optionsService;return{index:{spot:e.getIndexOptionSpot.bind(e),kline:e.getIndexOptionKline.bind(e)},etf:{months:e.getETFOptionMonths.bind(e),expireDay:e.getETFOptionExpireDay.bind(e),minute:e.getETFOptionMinute.bind(e),dailyKline:e.getETFOptionDailyKline.bind(e),fiveDayMinute:e.getETFOption5DayMinute.bind(e)},commodity:{spot:e.getCommodityOptionSpot.bind(e),kline:e.getCommodityOptionKline.bind(e)},cffex:{quotes:e.getCFFEXOptionQuotes.bind(e)},lhb:e.getOptionLHB.bind(e)}})}get futures(){return this.memoNs("futures",()=>{let e=this.futuresService;return{kline:e.getFuturesKline.bind(e),globalSpot:e.getGlobalFuturesSpot.bind(e),globalKline:e.getGlobalFuturesKline.bind(e),inventorySymbols:e.getFuturesInventorySymbols.bind(e),inventory:e.getFuturesInventory.bind(e),comexInventory:e.getComexInventory.bind(e)}})}get fundFlow(){return this.memoNs("fundFlow",()=>{let e=this.fundFlowService;return{individual:e.getIndividualFundFlow.bind(e),market:e.getMarketFundFlow.bind(e),rank:e.getFundFlowRank.bind(e),sectorRank:e.getSectorFundFlowRank.bind(e),sectorHistory:e.getSectorFundFlowHistory.bind(e)}})}get northbound(){return this.memoNs("northbound",()=>{let e=this.northboundService;return{minute:e.getNorthboundMinute.bind(e),summary:e.getNorthboundFlowSummary.bind(e),holdingRank:e.getNorthboundHoldingRank.bind(e),history:e.getNorthboundHistory.bind(e),individual:e.getNorthboundIndividual.bind(e)}})}get marketEvent(){return this.memoNs("marketEvent",()=>{let e=this.marketEventService;return{ztPool:e.getZTPool.bind(e),stockChanges:e.getStockChanges.bind(e),boardChanges:e.getBoardChanges.bind(e)}})}get dragonTiger(){return this.memoNs("dragonTiger",()=>{let e=this.dragonTigerService;return{detail:e.getDragonTigerDetail.bind(e),stockStats:e.getDragonTigerStockStats.bind(e),institution:e.getDragonTigerInstitution.bind(e),branchRank:e.getDragonTigerBranchRank.bind(e),seatDetail:e.getDragonTigerStockSeatDetail.bind(e)}})}get blockTrade(){return this.memoNs("blockTrade",()=>{let e=this.dataService;return{marketStat:e.getBlockTradeMarketStat.bind(e),detail:e.getBlockTradeDetail.bind(e),dailyStat:e.getBlockTradeDailyStat.bind(e)}})}get margin(){return this.memoNs("margin",()=>{let e=this.dataService;return{accountInfo:e.getMarginAccountInfo.bind(e),targetList:e.getMarginTargetList.bind(e)}})}get fund(){return this.memoNs("fund",()=>{let e=this.fundService;return{dividendList:e.getFundDividendList.bind(e),navHistory:e.getFundNavHistory.bind(e),estimate:e.getFundEstimate.bind(e),rankHistory:e.getFundRankHistory.bind(e)}})}get calendar(){return this.memoNs("calendar",()=>{let e=this.tradingCalendarService;return{isTradingDay:e.isTradingDay.bind(e),nextTradingDay:e.nextTradingDay.bind(e),prevTradingDay:e.prevTradingDay.bind(e),marketStatus:e.getMarketStatus.bind(e)}})}get reference(){return this.memoNs("reference",()=>{let e=this.quoteService;return{dividendDetail:e.getDividendDetail.bind(e),tradingCalendar:e.getTradingCalendar.bind(e)}})}search(e){return this.quoteService.search(e)}},cd=Cn;export{dt as a,pt as b,f as c,_ as d,se as e,ae as f,Be as g,F as h,ue as i,zo as j,le as k,ft as l,E as m,He as n,N as o,yt as p,ht as q,Ce as r,Pe as s,Cn as t,cd as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _chunk4Q7UQ5Q3cjs = require('./chunk-4Q7UQ5Q3.cjs');function P(b){let e=b.slice(),d={where(t){return e=e.filter(t),d},sortBy(t,c="desc"){let f=c==="asc"?1:-1;return e.sort((a,n)=>{let m=t(a),p=t(n),s=Number.isFinite(m),l=Number.isFinite(p);return!s&&!l?0:s?l?(m-p)*f:-1:1}),d},top(t){if(!Number.isInteger(t)||t<0)throw new (0, _chunk4Q7UQ5Q3cjs.e)(`top(n): n must be a non-negative integer, got ${t}`,{n:t});return e.slice(0,t)},toArray(){return e.slice()}};return d}function R(b){let e=b.close;return e!=null&&Number.isFinite(e)?e:null}function v(b){let{klines:e,strategy:d,initialCapital:t=1e5,fee:c=0,getClose:f=R}=b,a=t,n=0,m=0,p=-1,s=0,l=[],o=[],T=(r,i)=>{let u=(i/m*(1-c)*(1-c)-1)*100;l.push({entryIndex:p,exitIndex:r,entryPrice:m,exitPrice:i,returnPercent:u})};for(let r=0;r<e.length;r++){let i=f(e[r]),u=i!=null&&Number.isFinite(i)&&i>0?i:null,x=d(e[r],r,e);u!=null&&(s=u,x==="buy"&&n===0?(n=a*(1-c)/u,m=u,p=r,a=0):x==="sell"&&n>0&&(a=n*u*(1-c),T(r,u),n=0));let C=a+n*(_nullishCoalesce(u, () => (s)));o.push(C)}n>0&&s>0&&(a=n*s*(1-c),T(e.length-1,s),n=0,o.length>0&&(o[o.length-1]=a));let h=o.length?o[o.length-1]:t,S=(h/t-1)*100,B=l.filter(r=>r.returnPercent>0).length,w=l.length?B/l.length*100:0,y=-1/0,g=0;for(let r of o){r>y&&(y=r);let i=y>0?(y-r)/y*100:0;i>g&&(g=i)}return{initialCapital:t,finalEquity:h,totalReturn:S,winRate:w,maxDrawdown:g,tradeCount:l.length,trades:l,equityCurve:o}}exports.a = P; exports.b = v;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as E,f}from"./chunk-UBIQBXQ7.js";function y(e){if(e.startsWith("92")||/^[48]/.test(e))return"BSE";let n=e[0];return n==="6"||n==="5"||n==="9"?"SSE":"SZSE"}var d={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 N(e){let n=e.match(/^([A-Za-z]+)/);return(n?n[1]:e).toUpperCase()}var C={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"}},M=Object.keys(C),U={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"}},L={0:["SZSE","BSE"]},I={SSE:"CN",SZSE:"CN",BSE:"CN",HKEX:"HK",NASDAQ:"US",NYSE:"US",AMEX:"US",US:"US",...Object.fromEntries(Object.values(d).map(e=>[e.exchange,e.market]))};function X(e,n,S,i){let t=i??[n.exchange],h=e.toLowerCase();for(let s of M){if(!h.startsWith(s)||e.length<=s.length)continue;let g=e.slice(s.length);if(!/^\d+$/.test(g))continue;let o=C[s];if(o.market!==n.market||!t.includes(o.exchange))throw new f(`${S} (prefix '${s}' conflicts with resolved ${n.market}/${n.exchange})`);return{code:g,exchange:o.exchange}}return{code:e,exchange:n.exchange}}function H(e,n){let S=typeof e=="string"?{code:e}:{...e},i=typeof e=="string"?e:e.code,t=String(S.code??"").trim(),h=S.market??n?.market,s=S.assetType??n?.assetType,g=S.exchange??n?.exchange;if(!t)throw new f(String(i));let o=(r,a,c,p,u,k={})=>{if(h&&h!==r)throw new f(`${i} (market hint '${h}' conflicts with resolved market ${r})`);if(g){let x=I[g];if(x&&x!==r)throw new f(`${i} (exchange hint '${g}' belongs to market ${x}, conflicts with resolved market ${r})`);if(k.exchange&&g!==a)throw new f(`${i} (exchange hint '${g}' conflicts with resolved exchange ${a})`)}if(s&&s!==p){if(k.assetType)throw new f(`${i} (assetType hint '${s}' conflicts with resolved assetType ${p})`);if(s==="board"||s==="futures")throw new f(`${i} (assetType hint '${s}' conflicts with a ${p}-shaped code)`)}return{market:r,exchange:g??a,assetType:s??p,code:c,variety:u,input:i}},$=(r,a)=>a==="HK"&&/^\d+$/.test(r)?r.padStart(5,"0"):a==="US"?r.toUpperCase():r;if(t.includes(".")){let r=t.indexOf("."),a=t.slice(0,r),c=t.slice(r+1),p=a.toUpperCase(),u=c.toUpperCase();if(/^\d+$/.test(a)&&U[a]){let m=U[a],w=L[a],l=X(c,m,i,w),A=l.exchange,T=!0;if(w&&l.code===c&&/^\d+$/.test(l.code)){let b=y(l.code);w.includes(b)&&(A=b),T=!1}return o(m.market,A,$(l.code,m.market),"stock",void 0,{exchange:T})}let k=c.toLowerCase(),x=Object.prototype.hasOwnProperty.call(C,k)?C[k]:void 0;if(x){let m=X(a,x,i);return o(x.market,m.exchange,$(m.code,x.market),"stock",void 0,{exchange:m.exchange!=="US"})}if(d[p]){let m=d[p];return o(m.market,m.exchange,u,"futures",N(c),{exchange:!0,assetType:!0})}if(a==="90")return o("CN","SSE",c,"board",void 0,{exchange:!0,assetType:!0})}let R=t.toLowerCase();for(let r of M)if(R.startsWith(r)&&t.length>r.length){let a=t.slice(r.length),c=C[r];if(c.market==="CN"?/^\d+$/.test(a):/^[0-9A-Za-z]+$/.test(a)){let u=c.market==="HK"?a.padStart(5,"0"):c.market==="US"?a.toUpperCase():a;return o(c.market,c.exchange,u,"stock",void 0,{exchange:c.exchange!=="US"})}}if(/^\d+$/.test(t))return h==="US"?o("US","US",t,"stock"):h==="CN"?o("CN",y(t),t,"stock"):h==="HK"||t.length===5||t.length===4?o("HK","HKEX",t.padStart(5,"0"),"stock",void 0,{exchange:!0}):o("CN",y(t),t,"stock");if((s==="futures"||h==="GLOBAL")&&/[A-Za-z]/.test(t)){let r=g;if(!r&&h==="GLOBAL")throw new f(`${i} (GLOBAL futures require an explicit exchange, e.g. { exchange: 'COMEX' })`);let a=r?d[String(r).toUpperCase()]?.market:void 0;return o(h??a??"CN",r??"SHFE",t.toUpperCase(),"futures",N(t),{assetType:!0})}if(/^[A-Za-z][A-Za-z.\-]*$/.test(t))return o("US","US",t.toUpperCase(),"stock");throw new f(String(i))}function z(e){try{return H(e).market}catch{return}}var O={SSE:"1",SZSE:"0",BSE:"0",HKEX:"116",NASDAQ:"105",NYSE:"106",AMEX:"107",US:"105"},F={SSE:"sh",SZSE:"sz",BSE:"bj"};function G(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 n=F[e.exchange];if(!n)throw new E(`Cannot map to Tencent symbol: unsupported CN exchange '${e.exchange}'`,{exchange:e.exchange,code:e.code});return`${n}${e.code}`}case"HK":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 _(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.market==="HK")return`116.${e.code.padStart(5,"0")}`;let n=O[e.exchange];if(!n)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`${n}.${e.code}`}function B(e){return e.code}export{y as a,d as b,N as c,H as d,z as e,O as f,G as g,_ as h,B as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var c=class{constructor(e={}){this.cache=new Map;this.inflight=new Map;this.defaultTTL=e.defaultTTL??0,this.maxSize=e.maxSize??1e3}get(e){let t=this.cache.get(e);if(t){if(t.expireAt>0&&Date.now()>t.expireAt){this.cache.delete(e);return}return t.lastAccess=Date.now(),t.value}}set(e,t,i){this.cache.size>=this.maxSize&&!this.cache.has(e)&&this.evictLRU();let n=i??this.defaultTTL,s=Date.now();this.cache.set(e,{value:t,expireAt:n>0?s+n:0,lastAccess:s})}has(e){return this.get(e)!==void 0}delete(e){return this.cache.delete(e)}clear(){this.cache.clear(),this.inflight.clear()}get size(){return this.cache.size}cleanup(){let e=Date.now(),t=0;for(let[i,n]of this.cache)n.expireAt>0&&e>n.expireAt&&(this.cache.delete(i),t++);return t}evictLRU(){let e=null,t=1/0;for(let[i,n]of this.cache)n.lastAccess<t&&(t=n.lastAccess,e=i);e&&this.cache.delete(e)}async getOrFetch(e,t,i){let n=this.get(e);if(n!==void 0)return n;let s=this.inflight.get(e);if(s)return s;let h=t().then(o=>(this.set(e,o,i),o)).finally(()=>{this.inflight.delete(e)});return this.inflight.set(e,h),h}},a=new Map;function u(r,e){let t=a.get(r);if(t)return t;let i=new c(e);return a.set(r,i),i}function l(){for(let r of a.values())r.clear()}function f(...r){return r.
|
|
1
|
+
var c=class{constructor(e={}){this.cache=new Map;this.inflight=new Map;this.defaultTTL=e.defaultTTL??0,this.maxSize=e.maxSize??1e3}get(e){let t=this.cache.get(e);if(t){if(t.expireAt>0&&Date.now()>t.expireAt){this.cache.delete(e);return}return t.lastAccess=Date.now(),t.value}}set(e,t,i){this.cache.size>=this.maxSize&&!this.cache.has(e)&&this.evictLRU();let n=i??this.defaultTTL,s=Date.now();this.cache.set(e,{value:t,expireAt:n>0?s+n:0,lastAccess:s})}has(e){return this.get(e)!==void 0}delete(e){return this.cache.delete(e)}clear(){this.cache.clear(),this.inflight.clear()}get size(){return this.cache.size}cleanup(){let e=Date.now(),t=0;for(let[i,n]of this.cache)n.expireAt>0&&e>n.expireAt&&(this.cache.delete(i),t++);return t}evictLRU(){let e=null,t=1/0;for(let[i,n]of this.cache)n.lastAccess<t&&(t=n.lastAccess,e=i);e&&this.cache.delete(e)}async getOrFetch(e,t,i){let n=this.get(e);if(n!==void 0)return n;let s=this.inflight.get(e);if(s)return s;let h=t().then(o=>(this.set(e,o,i),o)).finally(()=>{this.inflight.delete(e)});return this.inflight.set(e,h),h}},a=new Map;function u(r,e){let t=a.get(r);if(t)return t;let i=new c(e);return a.set(r,i),i}function l(){for(let r of a.values())r.clear()}function f(...r){return r.map(e=>e==null?"\u2205":String(e)).join(":")}export{c as a,u as b,l as c,f as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h}from"./chunk-
|
|
1
|
+
import{a as h}from"./chunk-DU7MCVLJ.js";var m=class{constructor(e){this.cache=new h(e)}get(e){return this.cache.get(e)}set(e,r,i){this.cache.set(e,r,i)}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}},u=new WeakMap;async function y(n,e,r,i){let s=await n.get(e);if(s!==void 0)return s;let t=u.get(n);t||(t=new Map,u.set(n,t));let o=t.get(e);if(o)return o;let c=(async()=>{let a=await r();return a!==void 0&&await n.set(e,a,i),a})().finally(()=>{t.delete(e)});return t.set(e,c),c}export{m as a,y as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function w(e,n=2){let o=Math.pow(10,n);return Math.round(e*o)/o}var y=class{constructor(n,o){this.sum=0;this.comp=0;this.count=0;this.data=n,this.period=o}advance(n){let o=this.data[n];if(o!==null&&(this.add(o),this.count++),n>=this.period){let u=this.data[n-this.period];u!==null&&(this.add(-u),this.count--)}Number.isFinite(this.sum)||this.refill(n)}get value(){return this.sum}get nonNullCount(){return this.count}add(n){let o=n-this.comp,u=this.sum+o;this.comp=u-this.sum-o,this.sum=u}refill(n){this.sum=0,this.comp=0;let o=Math.max(0,n-this.period+1);for(let u=o;u<=n;u++){let s=this.data[u];s!==null&&this.add(s)}}};function M(e,n){let o=new Array(e.length),u=new y(e,n);for(let s=0;s<e.length;s++)u.advance(s),o[s]=s>=n-1&&u.nonNullCount===n?w(u.value/n):null;return o}function x(e,n){let o=[],u=2/(n+1),s=null,l=!1;for(let r=0;r<e.length;r++){if(r<n-1){o.push(null);continue}if(!l){let c=0,i=0;for(let a=r-n+1;a<=r;a++)e[a]!==null&&(c+=e[a],i++);i===n&&(s=c/n,l=!0),o.push(s!==null?w(s):null);continue}let t=e[r];t===null?o.push(s!==null?w(s):null):(s=u*t+(1-u)*s,o.push(w(s)))}return o}function F(e,n){let o=[],u=Array.from({length:n},(l,r)=>r+1),s=u.reduce((l,r)=>l+r,0);for(let l=0;l<e.length;l++){if(l<n-1){o.push(null);continue}let r=0,t=!0;for(let c=0;c<n;c++){let i=e[l-n+1+c];if(i===null){t=!1;break}r+=i*u[c]}o.push(t?w(r/s):null)}return o}function D(e,n={}){let{periods:o=[5,10,20,30,60,120,250],type:u="sma"}=n,s=u==="ema"?x:u==="wma"?F:M,l={};for(let r of o)l[`ma${r}`]=s(e,r);return e.map((r,t)=>{let c={};for(let i of o)c[`ma${i}`]=l[`ma${i}`][t];return c})}function U(e,n=2){let o=Math.pow(10,n);return Math.round(e*o)/o}function j(e,n={}){let{short:o=12,long:u=26,signal:s=9}=n,l=x(e,o),r=x(e,u),t=e.map((i,a)=>l[a]===null||r[a]===null?null:l[a]-r[a]),c=x(t,s);return e.map((i,a)=>({dif:t[a]!==null?U(t[a]):null,dea:c[a],macd:t[a]!==null&&c[a]!==null?U((t[a]-c[a])*2):null}))}function B(e,n=2){let o=Math.pow(10,n);return Math.round(e*o)/o}function Q(e,n,o){let u=new Array(e.length),s=e.map(t=>t===null?null:t*t),l=new y(e,n),r=new y(s,n);for(let t=0;t<e.length;t++){l.advance(t),r.advance(t);let c=o[t];if(t<n-1||c===null){u[t]=null;continue}if(l.nonNullCount!==n){u[t]=null;continue}let i=r.value-2*c*l.value+n*c*c;u[t]=Math.sqrt(Math.max(0,i)/n)}return u}function V(e,n={}){let{period:o=20,stdDev:u=2}=n,s=M(e,o),l=Q(e,o,s);return e.map((r,t)=>{if(s[t]===null||l[t]===null)return{mid:null,upper:null,lower:null,bandwidth:null};let c=s[t]+u*l[t],i=s[t]-u*l[t],a=s[t]!==0?B((c-i)/s[t]*100):null;return{mid:s[t],upper:B(c),lower:B(i),bandwidth:a}})}function P(e,n=2){let o=Math.pow(10,n);return Math.round(e*o)/o}function H(e,n={}){let{period:o=9,kPeriod:u=3,dPeriod:s=3}=n,l=[],r=50,t=50,c=[],i=0,a=[],p=0,h=0;for(let f=0;f<e.length;f++){let R=e[f];if(R.high===null||R.low===null)h++;else{for(;c.length>i&&e[c[c.length-1]].high<=R.high;)c.pop();for(c.push(f);a.length>p&&e[a[a.length-1]].low>=R.low;)a.pop();a.push(f)}let m=f-o+1;if(f>=o){let I=e[f-o];(I.high===null||I.low===null)&&h--}for(;c.length>i&&c[i]<m;)i++;for(;a.length>p&&a[p]<m;)p++;if(f<o-1){l.push({k:null,d:null,j:null});continue}let b=c.length>i?e[c[i]].high:-1/0,d=a.length>p?e[a[p]].low:1/0,g=e[f].close;if(h>0||g===null||b===d){l.push({k:null,d:null,j:null});continue}let k=(g-d)/(b-d)*100;r=(u-1)/u*r+1/u*k,t=(s-1)/s*t+1/s*r;let K=3*r-2*t;l.push({k:P(r),d:P(t),j:P(K)})}return l}function X(e,n=2){let o=Math.pow(10,n);return Math.round(e*o)/o}function T(e,n={}){let{periods:o=[6,12,24]}=n,u=[null];for(let l=1;l<e.length;l++)e[l]===null||e[l-1]===null?u.push(null):u.push(e[l]-e[l-1]);let s={};for(let l of o){let r=[],t=0,c=0;for(let i=0;i<e.length;i++){if(i<l){r.push(null),u[i]!==null&&(u[i]>0?t+=u[i]:c+=Math.abs(u[i]));continue}if(i===l)u[i]!==null&&(u[i]>0?t+=u[i]:c+=Math.abs(u[i])),t=t/l,c=c/l;else{let a=u[i]??0,p=a>0?a:0,h=a<0?Math.abs(a):0;t=(t*(l-1)+p)/l,c=(c*(l-1)+h)/l}if(c===0)r.push(100);else if(t===0)r.push(0);else{let a=t/c;r.push(X(100-100/(1+a)))}}s[`rsi${l}`]=r}return e.map((l,r)=>{let t={};for(let c of o)t[`rsi${c}`]=s[`rsi${c}`][r];return t})}function Z(e,n=2){let o=Math.pow(10,n);return Math.round(e*o)/o}function W(e,n={}){let{periods:o=[6,10]}=n,u={};for(let s of o){let l=[];for(let r=0;r<e.length;r++){if(r<s-1){l.push(null);continue}let t=-1/0,c=1/0,i=!0;for(let h=r-s+1;h<=r;h++){if(e[h].high===null||e[h].low===null){i=!1;break}t=Math.max(t,e[h].high),c=Math.min(c,e[h].low)}let a=e[r].close;if(!i||a===null||t===c){l.push(null);continue}let p=(t-a)/(t-c)*100;l.push(Z(p))}u[`wr${s}`]=l}return e.map((s,l)=>{let r={};for(let t of o)r[`wr${t}`]=u[`wr${t}`][l];return r})}function ee(e,n=2){let o=Math.pow(10,n);return Math.round(e*o)/o}function E(e,n={}){let{periods:o=[6,12,24]}=n,u={};for(let s of o){let l=M(e,s),r=[];for(let t=0;t<e.length;t++)if(e[t]===null||l[t]===null||l[t]===0)r.push(null);else{let c=(e[t]-l[t])/l[t]*100;r.push(ee(c))}u[`bias${s}`]=r}return e.map((s,l)=>{let r={};for(let t of o)r[`bias${t}`]=u[`bias${t}`][l];return r})}function ne(e,n=2){let o=Math.pow(10,n);return Math.round(e*o)/o}function N(e,n={}){let{period:o=14}=n,u=[],s=e.map(l=>l.high===null||l.low===null||l.close===null?null:(l.high+l.low+l.close)/3);for(let l=0;l<e.length;l++){if(l<o-1){u.push({cci:null});continue}let r=0,t=0;for(let p=l-o+1;p<=l;p++)s[p]!==null&&(r+=s[p],t++);if(t!==o||s[l]===null){u.push({cci:null});continue}let c=r/o,i=0;for(let p=l-o+1;p<=l;p++)i+=Math.abs(s[p]-c);let a=i/o;if(a===0)u.push({cci:0});else{let p=(s[l]-c)/(.015*a);u.push({cci:ne(p)})}}return u}function _(e,n=2){let o=Math.pow(10,n);return Math.round(e*o)/o}function v(e,n={}){let{period:o=14}=n,u=[],s=[];for(let r=0;r<e.length;r++){let{high:t,low:c,close:i}=e[r];if(t===null||c===null||i===null){s.push(null);continue}if(r===0)s.push(t-c);else{let a=e[r-1].close;if(a===null)s.push(t-c);else{let p=t-c,h=Math.abs(t-a),f=Math.abs(c-a);s.push(Math.max(p,h,f))}}}let l=null;for(let r=0;r<e.length;r++){if(r<o-1){u.push({tr:s[r]!==null?_(s[r]):null,atr:null});continue}if(r===o-1){let t=0,c=0;for(let i=0;i<o;i++)s[i]!==null&&(t+=s[i],c++);c===o&&(l=t/o)}else l!==null&&s[r]!==null&&(l=(l*(o-1)+s[r])/o);u.push({tr:s[r]!==null?_(s[r]):null,atr:l!==null?_(l):null})}return u}function $(e,n={}){let{maPeriod:o}=n,u=[];if(e.length===0)return u;let s=e[0].volume??0;u.push({obv:s,obvMa:null});for(let l=1;l<e.length;l++){let r=e[l],t=e[l-1];if(r.close===null||t.close===null||r.volume===null||r.volume===void 0){u.push({obv:null,obvMa:null});continue}r.close>t.close?s+=r.volume:r.close<t.close&&(s-=r.volume),u.push({obv:s,obvMa:null})}if(o&&o>0){let l=u.map(t=>t.obv),r=new y(l,o);for(let t=0;t<u.length;t++)r.advance(t),t>=o-1&&r.nonNullCount===o&&(u[t].obvMa=r.value/o)}return u}function J(e,n={}){let{period:o=12,signalPeriod:u}=n,s=[];for(let l=0;l<e.length;l++){if(l<o){s.push({roc:null,signal:null});continue}let r=e[l].close,t=e[l-o].close;if(r===null||t===null||t===0){s.push({roc:null,signal:null});continue}let c=(r-t)/t*100;s.push({roc:c,signal:null})}if(u&&u>0){let l=s.map(t=>t.roc),r=new y(l,u);for(let t=0;t<s.length;t++)r.advance(t),t>=o+u-1&&r.nonNullCount===u&&(s[t].signal=r.value/u)}return s}function q(e,n={}){let{period:o=14,adxPeriod:u=o}=n,s=[];if(e.length<2)return e.map(()=>({pdi:null,mdi:null,adx:null,adxr:null}));let l=[],r=[],t=[];for(let m=0;m<e.length;m++){if(m===0){l.push(0),r.push(0),t.push(0),s.push({pdi:null,mdi:null,adx:null,adxr:null});continue}let b=e[m],d=e[m-1];if(b.high===null||b.low===null||b.close===null||d.high===null||d.low===null||d.close===null){l.push(0),r.push(0),t.push(0),s.push({pdi:null,mdi:null,adx:null,adxr:null});continue}let g=b.high-b.low,k=Math.abs(b.high-d.close),K=Math.abs(b.low-d.close);t.push(Math.max(g,k,K));let I=b.high-d.high,A=d.low-b.low;I>A&&I>0?l.push(I):l.push(0),A>I&&A>0?r.push(A):r.push(0),s.push({pdi:null,mdi:null,adx:null,adxr:null})}let c=0,i=0,a=0,p=[];for(let m=1;m<e.length;m++){if(m<o){c+=t[m],i+=l[m],a+=r[m],p.push(0);continue}m===o?(c+=t[m],i+=l[m],a+=r[m]):(c=c-c/o+t[m],i=i-i/o+l[m],a=a-a/o+r[m]);let b=c>0?i/c*100:0,d=c>0?a/c*100:0;s[m].pdi=b,s[m].mdi=d;let g=b+d,k=g>0?Math.abs(b-d)/g*100:0;p.push(k)}let h=0,f=0,R=o+u-1;for(let m=o;m<e.length;m++){if(m<R){h+=p[m-1]||0;continue}if(m===R)h+=p[m-1]||0,f=h/u,s[m].adx=f;else{let b=p[m-1]||0;f=(f*(u-1)+b)/u,s[m].adx=f}}for(let m=R+u;m<e.length;m++){let b=s[m].adx,d=s[m-u]?.adx;b!==null&&d!==null&&(s[m].adxr=(b+d)/2)}return s}function G(e,n={}){let{afStart:o=.02,afIncrement:u=.02,afMax:s=.2}=n,l=[];if(e.length<2)return e.map(()=>({sar:null,trend:null,ep:null,af:null}));let r=1,t=o,c=e[0].high??0,i=e[0].low??0,a=e[0],p=e[1];a.close!==null&&p.close!==null&&p.close<a.close&&(r=-1,c=a.low??0,i=a.high??0),l.push({sar:null,trend:null,ep:null,af:null});for(let h=1;h<e.length;h++){let f=e[h],R=e[h-1];if(f.high===null||f.low===null||R.high===null||R.low===null){l.push({sar:null,trend:null,ep:null,af:null});continue}let m=i+t*(c-i);r===1?(m=Math.min(m,R.low,e[Math.max(0,h-2)]?.low??R.low),f.low<m?(r=-1,m=c,c=f.low,t=o):f.high>c&&(c=f.high,t=Math.min(t+u,s))):(m=Math.max(m,R.high,e[Math.max(0,h-2)]?.high??R.high),f.high>m?(r=1,m=c,c=f.high,t=o):f.low<c&&(c=f.low,t=Math.min(t+u,s))),i=m,l.push({sar:i,trend:r,ep:c,af:t})}return l}function Y(e,n={}){let{emaPeriod:o=20,atrPeriod:u=10,multiplier:s=2}=n,l=[],r=e.map(i=>i.close),t=x(r,o),c=v(e,{period:u});for(let i=0;i<e.length;i++){let a=t[i],p=c[i]?.atr;if(a===null||p===null){l.push({mid:null,upper:null,lower:null,width:null});continue}let h=a+s*p,f=a-s*p,R=a>0?(h-f)/a*100:null;l.push({mid:a,upper:h,lower:f,width:R})}return l}function L(e,n=0){return e.length===0?n:Math.max(...e)}function z(e){return{closes:e.map(n=>n.close),ohlcv:e.map(n=>({open:n.open,high:n.high,low:n.low,close:n.close,volume:n.volume}))}}var O={ma:{key:"ma",estimateLookback:e=>{let n=typeof e=="object"?e:{},o=n.periods??[5,10,20,30,60,120,250],u=n.type??"sma";return{bars:L(o,20),emaBased:u==="ema"}},compute:(e,n)=>D(e.closes,typeof n=="object"?n:{})},macd:{key:"macd",recursive:!0,estimateLookback:e=>{let n=typeof e=="object"?e:{},o=n.long??26,u=n.signal??9;return{bars:o*3+u,emaBased:!0}},compute:(e,n)=>j(e.closes,typeof n=="object"?n:{})},boll:{key:"boll",estimateLookback:e=>({bars:typeof e=="object"&&e.period?e.period:20}),compute:(e,n)=>V(e.closes,typeof n=="object"?n:{})},kdj:{key:"kdj",recursive:!0,estimateLookback:e=>({bars:typeof e=="object"&&e.period?e.period:9}),compute:(e,n)=>H(e.ohlcv,typeof n=="object"?n:{})},rsi:{key:"rsi",recursive:!0,estimateLookback:e=>{let n=typeof e=="object"&&e.periods?e.periods:[6,12,24];return{bars:L(n,14)+1}},compute:(e,n)=>T(e.closes,typeof n=="object"?n:{})},wr:{key:"wr",estimateLookback:e=>{let n=typeof e=="object"&&e.periods?e.periods:[6,10];return{bars:L(n,10)}},compute:(e,n)=>W(e.ohlcv,typeof n=="object"?n:{})},bias:{key:"bias",estimateLookback:e=>{let n=typeof e=="object"&&e.periods?e.periods:[6,12,24];return{bars:L(n,12)}},compute:(e,n)=>E(e.closes,typeof n=="object"?n:{})},cci:{key:"cci",estimateLookback:e=>({bars:typeof e=="object"&&e.period?e.period:14}),compute:(e,n)=>N(e.ohlcv,typeof n=="object"?n:{})},atr:{key:"atr",recursive:!0,estimateLookback:e=>({bars:typeof e=="object"&&e.period?e.period:14}),compute:(e,n)=>v(e.ohlcv,typeof n=="object"?n:{})},obv:{key:"obv",cumulative:!0,estimateLookback:e=>{let n=typeof e=="object"&&e.maPeriod?e.maPeriod:0;return{bars:Math.max(2,n)}},compute:(e,n)=>$(e.ohlcv,typeof n=="object"?n:{})},roc:{key:"roc",estimateLookback:e=>{let n=typeof e=="object"?e:{},o=n.period??12,u=n.signalPeriod??0;return{bars:o+u}},compute:(e,n)=>J(e.ohlcv,typeof n=="object"?n:{})},dmi:{key:"dmi",recursive:!0,estimateLookback:e=>{let n=typeof e=="object"?e:{},o=n.period??14,u=n.adxPeriod??o;return{bars:o*2+u}},compute:(e,n)=>q(e.ohlcv,typeof n=="object"?n:{})},sar:{key:"sar",recursive:!0,estimateLookback:()=>({bars:5}),compute:(e,n)=>G(e.ohlcv,typeof n=="object"?n:{})},kc:{key:"kc",recursive:!0,estimateLookback:e=>{let n=typeof e=="object"?e:{},o=n.emaPeriod??20,u=n.atrPeriod??10;return{bars:Math.max(o*3,u),emaBased:!0}},compute:(e,n)=>Y(e.ohlcv,typeof n=="object"?n:{})}},te=["ma","rsi","wr","bias"];function S(e){let n=null;for(let o of te){let u=e[o];if(Array.isArray(u))(n??(n={...e}))[o]={periods:u};else if(u&&typeof u=="object"&&!("periods"in u)&&typeof u.period=="number"){let{period:s,...l}=u;(n??(n={...e}))[o]={...l,periods:[s]}}}return n??e}function oe(e){return C(S(e)).some(n=>O[n].cumulative===!0)}function C(e){return Object.keys(O).filter(n=>!!e[n])}function le(e){e=S(e);let n=0,o=0,u=!1;for(let l of C(e)){let r=O[l],t=r.estimateLookback(e[l]);n=Math.max(n,t.bars),u||(u=!!t.emaBased),(r.recursive===!0||t.emaBased===!0)&&(o=Math.max(o,t.bars))}return{maxLookback:n,hasEmaBasedIndicator:u,requiredBars:Math.ceil(n*(u?1.5:1.2)),maxRecursiveLookback:o}}function re(e,n={}){if(e.length===0)return[];n=S(n);let o=z(e),u=new Map;for(let r of C(n)){let t=O[r];u.set(r,t.compute(o,n[r]))}let s=[],l=[];for(let[r,t]of u)s.push(r),l.push(t);return e.map((r,t)=>{let c={...r},i=c;for(let a=0;a<s.length;a++)i[s[a]]=l[a][t];return c})}export{M as a,x as b,F as c,D as d,j as e,V as f,H as g,T as h,W as i,E as j,N as k,v as l,$ as m,J as n,q as o,G as p,Y as q,z as r,O as s,oe as t,C as u,le as v,re as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function ue(a,p){let m,g=p.reduce((i,O)=>{if(!(i==null||typeof i!="object"))return m=i,i[O]},a);if(typeof g=="function")return{fn:g,parent:m}}var C=["qfq","hfq","none"],F=["daily","weekly","monthly"],B=["1","5","15","30","60"],w=["sh","sz","bj","kc","cy"],v=["NASDAQ","NYSE","AMEX"],K=["A","HK","US"],_=["north","south"],x=["zt","yesterday","strong","sub_new","broken","dt"],h=["1month","3month","6month","1year"],y=["50ETF","300ETF","500ETF","\u79D1\u521B50","\u79D1\u521B\u677F50"],L=["ho","io","mo"],H=["gold","silver"],U=["rocket_launch","quick_rebound","large_buy","limit_up_seal","limit_down_open","big_buy_order","auction_up","high_open_5d","gap_up","high_60d","surge_60d","accelerate_down","high_dive","large_sell","limit_down_seal","limit_up_open","big_sell_order","auction_down","low_open_5d","gap_down","low_60d","drop_60d"],r={flag:"adjust",type:"enum",enum:C,map:{none:""},default:"qfq",desc:"\u590D\u6743\uFF1Aqfq \u524D\u590D\u6743(\u9ED8\u8BA4) / hfq \u540E\u590D\u6743 / none \u4E0D\u590D\u6743",mcpDesc:"\u590D\u6743\uFF1Aqfq=\u524D\u590D\u6743(\u9ED8\u8BA4,\u770B\u8D70\u52BF) / hfq=\u540E\u590D\u6743(\u7B97\u6536\u76CA) / ''=\u4E0D\u590D\u6743"},D={...r,default:"",mcpDesc:"\u590D\u6743\u65B9\u5F0F\uFF0C\u9ED8\u8BA4\u4E0D\u590D\u6743\uFF08''\uFF09\uFF1B\u9700\u524D\u590D\u6743\u4F20 qfq\uFF08\u770B\u8D70\u52BF\uFF09\uFF0C\u540E\u590D\u6743\u4F20 hfq\uFF08\u7B97\u6536\u76CA\uFF09"},s={flag:"period",type:"enum",enum:F,default:"daily",desc:"K \u7EBF\u5468\u671F daily/weekly/monthly",mcpDesc:"\u5386\u53F2 K \u7EBF\u5468\u671F"},u={flag:"period",type:"enum",enum:B,default:"1",desc:"\u5206\u949F\u5468\u671F 1/5/15/30/60",mcpDesc:"\u5206\u949F\u5468\u671F\uFF1B1=\u5F53\u65E5\u5206\u65F6"},S={...u,default:"5",mcpDesc:"\u5206\u949F\u5468\u671F\uFF1B\u9ED8\u8BA4 5\uFF085 \u5206\u949F K \u7EBF\uFF09\uFF0C\u5F53\u65E5\u5206\u65F6\u8BF7\u4F20 period=1"},t={flag:"start",field:"startDate",type:"string",desc:"\u5F00\u59CB\u65E5\u671F YYYYMMDD",mcpDesc:"\u8D77\u59CB\u65E5\u671F YYYYMMDD"},o={flag:"end",field:"endDate",type:"string",desc:"\u7ED3\u675F\u65E5\u671F YYYYMMDD",mcpDesc:"\u7ED3\u675F\u65E5\u671F YYYYMMDD"},Y={...t,required:!0},f={...o,required:!0},z={...t,mcpDesc:"\u5F00\u59CB\u65F6\u95F4"},j={...o,mcpDesc:"\u7ED3\u675F\u65F6\u95F4"},Q={...t,mcpDesc:"\u5F00\u59CB\u65F6\u95F4 YYYY-MM-DD HH:mm\uFF08\u6E2F\u80A1\u672C\u5730\u65F6\u533A\uFF09"},G={...o,mcpDesc:"\u7ED3\u675F\u65F6\u95F4 YYYY-MM-DD HH:mm\uFF08\u6E2F\u80A1\u672C\u5730\u65F6\u533A\uFF09"},Z={...t,mcp:!1},X={...o,mcp:!1},q={...t,mcpDesc:"\u8D77\u59CB\u65E5\u671F YYYY-MM-DD"},R={...o,mcpDesc:"\u7ED3\u675F\u65E5\u671F YYYY-MM-DD"},V={...q,cli:!1},J={...R,cli:!1},M={flag:"ndays",jsonKey:"recentDays",type:"number",desc:"\u6700\u8FD1 N \u4E2A\u4EA4\u6613\u65E5\u5206\u65F6(\u4EC5 period=1 \u751F\u6548)",mcpDesc:"\u4EC5 period=1 \u751F\u6548\uFF1A\u8FD4\u56DE\u6700\u8FD1 N \u4E2A\u4EA4\u6613\u65E5\u7684\u5206\u65F6\uFF0C\u9ED8\u8BA4 1\uFF08\u5F53\u65E5\uFF09"},N={flag:"market",type:"enum",enum:w,desc:"\u5E02\u573A\u7B5B\u9009 sh/sz/bj/kc/cy",mcpDesc:"\u6309\u677F\u5757\u7B5B\u9009"},b={flag:"market",type:"enum",enum:v,upper:!0,desc:"\u4EA4\u6613\u6240\u7B5B\u9009 NASDAQ/NYSE/AMEX"},$={flag:"market",type:"enum",enum:K,upper:!0,desc:"\u5E02\u573A(\u9ED8\u8BA4\u81EA\u52A8\u8BC6\u522B)",mcpDesc:"\u5E02\u573A\u7C7B\u578B A / HK / US\uFF1B\u4E0D\u4F20\u5219\u7531 symbol \u81EA\u52A8\u8BC6\u522B"},c={flag:"batchSize",type:"number",desc:"\u5355\u6279\u6570\u91CF(\u9ED8\u8BA4 500)",mcpDesc:"\u5355\u6279\u4EE3\u7801\u6570\uFF0C\u9ED8\u8BA4 500"},l={flag:"concurrency",type:"number",desc:"\u5E76\u53D1\u6570(\u9ED8\u8BA4 7)",mcpDesc:"\u5E76\u53D1\u6570\uFF0C\u9ED8\u8BA4 7"},I={flag:"simple",type:"boolean",desc:"\u53BB\u6389\u4EA4\u6613\u6240\u524D\u7F00"},W={...I,mcpDesc:"\u53BB\u6389\u5E02\u573A\u524D\u7F00"},k={flag:"direction",type:"enum",enum:_,mcp:!1,desc:"\u65B9\u5411 north / south"},ee=["ma","rsi","wr","bias"],ae=["macd","kdj","boll","cci","atr","obv","roc","dmi","sar","kc"],te=[...ee.map(a=>({flag:a,type:"number[]",mcp:!1,desc:`${a.toUpperCase()} \u5468\u671F(\u9017\u53F7\u5206\u9694\uFF0C\u5982 5,10\uFF1B\u4EC5 --${a} \u7528\u9ED8\u8BA4)`})),...ae.map(a=>({flag:a,type:"boolean",mcp:!1,desc:`\u542F\u7528 ${a.toUpperCase()}`}))],A={flag:"indicator",type:"enum",enum:["today","3day","5day","10day"],default:"today",cli:!1,desc:"\u6392\u540D\u5468\u671F today/3day/5day/10day",mcpDesc:"\u6392\u540D\u5468\u671F\uFF1Atoday=\u4ECA\u65E5(\u9ED8\u8BA4) / 3day / 5day / 10day"},oe={flag:"sectorType",type:"enum",enum:["industry","concept","region"],default:"industry",cli:!1,desc:"\u677F\u5757\u7C7B\u578B industry/concept/region",mcpDesc:"\u677F\u5757\u7C7B\u578B\uFF1Aindustry=\u884C\u4E1A(\u9ED8\u8BA4) / concept=\u6982\u5FF5 / region=\u5730\u57DF"},se={flag:"market",type:"enum",enum:["all","shanghai","shenzhen"],default:"all",cli:!1,desc:"\u5E02\u573A all/shanghai/shenzhen",mcpDesc:"\u5E02\u573A:all(\u9ED8\u8BA4) / shanghai=\u6CAA\u80A1\u901A / shenzhen=\u6DF1\u80A1\u901A"},re={flag:"period",type:"enum",enum:["today","3day","5day","10day","month","quarter","year"],default:"5day",cli:!1,desc:"\u6392\u540D\u5468\u671F today/3day/5day/10day/month/quarter/year",mcpDesc:"\u6392\u540D\u5468\u671F:today / 3day / 5day(\u9ED8\u8BA4) / 10day / month / quarter / year"},ne={flag:"date",type:"string",cli:!1,desc:"\u6307\u5B9A\u4EA4\u6613\u65E5 YYYY-MM-DD",mcpDesc:"\u6307\u5B9A\u4EA4\u6613\u65E5 YYYY-MM-DD\uFF08\u9ED8\u8BA4\u670D\u52A1\u7AEF\u6700\u65B0\u4EA4\u6613\u65E5\uFF09"},pe={flag:"pageSize",type:"number",cli:!1,desc:"\u6BCF\u9875\u6761\u6570\uFF0C\u9ED8\u8BA4 20"},me={flag:"pageSize",type:"number",cli:!1,desc:"\u6BCF\u9875\u6761\u6570\uFF0C\u9ED8\u8BA4 20000"},E={flag:"pageSize",type:"number",cli:!1,desc:"\u5355\u9875\u6279\u91CF\u5927\u5C0F\uFF0C\u9ED8\u8BA4 500\uFF1B\u63A5\u53E3\u8FD4\u56DE\u5168\u91CF\u5386\u53F2\uFF0C\u8FC7\u5927\u65F6\u4F1A\u88AB\u88C1\u526A"},ie={flag:"marketCode",type:"number",cli:!1,desc:"\u4E1C\u8D22\u5E02\u573A\u4EE3\u7801\uFF08\u672A\u5185\u7F6E\u54C1\u79CD\u65F6\u624B\u52A8\u6307\u5B9A\uFF09"},ce={flag:"start",field:"startDate",type:"string",cli:!1,desc:"\u5F00\u59CB\u65E5\u671F YYYY-MM-DD\uFF0C\u9ED8\u8BA4 2020-10-28"},T={...r,mcp:!1},P="\u7EDF\u8BA1\u5468\u671F\uFF1A1month / 3month / 6month / 1year\uFF0C\u9ED8\u8BA4 1month",le=[{flag:"year",type:"string",cli:!1,desc:'\u67E5\u8BE2\u5E74\u4EFD\uFF0C\u5982 "2026"\uFF1B\u9ED8\u8BA4\u5F53\u524D\u5E74\uFF08Asia/Shanghai\uFF09'},{flag:"page",type:"string",cli:!1,desc:"\u9875\u7801\uFF08\u4ECE 1 \u5F00\u59CB\uFF09\u7684\u6570\u5B57\u5B57\u7B26\u4E32\uFF0C\u6216 'all' \u81EA\u52A8\u7FFB\u5B8C\u8BE5\u5E74\u6240\u6709\u9875\u5E76\u805A\u5408\uFF1B\u9ED8\u8BA4 1"},{flag:"fundType",type:"string",cli:!1,desc:"\u57FA\u91D1\u7C7B\u578B\u7B5B\u9009\uFF0C\u7A7A\u8868\u793A\u5168\u90E8\uFF0C\u5982 '\u80A1\u7968\u578B' / '\u6307\u6570\u578B-\u80A1\u7968' / '\u6DF7\u5408\u578B-\u504F\u80A1' / 'REITs'"},{flag:"rank",type:"enum",enum:["BZDM","ABBNAME","DJR","FSRQ","FHFCZ","FFR"],default:"FSRQ",cli:!1,desc:"\u6392\u5E8F\u5B57\u6BB5\uFF1ABZDM=\u57FA\u91D1\u4EE3\u7801 / ABBNAME=\u57FA\u91D1\u7B80\u79F0 / DJR=\u6743\u76CA\u767B\u8BB0\u65E5 / FSRQ=\u9664\u606F\u65E5\u671F(\u9ED8\u8BA4) / FHFCZ=\u5206\u7EA2(\u5143/\u4EFD) / FFR=\u5206\u7EA2\u53D1\u653E\u65E5"},{flag:"sort",type:"enum",enum:["asc","desc"],default:"desc",cli:!1,desc:"\u6392\u5E8F\u65B9\u5411\uFF1Aasc=\u5347\u5E8F / desc=\u964D\u5E8F(\u9ED8\u8BA4)"},{flag:"code",type:"string",cli:!1,desc:"\u6309\u57FA\u91D1\u4EE3\u7801\u8FC7\u6EE4\uFF08\u5BA2\u6237\u7AEF\u8FC7\u6EE4\uFF09\uFF0C\u4E00\u822C\u642D\u914D page='all' \u4F7F\u7528"}],e=a=>({name:"symbol",required:!0,desc:a}),n=a=>({name:"code",required:!0,desc:a}),d="\u5355\u53EA\u80A1\u7968\u4EE3\u7801\uFF0C\u5982 600519 / sh600519",de=[{path:["quotes","cn"],toolName:"get_a_share_quotes",tier:"core",summary:"A\u80A1\u5168\u91CF\u884C\u60C5(\u542B\u4E94\u6863)",mcpDesc:"\u83B7\u53D6 A \u80A1 / \u6307\u6570\u5168\u91CF\u884C\u60C5\uFF08\u817E\u8BAF\uFF09\uFF1A\u6700\u65B0\u4EF7\u3001\u6DA8\u8DCC\u5E45\u3001\u4E94\u6863\u76D8\u53E3\u3001\u5E02\u503C\u3001PE/PB \u7B49\u3002",argShape:"codes[]"},{path:["quotes","cnSimple"],toolName:"get_a_share_simple_quotes",summary:"A\u80A1\u7B80\u8981\u884C\u60C5",mcpDesc:"\u83B7\u53D6 A \u80A1 / \u6307\u6570\u7B80\u8981\u884C\u60C5\uFF08\u4EF7\u683C\u3001\u6DA8\u8DCC\u5E45\u3001\u6210\u4EA4\u91CF\u989D\uFF09\u3002",argShape:"codes[]"},{path:["quotes","hk"],toolName:"get_hk_quotes",tier:"core",summary:"\u6E2F\u80A1\u884C\u60C5",mcpDesc:"\u83B7\u53D6\u6E2F\u80A1\u884C\u60C5\u3002\u4EE3\u7801 5 \u4F4D\u6570\u5B57\uFF0C\u5E26\u4E0D\u5E26 hk \u524D\u7F00\u5747\u53EF\uFF08\u5982 00700 / hk00700\uFF09\u3002",argShape:"codes[]"},{path:["quotes","us"],toolName:"get_us_quotes",tier:"core",summary:"\u7F8E\u80A1\u884C\u60C5",mcpDesc:"\u83B7\u53D6\u7F8E\u80A1\u884C\u60C5\u3002\u4EE3\u7801\u5982 AAPL / BABA\u3002",argShape:"codes[]"},{path:["quotes","fund"],toolName:"get_fund_quotes",tier:"core",summary:"\u57FA\u91D1\u884C\u60C5",mcpDesc:"\u83B7\u53D6\u516C\u52DF\u57FA\u91D1\u884C\u60C5\uFF08\u573A\u5185 / \u573A\u5916\uFF0C\u51C0\u503C\u7C7B\uFF09\u3002",argShape:"codes[]"},{path:["quotes","fundFlow"],toolName:"get_fund_flow",summary:"\u8D44\u91D1\u6D41\u5411(\u7B80\u7248)",mcpDesc:"\u83B7\u53D6\u8D44\u91D1\u6D41\u5411\uFF08\u7B80\u7248\uFF0C\u6309\u4EE3\u7801\u6279\u91CF\uFF09\u3002",argShape:"codes[]"},{path:["quotes","largeOrder"],toolName:"get_panel_large_order",summary:"\u76D8\u53E3\u5927\u5355\u5360\u6BD4",mcpDesc:"\u83B7\u53D6\u76D8\u53E3\u5927\u5355\u5360\u6BD4\u3002",argShape:"codes[]"},{path:["quotes","timeline"],toolName:"get_today_timeline",tier:"core",summary:"\u5F53\u65E5\u5206\u65F6",mcpDesc:"\u83B7\u53D6 A \u80A1\u5F53\u65E5\u5206\u65F6\u8D70\u52BF\uFF08\u5355\u53EA\uFF09\u3002",argShape:"positional",positional:[n(d)]},{path:["codes","cn"],toolName:"get_a_share_code_list",summary:"A\u80A1\u4EE3\u7801\u5217\u8868",mcpDesc:"\u83B7\u53D6 A \u80A1\u5168\u91CF\u4EE3\u7801\u5217\u8868\uFF08\u53EF\u6309\u5E02\u573A\u7B5B\u9009 / \u53BB\u4EA4\u6613\u6240\u524D\u7F00\uFF09\u3002",argShape:"options",params:[I,N]},{path:["codes","us"],toolName:"get_us_code_list",summary:"\u7F8E\u80A1\u4EE3\u7801\u5217\u8868",mcpDesc:"\u83B7\u53D6\u7F8E\u80A1\u5168\u91CF\u4EE3\u7801\u5217\u8868\u3002",argShape:"options",params:[W,b]},{path:["codes","hk"],toolName:"get_hk_code_list",summary:"\u6E2F\u80A1\u4EE3\u7801\u5217\u8868",mcpDesc:"\u83B7\u53D6\u6E2F\u80A1\u5168\u91CF\u4EE3\u7801\u5217\u8868\u3002",argShape:"none"},{path:["codes","fund"],toolName:"get_fund_code_list",summary:"\u57FA\u91D1\u4EE3\u7801\u5217\u8868",mcpDesc:"\u83B7\u53D6\u57FA\u91D1\u5168\u91CF\u4EE3\u7801\u5217\u8868\u3002",argShape:"none"},{path:["batch","cn"],toolName:"get_all_a_share_quotes",summary:"\u5168\u5E02\u573AA\u80A1\u884C\u60C5",mcpDesc:"\u6279\u91CF\u62C9\u53D6\u5168\u5E02\u573A A \u80A1\u884C\u60C5\u3002\u26A0\uFE0F \u53EF\u80FD\u8017\u65F6\u6570\u5341\u79D2\u3001\u8FD4\u56DE\u6570\u5343\u6761\uFF08\u7ED3\u679C\u4F1A\u88AB\u88C1\u526A\uFF09\u3002",argShape:"options",params:[c,l,N]},{path:["batch","hk"],toolName:"get_all_hk_quotes",summary:"\u5168\u5E02\u573A\u6E2F\u80A1\u884C\u60C5",mcpDesc:"\u6279\u91CF\u62C9\u53D6\u5168\u5E02\u573A\u6E2F\u80A1\u884C\u60C5\u3002\u26A0\uFE0F \u8017\u65F6\u3002",argShape:"options",params:[c,l]},{path:["batch","us"],toolName:"get_all_us_quotes",summary:"\u5168\u5E02\u573A\u7F8E\u80A1\u884C\u60C5",mcpDesc:"\u6279\u91CF\u62C9\u53D6\u5168\u5E02\u573A\u7F8E\u80A1\u884C\u60C5\u3002\u26A0\uFE0F \u8017\u65F6\u3002",argShape:"options",params:[c,l,b]},{path:["batch","byCodes"],toolName:"get_quotes_by_codes",summary:"\u6309\u4EE3\u7801\u6279\u91CF\u884C\u60C5",mcpDesc:"\u6309\u4EE3\u7801\u5217\u8868\u6279\u91CF\u62C9\u53D6\u5B8C\u6574\u884C\u60C5\u3002",argShape:"codes+options",params:[c,l]},{path:["batch","raw"],summary:"\u817E\u8BAF\u539F\u59CB\u6279\u91CF",argShape:"positional",positional:[{name:"params",required:!0}],mcp:!1},{path:["kline","cn"],toolName:"get_history_kline",tier:"core",summary:"A\u80A1\u5386\u53F2K\u7EBF",mcpDesc:"A \u80A1 / \u6307\u6570\u5386\u53F2 K \u7EBF\uFF08\u65E5 / \u5468 / \u6708\uFF0C\u542B\u590D\u6743\uFF09\uFF1A\u5F00\u9AD8\u4F4E\u6536\u3001\u6210\u4EA4\u91CF\u989D\u3001\u632F\u5E45\u3001\u6DA8\u8DCC\u5E45\u7B49\u3002\u590D\u6743\u9ED8\u8BA4 qfq\uFF08\u524D\u590D\u6743\uFF0C\u770B\u8D70\u52BF\uFF09\uFF1B\u505A\u56DE\u6D4B / \u6536\u76CA\u8BA1\u7B97\u8BF7\u663E\u5F0F\u4F20 hfq\uFF08\u540E\u590D\u6743\uFF09\u6216 ''\uFF08\u4E0D\u590D\u6743\uFF09\u3002\u65E5\u671F\u683C\u5F0F YYYYMMDD\u3002",argShape:"symbol+options",positional:[e("\u80A1\u7968 / \u6307\u6570\u4EE3\u7801\uFF0C\u5982 600519 / sh600519")],params:[s,r,t,o]},{path:["kline","cnMinute"],toolName:"get_minute_kline",tier:"core",summary:"A\u80A1\u5206\u949FK\u7EBF/\u5206\u65F6",mcpDesc:"A \u80A1\u5206\u949F K \u7EBF / \u5F53\u65E5\u5206\u65F6\u3002period=1 \u8FD4\u56DE\u6700\u8FD1\u7EA6 5 \u4E2A\u4EA4\u6613\u65E5\u7684\u5206\u65F6\uFF08\u4E0D\u652F\u6301\u590D\u6743\uFF0C\u53EF\u7528 startDate/endDate \u6536\u7A84\u5230\u5F53\u65E5\uFF09\uFF1Bperiod=5/15/30/60 \u8FD4\u56DE\u5206\u949F K \u7EBF\uFF08adjust \u4EC5\u6B64\u65F6\u6709\u6548\uFF0C\u9ED8\u8BA4 qfq\uFF09\u3002",argShape:"symbol+options",positional:[e("\u80A1\u7968 / \u6307\u6570\u4EE3\u7801\uFF0C\u5982 600519 / sh600519")],params:[u,r,z,j]},{path:["kline","hk"],toolName:"get_hk_history_kline",tier:"core",summary:"\u6E2F\u80A1\u5386\u53F2K\u7EBF",mcpDesc:"\u6E2F\u80A1\u5386\u53F2 K \u7EBF\uFF08\u65E5 / \u5468 / \u6708\uFF0C\u542B\u590D\u6743\uFF0C\u5E01\u79CD HKD\uFF09\u3002\u4EE3\u7801 5 \u4F4D\u6570\u5B57\uFF0C\u5E26\u4E0D\u5E26 hk \u524D\u7F00\u5747\u53EF\uFF08\u5982 00700 / hk00700\uFF09\u3002\u590D\u6743\u9ED8\u8BA4 qfq\uFF1B\u65E5\u671F\u683C\u5F0F YYYYMMDD\u3002",argShape:"symbol+options",positional:[e("\u6E2F\u80A1\u4EE3\u7801\uFF0C\u5982 00700 / hk00700")],params:[s,r,t,o]},{path:["kline","hkMinute"],toolName:"get_hk_minute_kline",summary:"\u6E2F\u80A1\u5206\u949FK\u7EBF/\u5206\u65F6",mcpDesc:"\u6E2F\u80A1\u5206\u949F K \u7EBF / \u5F53\u65E5\u5206\u65F6\u3002period=1 \u8FD4\u56DE\u5F53\u65E5\u5206\u65F6\uFF08\u4E0D\u652F\u6301\u590D\u6743\uFF0C\u53EF\u7528 recentDays \u53D6\u8FD1 N \u65E5\uFF09\uFF1Bperiod=5/15/30/60 \u8FD4\u56DE\u5206\u949F K \u7EBF\uFF08adjust \u4EC5\u6B64\u65F6\u6709\u6548\uFF0C\u9ED8\u8BA4 qfq\uFF09\u3002\u65F6\u95F4\u683C\u5F0F YYYY-MM-DD HH:mm\uFF08\u6E2F\u80A1\u672C\u5730\u65F6\u533A Asia/Hong_Kong\uFF09\u3002",argShape:"symbol+options",positional:[e("\u6E2F\u80A1\u4EE3\u7801\uFF0C\u5982 00700 / hk00700")],params:[u,r,Q,G,M]},{path:["kline","us"],toolName:"get_us_history_kline",tier:"core",summary:"\u7F8E\u80A1\u5386\u53F2K\u7EBF",mcpDesc:"\u7F8E\u80A1\u5386\u53F2 K \u7EBF\uFF08\u65E5 / \u5468 / \u6708\uFF0C\u542B\u590D\u6743\uFF0C\u5E01\u79CD USD\uFF09\u3002\u4EE3\u7801\u683C\u5F0F {market}.{ticker}\uFF08\u5982 105.AAPL / 106.BABA\uFF09\u3002\u590D\u6743\u9ED8\u8BA4 qfq\uFF1B\u65E5\u671F\u683C\u5F0F YYYYMMDD\u3002",argShape:"symbol+options",positional:[e("\u7F8E\u80A1\u4EE3\u7801\uFF0C\u683C\u5F0F {market}.{ticker}\uFF0C\u5982 105.AAPL / 106.BABA")],params:[s,r,t,o]},{path:["kline","usMinute"],toolName:"get_us_minute_kline",summary:"\u7F8E\u80A1\u5206\u949FK\u7EBF/\u5206\u65F6",mcpDesc:"\u7F8E\u80A1\u5206\u949F K \u7EBF / \u5F53\u65E5\u5206\u65F6\uFF08\u4EC5\u5E38\u89C4\u4EA4\u6613\u65F6\u6BB5\uFF0C\u4E0D\u542B\u76D8\u524D / \u76D8\u540E\uFF09\u3002period=1 \u8FD4\u56DE\u5F53\u65E5\u5206\u65F6\uFF08\u4E0D\u652F\u6301\u590D\u6743\uFF0C\u53EF\u7528 recentDays \u53D6\u8FD1 N \u65E5\uFF09\uFF1Bperiod=5/15/30/60 \u8FD4\u56DE\u5206\u949F K \u7EBF\uFF08adjust \u4EC5\u6B64\u65F6\u6709\u6548\uFF0C\u9ED8\u8BA4 qfq\uFF09\u3002\u4EE3\u7801\u683C\u5F0F {market}.{ticker}\uFF0C\u5982 105.AAPL\u3002",argShape:"symbol+options",positional:[e("\u7F8E\u80A1\u4EE3\u7801\uFF0C\u683C\u5F0F {market}.{ticker}\uFF0C\u5982 105.AAPL / 106.BABA")],params:[u,r,Z,X,M]},{path:["kline","withIndicators"],toolName:"get_kline_with_indicators",tier:"core",summary:"\u5E26\u6307\u6807K\u7EBF(--ma 5,10 --macd --kdj --rsi ...)",mcpDesc:"\u5E26\u6280\u672F\u6307\u6807\u7684\u5386\u53F2 K \u7EBF\uFF08A \u80A1 / \u6E2F\u80A1 / \u7F8E\u80A1\uFF0Cmarket \u4E0D\u4F20\u81EA\u52A8\u6309 symbol \u8BC6\u522B\uFF09\u3002\u5468\u671F\u9ED8\u8BA4 daily\uFF0C\u590D\u6743\u9ED8\u8BA4\u6309 SDK \u9ED8\u8BA4\uFF08qfq\uFF09\uFF1B\u65E5\u671F\u652F\u6301 YYYYMMDD \u6216 YYYY-MM-DD\u3002indicators \u4E3A\u5BF9\u8C61\uFF0C\u952E\u53D6\u81EA 14 \u4E2A\u6307\u6807\uFF1Ama / macd / boll / kdj / rsi / wr / bias / cci / atr / obv / roc / dmi / sar / kc\uFF0C\u6BCF\u4E2A\u952E\u4F20 true \u5373\u7528\u9ED8\u8BA4\u53C2\u6570\u5F00\u542F\uFF0C\u6216\u4F20\u914D\u7F6E\u5BF9\u8C61\uFF08\u5982 { ma: { periods: [5,10,20] }, macd: { short: 12, long: 26, signal: 9 } }\uFF09\u3002SDK \u4F1A\u6309\u6307\u6807\u4F9D\u8D56\u81EA\u52A8\u5411\u524D\u591A\u53D6\u82E5\u5E72 bar \u4FDD\u8BC1\u9996\u65E5\u6709\u6548\u3002",argShape:"symbol+options",positional:[e("\u80A1\u7968\u4EE3\u7801\uFF08A \u80A1 / \u6E2F\u80A1 / \u7F8E\u80A1\uFF09")],params:[s,r,t,o,$,...te],mcpCustom:!0},{path:["board","industry","list"],toolName:"get_industry_list",tier:"core",summary:"\u884C\u4E1A\u677F\u5757\u5217\u8868",mcpDesc:"\u83B7\u53D6\u884C\u4E1A\u677F\u5757\u5217\u8868\uFF08\u4E1C\u65B9\u8D22\u5BCC\uFF09\uFF1A\u677F\u5757\u4EE3\u7801\u3001\u540D\u79F0\u3001\u6700\u65B0\u4EF7\u3001\u6DA8\u8DCC\u5E45\u3001\u6210\u4EA4\u989D\u3001\u9886\u6DA8\u80A1\u7B49\u3002\u65E0\u53C2\u3002",argShape:"none"},{path:["board","industry","spot"],toolName:"get_industry_spot",summary:"\u884C\u4E1A\u677F\u5757\u6210\u5206\u884C\u60C5",mcpDesc:"\u83B7\u53D6\u6307\u5B9A\u884C\u4E1A\u677F\u5757\u7684\u6210\u5206\u80A1\u5B9E\u65F6\u884C\u60C5\u5217\u8868\uFF08\u6700\u65B0\u4EF7\u3001\u6DA8\u8DCC\u5E45\u3001\u6210\u4EA4\u91CF\u989D\u7B49\uFF09\u3002symbol \u4E3A\u884C\u4E1A\u677F\u5757\u4EE3\u7801\uFF08\u5982 BK0475\uFF09\u6216\u540D\u79F0\u3002",argShape:"positional",positional:[e("\u884C\u4E1A\u677F\u5757\u4EE3\u7801\uFF08\u5982 BK0475\uFF09\u6216\u677F\u5757\u540D\u79F0")]},{path:["board","industry","constituents"],toolName:"get_industry_constituents",tier:"core",summary:"\u884C\u4E1A\u677F\u5757\u6210\u5206\u80A1",mcpDesc:"\u83B7\u53D6\u6307\u5B9A\u884C\u4E1A\u677F\u5757\u7684\u6210\u5206\u80A1\u5217\u8868\uFF08\u4EE3\u7801\u3001\u540D\u79F0\u7B49\u57FA\u7840\u4FE1\u606F\uFF09\u3002symbol \u4E3A\u884C\u4E1A\u677F\u5757\u4EE3\u7801\uFF08\u5982 BK0475\uFF09\u6216\u540D\u79F0\u3002",argShape:"positional",positional:[e("\u884C\u4E1A\u677F\u5757\u4EE3\u7801\uFF08\u5982 BK0475\uFF09\u6216\u677F\u5757\u540D\u79F0")]},{path:["board","industry","kline"],toolName:"get_industry_kline",summary:"\u884C\u4E1A\u677F\u5757K\u7EBF",mcpDesc:"\u83B7\u53D6\u884C\u4E1A\u677F\u5757\u5386\u53F2 K \u7EBF\uFF08\u65E5/\u5468/\u6708\uFF09\uFF1A\u65E5\u671F\u3001\u5F00\u9AD8\u4F4E\u6536\u3001\u6210\u4EA4\u91CF\u989D\u3001\u6DA8\u8DCC\u5E45\u3002\u4EF7\u683C\u5355\u4F4D\u4E3A\u5143\u3002\u590D\u6743\u9ED8\u8BA4\u4E0D\u590D\u6743\uFF0C\u9700\u524D/\u540E\u590D\u6743\u8BF7\u663E\u5F0F\u4F20 adjust\u3002",argShape:"symbol+options",positional:[e("\u884C\u4E1A\u677F\u5757\u4EE3\u7801\uFF08\u5982 BK0475\uFF09\u6216\u677F\u5757\u540D\u79F0")],params:[s,D,t,o]},{path:["board","industry","minuteKline"],toolName:"get_industry_minute_kline",summary:"\u884C\u4E1A\u677F\u5757\u5206\u65F6",mcpDesc:"\u83B7\u53D6\u884C\u4E1A\u677F\u5757\u5206\u65F6/\u5206\u949F K \u7EBF\u3002period=1 \u8FD4\u56DE\u5F53\u65E5\u5206\u65F6\uFF1B5/15/30/60 \u8FD4\u56DE\u5BF9\u5E94\u5206\u949F K \u7EBF\u3002\u9ED8\u8BA4 5\uFF085 \u5206\u949F K \u7EBF\uFF09\uFF0C\u5F53\u65E5\u5206\u65F6\u8BF7\u4F20 period=1\u3002",argShape:"symbol+options",positional:[e("\u884C\u4E1A\u677F\u5757\u4EE3\u7801\uFF08\u5982 BK0475\uFF09\u6216\u677F\u5757\u540D\u79F0")],params:[S]},{path:["board","concept","list"],toolName:"get_concept_list",tier:"core",summary:"\u6982\u5FF5\u677F\u5757\u5217\u8868",mcpDesc:"\u83B7\u53D6\u6982\u5FF5\u677F\u5757\u5217\u8868\uFF08\u4E1C\u65B9\u8D22\u5BCC\uFF09\uFF1A\u677F\u5757\u4EE3\u7801\u3001\u540D\u79F0\u3001\u6700\u65B0\u4EF7\u3001\u6DA8\u8DCC\u5E45\u3001\u6210\u4EA4\u989D\u3001\u9886\u6DA8\u80A1\u7B49\u3002\u65E0\u53C2\u3002",argShape:"none"},{path:["board","concept","spot"],toolName:"get_concept_spot",summary:"\u6982\u5FF5\u677F\u5757\u6210\u5206\u884C\u60C5",mcpDesc:"\u83B7\u53D6\u6307\u5B9A\u6982\u5FF5\u677F\u5757\u7684\u6210\u5206\u80A1\u5B9E\u65F6\u884C\u60C5\u5217\u8868\uFF08\u6700\u65B0\u4EF7\u3001\u6DA8\u8DCC\u5E45\u3001\u6210\u4EA4\u91CF\u989D\u7B49\uFF09\u3002symbol \u4E3A\u6982\u5FF5\u677F\u5757\u4EE3\u7801\uFF08\u5982 BK0815\uFF09\u6216\u540D\u79F0\u3002",argShape:"positional",positional:[e("\u6982\u5FF5\u677F\u5757\u4EE3\u7801\uFF08\u5982 BK0815\uFF09\u6216\u677F\u5757\u540D\u79F0")]},{path:["board","concept","constituents"],toolName:"get_concept_constituents",tier:"core",summary:"\u6982\u5FF5\u677F\u5757\u6210\u5206\u80A1",mcpDesc:"\u83B7\u53D6\u6307\u5B9A\u6982\u5FF5\u677F\u5757\u7684\u6210\u5206\u80A1\u5217\u8868\uFF08\u4EE3\u7801\u3001\u540D\u79F0\u7B49\u57FA\u7840\u4FE1\u606F\uFF09\u3002symbol \u4E3A\u6982\u5FF5\u677F\u5757\u4EE3\u7801\uFF08\u5982 BK0815\uFF09\u6216\u540D\u79F0\u3002",argShape:"positional",positional:[e("\u6982\u5FF5\u677F\u5757\u4EE3\u7801\uFF08\u5982 BK0815\uFF09\u6216\u677F\u5757\u540D\u79F0")]},{path:["board","concept","kline"],toolName:"get_concept_kline",summary:"\u6982\u5FF5\u677F\u5757K\u7EBF",mcpDesc:"\u83B7\u53D6\u6982\u5FF5\u677F\u5757\u5386\u53F2 K \u7EBF\uFF08\u65E5/\u5468/\u6708\uFF09\uFF1A\u65E5\u671F\u3001\u5F00\u9AD8\u4F4E\u6536\u3001\u6210\u4EA4\u91CF\u989D\u3001\u6DA8\u8DCC\u5E45\u3002\u4EF7\u683C\u5355\u4F4D\u4E3A\u5143\u3002\u590D\u6743\u9ED8\u8BA4\u4E0D\u590D\u6743\uFF0C\u9700\u524D/\u540E\u590D\u6743\u8BF7\u663E\u5F0F\u4F20 adjust\u3002",argShape:"symbol+options",positional:[e("\u6982\u5FF5\u677F\u5757\u4EE3\u7801\uFF08\u5982 BK0815\uFF09\u6216\u677F\u5757\u540D\u79F0")],params:[s,D,t,o]},{path:["board","concept","minuteKline"],toolName:"get_concept_minute_kline",summary:"\u6982\u5FF5\u677F\u5757\u5206\u65F6",mcpDesc:"\u83B7\u53D6\u6982\u5FF5\u677F\u5757\u5206\u65F6/\u5206\u949F K \u7EBF\u3002period=1 \u8FD4\u56DE\u5F53\u65E5\u5206\u65F6\uFF1B5/15/30/60 \u8FD4\u56DE\u5BF9\u5E94\u5206\u949F K \u7EBF\u3002\u9ED8\u8BA4 5\uFF085 \u5206\u949F K \u7EBF\uFF09\uFF0C\u5F53\u65E5\u5206\u65F6\u8BF7\u4F20 period=1\u3002",argShape:"symbol+options",positional:[e("\u6982\u5FF5\u677F\u5757\u4EE3\u7801\uFF08\u5982 BK0815\uFF09\u6216\u677F\u5757\u540D\u79F0")],params:[S]},{path:["options","index","spot"],toolName:"get_index_option_spot",summary:"\u80A1\u6307\u671F\u6743T\u578B\u62A5\u4EF7",mcpDesc:"\u83B7\u53D6\u4E2D\u91D1\u6240\u80A1\u6307\u671F\u6743 T \u578B\u5B9E\u65F6\u62A5\u4EF7\uFF08\u8BA4\u8D2D/\u8BA4\u6CBD\u5206\u5217\uFF09\u3002product=\u4EA7\u54C1\u4EE3\u7801(ho/io/mo)\uFF1Bcontract=\u5408\u7EA6\u6708\u4EFD\u3002",argShape:"positional",positional:[{name:"product",required:!0,enum:L,desc:"\u4EA7\u54C1\u4EE3\u7801\uFF1Aho / io / mo"},{name:"contract",required:!0,desc:"\u5408\u7EA6\uFF08\u6708\u4EFD\uFF09\uFF0C\u5982 2406"}]},{path:["options","index","kline"],toolName:"get_index_option_kline",summary:"\u80A1\u6307\u671F\u6743\u65E5K",mcpDesc:"\u83B7\u53D6\u4E2D\u91D1\u6240\u80A1\u6307\u671F\u6743\u67D0\u5408\u7EA6\u7684\u65E5 K \u7EBF\u3002",argShape:"positional",positional:[e("\u671F\u6743\u5408\u7EA6\u4EE3\u7801")]},{path:["options","etf","months"],toolName:"get_etf_option_months",summary:"ETF\u671F\u6743\u6708\u4EFD",mcpDesc:"\u83B7\u53D6 ETF \u671F\u6743\u53EF\u4EA4\u6613\u6708\u4EFD\u5217\u8868\uFF08\u542B\u6807\u7684/\u54C1\u79CD\u4FE1\u606F\uFF09\u3002cate=\u671F\u6743\u54C1\u79CD\u3002",argShape:"positional",positional:[{name:"cate",required:!0,enum:y,desc:"\u671F\u6743\u54C1\u79CD\uFF1A50ETF / 300ETF / 500ETF / \u79D1\u521B50 / \u79D1\u521B\u677F50"}]},{path:["options","etf","expireDay"],toolName:"get_etf_option_expire_day",summary:"ETF\u671F\u6743\u5230\u671F\u65E5",mcpDesc:"\u83B7\u53D6 ETF \u671F\u6743\u6307\u5B9A\u6708\u4EFD\u7684\u5230\u671F\u65E5\u4E0E\u5269\u4F59\u5929\u6570\u3002month \u683C\u5F0F YYYY-MM\uFF08\u5982 2024-06\uFF09\uFF0C\u53EF\u76F4\u63A5\u53D6\u81EA get_etf_option_months \u8FD4\u56DE\u7684\u6708\u4EFD\u3002",argShape:"positional",positional:[{name:"cate",required:!0,enum:y,desc:"\u671F\u6743\u54C1\u79CD\uFF1A50ETF / 300ETF / 500ETF / \u79D1\u521B50 / \u79D1\u521B\u677F50"},{name:"month",required:!0,desc:"\u6708\u4EFD YYYY-MM\uFF0C\u5982 2024-06\uFF08\u53EF\u53D6\u81EA get_etf_option_months \u8FD4\u56DE\u7684\u6708\u4EFD\uFF09"}]},{path:["options","etf","minute"],toolName:"get_etf_option_minute",summary:"ETF\u671F\u6743\u5F53\u65E5\u5206\u65F6",mcpDesc:"\u83B7\u53D6 ETF \u671F\u6743\u67D0\u5408\u7EA6\u7684\u5F53\u65E5\u5206\u65F6\u6570\u636E\uFF08\u4EF7\u683C\u3001\u6210\u4EA4\u91CF\u3001\u6301\u4ED3\u91CF\u3001\u5747\u4EF7\uFF09\u3002",argShape:"positional",positional:[n("\u671F\u6743\u5408\u7EA6\u4EE3\u7801")]},{path:["options","etf","dailyKline"],toolName:"get_etf_option_daily_kline",summary:"ETF\u671F\u6743\u65E5K",mcpDesc:"\u83B7\u53D6 ETF \u671F\u6743\u67D0\u5408\u7EA6\u7684\u65E5 K \u7EBF\u3002",argShape:"positional",positional:[n("\u671F\u6743\u5408\u7EA6\u4EE3\u7801")]},{path:["options","etf","fiveDayMinute"],toolName:"get_etf_option_five_day_minute",summary:"ETF\u671F\u67435\u65E5\u5206\u65F6",mcpDesc:"\u83B7\u53D6 ETF \u671F\u6743\u67D0\u5408\u7EA6\u7684\u8FD1 5 \u65E5\u5206\u65F6\u6570\u636E\u3002",argShape:"positional",positional:[n("\u671F\u6743\u5408\u7EA6\u4EE3\u7801")]},{path:["options","commodity","spot"],toolName:"get_commodity_option_spot",summary:"\u5546\u54C1\u671F\u6743T\u578B\u62A5\u4EF7",mcpDesc:"\u83B7\u53D6\u5546\u54C1\u671F\u6743 T \u578B\u5B9E\u65F6\u62A5\u4EF7\uFF08\u8BA4\u8D2D/\u8BA4\u6CBD\u5206\u5217\uFF09\u3002variety=\u54C1\u79CD\u4EE3\u7801\uFF08\u5982 cu/m/au\uFF09\uFF1Bcontract=\u5408\u7EA6\u6708\u4EFD\u3002",argShape:"positional",positional:[{name:"variety",required:!0,desc:"\u54C1\u79CD\u4EE3\u7801\uFF0C\u5982 cu / m / au"},{name:"contract",required:!0,desc:"\u5408\u7EA6\uFF08\u6708\u4EFD\uFF09\uFF0C\u5982 2406"}]},{path:["options","commodity","kline"],toolName:"get_commodity_option_kline",summary:"\u5546\u54C1\u671F\u6743\u65E5K",mcpDesc:"\u83B7\u53D6\u5546\u54C1\u671F\u6743\u67D0\u5408\u7EA6\u7684\u65E5 K \u7EBF\u3002",argShape:"positional",positional:[e("\u671F\u6743\u5408\u7EA6\u4EE3\u7801")]},{path:["options","cffex","quotes"],toolName:"get_cffex_option_quotes",summary:"\u4E2D\u91D1\u6240\u671F\u6743\u5F53\u65E5\u62A5\u4EF7",mcpDesc:"\u83B7\u53D6\u4E2D\u91D1\u6240\u5168\u90E8\u671F\u6743\u5B9E\u65F6\u884C\u60C5\u5217\u8868\uFF08\u4EF7\u683C\u3001\u6DA8\u8DCC\u3001\u6210\u4EA4\u3001\u6301\u4ED3\u3001\u884C\u6743\u4EF7\u3001\u5269\u4F59\u5929\u6570\u7B49\uFF09\u3002\u26A0\uFE0F \u4F53\u79EF\u5927\uFF1A\u9ED8\u8BA4 pageSize=20000 \u8FD4\u56DE\u5168\u5E02\u573A\u5408\u7EA6\u3002",argShape:"options",params:[me]},{path:["options","lhb"],toolName:"get_option_lhb",summary:"\u671F\u6743\u9F99\u864E\u699C",mcpDesc:"\u83B7\u53D6\u671F\u6743\u9F99\u864E\u699C\uFF08\u6309\u6807\u7684\u4E0E\u65E5\u671F\uFF0C\u542B\u6210\u4EA4\u91CF/\u6301\u4ED3\u91CF\u6392\u540D\u3001\u4F1A\u5458\u5E2D\u4F4D\u3001\u51C0\u4E70\u5356\u7B49\uFF09\u3002date \u683C\u5F0F YYYY-MM-DD\u3002",argShape:"positional",positional:[{name:"symbol",required:!0,desc:"\u671F\u6743\u6807\u7684/\u5408\u7EA6\u4EE3\u7801"},{name:"date",required:!0,desc:"\u65E5\u671F YYYY-MM-DD\uFF0C\u5982 2024-06-03"}]},{path:["futures","kline"],toolName:"get_futures_kline",tier:"core",summary:"\u56FD\u5185\u671F\u8D27K\u7EBF",mcpDesc:"\u83B7\u53D6\u56FD\u5185\u671F\u8D27\u5386\u53F2 K \u7EBF\uFF08\u4E1C\u8D22\uFF09\uFF1A\u5F00\u9AD8\u4F4E\u6536\u3001\u6210\u4EA4\u91CF\u3001\u6301\u4ED3\u91CF\u7B49\u3002symbol \u4E3A\u5408\u7EA6\u4EE3\u7801\uFF0C\u5982 rb2605(\u87BA\u7EB9\u94A2) / IF2604(\u6CAA\u6DF1300\u80A1\u6307) / au2606(\u9EC4\u91D1)\uFF0Cperiod \u9ED8\u8BA4 daily(\u65E5\u7EBF)\uFF0CstartDate/endDate \u4E3A YYYYMMDD\u3002",argShape:"symbol+options",positional:[e("\u671F\u8D27\u5408\u7EA6\u4EE3\u7801\uFF0C\u5982 rb2605 / IF2604 / au2606")],params:[s,T,t,o]},{path:["futures","globalSpot"],toolName:"get_global_futures_spot",summary:"\u5168\u7403\u671F\u8D27\u5B9E\u65F6\u884C\u60C5",mcpDesc:"\u83B7\u53D6\u5168\u7403\u671F\u8D27\u5B9E\u65F6\u884C\u60C5\uFF08\u4E1C\u8D22\uFF09\uFF1A\u56FD\u9645\u539F\u6CB9\u3001\u9EC4\u91D1\u3001\u5916\u76D8\u6307\u6570\u671F\u8D27\u7B49\u7684\u6700\u65B0\u4EF7\u3001\u6DA8\u8DCC\u5E45\u3001\u6210\u4EA4\u91CF\u3002pageSize \u4E3A\u6BCF\u9875\u6761\u6570\uFF0C\u9ED8\u8BA4 20\u3002",argShape:"options",params:[pe]},{path:["futures","globalKline"],toolName:"get_global_futures_kline",summary:"\u5168\u7403\u671F\u8D27K\u7EBF",mcpDesc:"\u83B7\u53D6\u5168\u7403\u671F\u8D27\u5386\u53F2 K \u7EBF\uFF08\u4E1C\u8D22\uFF09\uFF1A\u5F00\u9AD8\u4F4E\u6536\u3001\u6210\u4EA4\u91CF\u7B49\u3002symbol \u4E3A\u5408\u7EA6\u4EE3\u7801\uFF0Cperiod \u9ED8\u8BA4 daily\uFF0CstartDate/endDate \u4E3A YYYYMMDD\u3002marketCode \u4E3A\u4E1C\u8D22\u5E02\u573A\u4EE3\u7801\uFF08\u7528\u4E8E\u672A\u5185\u7F6E\u54C1\u79CD\uFF0C\u53EF\u4ECE\u5168\u7403\u671F\u8D27\u5B9E\u65F6\u884C\u60C5\u7ED3\u679C\u53CD\u67E5\uFF09\u3002",argShape:"symbol+options",positional:[e("\u5168\u7403\u671F\u8D27\u5408\u7EA6\u4EE3\u7801\uFF0C\u5982 CONC(WTI \u539F\u6CB9) / GC00Y(COMEX \u9EC4\u91D1)")],params:[s,T,t,o,ie]},{path:["futures","inventorySymbols"],toolName:"get_futures_inventory_symbols",summary:"\u671F\u8D27\u5E93\u5B58\u54C1\u79CD\u5217\u8868",mcpDesc:"\u83B7\u53D6\u671F\u8D27\u5E93\u5B58\u54C1\u79CD\u5217\u8868\uFF08\u4E1C\u8D22\uFF09\uFF1A\u53EF\u67E5\u5E93\u5B58\u7684\u54C1\u79CD\u4EE3\u7801\u4E0E\u540D\u79F0\uFF0C\u4F9B get_futures_inventory \u4F7F\u7528\u3002",argShape:"none"},{path:["futures","inventory"],toolName:"get_futures_inventory",summary:"\u671F\u8D27\u5E93\u5B58\u5386\u53F2",mcpDesc:"\u83B7\u53D6\u6307\u5B9A\u54C1\u79CD\u7684\u671F\u8D27\u5E93\u5B58\u5386\u53F2\uFF08\u4E1C\u8D22\uFF09\uFF1A\u4EA4\u6613\u6240\u6CE8\u518C\u4ED3\u5355 / \u5E93\u5B58\u91CF\u53CA\u589E\u51CF\u3002symbol \u4E3A\u54C1\u79CD\u4EE3\u7801\uFF08\u89C1 get_futures_inventory_symbols\uFF09\uFF0CstartDate \u4E3A YYYY-MM-DD(\u9ED8\u8BA4 2020-10-28)\u3002pageSize \u4EC5\u4E3A\u5355\u9875\u6279\u91CF\u5927\u5C0F\uFF08\u9ED8\u8BA4 500\uFF09\uFF0C\u63A5\u53E3\u8FD4\u56DE\u5168\u91CF\u5386\u53F2\uFF0C\u8FC7\u5927\u65F6\u4F1A\u88AB\u88C1\u526A\u3002",argShape:"symbol+options",positional:[e("\u5E93\u5B58\u54C1\u79CD\u4EE3\u7801\uFF08\u89C1 get_futures_inventory_symbols\uFF09")],params:[ce,E]},{path:["futures","comexInventory"],toolName:"get_comex_inventory",summary:"COMEX \u5E93\u5B58",mcpDesc:"\u83B7\u53D6 COMEX \u9EC4\u91D1 / \u767D\u94F6\u5E93\u5B58\u5386\u53F2\uFF08\u4E1C\u8D22\uFF09\uFF1A\u6CE8\u518C\u5E93\u5B58\u3001\u5408\u683C\u5E93\u5B58\u53CA\u603B\u91CF\u53D8\u5316\u3002symbol \u5FC5\u586B\uFF0C\u53D6 'gold'(\u9EC4\u91D1) \u6216 'silver'(\u767D\u94F6)\u3002pageSize \u4EC5\u4E3A\u5355\u9875\u6279\u91CF\u5927\u5C0F\uFF08\u9ED8\u8BA4 500\uFF09\uFF0C\u63A5\u53E3\u8FD4\u56DE\u5168\u91CF\u5386\u53F2\uFF0C\u8FC7\u5927\u65F6\u4F1A\u88AB\u88C1\u526A\u3002",argShape:"symbol+options",positional:[{name:"symbol",required:!0,enum:H,desc:"\u54C1\u79CD\uFF1Agold=\u9EC4\u91D1 / silver=\u767D\u94F6"}],params:[E]},{path:["fundFlow","individual"],toolName:"get_individual_fund_flow",tier:"core",summary:"\u4E2A\u80A1\u8D44\u91D1\u6D41\u5386\u53F2",mcpDesc:"\u83B7\u53D6\u4E2A\u80A1\u8D44\u91D1\u6D41\u5386\u53F2\uFF08\u65E5 / \u5468 / \u6708\uFF09\uFF1A\u4E3B\u529B / \u8D85\u5927\u5355 / \u5927\u5355 / \u4E2D\u5355 / \u5C0F\u5355\u51C0\u6D41\u5165\uFF08\u91D1\u989D\u5355\u4F4D\u5143\u3001\u5360\u6BD4\u4E3A\u767E\u5206\u6BD4\uFF09\u3002",argShape:"symbol+options",positional:[e("\u80A1\u7968\u4EE3\u7801\uFF0C\u5E26\u4E0D\u5E26 sh/sz/bj \u524D\u7F00\u5747\u53EF\uFF0C\u5982 600519 / sh600519")],params:[{...s,cli:!1}]},{path:["fundFlow","market"],toolName:"get_market_fund_flow",summary:"\u5927\u76D8\u8D44\u91D1\u6D41",mcpDesc:"\u83B7\u53D6\u5927\u76D8\u8D44\u91D1\u6D41\uFF08\u4E0A\u8BC1\u7EFC\u6307 + \u6DF1\u8BC1\u6210\u6307(399001)\uFF09\uFF1A\u5404\u5206\u7C7B\u8D44\u91D1\u51C0\u6D41\u5165\u91D1\u989D\uFF08\u5143\uFF09\u4E0E\u5360\u6BD4\uFF08%\uFF09\u3002",argShape:"none"},{path:["fundFlow","rank"],toolName:"get_fund_flow_rank",tier:"core",summary:"\u4E2A\u80A1\u8D44\u91D1\u6D41\u6392\u540D",mcpDesc:"\u83B7\u53D6\u4E2A\u80A1\u8D44\u91D1\u6D41\u6392\u540D\uFF08\u6CAA\u6DF1\u5317 A \u80A1\u5168\u5E02\u573A\uFF09\uFF1A\u6309\u4E3B\u529B\u51C0\u6D41\u5165\u6392\u5E8F\uFF0C\u91D1\u989D\u5355\u4F4D\u5143\u3001\u5360\u6BD4\u4E3A\u767E\u5206\u6BD4\u3002\u26A0\uFE0F \u8FD4\u56DE\u5168\u5E02\u573A\u6570\u5343\u6761\uFF0C\u7ED3\u679C\u88C1\u526A\u81F3\u524D 200\uFF08\u6309\u4E3B\u529B\u51C0\u6D41\u5165\u964D\u5E8F\uFF09\uFF0C\u5B8C\u6574\u6570\u636E\u8BF7\u76F4\u63A5\u7528 SDK\u3002",argShape:"options",params:[A]},{path:["fundFlow","sectorRank"],toolName:"get_sector_fund_flow_rank",summary:"\u677F\u5757\u8D44\u91D1\u6D41\u6392\u540D",mcpDesc:"\u83B7\u53D6\u677F\u5757\u8D44\u91D1\u6D41\u6392\u540D\uFF08\u884C\u4E1A / \u6982\u5FF5 / \u5730\u57DF\uFF09\uFF1A\u6309\u677F\u5757\u4E3B\u529B\u51C0\u6D41\u5165\u6392\u5E8F\uFF0C\u91D1\u989D\u5355\u4F4D\u5143\u3001\u5360\u6BD4\u4E3A\u767E\u5206\u6BD4\u3002",argShape:"options",params:[A,oe]},{path:["fundFlow","sectorHistory"],toolName:"get_sector_fund_flow_history",summary:"\u5355\u677F\u5757\u5386\u53F2\u8D44\u91D1\u6D41",mcpDesc:"\u83B7\u53D6\u5355\u4E2A\u677F\u5757\u7684\u5386\u53F2\u8D44\u91D1\u6D41\uFF08\u65E5 / \u5468 / \u6708\uFF09\uFF1A\u5404\u5206\u7C7B\u8D44\u91D1\u51C0\u6D41\u5165\u91D1\u989D\uFF08\u5143\uFF09\u4E0E\u5360\u6BD4\uFF08%\uFF09\u3002symbol \u4E3A\u677F\u5757\u7F16\u53F7\uFF0C\u5982 BK0438 \u6216\u5168\u524D\u7F00 90.BK0438\u3002",argShape:"symbol+options",positional:[e("\u677F\u5757\u7F16\u53F7\uFF0C\u5982 BK0438 \u6216\u5168\u524D\u7F00 90.BK0438")],params:[{...s,cli:!1}]},{path:["northbound","minute"],toolName:"get_northbound_minute",summary:"\u5317\u5411/\u5357\u5411\u5206\u65F6(--direction north|south \u6216\u4F4D\u7F6E\u53C2\u6570)",mcpDesc:"\u83B7\u53D6\u5317\u5411 / \u5357\u5411\u8D44\u91D1\u5206\u65F6\u6570\u636E\uFF08\u5F53\u65E5\uFF0C\u6309 HH:MM\uFF09\u3002\u8FD4\u56DE\u6CAA/\u6DF1\u5206\u9879\u4E0E\u5408\u8BA1\u51C0\u6D41\u5165\uFF08\u5355\u4F4D:\u4E07\u5143\uFF09\u3002direction:north=\u5317\u5411(\u9ED8\u8BA4) / south=\u5357\u5411\u3002",argShape:"positional",positional:[{name:"direction",enum:_,default:"north",desc:"\u8D44\u91D1\u65B9\u5411:north=\u5317\u5411(\u9ED8\u8BA4) / south=\u5357\u5411"}],params:[k]},{path:["northbound","summary"],toolName:"get_northbound_flow_summary",tier:"core",summary:"\u6CAA\u6DF1\u6E2F\u901A\u8D44\u91D1\u6C47\u603B",mcpDesc:"\u83B7\u53D6\u6CAA\u6DF1\u6E2F\u901A\u5E02\u573A\u8D44\u91D1\u6D41\u5411\u6C47\u603B\uFF08\u5317\u5411 + \u5357\u5411 + \u6E2F\u80A1\u901A\u62C6\u5206\uFF09\uFF1A\u542B\u677F\u5757\u540D\u3001\u51C0\u4E70\u989D/\u51C0\u6D41\u5165(\u5143)\u3001\u5F53\u65E5\u4F59\u989D\u3001\u76F8\u5173\u6307\u6570\u6DA8\u8DCC\u5E45\u7B49\u3002",argShape:"none"},{path:["northbound","holdingRank"],toolName:"get_northbound_holding_rank",summary:"\u5317\u5411\u6301\u80A1\u6392\u884C",mcpDesc:"\u83B7\u53D6\u5317\u5411 / \u6CAA\u80A1\u901A / \u6DF1\u80A1\u901A\u6301\u80A1\u4E2A\u80A1\u6392\u884C\uFF1A\u542B\u6301\u80A1\u80A1\u6570\u3001\u6301\u80A1\u5E02\u503C(\u5143)\u3001\u5360\u6D41\u901A\u80A1/\u603B\u80A1\u672C\u6BD4(%)\u3001\u533A\u95F4\u589E\u6301\u4F30\u8BA1\u7B49\u3002market:all(\u9ED8\u8BA4)/shanghai/shenzhen;period \u9ED8\u8BA4 5day;date \u987B\u4E3A\u6709\u6570\u636E\u7684\u4EA4\u6613\u65E5\uFF0C\u5426\u5219\u8FD4\u56DE\u7A7A\u3002",argShape:"options",params:[se,re,ne]},{path:["northbound","history"],toolName:"get_northbound_history",summary:"\u5317\u5411/\u5357\u5411\u5386\u53F2(--direction north|south\uFF1B--start/--end)",mcpDesc:"\u83B7\u53D6\u5317\u5411 / \u5357\u5411\u8D44\u91D1\u5386\u53F2\uFF08\u6309\u65E5\uFF09\uFF1A\u6210\u4EA4\u51C0\u4E70\u989D\u3001\u4E70/\u5356\u6210\u4EA4\u989D\u3001\u5386\u53F2\u7D2F\u8BA1\u51C0\u4E70\u989D\u3001\u5F53\u65E5\u8D44\u91D1\u6D41\u5165/\u4F59\u989D(\u5143)\u53CA\u9886\u6DA8\u80A1\u3002direction:north(\u9ED8\u8BA4)/south;\u4E0D\u4F20 startDate/endDate \u53D6\u5168\u91CF\u533A\u95F4\u3002",argShape:"symbol+options",positional:[{name:"direction",enum:_,default:"north",desc:"\u8D44\u91D1\u65B9\u5411:north=\u5317\u5411(\u9ED8\u8BA4) / south=\u5357\u5411"}],params:[k,q,R]},{path:["northbound","individual"],toolName:"get_northbound_individual",summary:"\u4E2A\u80A1\u5317\u5411\u6301\u4ED3\u5386\u53F2",mcpDesc:"\u83B7\u53D6\u4E2A\u80A1\u7684\u5317\u5411\u6301\u4ED3\u5386\u53F2\uFF08\u6309\u65E5\uFF09\uFF1A\u6301\u80A1\u6570\u91CF\u3001\u6301\u80A1\u5E02\u503C(\u5143)\u3001\u5360\u6D41\u901A\u80A1/\u603B\u80A1\u672C\u6BD4(%)\u3001\u5F53\u65E5\u6536\u76D8\u4EF7\u4E0E\u6DA8\u8DCC\u5E45\u3002\u4E0D\u4F20 startDate/endDate \u53D6\u5168\u91CF\u533A\u95F4\u3002",argShape:"symbol+options",positional:[e(d)],params:[V,J]},{path:["marketEvent","ztPool"],toolName:"get_zt_pool",tier:"core",summary:"\u6DA8\u505C\u80A1\u6C60",mcpDesc:"\u83B7\u53D6\u6DA8\u505C\u80A1\u6C60\uFF08\u4E1C\u65B9\u8D22\u5BCC\uFF09\uFF1A\u6DA8\u505C / \u6628\u65E5\u6DA8\u505C / \u5F3A\u52BF / \u6B21\u65B0 / \u70B8\u677F / \u8DCC\u505C\u3002\u5B57\u6BB5\u542B\u4EF7\u683C(\u5143)\u3001\u6DA8\u8DCC\u5E45(%)\u3001\u6210\u4EA4\u989D(\u5143)\u3001\u6D41\u901A/\u603B\u5E02\u503C(\u5143)\u3001\u6362\u624B\u7387(%)\u3001\u8FDE\u677F\u6570\u3001\u5C01\u677F\u65F6\u95F4(HHMMSS) \u7B49\u3002type \u9ED8\u8BA4 zt\uFF1Bdate \u4E0D\u4F20\u4E3A\u6700\u65B0\u4EA4\u6613\u65E5\u3002",argShape:"positional",positional:[{name:"type",enum:x,default:"zt",desc:"\u80A1\u6C60\u7C7B\u578B\uFF1Azt=\u6DA8\u505C / yesterday=\u6628\u65E5\u6DA8\u505C / strong=\u5F3A\u52BF / sub_new=\u6B21\u65B0 / broken=\u70B8\u677F / dt=\u8DCC\u505C"},{name:"date",desc:"\u65E5\u671F YYYYMMDD \u6216 YYYY-MM-DD\uFF0C\u4E0D\u4F20\u4E3A\u6700\u65B0\u4EA4\u6613\u65E5"}]},{path:["marketEvent","stockChanges"],toolName:"get_stock_changes",summary:"\u76D8\u53E3\u5F02\u52A8",mcpDesc:"\u83B7\u53D6\u5F53\u65E5\u76D8\u53E3\u5F02\u52A8\u5217\u8868\uFF08\u4E1C\u65B9\u8D22\u5BCC\uFF09\uFF1A\u6BCF\u6761\u542B\u53D1\u751F\u65F6\u95F4(HH:MM:SS)\u3001\u4EE3\u7801\u3001\u540D\u79F0\u3001\u5F02\u52A8\u7C7B\u578B\u53CA\u4E2D\u6587\u6807\u7B7E\u3001\u76F8\u5173\u4FE1\u606F\u3002type \u4E0D\u4F20\u9ED8\u8BA4 large_buy(\u5927\u7B14\u4E70\u5165)\u3002",argShape:"positional",positional:[{name:"type",enum:U,default:"large_buy",desc:"\u5F02\u52A8\u7C7B\u578B\u7B5B\u9009\uFF1Arocket_launch=\u706B\u7BAD\u53D1\u5C04 / quick_rebound=\u5FEB\u901F\u53CD\u5F39 / large_buy=\u5927\u7B14\u4E70\u5165 / limit_up_seal=\u5C01\u6DA8\u505C\u677F / limit_down_open=\u6253\u5F00\u8DCC\u505C\u677F / big_buy_order=\u6709\u5927\u4E70\u76D8 / auction_up=\u7ADE\u4EF7\u4E0A\u6DA8 / high_open_5d=\u9AD8\u5F005\u65E5\u7EBF / gap_up=\u5411\u4E0A\u7F3A\u53E3 / high_60d=60\u65E5\u65B0\u9AD8 / surge_60d=60\u65E5\u5927\u5E45\u4E0A\u6DA8 / accelerate_down=\u52A0\u901F\u4E0B\u8DCC / high_dive=\u9AD8\u53F0\u8DF3\u6C34 / large_sell=\u5927\u7B14\u5356\u51FA / limit_down_seal=\u5C01\u8DCC\u505C\u677F / limit_up_open=\u6253\u5F00\u6DA8\u505C\u677F / big_sell_order=\u6709\u5927\u5356\u76D8 / auction_down=\u7ADE\u4EF7\u4E0B\u8DCC / low_open_5d=\u4F4E\u5F005\u65E5\u7EBF / gap_down=\u5411\u4E0B\u7F3A\u53E3 / low_60d=60\u65E5\u65B0\u4F4E / drop_60d=60\u65E5\u5927\u5E45\u4E0B\u8DCC"}]},{path:["marketEvent","boardChanges"],toolName:"get_board_changes",summary:"\u677F\u5757\u5F02\u52A8",mcpDesc:"\u83B7\u53D6\u5F53\u65E5\u677F\u5757\u5F02\u52A8\u6C47\u603B\uFF08\u4E1C\u65B9\u8D22\u5BCC\uFF09\uFF1A\u6BCF\u6761\u542B\u677F\u5757\u540D\u79F0\u3001\u6DA8\u8DCC\u5E45(%)\u3001\u4E3B\u529B\u51C0\u6D41\u5165(\u5143)\u3001\u5F02\u52A8\u603B\u6B21\u6570\u3001\u5F02\u52A8\u6700\u9891\u7E41\u4E2A\u80A1\uFF08\u4EE3\u7801 / \u540D\u79F0 / \u65B9\u5411\uFF09\u53CA\u5F02\u52A8\u7C7B\u578B\u5206\u5E03\u3002\u65E0\u53C2\u3002",argShape:"none"},{path:["dragonTiger","detail"],toolName:"get_dragon_tiger_detail",tier:"core",summary:"\u9F99\u864E\u699C\u8BE6\u60C5(\u5FC5\u586B --start/--end)",mcpDesc:"\u83B7\u53D6\u9F99\u864E\u699C\u4E0A\u699C\u4E2A\u80A1\u660E\u7EC6\uFF08\u6309\u65E5\u671F\u8303\u56F4\uFF09\uFF1A\u4EE3\u7801\u3001\u540D\u79F0\u3001\u4E0A\u699C\u65E5\u671F\u3001\u6536\u76D8\u4EF7\u3001\u6DA8\u8DCC\u5E45(%)\u3001\u51C0\u4E70\u989D/\u4E70\u5165\u989D/\u5356\u51FA\u989D/\u6210\u4EA4\u989D(\u5143)\u3001\u5360\u603B\u6210\u4EA4\u6BD4(%)\u3001\u6362\u624B\u7387(%)\u3001\u6D41\u901A\u5E02\u503C(\u5143)\u3001\u4E0A\u699C\u539F\u56E0\u3001\u4E0A\u699C\u540E 1/2/5/10 \u65E5\u6DA8\u8DCC\u5E45(%)\u3002\u65E5\u671F\u683C\u5F0F YYYYMMDD\uFF0CstartDate / endDate \u5747\u5FC5\u586B\u3002\u65E5\u671F\u533A\u95F4\u8FC7\u5927\u65F6\u7ED3\u679C\u8D85 200 \u6761\u4F1A\u88AB\u88C1\u526A\uFF0C\u8BF7\u6536\u7A84\u533A\u95F4\u3002",argShape:"options",params:[Y,f]},{path:["dragonTiger","stockStats"],toolName:"get_dragon_tiger_stock_stats",summary:"\u4E2A\u80A1\u4E0A\u699C\u7EDF\u8BA1",mcpDesc:"\u83B7\u53D6\u9F99\u864E\u699C\u4E2A\u80A1\u4E0A\u699C\u7EDF\u8BA1\uFF08\u6309\u5468\u671F\u805A\u5408\uFF09\uFF1A\u4EE3\u7801\u3001\u540D\u79F0\u3001\u6700\u8FD1\u4E0A\u699C\u65E5\u3001\u6536\u76D8\u4EF7\u3001\u6DA8\u8DCC\u5E45(%)\u3001\u4E0A\u699C\u6B21\u6570\u3001\u7D2F\u8BA1\u4E70\u5165/\u5356\u51FA/\u51C0\u989D/\u6210\u4EA4\u989D(\u5143)\u3001\u7D2F\u8BA1\u4E70/\u5356\u65B9\u673A\u6784\u6B21\u6570\u3002period \u53EF\u9009\uFF0C\u9ED8\u8BA4 1month\u3002\u26A0\uFE0F \u8FD4\u56DE\u5168\u5E02\u573A\uFF0C\u53EF\u80FD\u6570\u767E\u81F3\u4E0A\u5343\u6761\uFF0C\u8D85 200 \u6761\u4F1A\u88AB\u88C1\u526A\u3002",argShape:"positional",positional:[{name:"period",enum:h,default:"1month",desc:P}]},{path:["dragonTiger","institution"],toolName:"get_dragon_tiger_institution",summary:"\u673A\u6784\u4E70\u5356\u7EDF\u8BA1(\u5FC5\u586B --start/--end)",mcpDesc:"\u83B7\u53D6\u9F99\u864E\u699C\u673A\u6784\u4E70\u5356\u660E\u7EC6\uFF08\u6309\u65E5\u671F\u8303\u56F4\uFF09\uFF1A\u4EE3\u7801\u3001\u540D\u79F0\u3001\u4E0A\u699C\u65E5\u671F\u3001\u6536\u76D8\u4EF7\u3001\u6DA8\u8DCC\u5E45(%)\u3001\u4E70/\u5356\u65B9\u673A\u6784\u6570\u3001\u673A\u6784\u4E70\u5165\u989D/\u5356\u51FA\u989D/\u51C0\u989D(\u5143)\u3002\u65E5\u671F\u683C\u5F0F YYYYMMDD\uFF0CstartDate / endDate \u5747\u5FC5\u586B\u3002\u65E5\u671F\u533A\u95F4\u8FC7\u5927\u65F6\u7ED3\u679C\u8D85 200 \u6761\u4F1A\u88AB\u88C1\u526A\uFF0C\u8BF7\u6536\u7A84\u533A\u95F4\u3002",argShape:"options",params:[Y,f]},{path:["dragonTiger","branchRank"],toolName:"get_dragon_tiger_branch_rank",summary:"\u8425\u4E1A\u90E8\u6392\u884C",mcpDesc:"\u83B7\u53D6\u9F99\u864E\u699C\u8425\u4E1A\u90E8\uFF08\u5E2D\u4F4D\uFF09\u6392\u884C\uFF08\u6309\u5468\u671F\u805A\u5408\uFF09\uFF1A\u8425\u4E1A\u90E8\u4EE3\u7801\u3001\u540D\u79F0\u3001\u4E70\u5165\u603B\u989D/\u5356\u51FA\u603B\u989D(\u5143)\u3001\u4E70\u5165/\u5356\u51FA\u6B21\u6570\u3001\u4E0A\u699C\u6B21\u6570\u3002period \u53EF\u9009\uFF0C\u9ED8\u8BA4 1month\u3002\u26A0\uFE0F \u8FD4\u56DE\u5168\u5E02\u573A\uFF0C\u53EF\u80FD\u6570\u767E\u81F3\u4E0A\u5343\u6761\uFF0C\u8D85 200 \u6761\u4F1A\u88AB\u88C1\u526A\u3002",argShape:"positional",positional:[{name:"period",enum:h,default:"1month",desc:P}]},{path:["dragonTiger","seatDetail"],toolName:"get_dragon_tiger_seat_detail",summary:"\u4E2A\u80A1\u5E2D\u4F4D\u660E\u7EC6",mcpDesc:"\u83B7\u53D6\u4E2A\u80A1\u67D0\u65E5\u9F99\u864E\u699C\u5E2D\u4F4D\u660E\u7EC6\uFF1A\u6392\u540D\u3001\u8425\u4E1A\u90E8\u540D\u79F0\u3001\u4E70\u5165\u989D/\u5356\u51FA\u989D/\u51C0\u989D(\u5143)\u3001\u4E70\u5165/\u5356\u51FA\u5360\u603B\u6210\u4EA4\u6BD4(%)\u3001\u4E70\u5356\u65B9\u5411(buy/sell)\u3002symbol \u4E0E date \u5747\u5FC5\u586B\uFF1Bdate \u652F\u6301 YYYYMMDD \u6216 YYYY-MM-DD\u3002",argShape:"positional",positional:[{name:"symbol",required:!0,desc:d},{name:"date",required:!0,desc:"\u4E0A\u699C\u65E5\u671F\uFF0CYYYYMMDD \u6216 YYYY-MM-DD"}]},{path:["blockTrade","marketStat"],summary:"\u5927\u5B97\u4EA4\u6613\u5E02\u573A\u7EDF\u8BA1",argShape:"none",mcp:!1},{path:["blockTrade","detail"],summary:"\u5927\u5B97\u4EA4\u6613\u660E\u7EC6",argShape:"options",mcp:!1},{path:["blockTrade","dailyStat"],summary:"\u5927\u5B97\u4EA4\u6613\u6BCF\u65E5\u7EDF\u8BA1",argShape:"options",mcp:!1},{path:["margin","accountInfo"],summary:"\u878D\u8D44\u878D\u5238\u8D26\u6237\u7EDF\u8BA1",argShape:"none",mcp:!1},{path:["margin","targetList"],summary:"\u878D\u8D44\u878D\u5238\u6807\u7684",argShape:"positional",positional:[{name:"date"}],mcp:!1},{path:["fund","dividendList"],toolName:"get_fund_dividend_list",summary:"\u57FA\u91D1\u5206\u7EA2\u660E\u7EC6",mcpDesc:"\u83B7\u53D6\u57FA\u91D1\u5206\u7EA2\u660E\u7EC6\u5217\u8868\uFF08\u4E1C\u65B9\u8D22\u5BCC\u5206\u7EA2\u9001\u914D\u9891\u9053\uFF09\u3002\u63A5\u53E3\u4EC5\u652F\u6301\u300C\u5E74\u4EFD+\u5168\u5E02\u573A+\u7FFB\u9875\u300D\u67E5\u8BE2\uFF0C\u4E0D\u652F\u6301\u670D\u52A1\u7AEF\u6309\u4EE3\u7801\u7CBE\u786E\u67E5\uFF1B\u8981\u62FF\u5355\u53EA\u57FA\u91D1\u5B8C\u6574\u5206\u7EA2\u8BB0\u5F55\u8BF7\u540C\u65F6\u8BBE page='all' \u4E0E code\uFF08code \u4E3A\u5BA2\u6237\u7AEF\u8FC7\u6EE4\uFF09\u3002\u9ED8\u8BA4\u62C9\u5F53\u524D\u5E74\u7B2C 1 \u9875\u3001\u6309\u9664\u606F\u65E5(FSRQ)\u5012\u5E8F\u3002",argShape:"options",params:le},{path:["fund","navHistory"],toolName:"get_fund_nav_history",summary:"\u57FA\u91D1\u5386\u53F2\u51C0\u503C",mcpDesc:"\u83B7\u53D6\u57FA\u91D1\u5386\u53F2\u51C0\u503C\uFF08\u5355\u4F4D\u51C0\u503C + \u7D2F\u8BA1\u51C0\u503C\uFF0C\u5168\u5386\u53F2\u4E00\u6B21\u8FD4\u56DE\uFF0C\u6309\u65E5\u671F\u5347\u5E8F\uFF09\u3002\u5F00\u653E\u5F0F / ETF / LOF / \u8D27\u5E01 / QDII \u5747\u901A\u7528\u3002\u26A0\uFE0F \u4F53\u79EF\u5927\uFF1A\u5168\u5386\u53F2\u6570\u5343\u6761\u3001\u54CD\u5E94\u4F53\u7EA6 600KB\uFF0C\u5EFA\u8BAE\u5E94\u7528\u5C42\u7F13\u5B58\u3002",argShape:"positional",positional:[n("\u57FA\u91D1\u4EE3\u7801\uFF0C\u7EAF\u6570\u5B57\uFF0C\u5982 110011")]},{path:["fund","estimate"],toolName:"get_fund_estimate",tier:"core",summary:"\u57FA\u91D1\u5F53\u65E5\u4F30\u503C",mcpDesc:"\u83B7\u53D6\u57FA\u91D1\u5F53\u65E5\u5B9E\u65F6\u4F30\u503C\uFF08\u5929\u5929\u57FA\u91D1 fundgz \u63A5\u53E3\uFF09\u3002\u540C\u65F6\u8FD4\u56DE\u6700\u65B0\u5DF2\u7ED3\u7B97\u5355\u4F4D\u51C0\u503C\uFF08nav/navDate\uFF09\u4E0E\u76D8\u4E2D\u5B9E\u65F6\u4F30\u7B97\uFF08estimatedNav/estimatedChangePercent/estimateTime\uFF0C\u6DA8\u8DCC\u5E45\u5355\u4F4D %\uFF09\u3002QDII / \u975E\u4EA4\u6613\u65E5 / \u90E8\u5206\u5C0F\u4F17\u57FA\u91D1\u7684\u4F30\u7B97\u5B57\u6BB5\u53EF\u80FD\u4E3A null\u3002",argShape:"positional",positional:[n("\u57FA\u91D1\u4EE3\u7801\uFF0C\u7EAF\u6570\u5B57\uFF0C\u5982 005827")]},{path:["fund","rankHistory"],toolName:"get_fund_rank_history",summary:"\u57FA\u91D1\u540C\u7C7B\u6392\u540D\u8D70\u52BF",mcpDesc:"\u83B7\u53D6\u57FA\u91D1\u540C\u7C7B\u6392\u540D\u8D70\u52BF\uFF08\u6BCF\u65E5\u8FD1\u4E09\u6708\u6392\u540D + \u540C\u7C7B\u603B\u6570 + \u6392\u540D\u767E\u5206\u4F4D %\uFF0C\u6309\u65E5\u671F\u5347\u5E8F\uFF09\u3002\u9002\u5408\u753B\u300C\u8BE5\u57FA\u91D1\u5728\u540C\u7C7B\u91CC\u7684\u76F8\u5BF9\u8868\u73B0\u300D\u6298\u7EBF\u56FE\u3002\u6570\u636E\u6E90\u540C get_fund_nav_history\u3002",argShape:"positional",positional:[n("\u57FA\u91D1\u4EE3\u7801\uFF0C\u7EAF\u6570\u5B57\uFF0C\u5982 110011")]},{path:["calendar","isTradingDay"],toolName:"is_trading_day",tier:"core",summary:"\u662F\u5426\u4EA4\u6613\u65E5",mcpDesc:"\u5224\u65AD\u67D0\u5929\u662F\u5426\u4E3A A \u80A1\u4EA4\u6613\u65E5\uFF08\u57FA\u4E8E\u4E0A\u6E38\u5B98\u65B9\u65E5\u5386\uFF0C\u80FD\u8BC6\u522B\u6CD5\u5B9A\u5047\u65E5\uFF09\u3002date \u53EF\u9009\uFF0C\u652F\u6301 YYYY-MM-DD \u6216 YYYYMMDD\uFF1B\u4E0D\u4F20\u5219\u5224\u65AD\u4ECA\u5929\u3002\u8FD4\u56DE boolean\u3002",argShape:"positional",positional:[{name:"date",desc:"\u65E5\u671F YYYY-MM-DD \u6216 YYYYMMDD\uFF1B\u4E0D\u4F20\u4E3A\u4ECA\u5929"}]},{path:["calendar","nextTradingDay"],toolName:"next_trading_day",summary:"\u4E0B\u4E00\u4EA4\u6613\u65E5",mcpDesc:"\u8FD4\u56DE\u7ED9\u5B9A\u65E5\u671F\u4E4B\u540E\u6700\u8FD1\u7684\u4E00\u4E2A A \u80A1\u4EA4\u6613\u65E5\uFF08YYYY-MM-DD\uFF09\u3002date \u53EF\u9009\uFF0C\u652F\u6301 YYYY-MM-DD \u6216 YYYYMMDD\uFF1B\u4E0D\u4F20\u5219\u4EE5\u4ECA\u5929\u4E3A\u57FA\u51C6\u3002",argShape:"positional",positional:[{name:"date",desc:"\u57FA\u51C6\u65E5\u671F YYYY-MM-DD \u6216 YYYYMMDD\uFF1B\u4E0D\u4F20\u4E3A\u4ECA\u5929"}]},{path:["calendar","prevTradingDay"],toolName:"prev_trading_day",summary:"\u4E0A\u4E00\u4EA4\u6613\u65E5",mcpDesc:"\u8FD4\u56DE\u7ED9\u5B9A\u65E5\u671F\u4E4B\u524D\u6700\u8FD1\u7684\u4E00\u4E2A A \u80A1\u4EA4\u6613\u65E5\uFF08YYYY-MM-DD\uFF09\u3002date \u53EF\u9009\uFF0C\u652F\u6301 YYYY-MM-DD \u6216 YYYYMMDD\uFF1B\u4E0D\u4F20\u5219\u4EE5\u4ECA\u5929\u4E3A\u57FA\u51C6\u3002",argShape:"positional",positional:[{name:"date",desc:"\u57FA\u51C6\u65E5\u671F YYYY-MM-DD \u6216 YYYYMMDD\uFF1B\u4E0D\u4F20\u4E3A\u4ECA\u5929"}]},{path:["calendar","marketStatus"],toolName:"get_market_status",tier:"core",summary:"\u5E02\u573A\u72B6\u6001",mcpDesc:"\u83B7\u53D6\u5E02\u573A\u5F53\u524D\u5B9E\u65F6\u72B6\u6001\uFF1Apre_market(\u76D8\u524D) / open(\u4EA4\u6613\u4E2D) / lunch_break(\u5348\u4F11) / after_hours(\u76D8\u540E) / closed(\u4F11\u5E02)\u3002market \u53EF\u9009\u679A\u4E3E A/HK/US\uFF0C\u9ED8\u8BA4 A\u3002\u26A0\uFE0F \u540C\u6B65\u672C\u5730\u65F6\u949F\u5224\u65AD\u3001\u4E0D\u53D1\u8BF7\u6C42\uFF1AA \u80A1\u57FA\u4E8E\u4EA4\u6613\u65F6\u6BB5\u4F46\u4E0D\u8BC6\u522B\u6CD5\u5B9A\u5047\u65E5\uFF0C\u6E2F\u80A1/\u7F8E\u80A1\u9000\u5316\u4E3A'\u5468\u4E00-\u5468\u4E94 + \u5DF2\u77E5\u4EA4\u6613\u65F6\u6BB5'\u8FD1\u4F3C\u3002",argShape:"positional",positional:[{name:"market",upper:!0,enum:K,default:"A",desc:"\u5E02\u573A\uFF1AA=A\u80A1 / HK=\u6E2F\u80A1 / US=\u7F8E\u80A1\uFF0C\u9ED8\u8BA4 A"}]},{path:["reference","dividendDetail"],toolName:"get_dividend_detail",summary:"\u5206\u7EA2\u914D\u80A1\u660E\u7EC6",mcpDesc:"\u83B7\u53D6 A \u80A1\u5206\u7EA2\u914D\u80A1\u660E\u7EC6\uFF1A\u5386\u5E74\u9001\u8F6C\u3001\u6D3E\u606F\uFF08\u6BCF 10 \u80A1\u6D3E X \u5143\uFF09\u3001\u9664\u6743\u9664\u606F\u65E5\u3001\u80A1\u6743\u767B\u8BB0\u65E5\u7B49\u3002\u4EE3\u7801\u5E26\u4E0D\u5E26\u4EA4\u6613\u6240\u524D\u7F00\u5747\u53EF\uFF08\u5982 600519 / sh600519\uFF09\u3002",argShape:"positional",positional:[e(d)]},{path:["reference","tradingCalendar"],toolName:"get_trading_calendar",summary:"\u4EA4\u6613\u65E5\u5386(\u539F\u59CB\u6570\u7EC4)",mcpDesc:"\u83B7\u53D6 A \u80A1\u4EA4\u6613\u65E5\u5386\u539F\u59CB\u6570\u7EC4\uFF08\u5347\u5E8F 'YYYY-MM-DD' \u5B57\u7B26\u4E32\u5217\u8868\uFF0C\u6765\u81EA\u817E\u8BAF\u63A5\u53E3\uFF0C\u5E26 12 \u5C0F\u65F6\u7F13\u5B58\uFF09\u3002\u26A0\uFE0F \u4F53\u79EF\u5927\uFF1A\u8FD4\u56DE\u6570\u5343\u4E2A\u4EA4\u6613\u65E5\u3002\u53EA\u9700\u5224\u65AD\u67D0\u65E5\u662F\u5426\u4EA4\u6613\u65E5 / \u53D6\u4E0A\u4E00\u6216\u4E0B\u4E00\u4EA4\u6613\u65E5\u65F6\uFF0C\u4F18\u5148\u7528 calendar \u547D\u540D\u7A7A\u95F4\u4E0B\u7684\u5DE5\u5177\uFF0C\u65E0\u9700\u62C9\u5168\u91CF\u3002",argShape:"none"},{path:["search"],toolName:"search",tier:"core",summary:"\u641C\u7D22\u80A1\u7968/\u6307\u6570/\u57FA\u91D1",mcpDesc:"\u6A21\u7CCA\u641C\u7D22\u80A1\u7968 / \u6307\u6570 / \u57FA\u91D1\uFF08\u4EE3\u7801 / \u540D\u79F0 / \u62FC\u97F3\uFF09\u3002\u8FD4\u56DE code\u3001name\u3001market\u3001category\u3002",argShape:"positional",positional:[{name:"keyword",required:!0,desc:"\u641C\u7D22\u5173\u952E\u8BCD"}]}];function ge(a){let p=de.find(m=>m.path.join(".")===a);if(!p)throw new Error(`spec \u4E2D\u4E0D\u5B58\u5728\u65B9\u6CD5: ${a}`);return p}export{ue as a,K as b,x as c,r as d,s as e,u as f,t as g,o as h,M as i,$ as j,ee as k,ae as l,de as m,ge as n};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as k}from"./chunk-UBIQBXQ7.js";function P(b){let e=b.slice(),d={where(t){return e=e.filter(t),d},sortBy(t,c="desc"){let f=c==="asc"?1:-1;return e.sort((a,n)=>{let m=t(a),p=t(n),s=Number.isFinite(m),l=Number.isFinite(p);return!s&&!l?0:s?l?(m-p)*f:-1:1}),d},top(t){if(!Number.isInteger(t)||t<0)throw new k(`top(n): n must be a non-negative integer, got ${t}`,{n:t});return e.slice(0,t)},toArray(){return e.slice()}};return d}function R(b){let e=b.close;return e!=null&&Number.isFinite(e)?e:null}function v(b){let{klines:e,strategy:d,initialCapital:t=1e5,fee:c=0,getClose:f=R}=b,a=t,n=0,m=0,p=-1,s=0,l=[],o=[],T=(r,i)=>{let u=(i/m*(1-c)*(1-c)-1)*100;l.push({entryIndex:p,exitIndex:r,entryPrice:m,exitPrice:i,returnPercent:u})};for(let r=0;r<e.length;r++){let i=f(e[r]),u=i!=null&&Number.isFinite(i)&&i>0?i:null,x=d(e[r],r,e);u!=null&&(s=u,x==="buy"&&n===0?(n=a*(1-c)/u,m=u,p=r,a=0):x==="sell"&&n>0&&(a=n*u*(1-c),T(r,u),n=0));let C=a+n*(u??s);o.push(C)}n>0&&s>0&&(a=n*s*(1-c),T(e.length-1,s),n=0,o.length>0&&(o[o.length-1]=a));let h=o.length?o[o.length-1]:t,S=(h/t-1)*100,B=l.filter(r=>r.returnPercent>0).length,w=l.length?B/l.length*100:0,y=-1/0,g=0;for(let r of o){r>y&&(y=r);let i=y>0?(y-r)/y*100:0;i>g&&(g=i)}return{initialCapital:t,finalEquity:h,totalReturn:S,winRate:w,maxDrawdown:g,tradeCount:l.length,trades:l,equityCurve:o}}export{P as a,v as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }function w(e,n=2){let o=Math.pow(10,n);return Math.round(e*o)/o}var y=class{constructor(n,o){this.sum=0;this.comp=0;this.count=0;this.data=n,this.period=o}advance(n){let o=this.data[n];if(o!==null&&(this.add(o),this.count++),n>=this.period){let u=this.data[n-this.period];u!==null&&(this.add(-u),this.count--)}Number.isFinite(this.sum)||this.refill(n)}get value(){return this.sum}get nonNullCount(){return this.count}add(n){let o=n-this.comp,u=this.sum+o;this.comp=u-this.sum-o,this.sum=u}refill(n){this.sum=0,this.comp=0;let o=Math.max(0,n-this.period+1);for(let u=o;u<=n;u++){let s=this.data[u];s!==null&&this.add(s)}}};function M(e,n){let o=new Array(e.length),u=new y(e,n);for(let s=0;s<e.length;s++)u.advance(s),o[s]=s>=n-1&&u.nonNullCount===n?w(u.value/n):null;return o}function x(e,n){let o=[],u=2/(n+1),s=null,l=!1;for(let r=0;r<e.length;r++){if(r<n-1){o.push(null);continue}if(!l){let c=0,i=0;for(let a=r-n+1;a<=r;a++)e[a]!==null&&(c+=e[a],i++);i===n&&(s=c/n,l=!0),o.push(s!==null?w(s):null);continue}let t=e[r];t===null?o.push(s!==null?w(s):null):(s=u*t+(1-u)*s,o.push(w(s)))}return o}function F(e,n){let o=[],u=Array.from({length:n},(l,r)=>r+1),s=u.reduce((l,r)=>l+r,0);for(let l=0;l<e.length;l++){if(l<n-1){o.push(null);continue}let r=0,t=!0;for(let c=0;c<n;c++){let i=e[l-n+1+c];if(i===null){t=!1;break}r+=i*u[c]}o.push(t?w(r/s):null)}return o}function D(e,n={}){let{periods:o=[5,10,20,30,60,120,250],type:u="sma"}=n,s=u==="ema"?x:u==="wma"?F:M,l={};for(let r of o)l[`ma${r}`]=s(e,r);return e.map((r,t)=>{let c={};for(let i of o)c[`ma${i}`]=l[`ma${i}`][t];return c})}function U(e,n=2){let o=Math.pow(10,n);return Math.round(e*o)/o}function j(e,n={}){let{short:o=12,long:u=26,signal:s=9}=n,l=x(e,o),r=x(e,u),t=e.map((i,a)=>l[a]===null||r[a]===null?null:l[a]-r[a]),c=x(t,s);return e.map((i,a)=>({dif:t[a]!==null?U(t[a]):null,dea:c[a],macd:t[a]!==null&&c[a]!==null?U((t[a]-c[a])*2):null}))}function B(e,n=2){let o=Math.pow(10,n);return Math.round(e*o)/o}function Q(e,n,o){let u=new Array(e.length),s=e.map(t=>t===null?null:t*t),l=new y(e,n),r=new y(s,n);for(let t=0;t<e.length;t++){l.advance(t),r.advance(t);let c=o[t];if(t<n-1||c===null){u[t]=null;continue}if(l.nonNullCount!==n){u[t]=null;continue}let i=r.value-2*c*l.value+n*c*c;u[t]=Math.sqrt(Math.max(0,i)/n)}return u}function V(e,n={}){let{period:o=20,stdDev:u=2}=n,s=M(e,o),l=Q(e,o,s);return e.map((r,t)=>{if(s[t]===null||l[t]===null)return{mid:null,upper:null,lower:null,bandwidth:null};let c=s[t]+u*l[t],i=s[t]-u*l[t],a=s[t]!==0?B((c-i)/s[t]*100):null;return{mid:s[t],upper:B(c),lower:B(i),bandwidth:a}})}function P(e,n=2){let o=Math.pow(10,n);return Math.round(e*o)/o}function H(e,n={}){let{period:o=9,kPeriod:u=3,dPeriod:s=3}=n,l=[],r=50,t=50,c=[],i=0,a=[],p=0,h=0;for(let f=0;f<e.length;f++){let R=e[f];if(R.high===null||R.low===null)h++;else{for(;c.length>i&&e[c[c.length-1]].high<=R.high;)c.pop();for(c.push(f);a.length>p&&e[a[a.length-1]].low>=R.low;)a.pop();a.push(f)}let m=f-o+1;if(f>=o){let I=e[f-o];(I.high===null||I.low===null)&&h--}for(;c.length>i&&c[i]<m;)i++;for(;a.length>p&&a[p]<m;)p++;if(f<o-1){l.push({k:null,d:null,j:null});continue}let b=c.length>i?e[c[i]].high:-1/0,d=a.length>p?e[a[p]].low:1/0,g=e[f].close;if(h>0||g===null||b===d){l.push({k:null,d:null,j:null});continue}let k=(g-d)/(b-d)*100;r=(u-1)/u*r+1/u*k,t=(s-1)/s*t+1/s*r;let K=3*r-2*t;l.push({k:P(r),d:P(t),j:P(K)})}return l}function X(e,n=2){let o=Math.pow(10,n);return Math.round(e*o)/o}function T(e,n={}){let{periods:o=[6,12,24]}=n,u=[null];for(let l=1;l<e.length;l++)e[l]===null||e[l-1]===null?u.push(null):u.push(e[l]-e[l-1]);let s={};for(let l of o){let r=[],t=0,c=0;for(let i=0;i<e.length;i++){if(i<l){r.push(null),u[i]!==null&&(u[i]>0?t+=u[i]:c+=Math.abs(u[i]));continue}if(i===l)u[i]!==null&&(u[i]>0?t+=u[i]:c+=Math.abs(u[i])),t=t/l,c=c/l;else{let a=_nullishCoalesce(u[i], () => (0)),p=a>0?a:0,h=a<0?Math.abs(a):0;t=(t*(l-1)+p)/l,c=(c*(l-1)+h)/l}if(c===0)r.push(100);else if(t===0)r.push(0);else{let a=t/c;r.push(X(100-100/(1+a)))}}s[`rsi${l}`]=r}return e.map((l,r)=>{let t={};for(let c of o)t[`rsi${c}`]=s[`rsi${c}`][r];return t})}function Z(e,n=2){let o=Math.pow(10,n);return Math.round(e*o)/o}function W(e,n={}){let{periods:o=[6,10]}=n,u={};for(let s of o){let l=[];for(let r=0;r<e.length;r++){if(r<s-1){l.push(null);continue}let t=-1/0,c=1/0,i=!0;for(let h=r-s+1;h<=r;h++){if(e[h].high===null||e[h].low===null){i=!1;break}t=Math.max(t,e[h].high),c=Math.min(c,e[h].low)}let a=e[r].close;if(!i||a===null||t===c){l.push(null);continue}let p=(t-a)/(t-c)*100;l.push(Z(p))}u[`wr${s}`]=l}return e.map((s,l)=>{let r={};for(let t of o)r[`wr${t}`]=u[`wr${t}`][l];return r})}function ee(e,n=2){let o=Math.pow(10,n);return Math.round(e*o)/o}function E(e,n={}){let{periods:o=[6,12,24]}=n,u={};for(let s of o){let l=M(e,s),r=[];for(let t=0;t<e.length;t++)if(e[t]===null||l[t]===null||l[t]===0)r.push(null);else{let c=(e[t]-l[t])/l[t]*100;r.push(ee(c))}u[`bias${s}`]=r}return e.map((s,l)=>{let r={};for(let t of o)r[`bias${t}`]=u[`bias${t}`][l];return r})}function ne(e,n=2){let o=Math.pow(10,n);return Math.round(e*o)/o}function N(e,n={}){let{period:o=14}=n,u=[],s=e.map(l=>l.high===null||l.low===null||l.close===null?null:(l.high+l.low+l.close)/3);for(let l=0;l<e.length;l++){if(l<o-1){u.push({cci:null});continue}let r=0,t=0;for(let p=l-o+1;p<=l;p++)s[p]!==null&&(r+=s[p],t++);if(t!==o||s[l]===null){u.push({cci:null});continue}let c=r/o,i=0;for(let p=l-o+1;p<=l;p++)i+=Math.abs(s[p]-c);let a=i/o;if(a===0)u.push({cci:0});else{let p=(s[l]-c)/(.015*a);u.push({cci:ne(p)})}}return u}function _(e,n=2){let o=Math.pow(10,n);return Math.round(e*o)/o}function v(e,n={}){let{period:o=14}=n,u=[],s=[];for(let r=0;r<e.length;r++){let{high:t,low:c,close:i}=e[r];if(t===null||c===null||i===null){s.push(null);continue}if(r===0)s.push(t-c);else{let a=e[r-1].close;if(a===null)s.push(t-c);else{let p=t-c,h=Math.abs(t-a),f=Math.abs(c-a);s.push(Math.max(p,h,f))}}}let l=null;for(let r=0;r<e.length;r++){if(r<o-1){u.push({tr:s[r]!==null?_(s[r]):null,atr:null});continue}if(r===o-1){let t=0,c=0;for(let i=0;i<o;i++)s[i]!==null&&(t+=s[i],c++);c===o&&(l=t/o)}else l!==null&&s[r]!==null&&(l=(l*(o-1)+s[r])/o);u.push({tr:s[r]!==null?_(s[r]):null,atr:l!==null?_(l):null})}return u}function $(e,n={}){let{maPeriod:o}=n,u=[];if(e.length===0)return u;let s=_nullishCoalesce(e[0].volume, () => (0));u.push({obv:s,obvMa:null});for(let l=1;l<e.length;l++){let r=e[l],t=e[l-1];if(r.close===null||t.close===null||r.volume===null||r.volume===void 0){u.push({obv:null,obvMa:null});continue}r.close>t.close?s+=r.volume:r.close<t.close&&(s-=r.volume),u.push({obv:s,obvMa:null})}if(o&&o>0){let l=u.map(t=>t.obv),r=new y(l,o);for(let t=0;t<u.length;t++)r.advance(t),t>=o-1&&r.nonNullCount===o&&(u[t].obvMa=r.value/o)}return u}function J(e,n={}){let{period:o=12,signalPeriod:u}=n,s=[];for(let l=0;l<e.length;l++){if(l<o){s.push({roc:null,signal:null});continue}let r=e[l].close,t=e[l-o].close;if(r===null||t===null||t===0){s.push({roc:null,signal:null});continue}let c=(r-t)/t*100;s.push({roc:c,signal:null})}if(u&&u>0){let l=s.map(t=>t.roc),r=new y(l,u);for(let t=0;t<s.length;t++)r.advance(t),t>=o+u-1&&r.nonNullCount===u&&(s[t].signal=r.value/u)}return s}function q(e,n={}){let{period:o=14,adxPeriod:u=o}=n,s=[];if(e.length<2)return e.map(()=>({pdi:null,mdi:null,adx:null,adxr:null}));let l=[],r=[],t=[];for(let m=0;m<e.length;m++){if(m===0){l.push(0),r.push(0),t.push(0),s.push({pdi:null,mdi:null,adx:null,adxr:null});continue}let b=e[m],d=e[m-1];if(b.high===null||b.low===null||b.close===null||d.high===null||d.low===null||d.close===null){l.push(0),r.push(0),t.push(0),s.push({pdi:null,mdi:null,adx:null,adxr:null});continue}let g=b.high-b.low,k=Math.abs(b.high-d.close),K=Math.abs(b.low-d.close);t.push(Math.max(g,k,K));let I=b.high-d.high,A=d.low-b.low;I>A&&I>0?l.push(I):l.push(0),A>I&&A>0?r.push(A):r.push(0),s.push({pdi:null,mdi:null,adx:null,adxr:null})}let c=0,i=0,a=0,p=[];for(let m=1;m<e.length;m++){if(m<o){c+=t[m],i+=l[m],a+=r[m],p.push(0);continue}m===o?(c+=t[m],i+=l[m],a+=r[m]):(c=c-c/o+t[m],i=i-i/o+l[m],a=a-a/o+r[m]);let b=c>0?i/c*100:0,d=c>0?a/c*100:0;s[m].pdi=b,s[m].mdi=d;let g=b+d,k=g>0?Math.abs(b-d)/g*100:0;p.push(k)}let h=0,f=0,R=o+u-1;for(let m=o;m<e.length;m++){if(m<R){h+=p[m-1]||0;continue}if(m===R)h+=p[m-1]||0,f=h/u,s[m].adx=f;else{let b=p[m-1]||0;f=(f*(u-1)+b)/u,s[m].adx=f}}for(let m=R+u;m<e.length;m++){let b=s[m].adx,d=_optionalChain([s, 'access', _2 => _2[m-u], 'optionalAccess', _3 => _3.adx]);b!==null&&d!==null&&(s[m].adxr=(b+d)/2)}return s}function G(e,n={}){let{afStart:o=.02,afIncrement:u=.02,afMax:s=.2}=n,l=[];if(e.length<2)return e.map(()=>({sar:null,trend:null,ep:null,af:null}));let r=1,t=o,c=_nullishCoalesce(e[0].high, () => (0)),i=_nullishCoalesce(e[0].low, () => (0)),a=e[0],p=e[1];a.close!==null&&p.close!==null&&p.close<a.close&&(r=-1,c=_nullishCoalesce(a.low, () => (0)),i=_nullishCoalesce(a.high, () => (0))),l.push({sar:null,trend:null,ep:null,af:null});for(let h=1;h<e.length;h++){let f=e[h],R=e[h-1];if(f.high===null||f.low===null||R.high===null||R.low===null){l.push({sar:null,trend:null,ep:null,af:null});continue}let m=i+t*(c-i);r===1?(m=Math.min(m,R.low,_nullishCoalesce(_optionalChain([e, 'access', _4 => _4[Math.max(0,h-2)], 'optionalAccess', _5 => _5.low]), () => (R.low))),f.low<m?(r=-1,m=c,c=f.low,t=o):f.high>c&&(c=f.high,t=Math.min(t+u,s))):(m=Math.max(m,R.high,_nullishCoalesce(_optionalChain([e, 'access', _6 => _6[Math.max(0,h-2)], 'optionalAccess', _7 => _7.high]), () => (R.high))),f.high>m?(r=1,m=c,c=f.high,t=o):f.low<c&&(c=f.low,t=Math.min(t+u,s))),i=m,l.push({sar:i,trend:r,ep:c,af:t})}return l}function Y(e,n={}){let{emaPeriod:o=20,atrPeriod:u=10,multiplier:s=2}=n,l=[],r=e.map(i=>i.close),t=x(r,o),c=v(e,{period:u});for(let i=0;i<e.length;i++){let a=t[i],p=_optionalChain([c, 'access', _8 => _8[i], 'optionalAccess', _9 => _9.atr]);if(a===null||p===null){l.push({mid:null,upper:null,lower:null,width:null});continue}let h=a+s*p,f=a-s*p,R=a>0?(h-f)/a*100:null;l.push({mid:a,upper:h,lower:f,width:R})}return l}function L(e,n=0){return e.length===0?n:Math.max(...e)}function z(e){return{closes:e.map(n=>n.close),ohlcv:e.map(n=>({open:n.open,high:n.high,low:n.low,close:n.close,volume:n.volume}))}}var O={ma:{key:"ma",estimateLookback:e=>{let n=typeof e=="object"?e:{},o=_nullishCoalesce(n.periods, () => ([5,10,20,30,60,120,250])),u=_nullishCoalesce(n.type, () => ("sma"));return{bars:L(o,20),emaBased:u==="ema"}},compute:(e,n)=>D(e.closes,typeof n=="object"?n:{})},macd:{key:"macd",recursive:!0,estimateLookback:e=>{let n=typeof e=="object"?e:{},o=_nullishCoalesce(n.long, () => (26)),u=_nullishCoalesce(n.signal, () => (9));return{bars:o*3+u,emaBased:!0}},compute:(e,n)=>j(e.closes,typeof n=="object"?n:{})},boll:{key:"boll",estimateLookback:e=>({bars:typeof e=="object"&&e.period?e.period:20}),compute:(e,n)=>V(e.closes,typeof n=="object"?n:{})},kdj:{key:"kdj",recursive:!0,estimateLookback:e=>({bars:typeof e=="object"&&e.period?e.period:9}),compute:(e,n)=>H(e.ohlcv,typeof n=="object"?n:{})},rsi:{key:"rsi",recursive:!0,estimateLookback:e=>{let n=typeof e=="object"&&e.periods?e.periods:[6,12,24];return{bars:L(n,14)+1}},compute:(e,n)=>T(e.closes,typeof n=="object"?n:{})},wr:{key:"wr",estimateLookback:e=>{let n=typeof e=="object"&&e.periods?e.periods:[6,10];return{bars:L(n,10)}},compute:(e,n)=>W(e.ohlcv,typeof n=="object"?n:{})},bias:{key:"bias",estimateLookback:e=>{let n=typeof e=="object"&&e.periods?e.periods:[6,12,24];return{bars:L(n,12)}},compute:(e,n)=>E(e.closes,typeof n=="object"?n:{})},cci:{key:"cci",estimateLookback:e=>({bars:typeof e=="object"&&e.period?e.period:14}),compute:(e,n)=>N(e.ohlcv,typeof n=="object"?n:{})},atr:{key:"atr",recursive:!0,estimateLookback:e=>({bars:typeof e=="object"&&e.period?e.period:14}),compute:(e,n)=>v(e.ohlcv,typeof n=="object"?n:{})},obv:{key:"obv",cumulative:!0,estimateLookback:e=>{let n=typeof e=="object"&&e.maPeriod?e.maPeriod:0;return{bars:Math.max(2,n)}},compute:(e,n)=>$(e.ohlcv,typeof n=="object"?n:{})},roc:{key:"roc",estimateLookback:e=>{let n=typeof e=="object"?e:{},o=_nullishCoalesce(n.period, () => (12)),u=_nullishCoalesce(n.signalPeriod, () => (0));return{bars:o+u}},compute:(e,n)=>J(e.ohlcv,typeof n=="object"?n:{})},dmi:{key:"dmi",recursive:!0,estimateLookback:e=>{let n=typeof e=="object"?e:{},o=_nullishCoalesce(n.period, () => (14)),u=_nullishCoalesce(n.adxPeriod, () => (o));return{bars:o*2+u}},compute:(e,n)=>q(e.ohlcv,typeof n=="object"?n:{})},sar:{key:"sar",recursive:!0,estimateLookback:()=>({bars:5}),compute:(e,n)=>G(e.ohlcv,typeof n=="object"?n:{})},kc:{key:"kc",recursive:!0,estimateLookback:e=>{let n=typeof e=="object"?e:{},o=_nullishCoalesce(n.emaPeriod, () => (20)),u=_nullishCoalesce(n.atrPeriod, () => (10));return{bars:Math.max(o*3,u),emaBased:!0}},compute:(e,n)=>Y(e.ohlcv,typeof n=="object"?n:{})}},te=["ma","rsi","wr","bias"];function S(e){let n=null;for(let o of te){let u=e[o];if(Array.isArray(u))(_nullishCoalesce(n, () => ((n={...e}))))[o]={periods:u};else if(u&&typeof u=="object"&&!("periods"in u)&&typeof u.period=="number"){let{period:s,...l}=u;(_nullishCoalesce(n, () => ((n={...e}))))[o]={...l,periods:[s]}}}return _nullishCoalesce(n, () => (e))}function oe(e){return C(S(e)).some(n=>O[n].cumulative===!0)}function C(e){return Object.keys(O).filter(n=>!!e[n])}function le(e){e=S(e);let n=0,o=0,u=!1;for(let l of C(e)){let r=O[l],t=r.estimateLookback(e[l]);n=Math.max(n,t.bars),u||(u=!!t.emaBased),(r.recursive===!0||t.emaBased===!0)&&(o=Math.max(o,t.bars))}return{maxLookback:n,hasEmaBasedIndicator:u,requiredBars:Math.ceil(n*(u?1.5:1.2)),maxRecursiveLookback:o}}function re(e,n={}){if(e.length===0)return[];n=S(n);let o=z(e),u=new Map;for(let r of C(n)){let t=O[r];u.set(r,t.compute(o,n[r]))}let s=[],l=[];for(let[r,t]of u)s.push(r),l.push(t);return e.map((r,t)=>{let c={...r},i=c;for(let a=0;a<s.length;a++)i[s[a]]=l[a][t];return c})}exports.a = M; exports.b = x; exports.c = F; exports.d = D; exports.e = j; exports.f = V; exports.g = H; exports.h = T; exports.i = W; exports.j = E; exports.k = N; exports.l = v; exports.m = $; exports.n = J; exports.o = q; exports.p = G; exports.q = Y; exports.r = z; exports.s = O; exports.t = oe; exports.u = C; exports.v = le; exports.w = re;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var c=class{constructor(e={}){this.cache=new Map;this.inflight=new Map;this.defaultTTL=_nullishCoalesce(e.defaultTTL, () => (0)),this.maxSize=_nullishCoalesce(e.maxSize, () => (1e3))}get(e){let t=this.cache.get(e);if(t){if(t.expireAt>0&&Date.now()>t.expireAt){this.cache.delete(e);return}return t.lastAccess=Date.now(),t.value}}set(e,t,i){this.cache.size>=this.maxSize&&!this.cache.has(e)&&this.evictLRU();let n=_nullishCoalesce(i, () => (this.defaultTTL)),s=Date.now();this.cache.set(e,{value:t,expireAt:n>0?s+n:0,lastAccess:s})}has(e){return this.get(e)!==void 0}delete(e){return this.cache.delete(e)}clear(){this.cache.clear(),this.inflight.clear()}get size(){return this.cache.size}cleanup(){let e=Date.now(),t=0;for(let[i,n]of this.cache)n.expireAt>0&&e>n.expireAt&&(this.cache.delete(i),t++);return t}evictLRU(){let e=null,t=1/0;for(let[i,n]of this.cache)n.lastAccess<t&&(t=n.lastAccess,e=i);e&&this.cache.delete(e)}async getOrFetch(e,t,i){let n=this.get(e);if(n!==void 0)return n;let s=this.inflight.get(e);if(s)return s;let h=t().then(o=>(this.set(e,o,i),o)).finally(()=>{this.inflight.delete(e)});return this.inflight.set(e,h),h}},a=new Map;function u(r,e){let t=a.get(r);if(t)return t;let i=new c(e);return a.set(r,i),i}function l(){for(let r of a.values())r.clear()}function f(...r){return r.
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var c=class{constructor(e={}){this.cache=new Map;this.inflight=new Map;this.defaultTTL=_nullishCoalesce(e.defaultTTL, () => (0)),this.maxSize=_nullishCoalesce(e.maxSize, () => (1e3))}get(e){let t=this.cache.get(e);if(t){if(t.expireAt>0&&Date.now()>t.expireAt){this.cache.delete(e);return}return t.lastAccess=Date.now(),t.value}}set(e,t,i){this.cache.size>=this.maxSize&&!this.cache.has(e)&&this.evictLRU();let n=_nullishCoalesce(i, () => (this.defaultTTL)),s=Date.now();this.cache.set(e,{value:t,expireAt:n>0?s+n:0,lastAccess:s})}has(e){return this.get(e)!==void 0}delete(e){return this.cache.delete(e)}clear(){this.cache.clear(),this.inflight.clear()}get size(){return this.cache.size}cleanup(){let e=Date.now(),t=0;for(let[i,n]of this.cache)n.expireAt>0&&e>n.expireAt&&(this.cache.delete(i),t++);return t}evictLRU(){let e=null,t=1/0;for(let[i,n]of this.cache)n.lastAccess<t&&(t=n.lastAccess,e=i);e&&this.cache.delete(e)}async getOrFetch(e,t,i){let n=this.get(e);if(n!==void 0)return n;let s=this.inflight.get(e);if(s)return s;let h=t().then(o=>(this.set(e,o,i),o)).finally(()=>{this.inflight.delete(e)});return this.inflight.set(e,h),h}},a=new Map;function u(r,e){let t=a.get(r);if(t)return t;let i=new c(e);return a.set(r,i),i}function l(){for(let r of a.values())r.clear()}function f(...r){return r.map(e=>e==null?"\u2205":String(e)).join(":")}exports.a = c; exports.b = u; exports.c = l; exports.d = f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkTVIEKKDQcjs = require('./chunk-TVIEKKDQ.cjs');var m=class{constructor(e){this.cache=new (0, _chunkTVIEKKDQcjs.a)(e)}get(e){return this.cache.get(e)}set(e,r,i){this.cache.set(e,r,i)}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}},u=new WeakMap;async function y(n,e,r,i){let s=await n.get(e);if(s!==void 0)return s;let t=u.get(n);t||(t=new Map,u.set(n,t));let o=t.get(e);if(o)return o;let c=(async()=>{let a=await r();return a!==void 0&&await n.set(e,a,i),a})().finally(()=>{t.delete(e)});return t.set(e,c),c}exports.a = m; exports.b = y;
|