249 lines
8.7 KiB
Markdown
249 lines
8.7 KiB
Markdown
# 事件套利 / 事件应用
|
|
|
|
## `TSEDApplication`
|
|
|
|
声明:class
|
|
|
|
事件应用框架
|
|
|
|
<!-- tags: 事件驱动 事件研究 事件应用 事件套利 -->
|
|
|
|
### `fEventNo`
|
|
|
|
声明:field
|
|
|
|
事件大类编号 0
|
|
|
|
可见性:`public`
|
|
|
|
类型:int
|
|
|
|
### `fEventType`
|
|
|
|
声明:field
|
|
|
|
事件类型 0
|
|
|
|
可见性:`public`
|
|
|
|
类型:int
|
|
|
|
### `fEventDateType`
|
|
|
|
声明:field
|
|
|
|
事件日类型 0
|
|
|
|
可见性:`public`
|
|
|
|
类型:int
|
|
|
|
### `fSampleData`
|
|
|
|
声明:field
|
|
|
|
事件样本数据 Array()
|
|
|
|
可见性:`public`
|
|
|
|
类型:array
|
|
|
|
### `get_DataRP_SampleData_Time(rsp_cy)`
|
|
|
|
声明:function
|
|
|
|
获取事件样本时间分布
|
|
|
|
<!-- tags: 查询 事件驱动 事件研究 时间处理 日期时间 -->
|
|
|
|
可见性:`public`
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
| -------- | ------ | ----------------------------------------------------------------------------------------------------------------- |
|
|
| `rsp_cy` | string | 表达式型,划分周期 取值 含义 备注 cy_week 周线 cy_month 月线 默认 cy_quarter 季线 cy_halfyear 半年线 cy_year 年线 |
|
|
|
|
返回:table
|
|
|
|
### `get_DataRP_SampleData_PlateIndustry(rsp_cy, type_name)`
|
|
|
|
声明:function
|
|
|
|
获取事件样本板块或行业分布,支持外部数据标签划分方式
|
|
|
|
<!-- tags: 查询 拆分 分割 事件驱动 事件研究 行业分类 -->
|
|
|
|
可见性:`public`
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
| ----------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
| `rsp_cy` | string | 具体介绍见 Get_DataRP_SampleData_Time(RSP_Cy)中参数 RSP_Cy |
|
|
| `type_name` | string | 字符串,划分类型 取值 含义 备注 "板块" 按板块划分 "行业" 按行业划分 采用中证一级行业分类 外部数据标签 自定义划分方式 比如按规模划分 |
|
|
|
|
返回:table
|
|
|
|
### `get_DataRP_SampleData_PlateIndustry(type_name)`
|
|
|
|
声明:function
|
|
|
|
获取事件样本分布统计,支持外部数据标签划分方式
|
|
|
|
<!-- tags: 查询 拆分 分割 汇总 事件驱动 事件研究 行业分类 板块 -->
|
|
|
|
可见性:`public`
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
| ----------- | ------ | ------------------------------------------------------------------------------ |
|
|
| `type_name` | string | 具体介绍见 Get_DataRP_SampleData_PlateIndustry(RSP_Cy,TypeName)中参数 TypeName |
|
|
|
|
返回:table
|
|
|
|
### `get_DataRP_RevenueData_Event(return_opt)`
|
|
|
|
声明:function
|
|
|
|
获取事件窗维度事件收益表现
|
|
|
|
<!-- tags: 查询 事件驱动 事件研究 -->
|
|
|
|
可见性:`public`
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
| ------------ | ------- | ---------------------------------------------------------- |
|
|
| `return_opt` | integer | 整数型,收益类型 取值 含义 备注 0 超额收益 默认 1 实际收益 |
|
|
|
|
返回:table
|
|
|
|
### `get_DataRP_RevenueData_Time(rsp_cy, n, return_opt)`
|
|
|
|
声明:function
|
|
|
|
获取时间轴维度事件收益表现
|
|
|
|
<!-- tags: 查询 事件驱动 事件研究 时间处理 日期时间 -->
|
|
|
|
可见性:`public`
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
| ------------ | ------- | ------------------------------------------------------------------ |
|
|
| `rsp_cy` | string | 具体介绍见 Get_DataRP_SampleData_Time(RSP_Cy)中参数 RSP_Cy |
|
|
| `n` | integer | 整数型,事件窗窗口值,必须属于事件窗序列,默认:0 |
|
|
| `return_opt` | integer | 具体介绍见 Get_DataRP_RevenueData_Event(ReturnOpt)中参数 ReturnOpt |
|
|
|
|
返回:table
|
|
|
|
### `get_DataRP_RevenueData_Statistics(return_opt)`
|
|
|
|
声明:function
|
|
|
|
获取事件收益基本统计描述(按事件窗)
|
|
|
|
<!-- tags: 查询 汇总 事件驱动 事件研究 -->
|
|
|
|
可见性:`public`
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
| ------------ | ------- | ------------------------------------------------------------------ |
|
|
| `return_opt` | integer | 具体介绍见 Get_DataRP_RevenueData_Event(ReturnOpt)中参数 ReturnOpt |
|
|
|
|
返回:table
|
|
|
|
### `get_DataRP_RevenueData_Statistics2(rsp_cy, n, return_opt)`
|
|
|
|
声明:function
|
|
|
|
获取事件收益基本统计描述(按时间轴)
|
|
|
|
<!-- tags: 查询 汇总 事件驱动 事件研究 时间处理 日期时间 -->
|
|
|
|
可见性:`public`
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
| ------------ | ------- | ------------------------------------------------------------------ |
|
|
| `rsp_cy` | string | 具体介绍见 Get_DataRP_SampleData_Time(RSP_Cy)中参数 RSP_Cy |
|
|
| `n` | integer | 整数型,事件窗窗口值,必须属于事件窗序列,默认:0 |
|
|
| `return_opt` | integer | 具体介绍见 Get_DataRP_RevenueData_Event(ReturnOpt)中参数 ReturnOpt |
|
|
|
|
返回:table
|
|
|
|
### `get_DataRP_RevenueData_Statistics3(type_name, n, return_opt)`
|
|
|
|
声明:function
|
|
|
|
获取事件收益基本统计描述(按标签分布)
|
|
|
|
<!-- tags: 查询 汇总 事件驱动 事件研究 -->
|
|
|
|
可见性:`public`
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
| ------------ | ------- | ------------------------------------------------------------------------------ |
|
|
| `type_name` | string | 具体介绍见 Get_DataRP_SampleData_PlateIndustry(RSP_Cy,TypeName)中参数 TypeName |
|
|
| `n` | integer | 整数型,事件窗窗口值,必须属于事件窗序列,默认:0 |
|
|
| `return_opt` | integer | 具体介绍见 Get_DataRP_RevenueData_Event(ReturnOpt)中参数 ReturnOpt |
|
|
|
|
返回:table
|
|
|
|
#### 示例
|
|
|
|
范例01:调用示例
|
|
|
|
```tsl
|
|
obj := CreateObject('TSEDApplication');
|
|
obj.FEventNo := 1; //事件大类编号
|
|
obj.FEventType := 0; //事件类型
|
|
obj.FEventDateType := 0; //事件日类型
|
|
obj.FBegT := 20191209T; //开始日
|
|
obj.FEndT := 20221209T; //截止日
|
|
obj.FBKName := "A 股;暂停上市;终止上市"; //初始样本池
|
|
obj.FReportType := 0; //(报告期类型事件设置)报告期类型
|
|
obj.FIndexArr := array("SH000300"); //(指数定期调整类型事件设置)指数池
|
|
obj.FIndexID := "SH000300"; //基准指数代码
|
|
obj.FDayArr := array(-1,0,1); //事件窗窗口序列
|
|
obj.main();
|
|
|
|
//返回事件分析数据
|
|
return array("事件基本信息":"-----",
|
|
"时间分布":obj.Get_DataRP_SampleData_Time("年线"),
|
|
"行业分布":obj.Get_DataRP_SampleData_PlateIndustry("年线","行
|
|
业"),
|
|
"板块分布":obj.Get_DataRP_SampleData_PlateIndustry("年线","板
|
|
块"),
|
|
"事件样本分布统计(行
|
|
业)":obj.Get_DataRP_SampleData_PlateIndustry2("行业"),
|
|
"事件样本分布统计(板
|
|
块)":obj.Get_DataRP_SampleData_PlateIndustry2("板块"),
|
|
"事件收益表现":"-----",
|
|
"事件窗维度":obj.Get_DataRP_RevenueData_Event(0),
|
|
"时间轴维度":obj.Get_DataRP_RevenueData_Time("年线",0,0),
|
|
"收益基本统计描述(按事件窗)
|
|
":obj.Get_DataRP_RevenueData_Statistics(0),
|
|
"收益基本统计描述(按时间轴)
|
|
":obj.Get_DataRP_RevenueData_Statistics2("年线",0,0),
|
|
"收益基本统计描述(按行业)
|
|
":obj.Get_DataRP_RevenueData_Statistics3("行业",0,0),
|
|
"收益基本统计描述(按板块)
|
|
":obj.Get_DataRP_RevenueData_Statistics3("板块",0,0),
|
|
"详情数据":"-----",
|
|
"事件样本数据":obj.GetSampleData(0),
|
|
"事件收益数据":obj.Get_Ret_Detail(1,0,0)
|
|
);
|
|
```
|
|
|
|
范例02:调用示例
|
|
|
|
```tsl
|
|
EventType := 0; // 事件类型,0:调入(默认),1:调出
|
|
EventDateType := 0; //事件日类型,0:实施日(默认),1:公布日,2:考察期截止日
|
|
BegT := 20200101T;
|
|
EndT := 20211231T;
|
|
IndexArr := array("SH000300");
|
|
IndexID := "SH000300";
|
|
DayArr := array(-30,1)->30; //事件窗
|
|
RSP_Cy := Cy_halfyear(); //采样周期
|
|
N := 1;
|
|
return_opt := 0; //返回结果,0:超额收益(默认),1:实际收益
|
|
Return
|
|
ED_Application_IndexAdjustment(EventType,EventDateType,Begt,Endt,IndexArr
|
|
,IndexID,DayArr,RSP_Cy,N,return_opt);
|
|
```
|