✨ feat(tsl-api-reference): expand and reorganize api catalog
Flatten builtin pages, add third-party and platform scopes, and import financial and data warehouse references. Keep the existing generated index without rebuilding after signature normalization.
This commit is contained in:
@@ -0,0 +1,150 @@
|
||||
# 数据仓库 / 成交明细数据函数
|
||||
|
||||
## `tdCount()`
|
||||
|
||||
声明:function
|
||||
|
||||
返回当前时间系统记载的交易点数量
|
||||
|
||||
返回:int
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:调用函数
|
||||
|
||||
```tsl
|
||||
setsysparam(pn_stock(), 'SZ000002');
|
||||
setsysparam(pn_date(), inttodate(20110909));
|
||||
return nday(5, 'date', datetostr(sp_time()), '系统记录交易点数量', tdcount());
|
||||
```
|
||||
|
||||
## `tdInfo()`
|
||||
|
||||
声明:function
|
||||
|
||||
取得当前时间点的成交明细数据。返回的数据是一维字符串下标表。 数据如下: 字段名字段含义字段类型 time日期时间TDateTime price成交价格Real amount成交金额Real vol成交量Real glb量比Real buy1买一价Real buy2买二价Real buy3买三价Real buy4买四价Real buy5买五价Real sale1卖一价Real sale2卖二价Real sale3卖三价Real sale4卖四价Real sale5卖五价Real bc1买一量Integer bc2买二量Integer bc3买三量Integer bc4买四量Integer bc5买五量Integer sc1卖一量Integer sc2卖二量Integer sc3卖三量Integer sc4卖四量Integer sc5卖五量Integer syl1市盈率1Real syl2市盈率2Real tradecnt交易笔数Integer
|
||||
|
||||
返回:array
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:调用函数
|
||||
|
||||
```tsl
|
||||
setsysparam(pn_stock(), 'SZ000002');
|
||||
setsysparam(pn_cycle(), cy_1m());
|
||||
setsysparam(pn_date(), strtodatetime("2014-01-15 10:00:00"));
|
||||
return TDInfo();
|
||||
```
|
||||
|
||||
## `tdInfoByIndex(n)`
|
||||
|
||||
声明:function
|
||||
|
||||
取得某一交易点的成交明细数据。返回的数据是一维字符串下标表。 数据如下: 字段名字段含义字段类型 time日期时间TDateTime price成交价格Real amount成交金额Real vol成交量Real glb量比Real buy1买一价Real buy2买二价Real buy3买三价Real buy4买四价Real buy5买五价Real sale1卖一价Real sale2卖二价Real sale3卖三价Real sale4卖四价Real sale5卖五价Real bc1买一量Integer bc2买二量Integer bc3买三量Integer bc4买四量Integer bc5买五量Integer sc1卖一量Integer sc2卖二量Integer sc3卖三量Integer sc4卖四量Integer sc5卖五量Integer syl1市盈率1Real syl2市盈率2Real tradecnt交易笔数Integer
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ---- | ---- | --------------------------------------------------------- |
|
||||
| `n` | int | 整数,交易点位置,0表示第一个交易点,-1表示最后一个交易点 |
|
||||
|
||||
返回:array
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:调用函数
|
||||
|
||||
```tsl
|
||||
setsysparam(pn_stock(), 'SZ000002');
|
||||
setsysparam(pn_date(), inttodate(20110909));
|
||||
return TDInfoByIndex(-1);
|
||||
```
|
||||
|
||||
## `tdSum(sum_vol, sum_amount, date, trade_flag, start_time, end_time, min_vol, min_amount, min_price, max_vol, max_amount, max_price, mmp_flag, vol_amount_or)`
|
||||
|
||||
声明:function
|
||||
|
||||
成交明细数据统计
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --------------- | -------- | ---------------------------------------------------------------------------- |
|
||||
| `sum_vol` | float | 整数,返回的成交量和 |
|
||||
| `sum_amount` | float | 实数,返回的成交金额和 |
|
||||
| `date` | datetime | 日期,成交明细的所在日期 |
|
||||
| `trade_flag` | integer | 整数,交易主买/主卖条件(0,全部,1主买,2主卖,3中性,4主买+中性,5主卖+中性) |
|
||||
| `start_time` | datetime | 时间,开始时间 |
|
||||
| `end_time` | datetime | 时间,截止时间 |
|
||||
| `min_vol` | float | 整数,最低的交易量 |
|
||||
| `min_amount` | float | 实数,最低的交易金额 |
|
||||
| `min_price` | float | 实数,最低的价格 |
|
||||
| `max_vol` | float | 整数,最高的交易量 |
|
||||
| `max_amount` | float | 实数,最低的交易金额 |
|
||||
| `max_price` | float | 实数,最高的价格 |
|
||||
| `mmp_flag` | integer | 整数,是否考虑买卖盘。0不考虑,1考虑买,2考虑卖,3考虑买盘和卖盘 |
|
||||
| `vol_amount_or` | bool | 布尔,交易量和交易金额是否用OR条件判断 |
|
||||
|
||||
返回:void
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:对万科A(SZ000002)在2011-9-9日统计满足以下条件的成交量,成交金额:
|
||||
|
||||
```tsl
|
||||
// 对万科A(SZ000002)在2011-9-9日统计满足以下条件的成交量,成交金额:
|
||||
|
||||
// 13点至15点之间、成交量在10000~90000
|
||||
|
||||
// 成交金额0~9000000、价格8.00~8.50之间且是主买
|
||||
|
||||
setsysparam(pn_stock(), 'SZ000002');
|
||||
|
||||
d := inttodate(20110909);
|
||||
|
||||
trade_flag := 1;
|
||||
|
||||
beg_time := strtotime('13:00:00');
|
||||
|
||||
end_time := strtotime('15:00:00');
|
||||
|
||||
min_vol := 10000;
|
||||
|
||||
min_amount := 0;
|
||||
|
||||
min_price := 8.00;
|
||||
|
||||
max_vol := 90000;
|
||||
|
||||
max_amount := 9000000;
|
||||
|
||||
max_price := 8.50;
|
||||
|
||||
TDSum(sumVol, sumAmount, d, trade_flag, beg_time, end_time,
|
||||
|
||||
min_vol, min_amount, min_price,
|
||||
|
||||
max_vol, max_amount, max_price);
|
||||
|
||||
return array(sumVol, sumAmount);
|
||||
```
|
||||
|
||||
## `toverData(date)`
|
||||
|
||||
声明:function
|
||||
|
||||
取得某日的成交明细数据。返回的数据是一张表。不给参数,则返回当前时间的交易明细数据。 数据如下: 字段名字段含义字段类型 time日期时间TDateTime price成交价格Real amount成交金额Real vol成交量Real glb量比Real buy1买一价Real buy2买二价Real buy3买三价Real buy4买四价Real buy5买五价Real sale1卖一价Real sale2卖二价Real sale3卖三价Real sale4卖四价Real sale5卖五价Real bc1买一量Integer bc2买二量Integer bc3买三量Integer bc4买四量Integer bc5买五量Integer sc1卖一量Integer sc2卖二量Integer sc3卖三量Integer sc4卖四量Integer sc5卖五量Integer syl1市盈率1Real syl2市盈率2Real tradecnt交易笔数Integer
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------ | -------- | ------------ |
|
||||
| `date` | datetime | 日期,可省略 |
|
||||
|
||||
返回:table_array
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:调用函数
|
||||
|
||||
```tsl
|
||||
setsysparam(pn_stock(), 'SZ000002');
|
||||
t := toverdata(inttodate(20140115));
|
||||
update t set ['time']=datetimetostr(['time']) end;
|
||||
return t;
|
||||
```
|
||||
Reference in New Issue
Block a user