✨ feat(tsl-api-reference): add class and framework API lookup
This commit is contained in:
-89
@@ -49,53 +49,29 @@ A线从下面穿越B线时返回1,从A上面向下穿越B时返回-1,否则
|
||||
|
||||
```tsl
|
||||
// 万科在指定区间内的均线穿越情况;
|
||||
|
||||
setsysparam(pn_stock(), 'SZ000002');
|
||||
|
||||
end_date := inttodate(20110829);
|
||||
|
||||
beg_date := IncWeek(end_date, -1); // end_date 前推一个
|
||||
|
||||
r := array();
|
||||
|
||||
i := 0;
|
||||
|
||||
for d := end_date downto beg_date do
|
||||
|
||||
begin
|
||||
|
||||
if not istradeday(d) then continue;
|
||||
|
||||
setsysparam(pn_date(), d);
|
||||
|
||||
r[i]['date'] := datetostr(d);
|
||||
|
||||
case cross(close(), ma(close(), 5)) of
|
||||
|
||||
1:begin
|
||||
|
||||
r[i]['cross_state'] := '突破5日均线';
|
||||
|
||||
end
|
||||
|
||||
-1:begin
|
||||
|
||||
r[i]['cross_state'] := '跌破5日均线';
|
||||
|
||||
end
|
||||
|
||||
0:begin
|
||||
|
||||
r[i]['cross_state'] := '';
|
||||
|
||||
end
|
||||
|
||||
end;
|
||||
|
||||
i++;
|
||||
|
||||
end;
|
||||
|
||||
return r;
|
||||
```
|
||||
|
||||
@@ -150,25 +126,15 @@ return ema(close(), n);
|
||||
|
||||
```tsl
|
||||
// 获取万科A(SZ000002)截止2011-09-09日14个交易日内的最高,最低的收盘价以及
|
||||
|
||||
// 发生日期。
|
||||
|
||||
setsysparam(pn_stock(), 'SZ000002');
|
||||
|
||||
setsysparam(pn_date(), inttodate(20110909));
|
||||
|
||||
N := 14;
|
||||
|
||||
r := array('h_value':hhv(close(), N),
|
||||
|
||||
'h_date':datetostr(GetSysParam('hhvtime')),
|
||||
|
||||
'l_value':llv(close(), N),
|
||||
|
||||
'l_date':datetostr(GetSysparam('llvtime'))
|
||||
|
||||
);
|
||||
|
||||
return r;
|
||||
```
|
||||
|
||||
@@ -210,13 +176,9 @@ return r;
|
||||
|
||||
```tsl
|
||||
// 获得万科A(SZ000002)在2011-09-09日的10日均价
|
||||
|
||||
setsysparam(pn_stock(), 'SZ000002');
|
||||
|
||||
setsysparam(pn_date(), inttodate(20110909));
|
||||
|
||||
N := 10;
|
||||
|
||||
return ma(close(), N);
|
||||
// 输出:8.103
|
||||
```
|
||||
@@ -225,13 +187,9 @@ return ma(close(), N);
|
||||
|
||||
```tsl
|
||||
// 获取万科A一段时间的10日均价
|
||||
|
||||
setsysparam(pn_stock(), "SZ000002");
|
||||
|
||||
setsysparam(pn_date(), strtodate("2014-01-15"));
|
||||
|
||||
t := nday(100, 'time', sp_time(), 'close', close(), 'ma10', ma(close(), 10), 'ma20', ma(close(), 20));
|
||||
|
||||
return t;
|
||||
```
|
||||
|
||||
@@ -319,13 +277,9 @@ return sma(close(), n, m);
|
||||
|
||||
```tsl
|
||||
Setsysparam(pn_Stock(), "SZ000002");
|
||||
|
||||
Setsysparam(pn_date(), 20181030T);
|
||||
|
||||
return Nday(10, "日期", SP_time(),
|
||||
|
||||
"几何平均价格", Specall(SP_geomean(Close(), 4),
|
||||
|
||||
Array(Pn_Cycle():Cy_60m(), pn_date():SP_time()+0.99)));
|
||||
```
|
||||
|
||||
@@ -350,9 +304,7 @@ return Nday(10, "日期", SP_time(),
|
||||
|
||||
```tsl
|
||||
Setsysparam(pn_Stock(), "SZ000002");
|
||||
|
||||
Setsysparam(pn_date(), 20181030T);
|
||||
|
||||
return Nday(10, "日期", SP_time(), "调和平均价格", Specall(SP_Harmean(Close(), 4800), Array(Pn_Cycle():Cy_3s(), pn_date():SP_time()+0.99)));
|
||||
```
|
||||
|
||||
@@ -377,9 +329,7 @@ return Nday(10, "日期", SP_time(), "调和平均价格", Specall(SP_Harmean(Cl
|
||||
|
||||
```tsl
|
||||
Setsysparam(pn_Stock(), "SZ000002");
|
||||
|
||||
Setsysparam(pn_date(), 20181030T);
|
||||
|
||||
return Nday(10, "日期", SP_time(), "峰度", Specall(SP_kurtosis(Close(), 4800), array(pn_date():SP_time()+0.99, pn_Cycle():Cy_3s())));
|
||||
```
|
||||
|
||||
@@ -404,9 +354,7 @@ return Nday(10, "日期", SP_time(), "峰度", Specall(SP_kurtosis(Close(), 4800
|
||||
|
||||
```tsl
|
||||
Setsysparam(pn_Stock(), "SZ000002");
|
||||
|
||||
Setsysparam(pn_date(), 20181030T);
|
||||
|
||||
return Nday(10, "日期", SP_time(), "峰度", Specall(SP_kurtosis2(Close(), 4800), array(pn_date():SP_time()+0.99, pn_Cycle():Cy_3s())));
|
||||
```
|
||||
|
||||
@@ -432,9 +380,7 @@ return Nday(10, "日期", SP_time(), "峰度", Specall(SP_kurtosis2(Close(), 480
|
||||
|
||||
```tsl
|
||||
Setsysparam(pn_Stock(), "SZ000002");
|
||||
|
||||
Setsysparam(pn_date(), 20181030T);
|
||||
|
||||
return Nday(10, "日期", SP_time(), "分钟线最大成交量", Specall(SP_Large(Vol(), 1, 240), Array(Pn_Cycle():Cy_1m(), pn_date():SP_time()+0.99)));
|
||||
```
|
||||
|
||||
@@ -460,9 +406,7 @@ return Nday(10, "日期", SP_time(), "分钟线最大成交量", Specall(SP_Larg
|
||||
|
||||
```tsl
|
||||
Setsysparam(pn_Stock(), "SZ000002");
|
||||
|
||||
Setsysparam(pn_date(), 20181030T);
|
||||
|
||||
Return Nday(10, "日期", SP_time(), "价格", SpecAll(SP_percentile(close(), 0.8, 240), Array(pn_Cycle():Cy_1m(), pn_date():SP_time()+0.99)));
|
||||
```
|
||||
|
||||
@@ -488,9 +432,7 @@ Return Nday(10, "日期", SP_time(), "价格", SpecAll(SP_percentile(close(), 0.
|
||||
|
||||
```tsl
|
||||
Setsysparam(pn_Stock(), "SZ000002");
|
||||
|
||||
Setsysparam(pn_date(), 20181030T);
|
||||
|
||||
Return Nday(10, "日期", SP_time(), "百分比", SpecAll(SP_percentRank(close(), close(), 240), Array(pn_Cycle():Cy_1m(), pn_date():SP_time()+0.99)));
|
||||
```
|
||||
|
||||
@@ -516,9 +458,7 @@ Return Nday(10, "日期", SP_time(), "百分比", SpecAll(SP_percentRank(close()
|
||||
|
||||
```tsl
|
||||
Setsysparam(pn_Stock(), "SZ000002");
|
||||
|
||||
Setsysparam(pn_date(), 20181030T);
|
||||
|
||||
return Nday(10, "日期", SP_time(), "价格", Specall(SP_quartile(Close(), 2, 4800), Array(Pn_Cycle():Cy_3s(), pn_date():SP_time()+0.99)));
|
||||
```
|
||||
|
||||
@@ -544,9 +484,7 @@ return Nday(10, "日期", SP_time(), "价格", Specall(SP_quartile(Close(), 2, 4
|
||||
|
||||
```tsl
|
||||
Setsysparam(pn_Stock(), "SZ000002");
|
||||
|
||||
Setsysparam(pn_date(), 20181030T);
|
||||
|
||||
Return Nday(10, "日期", SP_time(), "排名", SpecAll(SP_Rank(close(), close(), 240), Array(pn_Cycle():Cy_1m(), pn_date():SP_time()+0.99)));
|
||||
```
|
||||
|
||||
@@ -571,9 +509,7 @@ Return Nday(10, "日期", SP_time(), "排名", SpecAll(SP_Rank(close(), close(),
|
||||
|
||||
```tsl
|
||||
Setsysparam(pn_Stock(), "SZ000002");
|
||||
|
||||
Setsysparam(pn_date(), 20181030T);
|
||||
|
||||
return Nday(10, "日期", SP_time(), "偏度", Specall(SP_skewness(Close(), 4800), array(pn_date():SP_time()+0.99, pn_Cycle():Cy_3s())));
|
||||
```
|
||||
|
||||
@@ -598,9 +534,7 @@ return Nday(10, "日期", SP_time(), "偏度", Specall(SP_skewness(Close(), 4800
|
||||
|
||||
```tsl
|
||||
Setsysparam(pn_Stock(), "SZ000002");
|
||||
|
||||
Setsysparam(pn_date(), 20181030T);
|
||||
|
||||
return Nday(10, "日期", SP_time(), "偏度", Specall(SP_skewness2(Close(), 4800), array(pn_date():SP_time()+0.99, pn_Cycle():Cy_3s())));
|
||||
```
|
||||
|
||||
@@ -626,11 +560,8 @@ return Nday(10, "日期", SP_time(), "偏度", Specall(SP_skewness2(Close(), 480
|
||||
|
||||
```tsl
|
||||
Setsysparam(pn_Stock(), "SZ000002");
|
||||
|
||||
Setsysparam(pn_date(), 20181030T);
|
||||
|
||||
Setsysparam(pn_Cycle(), cy_Month());
|
||||
|
||||
return Nday(12, "日期", SP_time(), "月末5日最小价格", Specall(SP_Small(Close(), 1, 5), Array(Pn_Cycle():Cy_day())));
|
||||
```
|
||||
|
||||
@@ -656,25 +587,15 @@ return Nday(12, "日期", SP_time(), "月末5日最小价格", Specall(SP_Small(
|
||||
|
||||
```tsl
|
||||
// 计算万科A截止20110909前30个交易日股价的统计信息
|
||||
|
||||
setsysparam(pn_stock(), 'SZ000002');
|
||||
|
||||
setsysparam(pn_date(), inttodate(20110909));
|
||||
|
||||
_stat := array();
|
||||
|
||||
_stat := array('标准差':sp_std(close(), 30),
|
||||
|
||||
'总体标准差':sp_stdp(close(), 30),
|
||||
|
||||
'方差':sp_var(close(), 30),
|
||||
|
||||
'总体方差':sp_varp(close(), 30),
|
||||
|
||||
'平均绝对偏差':sp_avedev(close(), 30),
|
||||
|
||||
'偏差平方和':sp_devsq(close(), 30));
|
||||
|
||||
return _stat;
|
||||
```
|
||||
|
||||
@@ -700,11 +621,8 @@ return _stat;
|
||||
|
||||
```tsl
|
||||
// 计算万科截止20110909前30个交易日股票的总体标准差
|
||||
|
||||
setsysparam(pn_stock(), 'SZ000002');
|
||||
|
||||
setsysparam(pn_date(), inttodate(20110909));
|
||||
|
||||
return sp_stdp(close(), 30);
|
||||
// 输出:0.1456
|
||||
```
|
||||
@@ -730,9 +648,7 @@ return sp_stdp(close(), 30);
|
||||
|
||||
```tsl
|
||||
Setsysparam(pn_Stock(), "SZ000002");
|
||||
|
||||
Setsysparam(pn_date(), 20181030T);
|
||||
|
||||
return Nday(10, "日期", SP_time(), "偏差", Specall(SP_totalvariance(Close(), 4800), array(pn_date():SP_time()+0.99, pn_Cycle():Cy_3s())));
|
||||
```
|
||||
|
||||
@@ -758,9 +674,7 @@ return Nday(10, "日期", SP_time(), "偏差", Specall(SP_totalvariance(Close(),
|
||||
|
||||
```tsl
|
||||
Setsysparam(pn_Stock(), "SZ000002");
|
||||
|
||||
Setsysparam(pn_date(), 20181030T);
|
||||
|
||||
return Nday(10, "日期", SP_time(), "平均价格", Specall(SP_trimmean(Close(), 0.8, 4800), Array(Pn_Cycle():Cy_3s(), pn_date():SP_time()+0.99)));
|
||||
```
|
||||
|
||||
@@ -786,11 +700,8 @@ return Nday(10, "日期", SP_time(), "平均价格", Specall(SP_trimmean(Close()
|
||||
|
||||
```tsl
|
||||
// 计算万科截止20110909前30个交易日股票的样本方差
|
||||
|
||||
setsysparam(pn_stock(), 'SZ000002');
|
||||
|
||||
setsysparam(pn_date(), inttodate(20110909));
|
||||
|
||||
return sp_var(close(), 30);
|
||||
// 输出:0.0219
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user