hqchart 1.1.13016 → 1.1.13019
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/package.json
CHANGED
|
@@ -1277,6 +1277,15 @@ function Node(ErrorHandler)
|
|
|
1277
1277
|
return;
|
|
1278
1278
|
}
|
|
1279
1279
|
|
|
1280
|
+
//"MA.MA1"(10,5,5)"
|
|
1281
|
+
if (callee.Type==Syntax.Literal)
|
|
1282
|
+
{
|
|
1283
|
+
var item={ ID:JS_EXECUTE_JOB_ID.JOB_EXECUTE_INDEX, Args:args, FunctionName:callee.Value, DynamicName:callee.Value };
|
|
1284
|
+
if (token) item.Token={ Index:token.Start, Line:token.LineNumber };
|
|
1285
|
+
this.ExecuteIndex.push(item);
|
|
1286
|
+
return;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1280
1289
|
if (callee.Name=='COVER_C' || callee.Name=='COVER_O' || callee.Name=='COVER_H' || callee.Name=='COVER_L' || callee.Name=='COVER_A' || callee.Name=='COVER_V') //跨周期函数
|
|
1281
1290
|
{
|
|
1282
1291
|
var periodName=args[0].Value;
|
|
@@ -15266,6 +15275,98 @@ function JSSymbolData(ast,option,jsExecute)
|
|
|
15266
15275
|
|
|
15267
15276
|
}
|
|
15268
15277
|
|
|
15278
|
+
this.CallDynamicScriptIndex=function(job, varTable)
|
|
15279
|
+
{
|
|
15280
|
+
var callInfo=job.DynamicName;
|
|
15281
|
+
var indexInfo={ Job:job, PeriodID:this.Period , Symbol:this.Symbol };
|
|
15282
|
+
if (!this.ReadIndexFunctionValue(callInfo,indexInfo)) //读取指标
|
|
15283
|
+
{
|
|
15284
|
+
var token=job.Token;
|
|
15285
|
+
this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,`CallDynamicScriptIndex() Error: '${callInfo}' ${indexInfo.Error}`);
|
|
15286
|
+
}
|
|
15287
|
+
|
|
15288
|
+
var systemIndex=new JSIndexScript(); //系统指标
|
|
15289
|
+
var systemItem=systemIndex.Get(indexInfo.Name);
|
|
15290
|
+
if (!systemItem)
|
|
15291
|
+
{
|
|
15292
|
+
var token=job.Token;
|
|
15293
|
+
this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,`CallDynamicScriptIndex() Error: '${callInfo}' ${indexInfo.Name} 指标不存在`);
|
|
15294
|
+
}
|
|
15295
|
+
|
|
15296
|
+
indexInfo.SytemIndex=systemItem;
|
|
15297
|
+
if (!this.ReadDynamicIndexArgumentValue(job.Args, indexInfo, varTable))
|
|
15298
|
+
{
|
|
15299
|
+
var token=job.Token;
|
|
15300
|
+
this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,`CallDynamicScriptIndex() ${indexInfo.Name} 指标参数错误 : ${indexInfo.Error} `);
|
|
15301
|
+
}
|
|
15302
|
+
|
|
15303
|
+
JSConsole.Complier.Log('[JSSymbolData::CallMemberScriptIndex] call script index', indexInfo);
|
|
15304
|
+
|
|
15305
|
+
var dateTimeRange=this.Data.GetDateRange();
|
|
15306
|
+
|
|
15307
|
+
var option=
|
|
15308
|
+
{
|
|
15309
|
+
HQDataType:this.DataType,
|
|
15310
|
+
Symbol:indexInfo.Symbol,
|
|
15311
|
+
Name:'',
|
|
15312
|
+
Right:this.Right, //复权
|
|
15313
|
+
Period:indexInfo.PeriodID, //周期
|
|
15314
|
+
Data:null,
|
|
15315
|
+
SourceData:null,
|
|
15316
|
+
Callback:(outVar,job, symbolData)=> {
|
|
15317
|
+
this.RecvDynamicScriptIndexData(outVar,job,symbolData);
|
|
15318
|
+
this.Execute.RunNextJob();
|
|
15319
|
+
},
|
|
15320
|
+
CallbackParam:indexInfo,
|
|
15321
|
+
Async:true,
|
|
15322
|
+
MaxRequestDataCount:this.MaxRequestDataCount+30*2,
|
|
15323
|
+
MaxRequestMinuteDayCount:this.MaxRequestMinuteDayCount+2,
|
|
15324
|
+
Arguments:indexInfo.Args,
|
|
15325
|
+
//Condition:this.Condition,
|
|
15326
|
+
IsBeforeData:this.IsBeforeData,
|
|
15327
|
+
NetworkFilter:this.NetworkFilter,
|
|
15328
|
+
IsApiPeriod:this.IsApiPeriod,
|
|
15329
|
+
KLineRange:dateTimeRange //K线数据范围
|
|
15330
|
+
};
|
|
15331
|
+
|
|
15332
|
+
//执行脚本
|
|
15333
|
+
var run=JSComplier.Execute(systemItem.Script,option,(error, indexInfo)=>{this.ExecuteScriptIndexError(error,indexInfo)});
|
|
15334
|
+
}
|
|
15335
|
+
|
|
15336
|
+
this.ReadDynamicIndexArgumentValue=function(args, result, varTable)
|
|
15337
|
+
{
|
|
15338
|
+
result.Args=[];
|
|
15339
|
+
for(var i =0;i<result.SytemIndex.Args.length; ++i) //复制参数
|
|
15340
|
+
{
|
|
15341
|
+
var item=result.SytemIndex.Args[i];
|
|
15342
|
+
result.Args.push({ Value:item.Value, Name:item.Name, IsDefault:true });
|
|
15343
|
+
}
|
|
15344
|
+
|
|
15345
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(args)) return true;
|
|
15346
|
+
|
|
15347
|
+
for(var i=0;i<args.length;++i)
|
|
15348
|
+
{
|
|
15349
|
+
var item=args[i];
|
|
15350
|
+
var argItem=result.Args[i];
|
|
15351
|
+
if (!argItem) continue;
|
|
15352
|
+
if (item.Type==Syntax.Literal)
|
|
15353
|
+
{
|
|
15354
|
+
argItem.Value=item.Value;
|
|
15355
|
+
argItem.IsDefault=false;
|
|
15356
|
+
}
|
|
15357
|
+
else if (item.Type==Syntax.Identifier) //支持传参
|
|
15358
|
+
{
|
|
15359
|
+
if (varTable.has(item.Name))
|
|
15360
|
+
{
|
|
15361
|
+
argItem.Value=varTable.get(item.Name);
|
|
15362
|
+
argItem.IsDefault=false;
|
|
15363
|
+
}
|
|
15364
|
+
}
|
|
15365
|
+
}
|
|
15366
|
+
|
|
15367
|
+
return true;
|
|
15368
|
+
}
|
|
15369
|
+
|
|
15269
15370
|
/*****************************************************************************************************************************
|
|
15270
15371
|
脚本调用
|
|
15271
15372
|
|
|
@@ -15279,10 +15380,13 @@ function JSSymbolData(ast,option,jsExecute)
|
|
|
15279
15380
|
CALCSTOCKINDEX('SH600000','KDJ',3)表示上证600000的KDJ指标第3个输出即J之值,第一个参数可在前面加SZ(深市),SH(沪市),BJ(京市),或市场_,,
|
|
15280
15381
|
CALCSTOCKINDEX('47_IFL0','MACD',2)表示IFL0品种的MACD指标第2个输出值.
|
|
15281
15382
|
|
|
15383
|
+
"MA.MA1"(6,12,18)
|
|
15384
|
+
|
|
15282
15385
|
*******************************************************************************************************************************/
|
|
15283
|
-
this.CallScriptIndex=function(job)
|
|
15386
|
+
this.CallScriptIndex=function(job, varTable)
|
|
15284
15387
|
{
|
|
15285
15388
|
if (job.Member) return this.CallMemberScriptIndex(job);
|
|
15389
|
+
if (job.DynamicName) return this.CallDynamicScriptIndex(job, varTable);
|
|
15286
15390
|
|
|
15287
15391
|
if (!job.Args || !(job.Args.length>=2))
|
|
15288
15392
|
{
|
|
@@ -15395,6 +15499,42 @@ function JSSymbolData(ast,option,jsExecute)
|
|
|
15395
15499
|
}
|
|
15396
15500
|
}
|
|
15397
15501
|
|
|
15502
|
+
this.RecvDynamicScriptIndexData=function(outVar,indexInfo,symbolData)
|
|
15503
|
+
{
|
|
15504
|
+
JSConsole.Complier.Log('[JSSymbolData::RecvDynamicScriptIndexData] ', outVar, indexInfo, symbolData);
|
|
15505
|
+
var kLine=symbolData.Data.Data;
|
|
15506
|
+
var aryOutVar=outVar;
|
|
15507
|
+
var data=this.Data.FitKLineIndex(kLine,aryOutVar,this.Period,indexInfo.PeriodID);
|
|
15508
|
+
|
|
15509
|
+
var objName=indexInfo.Name;
|
|
15510
|
+
var memberValue={};
|
|
15511
|
+
if (this.Execute.VarTable.has(objName))
|
|
15512
|
+
memberValue=this.Execute.VarTable.get(objName);
|
|
15513
|
+
else
|
|
15514
|
+
this.Execute.VarTable.set(objName, memberValue);
|
|
15515
|
+
|
|
15516
|
+
var strValue="";
|
|
15517
|
+
for(var i=0; i<indexInfo.Args.length; ++i)
|
|
15518
|
+
{
|
|
15519
|
+
var item=indexInfo.Args[i];
|
|
15520
|
+
if (item.IsDefault===false)
|
|
15521
|
+
{
|
|
15522
|
+
if (strValue.length>0) strValue+=",";
|
|
15523
|
+
strValue+=`${item.Value}`;
|
|
15524
|
+
}
|
|
15525
|
+
}
|
|
15526
|
+
var strArgs=`(${strValue})`;
|
|
15527
|
+
|
|
15528
|
+
//保存所有的指标数据, 下面用到了就可以不用算了
|
|
15529
|
+
for(var i=0; i<data.length; ++i)
|
|
15530
|
+
{
|
|
15531
|
+
var key=`${outVar[i].Name}#${strArgs}`;
|
|
15532
|
+
if (indexInfo.Period) key+='#'+indexInfo.Period; //带周期的变量
|
|
15533
|
+
|
|
15534
|
+
memberValue[key]=data[i].Data;
|
|
15535
|
+
}
|
|
15536
|
+
}
|
|
15537
|
+
|
|
15398
15538
|
this.RecvScriptIndexData=function(outVar,indexInfo,symbolData)
|
|
15399
15539
|
{
|
|
15400
15540
|
var key=this.GenerateScriptIndexKey(indexInfo);
|
|
@@ -16268,7 +16408,8 @@ var JS_EXECUTE_JOB_ID=
|
|
|
16268
16408
|
//KDJ.K , KDJ.K#WEEK
|
|
16269
16409
|
//STKINDI('600000.sh','MA.MA1#WEEK',5,10,20,30,60,120);
|
|
16270
16410
|
//CALCSTOCKINDEX('SH600000','KDJ',3)表示上证600000的KDJ指标第3个输出即J之值,第一个参数可在前面加SZ(深市),SH(沪市),BJ(京市)
|
|
16271
|
-
|
|
16411
|
+
//"MA.MA(5,5,5)" 调用动态指标
|
|
16412
|
+
JOB_EXECUTE_INDEX:30010,
|
|
16272
16413
|
|
|
16273
16414
|
JOB_RUN_SCRIPT:10000, //执行脚本
|
|
16274
16415
|
|
|
@@ -16587,7 +16728,7 @@ function JSExecute(ast,option)
|
|
|
16587
16728
|
case JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_CUSTOM_API_DATA:
|
|
16588
16729
|
return this.SymbolData.DownloadCustomAPIData(jobItem);
|
|
16589
16730
|
case JS_EXECUTE_JOB_ID.JOB_EXECUTE_INDEX:
|
|
16590
|
-
return this.SymbolData.CallScriptIndex(jobItem);
|
|
16731
|
+
return this.SymbolData.CallScriptIndex(jobItem, this.VarTable);
|
|
16591
16732
|
|
|
16592
16733
|
case JS_EXECUTE_JOB_ID.JOB_RUN_SCRIPT:
|
|
16593
16734
|
if (this.Debug===1 && this.DebugFilter)
|
|
@@ -17567,6 +17708,35 @@ function JSExecute(ast,option)
|
|
|
17567
17708
|
args.push(value);
|
|
17568
17709
|
}
|
|
17569
17710
|
|
|
17711
|
+
if (node.Callee.Type==Syntax.Literal)
|
|
17712
|
+
{
|
|
17713
|
+
var dynamicName=node.Callee.Value;
|
|
17714
|
+
var aryValue=dynamicName.split(".");
|
|
17715
|
+
if (aryValue.length!=2)
|
|
17716
|
+
{
|
|
17717
|
+
this.ThrowUnexpectedNode(node,`调用指标格式'${dynamicName}'错误`);
|
|
17718
|
+
}
|
|
17719
|
+
|
|
17720
|
+
var name=aryValue[0];
|
|
17721
|
+
var outName=aryValue[1];
|
|
17722
|
+
var strValue="";
|
|
17723
|
+
for(var i=0; i<args.length; ++i)
|
|
17724
|
+
{
|
|
17725
|
+
var value=args[i];
|
|
17726
|
+
if (strValue.length>0) strValue+=",";
|
|
17727
|
+
strValue+=`${value}`;
|
|
17728
|
+
}
|
|
17729
|
+
var strArgs=`(${strValue})`;
|
|
17730
|
+
var key=`${outName}#${strArgs}`;
|
|
17731
|
+
|
|
17732
|
+
node.Out=[];
|
|
17733
|
+
if (!this.VarTable.has(name)) return node.Out;
|
|
17734
|
+
var indexData=this.VarTable.get(name);
|
|
17735
|
+
var value=indexData[key];
|
|
17736
|
+
if (value) node.Out=value;
|
|
17737
|
+
return node.Out;
|
|
17738
|
+
}
|
|
17739
|
+
|
|
17570
17740
|
if (funcName==="IFC")
|
|
17571
17741
|
{
|
|
17572
17742
|
//IFC(X,A,B)若X不为0则执行A,否则执行B.IFC与IF函数的区别:根据X的值来选择性执行A、B表达式.
|
|
@@ -18572,6 +18742,13 @@ function JSExplainer(ast,option)
|
|
|
18572
18742
|
args.push(value);
|
|
18573
18743
|
}
|
|
18574
18744
|
|
|
18745
|
+
if (node.Callee.Type==Syntax.Literal)
|
|
18746
|
+
{
|
|
18747
|
+
var dynamicName=node.Callee.Value;
|
|
18748
|
+
node.Out=`指标引用'${dynamicName}'`;
|
|
18749
|
+
return node.Out;
|
|
18750
|
+
}
|
|
18751
|
+
|
|
18575
18752
|
JSConsole.Complier.Log('[JSExplainer::VisitCallExpression]' , funcName, '(', args.toString() ,')');
|
|
18576
18753
|
|
|
18577
18754
|
if (g_JSComplierResource.IsCustomFunction(funcName))
|
|
@@ -94697,6 +94697,15 @@ function Node(ErrorHandler)
|
|
|
94697
94697
|
return;
|
|
94698
94698
|
}
|
|
94699
94699
|
|
|
94700
|
+
//"MA.MA1"(10,5,5)"
|
|
94701
|
+
if (callee.Type==Syntax.Literal)
|
|
94702
|
+
{
|
|
94703
|
+
var item={ ID:JS_EXECUTE_JOB_ID.JOB_EXECUTE_INDEX, Args:args, FunctionName:callee.Value, DynamicName:callee.Value };
|
|
94704
|
+
if (token) item.Token={ Index:token.Start, Line:token.LineNumber };
|
|
94705
|
+
this.ExecuteIndex.push(item);
|
|
94706
|
+
return;
|
|
94707
|
+
}
|
|
94708
|
+
|
|
94700
94709
|
if (callee.Name=='COVER_C' || callee.Name=='COVER_O' || callee.Name=='COVER_H' || callee.Name=='COVER_L' || callee.Name=='COVER_A' || callee.Name=='COVER_V') //跨周期函数
|
|
94701
94710
|
{
|
|
94702
94711
|
var periodName=args[0].Value;
|
|
@@ -108686,6 +108695,98 @@ function JSSymbolData(ast,option,jsExecute)
|
|
|
108686
108695
|
|
|
108687
108696
|
}
|
|
108688
108697
|
|
|
108698
|
+
this.CallDynamicScriptIndex=function(job, varTable)
|
|
108699
|
+
{
|
|
108700
|
+
var callInfo=job.DynamicName;
|
|
108701
|
+
var indexInfo={ Job:job, PeriodID:this.Period , Symbol:this.Symbol };
|
|
108702
|
+
if (!this.ReadIndexFunctionValue(callInfo,indexInfo)) //读取指标
|
|
108703
|
+
{
|
|
108704
|
+
var token=job.Token;
|
|
108705
|
+
this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,`CallDynamicScriptIndex() Error: '${callInfo}' ${indexInfo.Error}`);
|
|
108706
|
+
}
|
|
108707
|
+
|
|
108708
|
+
var systemIndex=new JSIndexScript(); //系统指标
|
|
108709
|
+
var systemItem=systemIndex.Get(indexInfo.Name);
|
|
108710
|
+
if (!systemItem)
|
|
108711
|
+
{
|
|
108712
|
+
var token=job.Token;
|
|
108713
|
+
this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,`CallDynamicScriptIndex() Error: '${callInfo}' ${indexInfo.Name} 指标不存在`);
|
|
108714
|
+
}
|
|
108715
|
+
|
|
108716
|
+
indexInfo.SytemIndex=systemItem;
|
|
108717
|
+
if (!this.ReadDynamicIndexArgumentValue(job.Args, indexInfo, varTable))
|
|
108718
|
+
{
|
|
108719
|
+
var token=job.Token;
|
|
108720
|
+
this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,`CallDynamicScriptIndex() ${indexInfo.Name} 指标参数错误 : ${indexInfo.Error} `);
|
|
108721
|
+
}
|
|
108722
|
+
|
|
108723
|
+
JSConsole.Complier.Log('[JSSymbolData::CallMemberScriptIndex] call script index', indexInfo);
|
|
108724
|
+
|
|
108725
|
+
var dateTimeRange=this.Data.GetDateRange();
|
|
108726
|
+
|
|
108727
|
+
var option=
|
|
108728
|
+
{
|
|
108729
|
+
HQDataType:this.DataType,
|
|
108730
|
+
Symbol:indexInfo.Symbol,
|
|
108731
|
+
Name:'',
|
|
108732
|
+
Right:this.Right, //复权
|
|
108733
|
+
Period:indexInfo.PeriodID, //周期
|
|
108734
|
+
Data:null,
|
|
108735
|
+
SourceData:null,
|
|
108736
|
+
Callback:(outVar,job, symbolData)=> {
|
|
108737
|
+
this.RecvDynamicScriptIndexData(outVar,job,symbolData);
|
|
108738
|
+
this.Execute.RunNextJob();
|
|
108739
|
+
},
|
|
108740
|
+
CallbackParam:indexInfo,
|
|
108741
|
+
Async:true,
|
|
108742
|
+
MaxRequestDataCount:this.MaxRequestDataCount+30*2,
|
|
108743
|
+
MaxRequestMinuteDayCount:this.MaxRequestMinuteDayCount+2,
|
|
108744
|
+
Arguments:indexInfo.Args,
|
|
108745
|
+
//Condition:this.Condition,
|
|
108746
|
+
IsBeforeData:this.IsBeforeData,
|
|
108747
|
+
NetworkFilter:this.NetworkFilter,
|
|
108748
|
+
IsApiPeriod:this.IsApiPeriod,
|
|
108749
|
+
KLineRange:dateTimeRange //K线数据范围
|
|
108750
|
+
};
|
|
108751
|
+
|
|
108752
|
+
//执行脚本
|
|
108753
|
+
var run=JSComplier.Execute(systemItem.Script,option,(error, indexInfo)=>{this.ExecuteScriptIndexError(error,indexInfo)});
|
|
108754
|
+
}
|
|
108755
|
+
|
|
108756
|
+
this.ReadDynamicIndexArgumentValue=function(args, result, varTable)
|
|
108757
|
+
{
|
|
108758
|
+
result.Args=[];
|
|
108759
|
+
for(var i =0;i<result.SytemIndex.Args.length; ++i) //复制参数
|
|
108760
|
+
{
|
|
108761
|
+
var item=result.SytemIndex.Args[i];
|
|
108762
|
+
result.Args.push({ Value:item.Value, Name:item.Name, IsDefault:true });
|
|
108763
|
+
}
|
|
108764
|
+
|
|
108765
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(args)) return true;
|
|
108766
|
+
|
|
108767
|
+
for(var i=0;i<args.length;++i)
|
|
108768
|
+
{
|
|
108769
|
+
var item=args[i];
|
|
108770
|
+
var argItem=result.Args[i];
|
|
108771
|
+
if (!argItem) continue;
|
|
108772
|
+
if (item.Type==Syntax.Literal)
|
|
108773
|
+
{
|
|
108774
|
+
argItem.Value=item.Value;
|
|
108775
|
+
argItem.IsDefault=false;
|
|
108776
|
+
}
|
|
108777
|
+
else if (item.Type==Syntax.Identifier) //支持传参
|
|
108778
|
+
{
|
|
108779
|
+
if (varTable.has(item.Name))
|
|
108780
|
+
{
|
|
108781
|
+
argItem.Value=varTable.get(item.Name);
|
|
108782
|
+
argItem.IsDefault=false;
|
|
108783
|
+
}
|
|
108784
|
+
}
|
|
108785
|
+
}
|
|
108786
|
+
|
|
108787
|
+
return true;
|
|
108788
|
+
}
|
|
108789
|
+
|
|
108689
108790
|
/*****************************************************************************************************************************
|
|
108690
108791
|
脚本调用
|
|
108691
108792
|
|
|
@@ -108699,10 +108800,13 @@ function JSSymbolData(ast,option,jsExecute)
|
|
|
108699
108800
|
CALCSTOCKINDEX('SH600000','KDJ',3)表示上证600000的KDJ指标第3个输出即J之值,第一个参数可在前面加SZ(深市),SH(沪市),BJ(京市),或市场_,,
|
|
108700
108801
|
CALCSTOCKINDEX('47_IFL0','MACD',2)表示IFL0品种的MACD指标第2个输出值.
|
|
108701
108802
|
|
|
108803
|
+
"MA.MA1"(6,12,18)
|
|
108804
|
+
|
|
108702
108805
|
*******************************************************************************************************************************/
|
|
108703
|
-
this.CallScriptIndex=function(job)
|
|
108806
|
+
this.CallScriptIndex=function(job, varTable)
|
|
108704
108807
|
{
|
|
108705
108808
|
if (job.Member) return this.CallMemberScriptIndex(job);
|
|
108809
|
+
if (job.DynamicName) return this.CallDynamicScriptIndex(job, varTable);
|
|
108706
108810
|
|
|
108707
108811
|
if (!job.Args || !(job.Args.length>=2))
|
|
108708
108812
|
{
|
|
@@ -108815,6 +108919,42 @@ function JSSymbolData(ast,option,jsExecute)
|
|
|
108815
108919
|
}
|
|
108816
108920
|
}
|
|
108817
108921
|
|
|
108922
|
+
this.RecvDynamicScriptIndexData=function(outVar,indexInfo,symbolData)
|
|
108923
|
+
{
|
|
108924
|
+
JSConsole.Complier.Log('[JSSymbolData::RecvDynamicScriptIndexData] ', outVar, indexInfo, symbolData);
|
|
108925
|
+
var kLine=symbolData.Data.Data;
|
|
108926
|
+
var aryOutVar=outVar;
|
|
108927
|
+
var data=this.Data.FitKLineIndex(kLine,aryOutVar,this.Period,indexInfo.PeriodID);
|
|
108928
|
+
|
|
108929
|
+
var objName=indexInfo.Name;
|
|
108930
|
+
var memberValue={};
|
|
108931
|
+
if (this.Execute.VarTable.has(objName))
|
|
108932
|
+
memberValue=this.Execute.VarTable.get(objName);
|
|
108933
|
+
else
|
|
108934
|
+
this.Execute.VarTable.set(objName, memberValue);
|
|
108935
|
+
|
|
108936
|
+
var strValue="";
|
|
108937
|
+
for(var i=0; i<indexInfo.Args.length; ++i)
|
|
108938
|
+
{
|
|
108939
|
+
var item=indexInfo.Args[i];
|
|
108940
|
+
if (item.IsDefault===false)
|
|
108941
|
+
{
|
|
108942
|
+
if (strValue.length>0) strValue+=",";
|
|
108943
|
+
strValue+=`${item.Value}`;
|
|
108944
|
+
}
|
|
108945
|
+
}
|
|
108946
|
+
var strArgs=`(${strValue})`;
|
|
108947
|
+
|
|
108948
|
+
//保存所有的指标数据, 下面用到了就可以不用算了
|
|
108949
|
+
for(var i=0; i<data.length; ++i)
|
|
108950
|
+
{
|
|
108951
|
+
var key=`${outVar[i].Name}#${strArgs}`;
|
|
108952
|
+
if (indexInfo.Period) key+='#'+indexInfo.Period; //带周期的变量
|
|
108953
|
+
|
|
108954
|
+
memberValue[key]=data[i].Data;
|
|
108955
|
+
}
|
|
108956
|
+
}
|
|
108957
|
+
|
|
108818
108958
|
this.RecvScriptIndexData=function(outVar,indexInfo,symbolData)
|
|
108819
108959
|
{
|
|
108820
108960
|
var key=this.GenerateScriptIndexKey(indexInfo);
|
|
@@ -109688,7 +109828,8 @@ var JS_EXECUTE_JOB_ID=
|
|
|
109688
109828
|
//KDJ.K , KDJ.K#WEEK
|
|
109689
109829
|
//STKINDI('600000.sh','MA.MA1#WEEK',5,10,20,30,60,120);
|
|
109690
109830
|
//CALCSTOCKINDEX('SH600000','KDJ',3)表示上证600000的KDJ指标第3个输出即J之值,第一个参数可在前面加SZ(深市),SH(沪市),BJ(京市)
|
|
109691
|
-
|
|
109831
|
+
//"MA.MA(5,5,5)" 调用动态指标
|
|
109832
|
+
JOB_EXECUTE_INDEX:30010,
|
|
109692
109833
|
|
|
109693
109834
|
JOB_RUN_SCRIPT:10000, //执行脚本
|
|
109694
109835
|
|
|
@@ -110007,7 +110148,7 @@ function JSExecute(ast,option)
|
|
|
110007
110148
|
case JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_CUSTOM_API_DATA:
|
|
110008
110149
|
return this.SymbolData.DownloadCustomAPIData(jobItem);
|
|
110009
110150
|
case JS_EXECUTE_JOB_ID.JOB_EXECUTE_INDEX:
|
|
110010
|
-
return this.SymbolData.CallScriptIndex(jobItem);
|
|
110151
|
+
return this.SymbolData.CallScriptIndex(jobItem, this.VarTable);
|
|
110011
110152
|
|
|
110012
110153
|
case JS_EXECUTE_JOB_ID.JOB_RUN_SCRIPT:
|
|
110013
110154
|
if (this.Debug===1 && this.DebugFilter)
|
|
@@ -110987,6 +111128,35 @@ function JSExecute(ast,option)
|
|
|
110987
111128
|
args.push(value);
|
|
110988
111129
|
}
|
|
110989
111130
|
|
|
111131
|
+
if (node.Callee.Type==Syntax.Literal)
|
|
111132
|
+
{
|
|
111133
|
+
var dynamicName=node.Callee.Value;
|
|
111134
|
+
var aryValue=dynamicName.split(".");
|
|
111135
|
+
if (aryValue.length!=2)
|
|
111136
|
+
{
|
|
111137
|
+
this.ThrowUnexpectedNode(node,`调用指标格式'${dynamicName}'错误`);
|
|
111138
|
+
}
|
|
111139
|
+
|
|
111140
|
+
var name=aryValue[0];
|
|
111141
|
+
var outName=aryValue[1];
|
|
111142
|
+
var strValue="";
|
|
111143
|
+
for(var i=0; i<args.length; ++i)
|
|
111144
|
+
{
|
|
111145
|
+
var value=args[i];
|
|
111146
|
+
if (strValue.length>0) strValue+=",";
|
|
111147
|
+
strValue+=`${value}`;
|
|
111148
|
+
}
|
|
111149
|
+
var strArgs=`(${strValue})`;
|
|
111150
|
+
var key=`${outName}#${strArgs}`;
|
|
111151
|
+
|
|
111152
|
+
node.Out=[];
|
|
111153
|
+
if (!this.VarTable.has(name)) return node.Out;
|
|
111154
|
+
var indexData=this.VarTable.get(name);
|
|
111155
|
+
var value=indexData[key];
|
|
111156
|
+
if (value) node.Out=value;
|
|
111157
|
+
return node.Out;
|
|
111158
|
+
}
|
|
111159
|
+
|
|
110990
111160
|
if (funcName==="IFC")
|
|
110991
111161
|
{
|
|
110992
111162
|
//IFC(X,A,B)若X不为0则执行A,否则执行B.IFC与IF函数的区别:根据X的值来选择性执行A、B表达式.
|
|
@@ -111992,6 +112162,13 @@ function JSExplainer(ast,option)
|
|
|
111992
112162
|
args.push(value);
|
|
111993
112163
|
}
|
|
111994
112164
|
|
|
112165
|
+
if (node.Callee.Type==Syntax.Literal)
|
|
112166
|
+
{
|
|
112167
|
+
var dynamicName=node.Callee.Value;
|
|
112168
|
+
node.Out=`指标引用'${dynamicName}'`;
|
|
112169
|
+
return node.Out;
|
|
112170
|
+
}
|
|
112171
|
+
|
|
111995
112172
|
JSConsole.Complier.Log('[JSExplainer::VisitCallExpression]' , funcName, '(', args.toString() ,')');
|
|
111996
112173
|
|
|
111997
112174
|
if (g_JSComplierResource.IsCustomFunction(funcName))
|
|
@@ -129902,7 +130079,7 @@ function ScrollBarBGChart()
|
|
|
129902
130079
|
|
|
129903
130080
|
|
|
129904
130081
|
|
|
129905
|
-
var HQCHART_VERSION="1.1.
|
|
130082
|
+
var HQCHART_VERSION="1.1.13018";
|
|
129906
130083
|
|
|
129907
130084
|
function PrintHQChartVersion()
|
|
129908
130085
|
{
|