# 期货 / 其他 ### `futureslimitschangecount2(n)` N日涨跌停板变化次数,与系统参数(期货合约代码,时间)相关 | 参数 | 类型 | 说明 | | ---- | ---- | -------------- | | `n` | int | integer,交易日 | 返回:float ### `futureslimitsrange()` 指定日涨跌停板幅度,与系统参数(期货合约代码,时间)相关 返回:float ### `futuresMaintenanceMarginRate(end_t, margin_rate_type)` 期货结算保证金率(%),取自期货结算参数(表704)中小于或等于EndT的最后一条数据,与系统证券pn_stock()有关。 | 参数 | 类型 | 说明 | | ------------------ | -------- | ------------------ | | `end_t` | datetime | 日期,截止日 | | `margin_rate_type` | int | 整数,保证金率类型 | 返回:float #### 示例 ```tsl setsysparam(pn_stock(),"cu1404"); return FuturesMaintenanceMarginRate(inttodate(20140331),0); ``` ### `futuresPremiumRate(annual)` 指定日升贴水率(%),与系统参数(证券代码、时间、周期、复权、基准)相关。目前仅支持股指期货,可使用主力连续代码。 | 参数 | 类型 | 说明 | | -------- | ---- | -------------- | | `annual` | int | 整数。是否年化 | 返回:float #### 示例 ```tsl SetSysParam(pn_stock(),"IC00"); SetSysParam(pn_date(),20230403T); return FuturesPremiumRate(1); ``` ### `futuresTradingMarginRate(end_t, margin_rate_type)` 期货交易保证金率(%),取自期货结算参数(表704)中小于或等于EndT-1的最后一条数据,与系统证券pn_stock()有关。 | 参数 | 类型 | 说明 | | ------------------ | -------- | ------------------ | | `end_t` | datetime | 日期,截止日 | | `margin_rate_type` | int | 整数,保证金率类型 | 返回:float #### 示例 ```tsl setsysparam(pn_stock(),"cu1404"); return FuturesTradingMarginRate(inttodate(20140331),0); ``` ### `getFuturesTradeRankingByDate(end_t, t)` 指定日期货日成交持仓排名 模型从数据库中提取系统证券pn_stock的成交持仓排名数据,按照排名类型、数量降序排序。注意,设置系统参数pn_stock只能用实际的合约,比如IF1508,而不能用虚拟合约代码,IF01、IF00等。 数据详细说明及查询案例见:关于增加期货日成交持仓排名数据及访问方法 | 参数 | 类型 | 说明 | | ------- | -------- | ---------------------------------------------------------------------------------------------------------- | | `end_t` | datetime | 日期,截止日期; | | `t` | array | 二维数组,结果存储。期货日成交持仓排名数据(截止日、代码、排名类型、排名、机构简称、数量、比上交易日增减) | 返回:float #### 示例 ```tsl setsysparam(pn_stock(),'IF1508'); GetFuturesTradeRankingByDate(20150722T,t); return t; ``` ### `futureslimitsischanged()` 涨跌停板幅度是否有变化,与系统参数(期货合约代码,时间)相关 返回:boolean ### `futureslimitschangecount(begt, endt)` 区间涨跌停板变化次数,与系统参数(期货合约代码,时间)相关 | 参数 | 类型 | 说明 | | --- | --- | --- | | `begt` | date | date,开始日期 | | `endt` | date | date,截止日期 | 返回:real ### `qhLastTradeDay(id)` 按照期货合约规则得到期货的最后交易日。 | 参数 | 类型 | 说明 | | ---- | ------ | -------- | | `id` | string | 期货代码 | 返回:datetime ### `futuresdeliverydaysbyendt(futuresid, endt)` 计算指定日期货离交割日的交易天数 | 参数 | 类型 | 说明 | | --- | --- | --- | | `futuresid` | security | security,期货合约 | | `endt` | date | date,指定日 | 返回:integer #### 示例 ```tsl //获取CU2101在2020-3-20日距离交割日的交易天数 return futuresdeliverydaysbyendt('CU2101',20200320T); //返回209 ``` ### `futuresBasis()` 指定日期现基差,与系统参数(证券代码、时间、周期、复权、基准)相关。目前仅支持股指期货,可使用主力连续代码。 返回:Real #### 示例 ```tsl //IC00在20230403的基差 setSysParam(pn_stock(),"IC00"); setSysParam(pn_date(),20230403T); return futuresBasis(); //结果:-63.8073 ``` ### `futuresSpotAmountRatio()` 指定日期现成交比,与系统参数(证券代码、时间、周期、复权、基准)相关。目前仅支持股指期货,可使用主力连续代码。 返回:Real #### 示例 ```tsl //IC00在20230331的期现成交比 setSysParam(pn_stock(),"IC00"); setSysParam(pn_date(),20230403T); return futuresSpotAmountRatio(); //结果:0.0914685663852422 ``` ### `futuresDeliverBondNum()` 当前国债期货可交割债券数,与系统参数(证券)相关。 返回:Integer #### 示例 ```tsl setSysParam(pn_stock(),"TF2012"); return futuresDeliverBondNum(); //结果:6 ``` ### `futureFeeRateField(_type)` 结算参数-手续费(交易额万分之)。根据Type\_的取值返回对应的值 | 参数 | 类型 | 说明 | | ------ | ---- | ---- | | `_type` | any | 整数 | 返回:string ### `futureMarginRateField(_type)` 结算参数-保证金率。根据Type\_的取值返回对应的值 | 参数 | 类型 | 说明 | | ------ | ---- | ---- | | `_type` | any | 整数 | 返回:string ### `futureFeeAmountField(_type)` 结算参数-手续费(元/手)。根据Type\_的取值返回对应的值 | 参数 | 类型 | 说明 | | ------ | ---- | ---- | | `_type` | any | 整数 | 返回:string ### `cuTMarketValueField()` 市价总值字段。 返回:string ### `cuDetailField()` 详情字段。 返回:string ### `cuEndDateField()` 截止日字段。 返回:string ### `cuMarketValueField()` 市值字段。 返回:string ### `cuNMarketValueField()` 流通市值字段。 返回:string ### `cuIndustryNameField()` 行业名称。 返回:string ### `cuNotGetFinancialDataBeforeListField()` 不返回上市前数据。 返回:string ### `cuValueField()` 数值字段。 返回:string|float ### `cuTtmField()` TTM。 返回:string ### `cuChangeDateField()` 变动日字段。根据数据库提供商返回对应的值 返回:string ### `cuTypeField()` 类型字段。 返回:string ### `cuItemField()` 项目字段。 返回:string ### `cuSourceField()` 来源字段。 返回:string ### `cuRemarkField()` 备注。 返回:string ### `cuDateField()` 日期字段。 返回:string|datetime ### `cuChangePercentField()` 变比字段。 返回:string ### `cuChangeValueField()` 变动值字段。 返回:string ### `cuReasonField()` 原因字段。 返回:string ### `cuIndustryValueField()` 行业字段。 返回:string ### `cuCompanyValueField()` 公司字段。 返回:string ### `cuBegDateField()` 开始日字段。 返回:string ### `cuPercentField()` 比例字段。 返回:string ### `cuVolumnField()` 数量字段。 名称字段。 返回:string ### `cuNameField()` 返回'Integer'字符串。 返回:string ### `qhlsrF(n, _type)` 阻力指标 | 参数 | 类型 | 说明 | | ------ | ---- | -------- | | `n` | any | 天数 | | `_type` | any | 结果类型 | 返回:float ### `qhlsrV(n)` 阻力指标,根据量增价涨,量减价跌的走势特征,先计算出QHL值,QHL值较小说明有较强的支撑和阻力,较大说明较弱的支撑和阻力。QHLSR阻力指标在实战应用中只是判断个股和市场阻力作为参考使用,要灵活结合K线,均线等技术分析综合使用。与系统证券pn_stock()、系统时间pn_date()、系统周期pn_cycle()、复权方式pn_rate()和复权基准日pn_rateday()相关。调用时需注意设置系统参数。 | 参数 | 类型 | 说明 | | ---- | ---- | ---------------- | | `n` | any | 整数,交易日天数 | 返回:float ### `qhzfXz(stock_id, begt, endt, cy)` 对于期货主力线和连续线的涨幅修正。更换合约时,使用当天实际代码计算涨幅。 | 参数 | 类型 | 说明 | | ---------- | -------- | -------------- | | `stock_id` | string | 证券,代码 | | `begt` | datetime | 日期,开始日期 | | `endt` | datetime | 日期,截止日期 | | `cy` | string | 周期 | 返回:any ### `cumTimeZf(rsp_cycle, b_time, e_time, n)` 过去N个日内累计时点涨幅(%) | 参数 | 类型 | 说明 | | ----------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- | | `rsp_cycle` | any | 采样小周期 | | `b_time` | datetime | 日内开始时点 | | `e_time` | datetime | 日内截止时点 | | `n` | any | 整型,当前时间向历史推移N个周期长度作为采样的时间区间(大区间),与当前时间,周期相关。默认为 1,与市场周期对齐;N为0时,返回最后一个高频时刻 | 返回:float ### `futuresSpotSpread(bond_id)` 返回指定期货相对于指定债券标的期现价差,与系统证券代码时间周期相关。 | 参数 | 类型 | 说明 | | --------- | ------ | ---------------- | | `bond_id` | string | 字符串,债券代码 | 返回:float ### `futuresDividentPredict(endt, predict_type)` 股指期货合约的存续期内分红,是指从当前时间到合约到期日之间的指数的分红点位,与系统证券代码相关。 | 参数 | 类型 | 说明 | | --- | --- | --- | | `endt` | Date | 日期类型,截止日 | | `predict_type` | Int | 整型,预测方式 | 返回:Real #### 示例 ```tsl //IF2409在合约期内的分红点位 setSysParam(PN_Stock(),"IF2409"); end_t := 20240301T; return futuresDividentPredict(end_t); //73.9048 ``` ### `futuresImpliedRate(endt, return_method, annual)` 隐含利率(%),与系统证券代码相关 | 参数 | 类型 | 说明 | | --- | --- | --- | | `endt` | Date | 日期类型,截止日 | | `return_method` | Integer | 整型,计算收益率方法 | | `annual` | Integer | 整型,是否年化,默认年化 | 返回:Real #### 示例 ```tsl //IF2409在合约期内的隐含利率(%) setSysParam(PN_Stock(),"IF2409"); end_t := 20240301T; return_method := 0; annual := 1; return futuresImpliedRate(end_t,return_method,annual);  //1.3291 ``` ### `futuresCorrectedBasis(endt, predict_type)` 矫正基差,当前基差加上期内分红得到矫正基差,它可以剔除分红对基差影响。与系统证券代码相关。 | 参数 | 类型 | 说明 | | --- | --- | --- | | `endt` | Date | 日期类型,截止日 | | `predict_type` | Int | 整型,预测方式 | 返回:Real #### 示例 ```tsl //IF2409在合约期内的矫正基差 setSysParam(PN_Stock(),"IF2409"); end_t := 20240301T; return futuresCorrectedBasis(end_t); //26.301 ``` ### `futuresTimeValue(endt, r, predict_type)` 时间价值,与系统证券代码相关 | 参数 | 类型 | 说明 | | --- | --- | --- | | `endt` | Date | 日期类型,截止日 | | `r` | Real | 实数型,年化利率(%)。支持用户传入,用户没传入时,使用隐含利率(%)模型FuturesImpliedRate。 | | `predict_type` | Int | 整型,预测方式 | 返回:Real #### 示例 ```tsl setSysParam(PN_Stock(),"IF2409"); end_t := 20240301T; return futuresTimeValue(endt);    //26.3782 ``` ### `futuresTheoryBasis(endt, r, predict_type)` 理论基差,与系统证券代码相关 | 参数 | 类型 | 说明 | | --- | --- | --- | | `endt` | Date | 日期类型,截止日 | | `r` | Real | 实数型,年化利率(%)。支持用户传入,用户没传入时,使用隐含利率(%)模型FuturesImpliedRate。 | | `predict_type` | Int | 整型,预测方式 | 返回:Real #### 示例 ```tsl setSysParam(PN_Stock(),"IF2409"); end_t := 20240301T; return futuresTheoryBasis(endt);    //-47.5267 ``` ### `futuresBasisRatio()` 基差占比(%),与系统证券代码、时间相关 返回:Real #### 示例 ```tsl setSysParam(PN_Stock(),"IF2409"); setSysParam(PN_Date(),20240301T); return futuresBasisRatio();  //-1.3456 //返回:-1.3456 ``` ### `futureBaseinfo()` 基本信息 返回:bool ### `futureWarehouseDaily(pz_id, beg_t, end_t)` 期货仓单日报,适用于大商所、上期所、郑商所、广期所的期货品种 | 参数 | 类型 | 说明 | | ------- | -------- | ------------- | | `pz_id` | string | 证券,品种代码 | | `beg_t` | datetime | 日期,开始日期 | | `end_t` | datetime | 日期,截止日期 | 返回:bool ### `futureDtList(end_t)` 结算会员成交持仓排名 | 参数 | 类型 | 说明 | | ------- | -------- | ------------- | | `end_t` | datetime | 日期,截止日期 | 返回:bool ### `futuresDtList(pz_id, end_t, show_type)` 期货品种结算会员成交持仓排名 | 参数 | 类型 | 说明 | | ----------- | -------- | ------------------- | | `pz_id` | string | 证券,品种代码 | | `end_t` | datetime | 日期,截止日期 | | `show_type` | any | 用户自定义,显示类型 | 返回:bool ### `futuresBaseinfo()` 期货品种基本信息 返回:bool ### `getFuturesTradeRankingDate(futurearr, end_t)` 指定日期货列表成交持仓排名最新数据日,与系统参数当前证券相关。 | 参数 | 类型 | 说明 | | --- | --- | --- | | `futurearr` | Array | 一维字符串数组,期货合约列表 | | `end_t` | TDateTime | 日期,截止日期 | 返回:Boolean ### `getFutureTradeRankingDate(end_t)` 指定日期货成交持仓排名最新数据日,与系统参数当前证券相关。 | 参数 | 类型 | 说明 | | --- | --- | --- | | `end_t` | TDateTime | 日期,截止日期 | 返回:Boolean ### `getFuturesTradeRankingByDate3(end_t, t)` 指定日最新期货成交持仓排名,与系统参数当前证券相关。 | 参数 | 类型 | 说明 | | --- | --- | --- | | `end_t` | TDateTime | 日期,截止日期 | | `t` | Array | 数据表类型,返回结果 | 返回:Boolean #### 示例 ```tsl //"IF1211" 在截至日20121026的成交持仓排名 setSysParam(pn_stock(),"IF1211"); endt:=20121026T; ret:=getFuturesTradeRankingByDate(end_t,t); if ret then //查询成功 return t; else return "获取数据失败"; ```