完成全市场热度涨跌幅与持有期离线标定
This commit is contained in:
parent
875a9fc7cb
commit
894da1a6a4
17
DEVLOG.md
17
DEVLOG.md
|
|
@ -2457,3 +2457,20 @@ QMT仍有序号缺口,16:23确认1441965、最高1442003、暂存32条。16:24
|
|||
部署方式与判收:仅文档和技能,经Git提交保存,没有访问155、188或QMT,没有改应用代码、业务参数或运行容器。未重新跑无关业务回归,不声称完成新的交易真机判收。新会话实际目录指令链尚未另外启动验证,官方机制、手工路径检查与本机技能发现分别记录在开发入口。
|
||||
|
||||
还欠着:无本次文档重整阻塞。运行接入待办继续按微盘阶段接续,不因本次改规则而重启或重做历史实验。已有DEVLOG的114行、复盘台账的10行及未跟踪研究材料保留。
|
||||
|
||||
|
||||
## 2026-10-28 · 全市场热度、涨跌幅与持有期四维标定
|
||||
|
||||
做了什么:按微盘三参数报告形式建立新研究,用户确认比较1至10个交易日。冻结热度下限、当日涨跌幅上下限、持有期,共3,510组含对照;主样本与含回填历史分别计算,补充118条费用分支账户。
|
||||
|
||||
数据发现:stock_fund_heat_scores导出636,116行,但4月27日至8月3日数据于8月4日集中回填。按入库可用时间筛选后,共同信号样本只有8月4日至10月8日41个日期,行情观察至10月23日。热度只覆盖沪深,无北交所;时间列两种时区假设在共同区间信号一致,尚未完成上游写入语义核查。
|
||||
|
||||
结果:基线0.80热度、涨幅0至5%、5日账户累计−9.18%。事后候选0.75热度、涨幅0至2%、4日累计+1.59%,最大回撤−4.82%;每边费用从30增加到60基点后累计−4.30%。训练规则选出的0.80、0至2%、1日验证账户累计−0.22%。2,770组样本量达标热度组合只有15组平均每批净收益在30基点下为正,60基点下为0组。不能认定稳健最优或直接上线。
|
||||
|
||||
动了哪些文件:新增research/heat_calibration_20261028的冻结协议、独立只读取数、离线引擎、测试、复算、结果、完整中文报告及三张图;新增docs/全市场热度四维标定接续_2026-10-28.md并更新开发入口。现有未提交日志、台账及研究材料保留。
|
||||
|
||||
验证与机器:开发机8项隔离断网测试通过,24条账户逐笔重建的最大误差1.50e-13,118条账户现金收支通过,3次日期前缀重跑一致,3组事件均值从成交独立复算一致。三张图已目视检查,本地链接及git diff --check通过。
|
||||
|
||||
部署方式与判收:155仅以模拟实例空前缀、实际pms:micro50-9e14f92镜像运行一次性只读导出,源容器只有logs挂载;不含下单凭证,没有业务表写入或服务重启。未修改应用代码,无业务容器需要重建。188未访问,线上交易效果本轮未判收。
|
||||
|
||||
还欠着:更长且当时可用的热度历史、源算法版本与时间语义、退市覆盖、整手和最低佣金、单股权重与开盘容量。当前研究已完成,未创建后台任务或自动上线安排。具体结果、核验时间和复现入口见新接续文档。
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
# 全市场热度策略标定接续
|
||||
|
||||
核验时间:2026年10月28日15:37,北京时间。仅为离线研究,不改变PMS、bionic或QMT运行规则。
|
||||
|
||||
完整报告见[全市场热度四维标定](../research/heat_calibration_20261028/全市场热度四维标定.md),协议和可复现代码位于同一目录。
|
||||
|
||||
## 用户问题与固定口径
|
||||
|
||||
每天按系统已有热度及当日涨跌幅选股,次日开盘买入,比较持有1至10个交易日。用户已确认“天”按交易日。扫描热度下限、涨跌幅下限、涨跌幅上限和持有期,含无热度对照共3,510组。
|
||||
|
||||
行情截止2026年10月23日,所有持有期共用10月8日这个信号末日,后续留作到期退出。重复信号独立建批,不延长旧批期限。资金账户限制可用现金,买入失败留现金,到期无法卖出保留任务。
|
||||
|
||||
## 本轮结果
|
||||
|
||||
- 基线热度至少0.80、涨幅0%至5%、持有5日,平均每批净收益−1.15%;现金约束账户累计−9.18%,最大回撤−10.66%。
|
||||
- 看完历史后得到的候选为热度至少0.75、涨幅0%至2%、持有4日,平均每批净收益+0.18%;账户累计+1.59%,最大回撤−4.82%。每边费用从30提高到60基点后,累计收益−4.30%。区间均包含下限、不含上限。
|
||||
- 相邻3日、5日,或热度改为0.70、0.80,账户未保持正收益。候选单股最大权重27.09%,存在集中问题。
|
||||
- 时间顺序训练选出的参数是0.80、0%至2%、1日,验证账户累计−0.22%,60基点下−5.89%。候选4日参数不是这项验证的赢家。
|
||||
- 样本量达标的2,770组带热度组合,仅15组平均每批净收益在30基点下为正,60基点下为正的有0组。当前没有足够证据支持直接上线。
|
||||
|
||||
## 数据与核验边界
|
||||
|
||||
热度表导出636,116行,日期为4月27日至10月27日。4月27日至8月3日的记录在8月4日集中入库,主样本剔除回填后的实际信号区间只有8月4日至10月8日、41个日期。完整历史108个信号日另作含回填诊断。不能以“已有半年历史分数”声称半年都能当时执行。
|
||||
|
||||
热度仅覆盖沪深,不含北交所。78只股票缺有效上市日期被排除;历史ST、名称、退市覆盖、源算法版本与不可变历史仍有限制。create_time时区未完成上游写入语义核查,原值及加8小时两种假设在主比较区间选出相同信号。10月16日位于共同信号末日之后,两种时区假设存在可用性差异。
|
||||
|
||||
开发机8项断网隔离测试通过;24条详细账户逐笔复算通过,118条账户现金守恒通过;3个日期前缀重跑一致;3组事件收益从逐笔成交独立复算一致。三张研究图已经目视检查。原始数据和派生矩阵在研究目录的本地忽略目录,保留数据摘要;不把原数据重复提交Git。
|
||||
|
||||
155仅执行只读单表导出,已核对模拟实例空前缀、实际镜像pms:micro50-9e14f92及只有logs的挂载。未修改应用代码、参数、业务容器或账本;188未访问。没有新的线上交易判收。
|
||||
|
||||
## 后续如继续研究
|
||||
|
||||
先扩大可确认当时可用的热度历史,并核实上游计算版本、写入时区及漏日原因。保留0.70至0.80、涨幅0%至2%、持有3至5日作为候选范围,但不把这些值写入ParamStore。实际资金规模、每日股数或单股权重上限尚未由用户指定;整手、最低佣金和开盘容量尚未建模。
|
||||
|
||||
本轮已完成,没有后台任务或自动上线安排。后续研究需要另存新协议,不能根据新增结果回改本轮冻结口径。
|
||||
|
|
@ -7,6 +7,7 @@
|
|||
| 任务 | 入口 |
|
||||
| --- | --- |
|
||||
| 当前微盘接入、参数和运行待办 | [阶段接续与实验意见](微盘轮动阶段接续_2026-10-28.md);需要部署证据再读[50股发布记录](微盘轮动50股参数发布_2026-10-28.md) |
|
||||
| 全市场热度、涨跌幅与持有期标定 | [热度策略研究接续](全市场热度四维标定接续_2026-10-28.md),含回填限制、参数结果和复现入口 |
|
||||
| PMS通用迁移与既有修复 | [开发接续](开发接续_2026-10-12.md),按主题查对应节;旧时点未完成项可能已有后续结论 |
|
||||
| 架构与接口 | [README模块地图](../README.md)、[总体设计](../POSITION_MGMT_DESIGN.md);改接口再读[QMT协议](../QMT_WS_PROTOCOL.md)、[bionic接口](../BIONIC_PMS_INTERFACE.md)或[计划接口](../UPSTREAM_PLAN_API.md) |
|
||||
| 后端、前端、测试、研究 | [后端规则](../app/AGENTS.md)、[页面规则](../app/web/AGENTS.md)、[脚本规则](../scripts/AGENTS.md)、[研究规则](../research/AGENTS.md),仅选择所涉及目录 |
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
raw/
|
||||
cache/
|
||||
__pycache__/
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
"""独立逐笔重建现金和持仓;核验完整路径与截断前缀一致。"""
|
||||
import csv
|
||||
import gzip
|
||||
import json
|
||||
import sys
|
||||
from collections import defaultdict
|
||||
|
||||
import numpy as np
|
||||
from calibrate import account, stock_mask
|
||||
from prepare import ROOT, digest, dump, offline, read
|
||||
|
||||
def main():
|
||||
sys.addaudithook(offline)
|
||||
p=read(ROOT/'protocol.json');data=dict(np.load(ROOT/'cache/panel.npz'))
|
||||
accounts={**read(ROOT/'results/accounts.json.gz'),**read(ROOT/'results/supplement_accounts.json.gz')};maxerror=0.;checks=[]
|
||||
for key,a in accounts.items():
|
||||
if not a['journal']:continue
|
||||
fee=int(key.split('@')[-1])/10000;cash=1.;holdings=defaultdict(float);byday=defaultdict(list)
|
||||
for trade in a['journal']:byday[trade['day']].append(trade)
|
||||
for i,row in enumerate(a['daily']):
|
||||
for tr in byday[i]:
|
||||
value=tr['qty']*tr['price'];j=tr['stock']
|
||||
assert tr['price']==data['open'][i,j]
|
||||
if tr['side']=='buy':
|
||||
assert i==tr['signal']+1 and data['can_buy'][i,j]
|
||||
cash-=value*(1+fee);holdings[j]+=tr['qty']
|
||||
else:
|
||||
assert data['can_sell'][i,j]
|
||||
cash+=value*(1-fee);holdings[j]-=tr['qty']
|
||||
assert holdings[j]>-1e-12 and cash>-1e-12
|
||||
value=sum(q*data['mark'][i,j] for j,q in holdings.items())
|
||||
error=max(abs(cash-row['cash']),abs(value-row['stock_value']),abs(cash+value-row['nav']))
|
||||
maxerror=max(maxerror,error);assert error<1e-10
|
||||
checks.append(key)
|
||||
baseline=p['baseline'];mask=stock_mask(data,'asof',baseline['heat'],baseline['lower'],baseline['upper'],len(data['dates'])-12)
|
||||
full=account(data,mask,baseline['hold'],.003)
|
||||
prefix=[]
|
||||
for date in ['2026-08-31','2026-09-14','2026-09-30']:
|
||||
n=int(np.searchsorted(data['dates'],date,side='right'))
|
||||
short={k:(v[:n].copy() if k!='codes' else v.copy()) for k,v in data.items()}
|
||||
part=account(short,mask[:n],baseline['hold'],.003)
|
||||
assert part['daily']==full['daily'][:n]
|
||||
prefix.append(date)
|
||||
coverage=read(ROOT/'coverage.json');time_diff=[]
|
||||
for r in coverage['daily']:
|
||||
if r['asof_stocks']!=r['asof_raw_stocks']:time_diff.append(r['date'])
|
||||
# 从实际逐笔成交独立重算每笔收益、逐信号日等权收益,并和网格比较。
|
||||
with (ROOT/'results/grid_asof.csv').open() as f:grid={r['key']:r for r in csv.DictReader(f)}
|
||||
event_checks=[]
|
||||
for key in ['0.8/0/5/5','0.8/0/2/1','0.75/0/2/4']:
|
||||
aa=accounts[key+'@30'];legs=defaultdict(dict)
|
||||
for tr in aa['journal']:legs[tr['signal'],tr['stock']][tr['side']]=tr
|
||||
bysignal=defaultdict(list)
|
||||
for (sig,j),tr in legs.items():
|
||||
if 'sell' in tr:
|
||||
rr=tr['sell']['price']/tr['buy']['price']*.997/1.003-1
|
||||
bysignal[sig].append(rr)
|
||||
observed=float(np.mean([np.mean(v) for v in bysignal.values()]))
|
||||
assert abs(observed-float(grid[key]['mean_daily_net30']))<1e-12
|
||||
assert sum(map(len,bysignal.values()))==int(grid[key]['completed'])
|
||||
event_checks.append(key)
|
||||
# 逐日出入金额必须解释现金变化,所有候选均检查,不只详细账户。
|
||||
for key,a in accounts.items():
|
||||
prev=1.
|
||||
for row in a['daily']:
|
||||
assert abs(prev+row['sell_cash']-row['buy_cash']-row['cash'])<1e-10
|
||||
assert row['cash']>=-1e-12
|
||||
prev=row['cash']
|
||||
dump(ROOT/'results/audit.json',{'detailed_accounts_rebuilt':checks,'max_absolute_error':maxerror,
|
||||
'all_accounts_cash_checked':len(accounts),'prefix_recomputed':prefix,'event_means_rebuilt':event_checks,
|
||||
'timestamp_offset_changed_dates':time_diff,
|
||||
'protocol_sha256_checked':digest(ROOT/'protocol.json')==(ROOT/'protocol.sha256').read_text().split()[0],
|
||||
'environment':'开发机;unit_test_guard隔离配置并禁止联网;独立纯研究代码',
|
||||
'tests':'8项内存合成用例另经unit_test_guard执行;不连接数据库'})
|
||||
print('复算通过',len(checks),'个逐笔账户;现金检查',len(accounts),'个账户;最大误差',maxerror)
|
||||
|
||||
if __name__=='__main__':main()
|
||||
|
|
@ -0,0 +1,210 @@
|
|||
"""四维网格事件研究及现金约束账户。离线运行,不导入线上策略服务。"""
|
||||
import csv
|
||||
import datetime as dt
|
||||
import gzip
|
||||
import itertools
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
|
||||
from prepare import ROOT, digest, dump, offline, read
|
||||
|
||||
def parameter_key(heat,lower,upper,hold):return f'{heat:g}/{lower:g}/{upper:g}/{hold}'
|
||||
|
||||
def stock_mask(panel, field, heat, lower, upper, signal_end):
|
||||
out=panel['eligible']&np.isfinite(panel[field])&(panel[field]>=heat)&(panel['pct']>=lower)&(panel['pct']<upper)
|
||||
out[signal_end+1:]=False
|
||||
return out
|
||||
|
||||
def future_exits(panel,hold):
|
||||
t,n=panel['open'].shape
|
||||
nxt=np.full((t+1,n),-1,dtype=np.int16)
|
||||
for i in range(t-1,-1,-1):nxt[i]=np.where(panel['can_sell'][i],i,nxt[i+1])
|
||||
exits=np.full((t,n),-1,dtype=np.int16)
|
||||
gross=np.full((t,n),np.nan)
|
||||
for s in range(t-hold-1):
|
||||
e=nxt[s+hold+1];j=np.arange(n)
|
||||
exits[s]=e
|
||||
ok=(e>=0)&panel['can_buy'][s+1]
|
||||
gross[s,ok]=panel['open'][e[ok],j[ok]]/panel['open'][s+1,ok]
|
||||
return exits,gross
|
||||
|
||||
def daily_means(mask,values):
|
||||
valid=mask&np.isfinite(values)
|
||||
n=valid.sum(axis=1)
|
||||
total=np.where(valid,values,0).sum(axis=1)
|
||||
return np.divide(total,n,out=np.full(len(n),np.nan),where=n>0)
|
||||
|
||||
def mean(v):
|
||||
v=np.asarray(v);v=v[np.isfinite(v)]
|
||||
return float(v.mean()) if len(v) else None
|
||||
|
||||
def event_grid(panel,p,field,out):
|
||||
dates=panel['dates'];t=len(dates);end=t-12
|
||||
pairs=[(l,u) for l in p['return_lower_pct'] for u in p['return_upper_pct'] if l<u]
|
||||
buy=np.vstack([panel['can_buy'][1:],np.zeros_like(panel['can_buy'][0])])
|
||||
result=[];daily={}
|
||||
train_days=dates<='2026-08-31';test_days=dates>='2026-09-15'
|
||||
split=int(np.searchsorted(dates,'2026-09-15'))
|
||||
for h in p['hold_sessions']:
|
||||
exits,gross=future_exits(panel,h)
|
||||
net=gross*(1-.003)/(1+.003)-1
|
||||
base={}
|
||||
for l,u in pairs:
|
||||
m=stock_mask(panel,field,0,l,u,end)&buy
|
||||
base[l,u]=daily_means(m,net)
|
||||
for heat,l,u in itertools.product(p['heat_thresholds'],p['return_lower_pct'],p['return_upper_pct']):
|
||||
if l>=u:continue
|
||||
select=stock_mask(panel,field,heat,l,u,end);filled=select&buy
|
||||
complete=filled&np.isfinite(net);means=daily_means(complete,net)
|
||||
excess=means-base[l,u]
|
||||
train=complete&(exits<split)&train_days[:,None]
|
||||
tr_mean=daily_means(train,net)
|
||||
# 对照也只使用分割日前已经完成的交易,避免训练标签偷看验证期。
|
||||
bm=stock_mask(panel,field,0,l,u,end)&buy&(exits<split)&train_days[:,None]
|
||||
tr_excess=tr_mean-daily_means(bm,net)
|
||||
v=net[complete];key=parameter_key(heat,l,u,h)
|
||||
r={'key':key,'view':field,'heat':heat,'lower':l,'upper':u,'hold':h,
|
||||
'signals':int(select.sum()),'signal_days':int(np.any(select,axis=1).sum()),
|
||||
'filled':int(filled.sum()),'completed':len(v),'unresolved':int(filled.sum()-len(v)),
|
||||
'skipped_buy':int(select.sum()-filled.sum()),'stocks':int(np.any(filled,axis=0).sum()),
|
||||
'mean_daily_net30':mean(means),'mean_daily_excess30':mean(excess),
|
||||
'mean_daily_net60':mean((means+1)*((1-.006)/(1+.006))/((1-.003)/(1+.003))-1),
|
||||
'pooled_mean30':mean(v),'pooled_median30':float(np.median(v)) if len(v) else None,
|
||||
'win_rate30':float((v>0).mean()) if len(v) else None,
|
||||
'p10_net30':float(np.quantile(v,.1)) if len(v) else None,
|
||||
'worst_net30':float(v.min()) if len(v) else None,
|
||||
'delayed_exits':int(np.sum(complete&(exits>np.arange(t)[:,None]+h+1))),
|
||||
'train_days':int(np.isfinite(tr_mean).sum()),'train_completed':int(train.sum()),
|
||||
'train_net30':mean(tr_mean),'train_excess_per_day':mean(tr_excess/h),
|
||||
'test_days':int(np.sum(np.isfinite(means)&test_days)),
|
||||
'test_net30':mean(means[test_days]),'test_excess30':mean(excess[test_days])}
|
||||
for month in sorted(set(d[:7] for d in dates)):
|
||||
r[month+'_net30']=mean(means[np.char.startswith(dates,month)])
|
||||
result.append(r)
|
||||
daily[key]={'net30':[None if not np.isfinite(x) else float(x) for x in means],
|
||||
'excess30':[None if not np.isfinite(x) else float(x) for x in excess]}
|
||||
print(field,'持有',h,'日,网格完成',flush=True)
|
||||
with (out/f'grid_{field}.csv').open('w',newline='') as f:
|
||||
w=csv.DictWriter(f,fieldnames=list(result[0]),lineterminator='\n');w.writeheader();w.writerows(result)
|
||||
with gzip.open(out/f'daily_{field}.json.gz','wt') as f:json.dump(daily,f,separators=(',',':'))
|
||||
return result
|
||||
|
||||
def select_train(rows,p):
|
||||
axes=[p['heat_thresholds'],p['return_lower_pct'],p['return_upper_pct'],p['hold_sessions']]
|
||||
def eligible(r):return r['train_days']>=10 and r['train_completed']>=100 and r['train_excess_per_day'] is not None and r['heat']>0
|
||||
lookup={r['key']:r for r in rows};scored=[]
|
||||
for r in rows:
|
||||
if not eligible(r):continue
|
||||
vals=[r[k] for k in ['heat','lower','upper','hold']];near=[r['train_excess_per_day']]
|
||||
for a in range(4):
|
||||
at=axes[a].index(vals[a])
|
||||
for k in [at-1,at+1]:
|
||||
if 0<=k<len(axes[a]):
|
||||
z=vals.copy();z[a]=axes[a][k];rr=lookup.get(parameter_key(*z))
|
||||
if rr and eligible(rr):near.append(rr['train_excess_per_day'])
|
||||
scored.append({**r,'neighbor_score':float(np.median(near)),'neighbors':len(near)})
|
||||
scored.sort(key=lambda r:(-r['neighbor_score'],-r['hold'],r['heat'],-(r['upper']-r['lower']),r['key']))
|
||||
return scored[0] if scored else None,scored[:20]
|
||||
|
||||
def account(panel,mask,hold,cost,stop=None,detail=False):
|
||||
"""每批次独立到期;卖出失败保留原任务。预算采用前收资产,禁止重复使用现金。"""
|
||||
t,n=mask.shape;stop=t if stop is None else stop
|
||||
cash=1.;prev=1.;lots=[];records=[];journal=[];fees=0.;skipped=0;delays=0
|
||||
max_weight=0.;max_positions=0;max_stale_value=0.;buy_count=sell_count=0
|
||||
for i in range(stop):
|
||||
fee_today=0.;turnover=0.;sell_cash=0.;buy_cash=0.
|
||||
survivors=[]
|
||||
for lot in lots:
|
||||
ix,q,due,sig=lot
|
||||
if i>=due:
|
||||
sell=panel['can_sell'][i,ix]
|
||||
if i==due:delays+=int((~sell).sum())
|
||||
if sell.any():
|
||||
v=q[sell]*panel['open'][i,ix[sell]];fee=float(v.sum()*cost)
|
||||
cash+=float(v.sum())-fee;fee_today+=fee;turnover+=float(v.sum());sell_cash+=float(v.sum())-fee
|
||||
sell_count+=int(sell.sum())
|
||||
if detail:
|
||||
journal.extend({'day':i,'side':'sell','stock':int(j),'qty':float(qty),'price':float(price),'signal':sig}
|
||||
for j,qty,price in zip(ix[sell],q[sell],panel['open'][i,ix[sell]]))
|
||||
ix,q=ix[~sell],q[~sell]
|
||||
if len(ix):survivors.append((ix,q,due,sig))
|
||||
lots=survivors
|
||||
if i>0:
|
||||
chosen=np.flatnonzero(mask[i-1]);count=len(chosen)
|
||||
if count:
|
||||
available=panel['can_buy'][i,chosen];skipped+=int((~available).sum());ix=chosen[available]
|
||||
budget=min(max(cash,0),prev/hold)
|
||||
if len(ix) and budget>0:
|
||||
each=budget/count/(1+cost);q=each/panel['open'][i,ix]
|
||||
value=each*len(ix);fee=value*cost
|
||||
cash-=value+fee;fee_today+=fee;turnover+=value;buy_cash=value+fee
|
||||
lots.append((ix,q,i+hold,i-1));buy_count+=len(ix)
|
||||
if detail:
|
||||
journal.extend({'day':i,'side':'buy','stock':int(j),'qty':float(qty),'price':float(price),'signal':i-1}
|
||||
for j,qty,price in zip(ix,q,panel['open'][i,ix]))
|
||||
values=np.zeros(n)
|
||||
for ix,q,_,_ in lots:np.add.at(values,ix,q*panel['mark'][i,ix])
|
||||
value=float(values.sum());nav=cash+value;assert cash>=-1e-12 and nav>=0
|
||||
max_weight=max(max_weight,float(values.max()/nav) if nav else 0)
|
||||
max_positions=max(max_positions,int(np.count_nonzero(values)))
|
||||
max_stale_value=max(max_stale_value,float(values[~np.isfinite(panel['close'][i])].sum()))
|
||||
fees+=fee_today
|
||||
records.append({'date':str(panel['dates'][i]),'cash':cash,'stock_value':value,'nav':nav,'fee':fee_today,
|
||||
'turnover':turnover,'sell_cash':sell_cash,'buy_cash':buy_cash,'positions':int(np.count_nonzero(values))})
|
||||
prev=nav
|
||||
nav=np.array([1.]+[r['nav'] for r in records]);draw=nav/np.maximum.accumulate(nav)-1
|
||||
summary={'return':float(nav[-1]-1),'max_drawdown':float(draw.min()),'fees_initial_capital':fees,
|
||||
'buy_count':buy_count,'sell_count':sell_count,'skipped_buy':skipped,'delayed_lots':delays,
|
||||
'ending_cash':cash,'ending_stock_value':records[-1]['stock_value'],'open_lots':sum(len(x[0]) for x in lots),
|
||||
'max_stock_weight':max_weight,'max_positions':max_positions,'max_stale_valuation':max_stale_value,
|
||||
'mean_exposure':float(np.mean([r['stock_value']/r['nav'] for r in records if r['buy_cash'] or r['stock_value']])) if buy_count else 0}
|
||||
return {'summary':summary,'daily':records,'journal':journal}
|
||||
|
||||
def main():
|
||||
sys.addaudithook(offline)
|
||||
p=read(ROOT/'protocol.json');assert digest(ROOT/'protocol.json')==(ROOT/'protocol.sha256').read_text().split()[0]
|
||||
assert digest(ROOT/'cache/panel.npz')==read(ROOT/'coverage.json')['panel_sha256']
|
||||
panel=dict(np.load(ROOT/'cache/panel.npz'));out=ROOT/'results';out.mkdir(exist_ok=True)
|
||||
allrows={field:event_grid(panel,p,field,out) for field in ['asof','heat']}
|
||||
winner,top=select_train(allrows['asof'],p)
|
||||
b=p['baseline'];baseline=parameter_key(b['heat'],b['lower'],b['upper'],b['hold'])
|
||||
eligible=[r for r in allrows['asof'] if r['heat']>0 and r['signal_days']>=20 and r['completed']>=100]
|
||||
best=max(eligible,key=lambda r:r['mean_daily_excess30']/r['hold']) if eligible else None
|
||||
lookup={r['key']:r for r in allrows['asof']}
|
||||
candidates=[baseline]+([winner['key']] if winner else [])+([best['key']] if best else [])
|
||||
# 固定基线的四条参数轴,用同一账户规则补充现金、回撤和费用含义。
|
||||
for r in allrows['asof']:
|
||||
if sum([r['heat']!=b['heat'],r['lower']!=b['lower'],r['upper']!=b['upper'],r['hold']!=b['hold']])<=1:candidates.append(r['key'])
|
||||
for k in list(candidates):
|
||||
r=lookup[k];candidates.append(parameter_key(0,r['lower'],r['upper'],r['hold']))
|
||||
accounts={};account_rows=[]
|
||||
for key in sorted(set(candidates)):
|
||||
r=lookup[key];mask=stock_mask(panel,'asof',r['heat'],r['lower'],r['upper'],len(panel['dates'])-12)
|
||||
for fee in p['cost_bps_each_side']:
|
||||
v=account(panel,mask,r['hold'],fee/10000,detail=key in [baseline,winner['key'] if winner else ''])
|
||||
accounts[f'{key}@{fee}']=v
|
||||
account_rows.append({'key':key,'cost_bps':fee,**v['summary']})
|
||||
with (out/'accounts.csv').open('w',newline='') as f:
|
||||
w=csv.DictWriter(f,fieldnames=list(account_rows[0]),lineterminator='\n');w.writeheader();w.writerows(account_rows)
|
||||
with gzip.open(out/'accounts.json.gz','wt') as f:json.dump(accounts,f,separators=(',',':'))
|
||||
# 对入库时区及执行晚一天做固定基线诊断,不参与挑选网格。
|
||||
sensitivities={}
|
||||
for field in ['asof','asof_raw','heat']:
|
||||
m=stock_mask(panel,field,b['heat'],b['lower'],b['upper'],len(panel['dates'])-12)
|
||||
sensitivities[field]=account(panel,m,b['hold'],.003)['summary']
|
||||
delayed=stock_mask(panel,'asof',b['heat'],b['lower'],b['upper'],len(panel['dates'])-12)
|
||||
delayed=np.vstack([np.zeros_like(delayed[:1]),delayed[:-1]])
|
||||
sensitivities['one_more_day_delay']=account(panel,delayed,b['hold'],.003)['summary']
|
||||
dump(out/'selection.json',{'baseline':baseline,'training_winner':winner,'training_top20':top,'full_sample_best_excess_per_day':best,
|
||||
'sensitivity':sensitivities,'grid_rows_per_view':len(allrows['asof']),
|
||||
'account_cases':len(accounts),'common_last_signal':str(panel['dates'][-12])})
|
||||
dump(out/'manifest.json',{'completed_at_beijing':dt.datetime.now(dt.timezone(dt.timedelta(hours=8))).isoformat(),
|
||||
'protocol_sha256':digest(ROOT/'protocol.json'),'coverage_sha256':digest(ROOT/'coverage.json'),
|
||||
'code_sha256':{f.name:digest(f) for f in ROOT.glob('*.py')},
|
||||
'result_sha256':{f.name:digest(f) for f in out.iterdir() if f.name!='manifest.json'}})
|
||||
print('标定计算完成',len(allrows['asof']),'组/视图;账户',len(accounts),flush=True)
|
||||
|
||||
if __name__=='__main__':main()
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,61 @@
|
|||
"""从155模拟PMS的配置只读导出源表;独立容器不含交易凭证。"""
|
||||
import gzip
|
||||
import json
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parent
|
||||
|
||||
WRAPPER = r'''
|
||||
import json, os, subprocess, sys
|
||||
request = json.load(sys.stdin)
|
||||
info = json.loads(subprocess.check_output(['docker','inspect','pms-web']))[0]
|
||||
values = dict(x.split('=',1) for x in info['Config']['Env'] if '=' in x)
|
||||
if values.get('PMS_TABLE_PREFIX','') or values.get('PMS_STACK_PREFIX',''):
|
||||
raise SystemExit('实例范围不符合155模拟PMS,停止')
|
||||
if info['Config']['Image'].startswith('pms-real'):
|
||||
raise SystemExit('实际镜像不符合模拟范围,停止')
|
||||
env = dict(os.environ)
|
||||
args = ['docker','run','--rm','-i','--name','pms-heat-research',
|
||||
'--label','pms.role=offline-research','--cpus','0.5','--memory','1g',
|
||||
'--pids-limit','64','--read-only','--entrypoint','python']
|
||||
for key in ['PROXY_DB_URL','DB_MYSQL_URL']:
|
||||
if not values.get(key): raise SystemExit('源连接配置缺失')
|
||||
env[key] = values[key]
|
||||
args += ['--env',key]
|
||||
args += ['--env','PMS_TABLE_PREFIX=',info['Image'],'-',request['mode']]
|
||||
print(json.dumps({'host': '155', 'prefix': '', 'source_image': info['Config']['Image'],
|
||||
'image_id': info['Image'], 'role': 'readonly-research'}),file=sys.stderr)
|
||||
p = subprocess.run(args,input=request['code'].encode(),env=env)
|
||||
raise SystemExit(p.returncode)
|
||||
'''
|
||||
|
||||
def main():
|
||||
mode = sys.argv[1]
|
||||
if mode != 'probe' and not (len(mode) == 6 and mode.isdigit()):
|
||||
raise ValueError('仅允许probe或月份')
|
||||
raw = ROOT / 'raw'
|
||||
raw.mkdir(exist_ok=True)
|
||||
path = raw / (mode + '.json.gz')
|
||||
if path.exists():
|
||||
json.load(gzip.open(path))
|
||||
print(mode, '已有缓存,保留')
|
||||
return
|
||||
common = (ROOT/'readonly_support.py').read_text()
|
||||
code = common + '\n' + (ROOT/'remote.py').read_text()
|
||||
with (raw/(mode+'.stderr')).open('wb') as log:
|
||||
p = subprocess.run(['ssh','-o','BatchMode=yes','-o','ConnectTimeout=8',
|
||||
'-p','2280','factor@192.168.16.155',
|
||||
'python3 -c '+shlex.quote(WRAPPER)],
|
||||
input=json.dumps({'mode':mode,'code':code}).encode(),
|
||||
stdout=subprocess.PIPE,stderr=log,timeout=170)
|
||||
if p.returncode:
|
||||
raise RuntimeError(f'只读导出失败,退出码{p.returncode};未回显异常正文')
|
||||
out=json.loads(gzip.decompress(p.stdout))
|
||||
path.write_bytes(p.stdout)
|
||||
if mode == 'probe': print(json.dumps(out,ensure_ascii=False,indent=2))
|
||||
else: print(mode, 'rows',len(out['data']['rows']), 'bytes',len(p.stdout),flush=True)
|
||||
|
||||
if __name__ == '__main__': main()
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 248 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 217 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 231 KiB |
|
|
@ -0,0 +1,143 @@
|
|||
"""仅处理本地缓存,生成日期×股票矩阵和热度可用性证据。"""
|
||||
import bisect
|
||||
import datetime as dt
|
||||
import gzip
|
||||
import hashlib
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
from collections import defaultdict
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
|
||||
ROOT = Path(__file__).resolve().parent
|
||||
OLD = ROOT.parent/'macro_timing_20261026'
|
||||
|
||||
def offline(event,args):
|
||||
if event in ('socket.connect','socket.getaddrinfo','socket.sendto','socket.sendmsg'):
|
||||
raise RuntimeError('离线研究禁止联网')
|
||||
|
||||
def read(path):
|
||||
return json.load(gzip.open(path) if str(path).endswith('.gz') else open(path))
|
||||
|
||||
def dump(path,value):
|
||||
path.write_text(json.dumps(value,ensure_ascii=False,indent=2,allow_nan=False)+'\n')
|
||||
|
||||
def digest(path): return hashlib.sha256(path.read_bytes()).hexdigest()
|
||||
|
||||
def dot(code):
|
||||
if re.fullmatch(r'(SH|SZ|BJ)\d{6}',code): return code[2:]+'.'+code[:2]
|
||||
return code
|
||||
|
||||
def chosen_batch(rows, deadline=None, offset_hours=8):
|
||||
"""整批最晚入库时间小于截止时间才可用,不能逐股混合不同批次。"""
|
||||
batches=defaultdict(list)
|
||||
for r in rows: batches[r['batch_no']].append(r)
|
||||
eligible=[]
|
||||
for b,rr in batches.items():
|
||||
stamp=max(dt.datetime.fromisoformat(r['create_time']) for r in rr)
|
||||
if deadline is None or stamp+dt.timedelta(hours=offset_hours)<deadline:
|
||||
eligible.append(b)
|
||||
return batches[max(eligible)] if eligible else []
|
||||
|
||||
def main():
|
||||
sys.addaudithook(offline)
|
||||
p=read(ROOT/'protocol.json')
|
||||
assert digest(ROOT/'protocol.json')==(ROOT/'protocol.sha256').read_text().split()[0]
|
||||
sources={}
|
||||
def tracked(path):
|
||||
sources[str(path.relative_to(ROOT.parent))]=digest(path)
|
||||
return read(path)
|
||||
ix=tracked(OLD/'raw/export.json')['data']['index_daily']['000001.SH']['rows']
|
||||
calendar=sorted({r['timestamp'][:10] for r in ix if r['timestamp'][:10]<=p['data_cutoff']})
|
||||
dates=[d for d in calendar if d>='2026-04-27']
|
||||
heat=[]
|
||||
for path in sorted((ROOT/'raw').glob('2026*.json.gz')):
|
||||
d=tracked(path)['data'];assert d['ok'];heat+=d['rows']
|
||||
codes=sorted({dot(r['stock_code']) for r in heat})
|
||||
ci={c:i for i,c in enumerate(codes)};di={d:i for i,d in enumerate(dates)}
|
||||
shape=(len(dates),len(codes))
|
||||
arrays={k:np.full(shape,np.nan) for k in ['open','close','mark','pct','adj','raw_open','up','down','volume','amount','heat','asof','asof_raw']}
|
||||
risk=np.zeros(shape,dtype=bool);quality=defaultdict(int)
|
||||
# 原始行情缓存只读复用;不把微盘402只股票名单带入本次全市场研究。
|
||||
for ym in [f'2026{m:02}' for m in range(4,11)]:
|
||||
folder='timed_micro100' if ym<='202608' else 'micro100'
|
||||
data=tracked(OLD/f'raw/{folder}/{ym}.json.gz')['data']
|
||||
for key in ['bars','st','limits']: assert data[key]['ok']
|
||||
seen=set()
|
||||
for r in data['bars']['rows']:
|
||||
day=r['trade_date'][:10];code=r['ts_code']
|
||||
if day not in di or code not in ci:continue
|
||||
i,j=di[day],ci[code]
|
||||
assert (i,j) not in seen;seen.add((i,j))
|
||||
for key,src in [('raw_open','open'),('pct','pct_chg'),('adj','adj_factor'),('volume','vol'),('amount','amount')]:
|
||||
v=r[src];arrays[key][i,j]=float(v) if v is not None else np.nan
|
||||
a=arrays['adj'][i,j]
|
||||
if a>0 and r['open'] and r['close'] and r['open']>0 and r['close']>0:
|
||||
arrays['open'][i,j]=float(r['open'])*a;arrays['close'][i,j]=float(r['close'])*a
|
||||
for r in data['limits']['rows']:
|
||||
if r['trade_date'][:10] in di and r['ts_code'] in ci:
|
||||
i,j=di[r['trade_date'][:10]],ci[r['ts_code']]
|
||||
for k in ['up','down']:
|
||||
v=r[k+'_limit'];arrays[k][i,j]=float(v) if v else np.nan
|
||||
for r in data['st']['rows']:
|
||||
if r['trade_date'][:10] in di and r['ts_code'] in ci:
|
||||
risk[di[r['trade_date'][:10]],ci[r['ts_code']]]=True
|
||||
print(ym,'行情处理完成',flush=True)
|
||||
ref=tracked(OLD/'raw/micro100/reference.json.gz')['data']
|
||||
listing={r['stock_code']:r['list_date'] for r in ref['listings']['rows']}
|
||||
names=defaultdict(list)
|
||||
for r in ref['names']['rows']:names[r['ts_code']].append(r)
|
||||
eligible=np.zeros(shape,dtype=bool)
|
||||
for j,c in enumerate(codes):
|
||||
ld=listing.get(c)
|
||||
if not ld:quality['missing_listing_codes']+=1;continue
|
||||
for i,day in enumerate(dates):
|
||||
if bisect.bisect_right(calendar,day)-bisect.bisect_left(calendar,ld)<120:continue
|
||||
nr=[r for r in names[c] if r['start_date']<=day and (not r['end_date'] or day<=r['end_date']) and (not r['ann_date'] or r['ann_date']<=day)]
|
||||
if not nr:quality['missing_historical_name_stock_days']+=1;continue
|
||||
name=max(nr,key=lambda r:r['start_date'])['name']
|
||||
eligible[i,j]=not risk[i,j] and not re.search(r'ST|退',name,re.I) and np.isfinite(arrays['pct'][i,j])
|
||||
groups=defaultdict(list)
|
||||
for r in heat:groups[r['trade_date']].append(r)
|
||||
coverage=[]
|
||||
for i,day in enumerate(dates):
|
||||
rr=groups.get(day,[])
|
||||
deadline=dt.datetime.fromisoformat(dates[i+1]+'T09:25:00') if i+1<len(dates) else None
|
||||
selected={k:chosen_batch(rr,deadline if k!='heat' else None,hours) if i+1<len(dates) or k=='heat' else []
|
||||
for k,hours in [('heat',8),('asof',8),('asof_raw',0)]}
|
||||
for k,rs in selected.items():
|
||||
seen=set()
|
||||
for r in rs:
|
||||
c=dot(r['stock_code']);assert c not in seen;seen.add(c)
|
||||
v=float(r['score']);assert 0<=v<=1
|
||||
arrays[k][i,ci[c]]=v
|
||||
coverage.append({'date':day,'raw_rows':len(rr),'latest_batch':selected['heat'][0]['batch_no'] if selected['heat'] else None,
|
||||
'latest_create_min':min((r['create_time'] for r in selected['heat']),default=None),
|
||||
'latest_create_max':max((r['create_time'] for r in selected['heat']),default=None),
|
||||
'heat_stocks':len(selected['heat']),'asof_stocks':len(selected['asof']),
|
||||
'asof_raw_stocks':len(selected['asof_raw']),
|
||||
'eligible':int(np.sum(eligible[i]&np.isfinite(arrays['heat'][i]))),
|
||||
'missing_quotes':int(np.sum(np.isfinite(arrays['heat'][i])&~np.isfinite(arrays['open'][i])))})
|
||||
valid=np.isfinite(arrays['open'])&(arrays['open']>0)&(arrays['volume']>0)
|
||||
can_buy=valid&np.isfinite(arrays['up'])&np.isfinite(arrays['down'])&(arrays['raw_open']<arrays['up']-.005)&(arrays['raw_open']>arrays['down']+.005)&~risk
|
||||
can_sell=valid&np.isfinite(arrays['down'])&(arrays['raw_open']>arrays['down']+.005)
|
||||
# 估值只向前持有最后已知价;缺价20个交易日后归零并记录,绝不倒填未来价格。
|
||||
last=np.zeros(len(codes));age=np.full(len(codes),1000)
|
||||
for i in range(len(dates)):
|
||||
good=np.isfinite(arrays['close'][i])&(arrays['close'][i]>0)
|
||||
last[good]=arrays['close'][i,good];age[good]=0;age[~good]+=1
|
||||
arrays['mark'][i]=np.where(age>20,0,last)
|
||||
cache=ROOT/'cache';cache.mkdir(exist_ok=True)
|
||||
np.savez_compressed(cache/'panel.npz',dates=dates,codes=codes,eligible=eligible,can_buy=can_buy,can_sell=can_sell,**arrays)
|
||||
c={'created_at_beijing':dt.datetime.now(dt.timezone(dt.timedelta(hours=8))).isoformat(),
|
||||
'raw_heat_rows':len(heat),'raw_heat_dates':len(groups),'raw_heat_first':min(groups),'raw_heat_last':max(groups),
|
||||
'dates':len(dates),'stocks':len(codes),'exchanges':sorted({c[-2:] for c in codes}),
|
||||
'common_last_signal':dates[-12],'daily':coverage,'quality':dict(quality),
|
||||
'source_sha256':sources,'panel_sha256':digest(cache/'panel.npz'),
|
||||
'timestamp_note':'create_time为DATETIME,未找到上游写入代码核实其时区。主口径按原值+8小时,原值另作敏感性,均不将回填数据倒用。'}
|
||||
dump(ROOT/'coverage.json',c)
|
||||
print(json.dumps({k:v for k,v in c.items() if k not in ['daily','source_sha256']},ensure_ascii=False))
|
||||
|
||||
if __name__=='__main__':main()
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
"version": "1.0",
|
||||
"frozen_at_beijing": "2026-10-28T15:14:27.660504+08:00",
|
||||
"question": "全市场现有热度下限、当日涨跌幅上下限和持有1至10交易日的阈值研究",
|
||||
"data_cutoff": "2026-10-23",
|
||||
"heat_source": "stock_fund_heat_scores.score;不另算热度",
|
||||
"heat_thresholds": [
|
||||
0,
|
||||
0.5,
|
||||
0.6,
|
||||
0.7,
|
||||
0.75,
|
||||
0.8,
|
||||
0.85,
|
||||
0.9,
|
||||
0.95
|
||||
],
|
||||
"return_lower_pct": [
|
||||
-10,
|
||||
-5,
|
||||
-3,
|
||||
0,
|
||||
2,
|
||||
3,
|
||||
5
|
||||
],
|
||||
"return_upper_pct": [
|
||||
0,
|
||||
2,
|
||||
3,
|
||||
5,
|
||||
7,
|
||||
10,
|
||||
20
|
||||
],
|
||||
"hold_sessions": [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10
|
||||
],
|
||||
"cost_bps_each_side": [
|
||||
30,
|
||||
60
|
||||
],
|
||||
"baseline": {
|
||||
"heat": 0.8,
|
||||
"lower": 0,
|
||||
"upper": 5,
|
||||
"hold": 5
|
||||
},
|
||||
"heat_comparison": ">=,0为不筛热度的对照,但限当天有热度覆盖的同一市场",
|
||||
"return_comparison": "信号日pct_chg,下限含、上限不含;上下限必须下限<上限",
|
||||
"availability": "主样本只选在次日09:25前整批已入库的最新批次;create_time时区未核实,按原值+8小时保守处理,并单列原值敏感性;不搬用陈旧热度",
|
||||
"diagnostic": "完整历史按每交易日最大批次,仅作含回填的历史分数诊断,不称当时可交易",
|
||||
"timing": "信号日收盘涨跌幅;次一交易日开盘买入;买入后经过H个交易日开盘卖出,H=1也是次日才能卖,遵循T+1",
|
||||
"eligibility": "有当日热度的A股;上市至少120个交易日;剔除当日历史ST或退市整理,历史名称缺失剔除;不按现存股票名单筛选",
|
||||
"execution": "买入开盘触涨停或跌停、零量、缺有效复权价/涨跌停价则该笔放弃;到期卖出在跌停/零量/缺价时顺延,不伪造最长10日强制成交;入选资格不使用未来信息",
|
||||
"portfolio": "每天以前日收盘资产/H为预算,先卖后买、预算不超过可用现金;当日全部入选等额分配,买入失败份额留现金;重复信号单独建批次,已有批次到期不延长;无杠杆;可分割复权单位",
|
||||
"shared_signal_end": "所有H共用能在截止日完成10日正常持有的最后信号日,之后只处理退出;无法成交残仓按末价估值并披露",
|
||||
"selection": "主样本训练信号至2026-08-31,实际退出必须早于2026-09-15;验证信号从2026-09-15至共享末日。训练至少10个有成交信号日且100笔完成;评分为同日等权净超额收益均值/H,取本点及四维相邻各一档合格点评分中位数;平分优先低换手(较长H)、较低热度、较宽涨跌幅。无合格则基线。",
|
||||
"report": "主样本、回填诊断、同涨跌幅无热度对照、四维切片、月份、费用、独立现金持仓复算、前缀不变;不据短历史宣称最优或自动部署",
|
||||
"limitations": [
|
||||
"时间很短,不做年度外推或年化收益",
|
||||
"历史入库不等于不可改写版本;缺上游完整热度算法版本",
|
||||
"整手、最低佣金、开盘冲击与容量未建模",
|
||||
"同股多日与多参数共享行情不是独立样本"
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
1be91305138b7dc546c7a95b93431c0b7ae6087353ae808511810a4d1da5d93b protocol.json
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
#!/usr/bin/env python3
|
||||
"""既有研究单表只读守卫的本地副本,供fetch.py拼接remote.py。
|
||||
|
||||
在155一次性研究容器从stdin运行,不调用业务服务。
|
||||
凭证仅从容器环境取得;异常只输出类型和数值错误码。
|
||||
"""
|
||||
import datetime as dt
|
||||
import decimal
|
||||
import json
|
||||
import re
|
||||
import signal
|
||||
import sys
|
||||
import time
|
||||
|
||||
import pymysql
|
||||
from sqlalchemy.engine import make_url
|
||||
from config.settings import settings
|
||||
from app.db.session import assert_single_table
|
||||
|
||||
TABLES = {
|
||||
"proxy": ["zs_day_data", "intraday_index_qrs", "gp_day_data", "gp_day_basic",
|
||||
"gp_fina_indicator", "gp_stock_basic", "gp_stock_st", "gp_index_weight",
|
||||
"gp_adj_factor", "gp_trade_cal", "gp_hybk", "gp_fx_daily", "gp_shibor"],
|
||||
"index": ["zs_day_data", "gp_day_data", "gp_hybk"],
|
||||
}
|
||||
INDEXES = ["000300.SH", "000905.SH", "000852.SH", "399006.SZ", "000688.SH", "000001.SH"]
|
||||
CUTOFF = "2026-10-23 23:59:59"
|
||||
START = "2005-01-01"
|
||||
CONNECTIONS = {}
|
||||
|
||||
|
||||
def safe_error(exc):
|
||||
args = getattr(exc, "args", ())
|
||||
return {"type": type(exc).__name__, "code": args[0] if args and isinstance(args[0], int) else None}
|
||||
|
||||
|
||||
def encode(value):
|
||||
if isinstance(value, (dt.datetime, dt.date)):
|
||||
return value.isoformat()
|
||||
if isinstance(value, decimal.Decimal):
|
||||
return float(value)
|
||||
raise TypeError(type(value).__name__)
|
||||
|
||||
|
||||
def connection(source):
|
||||
if source not in CONNECTIONS:
|
||||
raw = settings.PROXY_DB_URL if source == "proxy" else settings.DB_MYSQL_URL
|
||||
url = make_url(raw)
|
||||
if url.get_backend_name() != "mysql":
|
||||
raise ValueError("仅支持预定的MySQL源")
|
||||
CONNECTIONS[source] = pymysql.connect(
|
||||
host=url.host, port=url.port or 3306, user=url.username,
|
||||
password=url.password, database=url.database, charset="utf8mb4",
|
||||
connect_timeout=5, read_timeout=20, write_timeout=5, autocommit=True,
|
||||
cursorclass=pymysql.cursors.DictCursor,
|
||||
)
|
||||
return CONNECTIONS[source]
|
||||
|
||||
|
||||
def read(source, sql, params=None, cap=10000):
|
||||
if not re.match(r"^(SELECT|SHOW)\s", sql, re.I) or ";" in sql:
|
||||
raise ValueError("只允许单条SELECT或SHOW")
|
||||
if re.search(r"\b(INTO|OUTFILE|DUMPFILE|FOR\s+UPDATE|LOCK|SLEEP|BENCHMARK)\b", sql, re.I):
|
||||
raise ValueError("不允许具有副作用的读取")
|
||||
assert_single_table(sql)
|
||||
begin = time.monotonic()
|
||||
try:
|
||||
with connection(source).cursor() as cur:
|
||||
cur.execute(sql, params)
|
||||
rows = cur.fetchmany(cap + 1)
|
||||
if len(rows) > cap:
|
||||
raise ValueError("读取超过固定行数上限")
|
||||
return {"ok": True, "rows": rows, "seconds": round(time.monotonic() - begin, 3)}
|
||||
except Exception as exc:
|
||||
# 错误信息可能包含连接串,禁止直接输出str(exc)。
|
||||
return {"ok": False, "error": safe_error(exc), "seconds": round(time.monotonic() - begin, 3)}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
"""由fetch.py拼接既有严格单表只读守卫,仅读取热度。"""
|
||||
import gzip
|
||||
|
||||
signal.alarm(140)
|
||||
mode = sys.argv[1]
|
||||
if settings.PMS_TABLE_PREFIX: raise SystemExit('不是预定模拟实例')
|
||||
if mode == 'probe':
|
||||
data = {}
|
||||
data['columns'] = read('proxy','SHOW COLUMNS FROM stock_fund_heat_scores')
|
||||
data['indexes'] = read('proxy','SHOW INDEX FROM stock_fund_heat_scores')
|
||||
for order in ['ASC','DESC']:
|
||||
data[order] = read('proxy','SELECT * FROM stock_fund_heat_scores ORDER BY trade_date '+order+' LIMIT 2',cap=2)
|
||||
data['coverage'] = read('proxy','SELECT trade_date,COUNT(*) AS n,COUNT(DISTINCT stock_code) AS stocks,MIN(batch_no) AS first_batch,MAX(batch_no) AS last_batch FROM stock_fund_heat_scores GROUP BY trade_date ORDER BY trade_date',cap=6000)
|
||||
else:
|
||||
if not re.fullmatch(r'20\d{4}',mode): raise ValueError('月份越界')
|
||||
first = mode[:4]+'-'+mode[4:]+'-01'
|
||||
last = (dt.date.fromisoformat(first).replace(day=28)+dt.timedelta(days=4)).replace(day=1)
|
||||
data=read('proxy','SELECT * FROM stock_fund_heat_scores WHERE trade_date>=%s AND trade_date<%s ORDER BY trade_date,batch_no,stock_code',(first,last),cap=500000)
|
||||
out={'collected_at_beijing':dt.datetime.now(dt.timezone(dt.timedelta(hours=8))).isoformat(),'host':'155','data':data}
|
||||
sys.stdout.buffer.write(gzip.compress(json.dumps(out,ensure_ascii=False,default=encode,separators=(',',':')).encode()))
|
||||
for conn in CONNECTIONS.values(): conn.close()
|
||||
|
|
@ -0,0 +1,153 @@
|
|||
"""由保存的结果生成中文研究报告和可导出的图,不重新选择参数。"""
|
||||
import datetime as dt
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
import matplotlib
|
||||
matplotlib.use('Agg')
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib import font_manager, ticker
|
||||
|
||||
from prepare import ROOT, dump, digest, offline, read
|
||||
|
||||
OUT=ROOT/'results';FIG=ROOT/'figures'
|
||||
|
||||
def pct(v):return '—' if v is None or not np.isfinite(v) else f'{v*100:+.2f}%'
|
||||
def pp(v):return '—' if v is None or not np.isfinite(v) else f'{v*100:+.2f}'
|
||||
def plain(v):return f'{v*100:.2f}%'
|
||||
def table(head,rows):return '\n'.join(['| '+' | '.join(head)+' |','| '+' | '.join(['---']*len(head))+' |']+['| '+' | '.join(map(str,r))+' |' for r in rows])
|
||||
|
||||
def main():
|
||||
sys.addaudithook(offline)
|
||||
FIG.mkdir(exist_ok=True)
|
||||
for path in ['/System/Library/Fonts/STHeiti Light.ttc','/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc']:
|
||||
if Path(path).exists():
|
||||
font_manager.fontManager.addfont(path);plt.rcParams['font.family']=font_manager.FontProperties(fname=path).get_name();break
|
||||
plt.rcParams.update({'axes.unicode_minus':False,'font.size':11,'axes.spines.top':False,'axes.spines.right':False,'savefig.dpi':160})
|
||||
g=pd.read_csv(OUT/'grid_asof.csv').set_index('key');r=pd.read_csv(OUT/'grid_heat.csv').set_index('key')
|
||||
s=read(OUT/'selection.json');sup=read(OUT/'supplement.json');cov=read(ROOT/'coverage.json');audit=read(OUT/'audit.json')
|
||||
accounts={**read(OUT/'accounts.json.gz'),**read(OUT/'supplement_accounts.json.gz')}
|
||||
def a(key,fee=30):return accounts[f'{key}@{fee}']['summary']
|
||||
def gr(key):return g.loc[key]
|
||||
baseline='0.8/0/5/5';candidate='0.75/0/2/4';winner=s['training_winner']['key']
|
||||
eligible=g[(g.heat>0)&(g.signal_days>=20)&(g.completed>=100)]
|
||||
# 四个一维切片;一致单位,收益和相对差异不混用。
|
||||
fig,axes=plt.subplots(2,2,figsize=(13,9),layout='constrained')
|
||||
slices=[('heat',(g.lower==0)&(g.upper==5)&(g.hold==5),'热度下限(0为无热度对照)'),
|
||||
('upper',(g.heat==.8)&(g.lower==0)&(g.hold==5),'当日涨幅上限(%,不含)'),
|
||||
('lower',(g.heat==.8)&(g.upper==5)&(g.hold==5),'当日涨跌幅下限(%,含)'),
|
||||
('hold',(g.heat==.8)&(g.lower==0)&(g.upper==5),'持有交易日')]
|
||||
for ax,(col,mask,label) in zip(axes.flat,slices):
|
||||
z=g[mask].sort_values(col)
|
||||
ax.plot(z[col],100*z.mean_daily_net30,'o-',color='#326bb1',label='单边30基点')
|
||||
ax.plot(z[col],100*z.mean_daily_net60,'s--',color='#b8752d',label='单边60基点')
|
||||
ax.axhline(0,color='#555',lw=.7);ax.set_xlabel(label);ax.set_ylabel('平均每批净收益(%)');ax.grid(alpha=.15)
|
||||
axes[0,0].legend();fig.suptitle('固定其他参数的切片:提高热度或延长持有期未改善基线\n基线:热度≥0.80、涨幅[0%,5%)、持有5日;41个信号日',fontsize=14)
|
||||
fig.savefig(FIG/'四维切片.png');plt.close(fig)
|
||||
fig,axes=plt.subplots(1,2,figsize=(14,5.8),layout='constrained')
|
||||
subset=g[(g.lower==0)&(g.upper==2)&(g.heat>=.5)]
|
||||
sample_ok=subset.assign(ok=(subset.signal_days>=20)&(subset.completed>=100)).pivot(index='heat',columns='hold',values='ok')
|
||||
for ax,col,title in zip(axes,['mean_daily_net30','mean_daily_net60'],['每边30基点','每边60基点']):
|
||||
z=subset.pivot(index='heat',columns='hold',values=col)*100
|
||||
cmap=plt.get_cmap('RdBu_r').copy();cmap.set_bad('#eeeeee')
|
||||
im=ax.imshow(z.where(sample_ok),aspect='auto',cmap=cmap,vmin=-4,vmax=4)
|
||||
ax.set_xticks(range(10),range(1,11));ax.set_yticks(range(len(z)),[f'{x:.2f}' for x in z.index])
|
||||
ax.set_xlabel('持有交易日');ax.set_ylabel('热度下限');ax.set_title(title)
|
||||
for i in range(z.shape[0]):
|
||||
for j in range(z.shape[1]):
|
||||
label=f'{z.iloc[i,j]:.2f}' if sample_ok.iloc[i,j] else '样本\n不足'
|
||||
ax.text(j,i,label,ha='center',va='center',fontsize=8,color='white' if sample_ok.iloc[i,j] and abs(z.iloc[i,j])>2.5 else '#555')
|
||||
fig.colorbar(im,ax=axes,label='平均每批净收益(%)',shrink=.75)
|
||||
fig.suptitle('把涨幅收窄到[0%,2%)后,微弱正收益仍无法承受费用压力\n全部样本回看;仅显示至少20个入选日、100笔完成交易的组合',fontsize=14)
|
||||
fig.savefig(FIG/'低涨幅热度与持有期.png');plt.close(fig)
|
||||
fig,ax=plt.subplots(figsize=(12,5.7),layout='constrained')
|
||||
for key,fee,label,color,style in [(baseline,30,'基线 0.80 / 0至5% / 5日','#888888','-'),
|
||||
(candidate,30,'回看候选 0.75 / 0至2% / 4日','#326bb1','-'),
|
||||
(candidate,60,'同一候选,60基点费用','#b8752d','--'),
|
||||
('0/0/2/4',30,'无热度对照 / 0至2% / 4日','#5d8e83','-')]:
|
||||
rows=[x for x in accounts[f'{key}@{fee}']['daily'] if x['date']>='2026-08-04']
|
||||
ax.plot([dt.date.fromisoformat(x['date']) for x in rows],[x['nav'] for x in rows],label=label,color=color,ls=style,lw=1.9)
|
||||
ax.axvline(dt.date(2026,10,8),ls=':',color='#777',label='共同信号截止日10月8日')
|
||||
ax.axhline(1,color='#777',lw=.6);ax.set_ylabel('净值(初始资金=1)');ax.grid(alpha=.15);ax.legend(fontsize=10)
|
||||
ax.set_title('现金约束账户:0.75 / 0至2% / 4日累计+1.59%,费用加倍后−4.30%\n8月5日开始成交;10月8日后不再接新信号,仅处理到期退出',fontsize=13)
|
||||
fig.savefig(FIG/'候选账户净值.png');plt.close(fig)
|
||||
def event_table(keys):
|
||||
return table(['热度 / 涨跌幅区间 / 日数','入选信号日','完成笔数','平均每批净收益','相对同涨跌幅对照(百分点)','个股胜率','60基点平均每批'],
|
||||
[[k,int(gr(k).signal_days),int(gr(k).completed),pct(gr(k).mean_daily_net30),pp(gr(k).mean_daily_excess30),plain(gr(k).win_rate30),pct(gr(k).mean_daily_net60)] for k in keys])
|
||||
def acct_table(keys):
|
||||
return table(['参数','30基点累计收益','最大回撤','60基点累计收益','单股最大权重'],
|
||||
[[k,pct(a(k)['return']),pct(a(k)['max_drawdown']),pct(a(k,60)['return']),plain(a(k)['max_stock_weight'])] for k in keys])
|
||||
lines=['# 全市场热度、涨跌幅与持有期四维标定','',
|
||||
'核验日期:2026年10月28日。使用系统现有资金热度,不重算信号。计算在开发机离线完成;155只用于导出源数据,没有写业务表或修改运行策略。', '',
|
||||
'## 可以据此做什么判断','',
|
||||
'**首轮不支持直接上线“高热度追涨、最多持有10日”。热度越高、当日涨幅越大或持有越久,并没有在这段样本中带来更好的结果。**', '',
|
||||
f'若继续缩小研究范围,可保留 **热度0.70至0.80、当日涨幅0%至2%、持有3至5个交易日**。其中 **0.75 / [0%,2%) / 4日** 是看完本次历史后得到的候选点:平均每批净收益{pct(gr(candidate).mean_daily_net30)},现金约束账户累计{pct(a(candidate)["return"])}、最大回撤{pct(a(candidate)["max_drawdown"])};费用从每边30提高到60基点后,账户变为{pct(a(candidate,60)["return"])}。相邻3日和5日账户也未保持正收益,因此不能称为稳健最优。','',
|
||||
f'样本量门槛为至少20个有选股信号日、100笔完成交易。{len(eligible):,}组非零热度组合满足门槛,只有{int((eligible.mean_daily_net30>0).sum())}组的平均每批净收益在30基点费用下为正,60基点下为正的有{int((eligible.mean_daily_net60>0).sum())}组。该计数衡量每批收益,不是对全部参数资金账户盈利数量的统计。','',
|
||||
acct_table([baseline,'0/0/5/5',candidate,'0/0/2/4',winner]),'',
|
||||
'参数写法为“热度下限 / 涨跌幅下限 / 上限 / 持有日数”,涨跌幅单位为百分数,区间下限包含、上限不含。0表示不筛热度。累计收益来自独立现金约束研究账户,空仓不计息;不是指数超额收益、PMS账户收益或联合策略收益。','',
|
||||
'## 先说明历史数据能支持多长的实验','',
|
||||
'热度表共有636,116行、120个数据日期,最早2026年4月27日,最新10月27日。行情复用已经导出的全市场月度因子数据,截止10月23日;10月26日至27日的热度不参与信号或收益计算。本次没有套用原微盘股票名单。','',
|
||||
'**4月27日至8月3日的热度是在8月4日集中入库的。** 主研究要求次日开盘前整批数据已入库,因此这些回填值不能当作历史上当时可用的信号。完整历史另做诊断,并明确标记含回填。','',
|
||||
table(['口径','信号区间','有热度信号日','用途'],[
|
||||
['按入库时间可用,主样本','2026-08-04至2026-10-08','41','阈值主比较;8月5日起成交'],
|
||||
['最大批次历史分数','2026-04-27至2026-10-08','108','包含回填,只作历史关联诊断'],
|
||||
['行情尾段','至2026-10-23','—','留出最长10日的退出观察']]),'',
|
||||
'选择每个交易日、在下一个交易日09:25前整批可用的最大batch_no,不逐股拼接不同批次,也不在热度缺失日沿用旧分数。create_time为DATETIME,未找到上游写入代码确认时区;主口径将原值加8小时作为保守时点,原值另作敏感性。两种假设在本次主网格共同信号区间选出的批次一致,基线净值也一致;这不是对源时间语义或热度算法的完整审计。','',
|
||||
'源表只有沪深代码,没有北交所热度,实际覆盖5,232只历史股票并集;所以“全市场”在本轮指已有热度覆盖的沪深A股。每日先排除历史ST、退市整理、上市未满120个交易日、缺历史名称或必要行情的股票。78只股票缺有效上市日期而被排除。历史ST与名称数据及退市覆盖仍可能不完整。','',
|
||||
'9月7日、10月13日整日缺热度;5月7日、10月14日和15日覆盖不足5,000只。主比较的共同末日是10月8日,所以10月中旬缺口不影响本轮选股,但不能据此声称目前每日数据已齐。完整批次和行情摘要见[coverage.json](coverage.json)。','',
|
||||
'## 只改变四个维度','',
|
||||
'协议于北京时间2026年10月28日15:14冻结,先于收益计算,见[protocol.json](protocol.json)及SHA-256摘要。基线0.80 / [0%,5%) / 5日是本次研究的参考锚点,并非已经运行的线上策略。','',
|
||||
'- 热度下限:0.50、0.60、0.70、0.75、0.80、0.85、0.90、0.95,另设不筛热度对照。\n- 当日涨跌幅下限:−10%、−5%、−3%、0%、2%、3%、5%。\n- 当日涨跌幅上限:0%、2%、3%、5%、7%、10%、20%,只保留下限小于上限的39种区间。\n- 持有期:1至10个交易日,按用户确认口径。','',
|
||||
'9×39×10共3,510组,其中3,120组带热度筛选、390组为对照。主样本和含回填诊断各计算一遍;每笔收益同时给出30和60基点费用。完整网格是事件收益标定,随后对固定四维切片、训练赢家及候选补充118条费用分支账户。没有宣称已经给3,510组全部计算累计账户收益。','',
|
||||
'信号日收盘涨跌幅取pct_chg,热度至少达到阈值;次交易日开盘买入。买入后经过H个交易日,在开盘卖出,所以H=1也是买入后的下一个交易日卖出。没有另加止盈止损。同股连续入选分别建批次,旧批次的到期日不会被新信号重置。','',
|
||||
'事件表先计算每天所有已完成个股交易的等权净收益,再对有成交的信号日等权平均,称“平均每批净收益”。个股胜率、个股中位数和尾部按全部完成交易统计,两种加权不同。同涨跌幅对照使用同日、同资格、同持有期和同费用,仅不筛热度;相对差异取热度组合有成交的匹配日。未完成交易数在明细单列,不能当成盈利退出。','',
|
||||
'资金账户每天以前日收盘资产除以H作为新批预算,先卖后买且不超过可用现金;全部入选股等额分配,买入失败部分留现金。同股重叠持有消耗各自批次资金,不重复使用资本。H=1会高频换手;持股数量未设固定上限。','',
|
||||
'买入开盘触涨停或跌停、零成交量、缺有效复权价或限制价时放弃该笔;卖出遇跌停、零量、缺价时保留原退出任务,之后每个交易日重试。10日是计划持有上限,无法保证跌停或停牌时10日内实际卖出。缺收盘价时只延用最后已知复权价,连续缺价超过20日暂记零,既不倒填未来价格,也不把零估值当作成交。','',
|
||||
'## 热度线:在普通追涨区间,提高阈值反而更差','',
|
||||
'固定当日涨幅[0%,5%)、持有5日。', '',
|
||||
event_table([f'{h:g}/0/5/5' for h in [.0,.5,.6,.7,.75,.8,.85,.9,.95]]),'',
|
||||
'从0.50提高到0.95,平均每批净收益总体恶化;高热度不是这个区间里的正向收益保证。基线的3,091笔完成交易涉及2,147只股票,但只有41个信号日,不能把3,091笔视为相互独立的试验。','',
|
||||
'## 涨跌幅区间:限制追涨比继续抬高热度更有价值','',
|
||||
'固定热度0.80、持有5日,只改变涨幅上限。','',
|
||||
event_table([f'0.8/0/{u}/5' for u in [2,3,5,7,10,20]]),'',
|
||||
'把涨幅上限从5%收窄到2%后,每批收益由−1.15%改善到−0.11%,但仍为负。并且完成交易从3,091笔降至261笔、信号日从41降至37,集中度和样本稀疏风险增加。这里体现的是更少追涨,不能直接解释成热度本身产生了利润。','',
|
||||
'固定上限5%,把下限从0%放宽到−3%、−5%或−10%,都只增加2笔完成交易,三档产生相同的高热度选股集合。这个样本几乎没有“高热度但当天下跌”的股票,无法精确标定负涨幅下限;不能据此得出所有下跌股票都不适合买入。','',
|
||||
'','',
|
||||
'## 持有期:基线延长到10日更差,低涨幅候选只有窄峰','',
|
||||
event_table([f'0.8/0/5/{h}' for h in range(1,11)]),'',
|
||||
'基线从1日延长到10日,平均每批净收益从−0.80%降至−2.73%。这比较的是一笔交易的持有期,不能把它直接当成资金账户累计收益:1日方案虽然每笔亏损较小,却支付更高频的交易摩擦。','',
|
||||
acct_table(['0.7/0/2/4','0.75/0/2/3',candidate,'0.75/0/2/5','0.8/0/2/4']),'',
|
||||
'0.75 / [0%,2%) / 4日的40个有成交信号日、654笔交易,平均每批净收益约+0.18%。相邻的3日和5日账户累计分别为−0.72%和−0.17%,热度改到0.70或0.80时4日账户也略亏。最高点缺乏稳定的相邻正收益区域。候选单股最大权重27.09%,说明当日少量选股可能使组合集中。','',
|
||||
'','',
|
||||
'## 时间顺序检验:相对改善没有转化为可靠绝对利润','',
|
||||
'训练只用8月4日至8月31日信号,且实际退出必须早于9月15日。9月1日至14日不参与训练选参或验证信号,形成最长持有期的间隔。验证信号从9月15日到10月8日,总共只有12个有热度的日期。','',
|
||||
'预设评分为每日等权净超额收益除以持有日数,取本点及四维相邻一档合格组合的中位数。训练至少10个有成交日、100笔完成交易。这个评分偏重单位持有期的相对优势,允许绝对收益为负;它不是自动上线条件。','',
|
||||
f'训练选出 **{winner}**。其训练有18个成交信号日、115笔,训练平均每批净收益−0.20%;验证有10个成交日、{accounts["validation:"+winner+"@30"]["summary"]["sell_count"]}笔,平均每批净收益+0.06%,比同日不筛热度对照高0.42个百分点。验证新研究账户实际累计{pct(accounts["validation:"+winner+"@30"]["summary"]["return"])},费用加倍后{pct(accounts["validation:"+winner+"@60"]["summary"]["return"])}。平均每批略正与复利账户略负并不矛盾:批次收益波动、现金分配和复利影响最终资金结果。','',
|
||||
table(['验证新账户','30基点累计收益','最大回撤','60基点累计收益'],[[k,pct(accounts['validation:'+k+'@30']['summary']['return']),pct(accounts['validation:'+k+'@30']['summary']['max_drawdown']),pct(accounts['validation:'+k+'@60']['summary']['return'])] for k in [winner,'0/0/2/1',baseline,'0/0/5/5']]),'',
|
||||
'验证账户在验证起点持有现金,没有接入训练期持仓,也不是年末换参连续账户。0.75 / [0%,2%) / 4日是看完主网格后挑出的最高平均绝对收益点,只作为事后候选;追加账户协议见[supplement_protocol.json](supplement_protocol.json)。不把它冒充预先固定参数或样本外赢家。','',
|
||||
'只有2026年几个月的数据,无法复刻参考报告的跨年度比较。更长的含回填历史里,0.75 / [0%,2%) / 4日平均每批净收益为−0.35%,相对同区间对照+0.54个百分点;并未显示出稳定绝对盈利。多参数共享同一历史、反复选择会带来选择偏差,参见[Bailey等人的回测过拟合研究](https://www.davidhbailey.com/dhbpapers/backtest-prob.pdf)。本报告不计算或宣称统计显著性。','',
|
||||
'','',
|
||||
'## 费用、成交和可信边界','',
|
||||
'每边30基点和60基点是统一佣金、税费、滑点等摩擦的研究假设,不是新核验的实际券商收费。使用可分割复权单位,没有模拟整手、单笔最低佣金、分红现金账或逐笔开盘容量。无热度对照可能同时持有数千只股票,只用于识别热度增量价值,不代表实际可实施的资金配置。','',
|
||||
'基线买入3,091笔,跳过5笔无法买入,2笔到期退出延迟;最终无残仓。两个无热度的较长持有对照仍各有2笔未退出,它们按超过20日缺价记零,不能描述为已全部平仓。候选0.75 / [0%,2%) / 4日最终无残仓。研究不能保证实际开盘撮合、容量和退市损失与这些估值相同。','',
|
||||
'主样本的create_time两种时区假设得到相同信号;基线把入场再延后一个交易日的账户累计约'+pct(s['sensitivity']['one_more_day_delay']['return'])+',仍为负。没有重建热度算法历史版本,也未证明数据库中的已入库分数从未被改写。因此本研究是带入库时点限制的历史复算,不是不可变执行日志回放。','',
|
||||
'**结论是缩小后续研究范围,而非找到上线阈值。** 若保留一个具体研究点,使用热度≥0.75、当日涨幅[0%,2%)、持有4个交易日;同时保留0.70和0.80、持有3日和5日作相邻对照。当前证据不支持通过抬高热度、追更大涨幅或延长到10日解决盈利问题。','',
|
||||
'## 复核、复现与接续','',
|
||||
f'开发机通过8项隔离配置、断网内存测试,覆盖回填与整批可用时点、次日买入与T+1卖出、失败买单留现金、退出延期、重复信号不延长旧批持有期、费用公式、未来数据不改变过去及区间边界。独立逐笔复算{len(audit["detailed_accounts_rebuilt"])}条账户,最大现金和估值误差{audit["max_absolute_error"]:.2e};{audit["all_accounts_cash_checked"]}条账户现金收支检查通过,3个日期截断重跑与完整基线前缀完全一致,另从成交逐笔复算3个候选的事件均值。详见[audit.json](results/audit.json)。','',
|
||||
'155取数时核对主机factorevaluation、模拟实例空表前缀和实际镜像pms:micro50-9e14f92;只启动受资源限制、只读文件系统、无下单凭证的一次性研究容器执行单表SELECT/SHOW。应用只挂载logs,没有/app源码覆盖。本次没有更改应用Python代码,因此没有需要更新的业务镜像或受影响业务容器。188未访问,执行链路本轮未判收。','',
|
||||
'原始热度与派生矩阵保存在本地忽略目录,源摘要在coverage.json;行情依赖既有macro_timing_20261026/raw缓存,未随本次Git提交重复加入。运行需要Python、NumPy、Pandas、Matplotlib。只读导出fetch.py与离线计算分开,研究测试不连接服务器。','',
|
||||
'```bash\n# 从仓库根目录执行;prepare起均为本地离线运算。\npython research/heat_calibration_20261028/prepare.py\npython research/heat_calibration_20261028/calibrate.py\npython research/heat_calibration_20261028/supplement.py\npython scripts/unit_test_guard.py research/heat_calibration_20261028/test_calibration.py\npython scripts/unit_test_guard.py research/heat_calibration_20261028/audit.py\npython research/heat_calibration_20261028/report.py\n```','',
|
||||
'主结果:[3,510组主样本明细](results/grid_asof.csv)、[含回填诊断](results/grid_heat.csv)、[原设候选账户明细](results/accounts.csv)、[训练选参及敏感性](results/selection.json)、[事后候选与验证账户](results/supplement.json)、[运行摘要](results/manifest.json)。原始热度来源为2026年10月28日只读导出;最后核验时间见运行摘要。','']
|
||||
(ROOT/'全市场热度四维标定.md').write_text('\n'.join(lines))
|
||||
manifest={'completed_at_beijing':dt.datetime.now(dt.timezone(dt.timedelta(hours=8))).isoformat(),
|
||||
'protocol_sha256':digest(ROOT/'protocol.json'),'coverage_sha256':digest(ROOT/'coverage.json'),
|
||||
'code_sha256':{f.name:digest(f) for f in ROOT.glob('*.py')},
|
||||
'result_sha256':{f.name:digest(f) for f in OUT.iterdir() if f.name!='manifest.json'},
|
||||
'figures_sha256':{f.name:digest(f) for f in FIG.glob('*.png')}}
|
||||
dump(OUT/'manifest.json',manifest)
|
||||
print('报告和3张图完成')
|
||||
|
||||
if __name__=='__main__':main()
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
# 开发机研究依赖,不并入生产requirements.txt。
|
||||
numpy==2.3.5
|
||||
pandas==2.2.3
|
||||
matplotlib==3.11.2
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
key,cost_bps,return,max_drawdown,fees_initial_capital,buy_count,sell_count,skipped_buy,delayed_lots,ending_cash,ending_stock_value,open_lots,max_stock_weight,max_positions,max_stale_valuation,mean_exposure
|
||||
0.5/0/5/5,30,-0.04900189132636412,-0.08294537874993835,0.048884954228804914,69170,69168,66,76,0.9509981086736359,0.0,2,0.001340800764378021,4577,0.00298199134347846,0.8353803118887044
|
||||
0.5/0/5/5,60,-0.09454163244966296,-0.11951659275458537,0.09543404828506415,69170,69168,66,76,0.905458367550337,0.0,2,0.0013408521086155313,4577,0.0028640135340482374,0.8354450904961649
|
||||
0.6/0/5/5,30,-0.06503243929226055,-0.09659163025868811,0.048365530566968205,17999,17998,28,23,0.9349675607077395,0.0,1,0.003434041214379078,2036,0.003447620232955078,0.8351690104926127
|
||||
0.6/0/5/5,60,-0.10982059122592691,-0.13284874387703838,0.09443602852300083,17999,17998,28,23,0.8901794087740731,0.0,1,0.0034338693935413735,2036,0.0033073706092505237,0.8353179110841311
|
||||
0.7/0/5/5,30,-0.07953176152709429,-0.10341100203047549,0.04793784002780805,7453,7453,14,9,0.9204682384729057,0.0,0,0.011191377779770929,962,0.0042875346814535385,0.889789184912628
|
||||
0.7/0/5/5,60,-0.12364569169963802,-0.13919484045421737,0.09359861458857406,7453,7453,14,9,0.876354308300362,0.0,0,0.01118308358649081,962,0.004189969332324399,0.8899080184918253
|
||||
0.75/0/5/5,30,-0.08008502283067487,-0.1046157648717212,0.04795366802354817,4877,4877,10,6,0.9199149771693251,0.0,0,0.016745697326224177,654,0.0038615381972265054,0.8897143363272064
|
||||
0.75/0/5/5,60,-0.12415923645166616,-0.1403295807523678,0.09363030796815608,4877,4877,10,6,0.8758407635483338,0.0,0,0.016742090512488456,654,0.0037792200523393037,0.8898330269372271
|
||||
0.8/-10/5/5,30,-0.09178098022448933,-0.10669055999179367,0.047469571157997215,3093,3093,5,2,0.9082190197755107,0.0,0,0.055311350425798225,438,0.0032966470341278206,0.8892083167329148
|
||||
0.8/-10/5/5,60,-0.13531687019850647,-0.1428011081742534,0.09268739366009313,3093,3093,5,2,0.8646831298014935,0.0,0,0.055305033256939994,438,0.003143856367554088,0.8893171081083748
|
||||
0.8/-3/5/5,30,-0.09178098022448933,-0.10669055999179367,0.047469571157997215,3093,3093,5,2,0.9082190197755107,0.0,0,0.055311350425798225,438,0.0032966470341278206,0.8892083167329148
|
||||
0.8/-3/5/5,60,-0.13531687019850647,-0.1428011081742534,0.09268739366009313,3093,3093,5,2,0.8646831298014935,0.0,0,0.055305033256939994,438,0.003143856367554088,0.8893171081083748
|
||||
0.8/-5/5/5,30,-0.09178098022448933,-0.10669055999179367,0.047469571157997215,3093,3093,5,2,0.9082190197755107,0.0,0,0.055311350425798225,438,0.0032966470341278206,0.8892083167329148
|
||||
0.8/-5/5/5,60,-0.13531687019850647,-0.1428011081742534,0.09268739366009313,3093,3093,5,2,0.8646831298014935,0.0,0,0.055305033256939994,438,0.003143856367554088,0.8893171081083748
|
||||
0.8/0/10/5,30,-0.10720778255257446,-0.13565129591613,0.04727955099400579,6608,6608,53,13,0.8927922174474255,0.0,0,0.010017845685486864,884,0.005658393599190707,0.8844477831136245
|
||||
0.8/0/10/5,60,-0.14979915895975782,-0.1699739506310154,0.09235759023320055,6608,6608,53,13,0.8502008410402422,0.0,0,0.010008546376022418,884,0.005515465792193314,0.8847827579326591
|
||||
0.8/0/2/1,30,-0.1187787503148987,-0.18527414605847958,0.21031891955154758,261,261,1,0,0.8812212496851013,0.0,0,1.0000000000000002,21,0.0,0.9924707142556597
|
||||
0.8/0/2/1,60,-0.293168554873217,-0.32947157571965,0.3788826448303117,261,261,1,0,0.706831445126783,0.0,0,1.0,21,0.0,0.9929543534387564
|
||||
0.8/0/2/5,30,-0.010309673241817086,-0.051692413137346405,0.04397142799336587,261,261,1,0,0.9896903267581829,0.0,0,0.2090804292330855,52,0.0,0.8347981820406741
|
||||
0.8/0/2/5,60,-0.05305977996569877,-0.07751985948806162,0.08603327085875624,261,261,1,0,0.9469402200343012,0.0,0,0.209210526832728,52,0.0,0.8348729008301486
|
||||
0.8/0/20/5,30,-0.11296553157324885,-0.14525047451575523,0.04695196543946993,8194,8193,116,23,0.8860246492274327,0.0010098191993184607,1,0.006313965817329451,1060,0.006002489912404257,0.7781080126915447
|
||||
0.8/0/20/5,60,-0.15504281881479065,-0.17936254532508,0.09173903409183919,8194,8193,116,23,0.8439918572543276,0.0009653239308817383,1,0.006307929282926078,1060,0.005850624483620738,0.7784437552849673
|
||||
0.8/0/3/5,30,-0.07057010903417849,-0.08530362699812799,0.046357833911190145,1006,1006,1,0,0.9294298909658215,0.0,0,0.20195360339761687,175,0.0,0.8857074773922319
|
||||
0.8/0/3/5,60,-0.11397041700862554,-0.12496899520203131,0.09056751382789643,1006,1006,1,0,0.8860295829913745,0.0,0,0.2014726924617259,175,0.0,0.8858276673787303
|
||||
0.8/0/5/1,30,-0.2791862445244173,-0.2881769265232774,0.21010399787884695,3091,3091,5,4,0.7208137554755827,0.0,0,0.2651786390931667,123,0.01331207802542293,0.952616016986098
|
||||
0.8/0/5/1,60,-0.43563389044181666,-0.44098678762294363,0.3752505503609775,3091,3091,5,4,0.5643661095581833,0.0,0,0.26517863909316663,123,0.010640316627663817,0.9527737666574656
|
||||
0.8/0/5/10,30,-0.1082377445787861,-0.11905780693778545,0.023657216554943527,3091,3091,5,2,0.8917622554212139,0.0,0,0.02809058851027885,791,0.001656062662986448,0.8016547487977246
|
||||
0.8/0/5/10,60,-0.12982599402403283,-0.1377804376236661,0.04674017523226773,3091,3091,5,2,0.8701740059759672,0.0,0,0.028055672958838512,791,0.0016193415215935833,0.8015226109332775
|
||||
0.8/0/5/2,30,-0.1672925580655341,-0.17672702287330877,0.11314085056968039,3091,3091,5,4,0.8327074419344659,0.0,0,0.13333942090541356,223,0.0074760535675675996,0.9301137422233406
|
||||
0.8/0/5/2,60,-0.26343075516824765,-0.2669211457469093,0.21341234770861964,3091,3091,5,4,0.7365692448317523,0.0,0,0.1331414325588802,223,0.006671434483592244,0.9303868962525077
|
||||
0.8/0/5/3,30,-0.11086114047267648,-0.12307431345307196,0.07794748462965168,3091,3091,5,2,0.8891388595273235,0.0,0,0.0890608961907462,297,0.0053562626889819415,0.9299474021739766
|
||||
0.8/0/5/3,60,-0.18069920788535176,-0.18506592770268593,0.1498373147840937,3091,3091,5,2,0.8193007921146482,0.0,0,0.08888432896504349,297,0.004975223290521504,0.9301814429070322
|
||||
0.8/0/5/4,30,-0.09392052489239477,-0.1077660776839513,0.059264137725391186,3091,3091,5,4,0.9060794751076052,0.0,0,0.06708050171913767,381,0.004115369317533079,0.8891329334843485
|
||||
0.8/0/5/4,60,-0.14780345435789133,-0.15459520398524118,0.1150257138813924,3091,3091,5,4,0.8521965456421087,0.0,0,0.06707640643833668,381,0.0038937895078056902,0.8892090069236198
|
||||
0.8/0/5/5,30,-0.09183817866851673,-0.106626148101161,0.04746774022339881,3091,3091,5,2,0.9081618213314833,0.0,0,0.055311350425798225,438,0.0032964394156133306,0.8892093746827127
|
||||
0.8/0/5/5,60,-0.135371921494852,-0.1428556829758144,0.09268380783491686,3091,3091,5,2,0.864628078505148,0.0,0,0.055305033256939994,438,0.0031436562093987933,0.8893181713849726
|
||||
0.8/0/5/6,30,-0.09422515451104507,-0.10787467015502883,0.039637858145158134,3091,3091,5,0,0.9057748454889549,0.0,0,0.04658674283298859,522,0.002770755801095702,0.870425599840552
|
||||
0.8/0/5/6,60,-0.13052426650911664,-0.1387386634939246,0.0776936039123207,3091,3091,5,0,0.8694757334908834,0.0,0,0.046581849243572115,522,0.002670360811136806,0.8704005972649398
|
||||
0.8/0/5/7,30,-0.10204169641465033,-0.1142566497231422,0.03378960696465498,3091,3091,5,2,0.8979583035853497,0.0,0,0.04000140409911087,580,0.0023185512979334954,0.8519717214031468
|
||||
0.8/0/5/7,60,-0.13300536916410366,-0.1401799913670052,0.06642713392053831,3091,3091,5,2,0.8669946308358963,0.0,0,0.03998137969548401,580,0.0022452995236921405,0.8520302072390505
|
||||
0.8/0/5/8,30,-0.09948503293935362,-0.11243813513581769,0.02970153476411646,3091,3091,5,1,0.9005149670606464,0.0,0,0.03504781217836241,662,0.0020282649738155474,0.8341997693445711
|
||||
0.8/0/5/8,60,-0.12667901790497538,-0.13528076216966844,0.058515729762361544,3091,3091,5,1,0.8733209820950246,0.0,0,0.0350194340258579,662,0.001972160394828766,0.8342268940727733
|
||||
0.8/0/5/9,30,-0.10320487028350278,-0.11557964744222182,0.026364479286557295,3091,3091,5,4,0.8967951297164972,0.0,0,0.03118589221621126,721,0.0018442664601897106,0.8176349464923325
|
||||
0.8/0/5/9,60,-0.12727250725841865,-0.13612555639740886,0.052023752734200054,3091,3091,5,4,0.8727274927415813,0.0,0,0.031153136858411184,721,0.001798916927165686,0.8175619926119551
|
||||
0.8/0/7/5,30,-0.09546575828546855,-0.10906239302889931,0.047275424131853296,4862,4862,13,8,0.9045342417145315,0.0,0,0.019405825441849437,667,0.005590115921215743,0.888698110841455
|
||||
0.8/0/7/5,60,-0.13876931132554948,-0.14457052269981863,0.09231136711717643,4862,4862,13,8,0.8612306886744505,0.0,0,0.019402051848582902,667,0.005356231705449348,0.8888306133295009
|
||||
0.8/2/5/5,30,-0.0988093432382956,-0.11332391101738237,0.04731233527244167,2830,2830,4,2,0.9011906567617044,0.0,0,0.053517427769249275,409,0.004162045422681886,0.8891826265781076
|
||||
0.8/2/5/5,60,-0.141984388631491,-0.14872488816643714,0.09238273382281391,2830,2830,4,2,0.858015611368509,0.0,0,0.053389965190924794,409,0.00398178069865358,0.8892877494791908
|
||||
0.8/3/5/5,30,-0.1076510816285744,-0.12263963578689341,0.04718289349034165,2085,2085,4,2,0.8923489183714256,0.0,0,0.053517427769249275,327,0.005972019938952246,0.8881382271595228
|
||||
0.8/3/5/5,60,-0.15036172155348349,-0.15760740742863444,0.0921344170460677,2085,2085,4,2,0.8496382784465165,0.0,0,0.053389965190924794,327,0.005713645858791235,0.8882398296357551
|
||||
0.85/0/5/5,30,-0.09444008934634751,-0.10837726154052629,0.04720783803621299,1815,1815,4,2,0.9055599106536525,0.0,0,0.2114784236683222,288,0.004532072954250922,0.8889280261990398
|
||||
0.85/0/5/5,60,-0.13781983375045392,-0.15005435008385926,0.09217314112326253,1815,1815,4,2,0.8621801662495461,0.0,0,0.21098082765198348,288,0.004322376098174727,0.8889888084802702
|
||||
0.9/0/5/5,30,-0.10747049334547298,-0.12358271840542356,0.04729161908574362,897,897,2,1,0.892529506654527,0.0,0,0.2114784236683222,139,0.011296283452696568,0.8890129365857181
|
||||
0.9/0/5/5,60,-0.15020812611237466,-0.16268396271310692,0.09233938254500222,897,897,2,1,0.8497918738876253,0.0,0,0.21098082765198348,139,0.010806817206523022,0.889068622698739
|
||||
0.95/0/5/5,30,-0.1500219278530499,-0.1580272110150448,0.044780951327068635,316,316,1,0,0.8499780721469501,0.0,0,0.20281896549500517,62,0.0,0.8839010177230375
|
||||
0.95/0/5/5,60,-0.18956600947505198,-0.1956835904685198,0.08750326279914894,316,316,1,0,0.810433990524948,0.0,0,0.20257843839046985,62,0.0,0.8838807286932219
|
||||
0/-10/5/5,30,-0.05610982750384241,-0.08472526385939028,0.04893767089911673,189857,189846,160,212,0.9437694181340023,0.00012075436215527063,11,0.00027063716353232766,4903,0.0021962406121102934,0.7877075461861135
|
||||
0/-10/5/5,60,-0.10134452258917281,-0.12126210932773895,0.09554009489379973,189857,189846,160,212,0.898540180670066,0.00011529674076121322,11,0.00027064055085798954,4903,0.002110795650808889,0.7878163702495475
|
||||
0/-3/5/5,30,-0.047779015198149755,-0.07564397867432249,0.04898485815621228,171382,171375,118,188,0.95217098552794,4.999927391025589e-05,7,0.00035844862797511606,4897,0.002236574354198337,0.7877270544609688
|
||||
0/-3/5/5,60,-0.0934110684824625,-0.11253661250564195,0.09562676972768043,171382,171375,118,188,0.9065413434616748,4.7588055862704686e-05,7,0.000358676834023601,4897,0.002148874157377873,0.7878064356389924
|
||||
0/-5/5/5,30,-0.05165843442534079,-0.0799975570188518,0.04898707837163808,183933,183923,132,203,0.9482583006338348,8.326494082449995e-05,10,0.00029977500671949297,4899,0.002185408577842596,0.7877517326459025
|
||||
0/-5/5/5,60,-0.09711650355080781,-0.11673103392492412,0.0956348640025132,183933,183923,132,203,0.9028040797507437,7.941669844842316e-05,10,0.00029979419610303516,4899,0.0021004508642761483,0.7878606747525125
|
||||
0/0/10/5,30,-0.050681944350619235,-0.0870925031439509,0.0489434951462466,97241,97239,183,119,0.9493180556493808,0.0,2,0.0011546584532285133,4884,0.0032951554579641077,0.8181076161411052
|
||||
0/0/10/5,60,-0.0961114910353138,-0.12345740906450042,0.09555781695992077,97241,97239,183,119,0.9038885089646862,0.0,2,0.001154735363276098,4884,0.003162339348024432,0.8182318474233198
|
||||
0/0/2/1,30,-0.20403799670454204,-0.2151606805784676,0.22288076067580903,63461,63461,48,11,0.795962003295458,0.0,0,0.0039671212888282275,2640,0.00157679801188347,0.8714425544936787
|
||||
0/0/2/1,60,-0.3773797806233701,-0.3803670576695749,0.3973482547760393,63461,63461,48,11,0.6226202193766299,0.0,0,0.0039789386724428805,2640,0.0013977504559137452,0.8715324543356593
|
||||
0/0/2/5,30,-0.04353470154692374,-0.06936876288780291,0.04891552054950945,63461,63459,48,63,0.9564652984530763,0.0,2,0.0015937484725191918,4402,0.002645558607513543,0.8188675189470245
|
||||
0/0/2/5,60,-0.08933917742974606,-0.10707470619664072,0.09549085877573933,63461,63459,48,63,0.9106608225702539,0.0,2,0.0015932648337344403,4402,0.002541151687361141,0.8189310460007594
|
||||
0/0/20/5,30,-0.053161587474159666,-0.09020799228609488,0.048850213720208494,99434,99431,331,134,0.9467821899225014,5.622260333891701e-05,3,0.001278612126227526,4891,0.0033213893800515164,0.7859513640278558
|
||||
0/0/20/5,60,-0.09845679014192643,-0.12643346140011413,0.09538442507034205,99434,99431,331,134,0.9014894851978272,5.3724660246336224e-05,3,0.0012788121577035384,4891,0.003188072850038852,0.7861270165185258
|
||||
0/0/3/5,30,-0.046102214087847426,-0.07449615187857994,0.04889729780277429,77481,77479,69,82,0.9538977859121526,0.0,2,0.0013682702605642635,4675,0.0028327109051467857,0.8188052224073813
|
||||
0/0/3/5,60,-0.0917727883732189,-0.11139209240912507,0.09545677470646625,77481,77479,69,82,0.9082272116267811,0.0,2,0.0013682965665930131,4675,0.0027200624298111048,0.8188687807545024
|
||||
0/0/5/1,30,-0.21306730594913492,-0.23245200019676293,0.22277979955171157,89599,89599,81,26,0.7869326940508651,0.0,0,0.003098547760444422,3564,0.0031214703289247463,0.8532793527545189
|
||||
0/0/5/1,60,-0.3843203116601055,-0.39173993191749434,0.3973833506429438,89599,89599,81,26,0.6156796883398945,0.0,0,0.003107011701665004,3564,0.002496517334929422,0.8534067061244023
|
||||
0/0/5/10,30,-0.0708969713736064,-0.09432305051061352,0.02417123939670283,89599,89581,81,154,0.9287190466417251,0.000383981984668516,18,0.0008041387895685471,4900,0.002963994410920518,0.7870019601125667
|
||||
0/0/5/10,60,-0.09339134994594345,-0.1138382036163248,0.04776304797579851,89599,89581,81,154,0.9062332374321914,0.0003754126218651259,18,0.0008039745261190698,4900,0.0029090587235291146,0.7870459756193863
|
||||
0/0/5/2,30,-0.1048484895530174,-0.13103281475419348,0.11850442539181852,89599,89597,81,59,0.8951515104469826,0.0,2,0.0020787734022298114,4482,0.004902226598911704,0.8195226469567192
|
||||
0/0/5/2,60,-0.20821541910698815,-0.22439788595358034,0.22337360123959515,89599,89597,81,59,0.7917845808930118,0.0,2,0.002077939934768452,4482,0.004423464953627362,0.8197002503582123
|
||||
0/0/5/3,30,-0.054532835005008495,-0.08731573308504459,0.08102680858875871,89599,89597,81,68,0.9454671649949915,0.0,2,0.0014662757642503086,4672,0.0036928030007586246,0.8192845196800965
|
||||
0/0/5/3,60,-0.12883007448190353,-0.1490117138162097,0.15570664581118374,89599,89597,81,68,0.8711699255180965,0.0,2,0.0014672932553042473,4672,0.0034476072880230317,0.8194927930710879
|
||||
0/0/5/4,30,-0.04518113126717582,-0.07880833707341195,0.06124649197050887,89599,89597,81,83,0.9548188687328242,0.0,2,0.0014745913763304604,4794,0.0035192990974467053,0.8191612918370204
|
||||
0/0/5/4,60,-0.10202297222980183,-0.1245156481419527,0.11885879689183028,89599,89597,81,83,0.8979770277701982,0.0,2,0.0014749772096058502,4794,0.0033423156360805903,0.8193177341575852
|
||||
0/0/5/5,30,-0.048215823174561634,-0.08028718098440257,0.04892555443773997,89599,89597,81,97,0.9517841768254384,0.0,2,0.0011978906633270023,4835,0.0031759918606091503,0.8187149056873996
|
||||
0/0/5/5,60,-0.09378431917710217,-0.11694811999460308,0.0955128916048567,89599,89597,81,97,0.9062156808228978,0.0,2,0.0011979234167170522,4835,0.0030484163244713296,0.8187783321146686
|
||||
0/0/5/6,30,-0.05127462463660126,-0.0823484104521941,0.040800029239852785,89599,89595,81,108,0.9487253753633987,0.0,4,0.0011285135153901598,4867,0.002991157206912812,0.8191003505084626
|
||||
0/0/5/6,60,-0.08937870187374342,-0.11383712110381883,0.07997562148016227,89599,89595,81,108,0.9106212981262566,0.0,4,0.0011299166462682526,4867,0.002892273989855081,0.8192616556917828
|
||||
0/0/5/7,30,-0.05447242787639972,-0.08305730351897023,0.03488083987346407,89599,89592,81,121,0.9454383429786526,8.922914494772161e-05,7,0.0009758353119699986,4879,0.0030548410126483992,0.7874027477869211
|
||||
0/0/5/7,60,-0.08712531085032338,-0.1103726092268682,0.06856714566503741,89599,89592,81,121,0.9127880952643511,8.659388532552296e-05,7,0.0009772926643619492,4879,0.002969874349721623,0.787515962304484
|
||||
0/0/5/8,30,-0.05930370336305202,-0.08690862217625439,0.030427611341164798,89599,89590,81,119,0.9404814454097545,0.0002148512271934544,9,0.0009393282870508018,4888,0.002814977376457604,0.787269271234795
|
||||
0/0/5/8,60,-0.08777433530349577,-0.11081886810472674,0.059943705081417165,89599,89590,81,119,0.9120166966375964,0.0002089680589078477,9,0.0009401658228509374,4888,0.002747273514074793,0.7873700380620448
|
||||
0/0/5/9,30,-0.061856521321320246,-0.08829356209641626,0.027015280708095304,89599,89587,81,138,0.9379030398464322,0.0002404388322475073,12,0.000852474846277798,4895,0.0026847167400309833,0.7872398128883525
|
||||
0/0/5/9,60,-0.08709957611676089,-0.10985698190289461,0.05331084803020237,89599,89587,81,138,0.9126658813151689,0.00023454256807021141,12,0.0008536782481073542,4895,0.0026280975506604303,0.7873101427297506
|
||||
0/0/7/5,30,-0.04839002815663107,-0.08277511589524922,0.048967331789183756,94254,94252,100,108,0.9516099718433689,0.0,2,0.001189602529349422,4868,0.003372932122613478,0.8186015911092052
|
||||
0/0/7/5,60,-0.09394601958400173,-0.11933004437723538,0.09559482169898616,94254,94252,100,108,0.9060539804159983,0.0,2,0.001189677064407485,4868,0.0032369252363613973,0.8186646957250858
|
||||
0/2/5/5,30,-0.07160559476900952,-0.11622774800087243,0.048642347488865666,26138,26138,33,34,0.9283944052309905,0.0,0,0.004432282967207347,3240,0.005691232951451235,0.8520859822606459
|
||||
0/2/5/5,60,-0.11600970310593506,-0.15140267032157406,0.09497736746573734,26138,26138,33,34,0.8839902968940649,0.0,0,0.00443588965905137,3240,0.005455215536269949,0.8522123956083675
|
||||
0/3/5/5,30,-0.0784108723732484,-0.12658353707893943,0.048579154367655294,12118,12118,12,15,0.9215891276267516,0.0,0,0.007997296428789316,1912,0.006442517719883745,0.8515998772340874
|
||||
0/3/5/5,60,-0.12246566471738496,-0.16132632407095382,0.09485805919938081,12118,12118,12,15,0.877534335282615,0.0,0,0.008008854843446258,1912,0.006172778203151488,0.8517246148936506
|
||||
|
Binary file not shown.
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"detailed_accounts_rebuilt": [
|
||||
"0.8/0/2/1@30",
|
||||
"0.8/0/2/1@60",
|
||||
"0.8/0/5/5@30",
|
||||
"0.8/0/5/5@60",
|
||||
"0.7/0/2/4@30",
|
||||
"0.7/0/2/4@60",
|
||||
"0.75/0/2/3@30",
|
||||
"0.75/0/2/3@60",
|
||||
"0.75/0/2/4@30",
|
||||
"0.75/0/2/4@60",
|
||||
"0.75/0/2/5@30",
|
||||
"0.75/0/2/5@60",
|
||||
"0.8/0/2/4@30",
|
||||
"0.8/0/2/4@60",
|
||||
"0/0/2/4@30",
|
||||
"0/0/2/4@60",
|
||||
"validation:0.8/0/2/1@30",
|
||||
"validation:0.8/0/2/1@60",
|
||||
"validation:0/0/2/1@30",
|
||||
"validation:0/0/2/1@60",
|
||||
"validation:0.8/0/5/5@30",
|
||||
"validation:0.8/0/5/5@60",
|
||||
"validation:0/0/5/5@30",
|
||||
"validation:0/0/5/5@60"
|
||||
],
|
||||
"max_absolute_error": 1.5021317523178368e-13,
|
||||
"all_accounts_cash_checked": 118,
|
||||
"prefix_recomputed": [
|
||||
"2026-08-31",
|
||||
"2026-09-14",
|
||||
"2026-09-30"
|
||||
],
|
||||
"event_means_rebuilt": [
|
||||
"0.8/0/5/5",
|
||||
"0.8/0/2/1",
|
||||
"0.75/0/2/4"
|
||||
],
|
||||
"timestamp_offset_changed_dates": [
|
||||
"2026-10-16"
|
||||
],
|
||||
"protocol_sha256_checked": true,
|
||||
"environment": "开发机;unit_test_guard隔离配置并禁止联网;独立纯研究代码",
|
||||
"tests": "8项内存合成用例另经unit_test_guard执行;不连接数据库"
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"completed_at_beijing": "2026-10-28T15:37:30.823418+08:00",
|
||||
"protocol_sha256": "1be91305138b7dc546c7a95b93431c0b7ae6087353ae808511810a4d1da5d93b",
|
||||
"coverage_sha256": "deb42fa6f14de8ba8dab15300098f4017fedf39d9c427b09753d83391ffd589c",
|
||||
"code_sha256": {
|
||||
"fetch.py": "65cf772b8d29ce390e8c68bea612e95e587a17e2e9e725caffb7f396cee7df23",
|
||||
"audit.py": "751a3e572ec76c1e5e4eaf7b4b5e5bddffce4f4d8d3569f48c66f1e19f9deea3",
|
||||
"remote.py": "2a5ad9c505e683295b8e57b173c9432fe5e989828eb862c7ed050820376e8fdd",
|
||||
"readonly_support.py": "4c2fd0dc3a5460bdc80ca86970ddac9704917979a0a7d21d59d337c16be840b5",
|
||||
"test_calibration.py": "a937461ce1422dad84a02aa613e453121f982b8b8fcc33e2f56362c684d611bc",
|
||||
"calibrate.py": "964c041f6788a40f0dc38fd1d3183de8a2ebe0adecba76af49b07331cb4e233f",
|
||||
"supplement.py": "2dc0a513dded5051c2a890166fc81b30c460dabf9bc75e0365e9f7c413c1258c",
|
||||
"report.py": "02616ef3c1402630cf777f7dc5892700f8efa60dde6011fe67d394ff575809da",
|
||||
"prepare.py": "37a3fbdbc2e379e8bc5db6238c6e3ae755a8416e9793a7e29c1372dc99fb0fcf"
|
||||
},
|
||||
"result_sha256": {
|
||||
"daily_heat.json.gz": "3c69d3c22a5a94f51f9fe7cf427fff1efc019c0bb2f9f0a6bc6433d1ecdb4f97",
|
||||
"grid_heat.csv": "87d894714b1acf5004cbac80286cf4a308418e739c2c50f963a570a45f041921",
|
||||
"daily_asof.json.gz": "9df046bed1e9cced28f204e8b4d05fa9f195341cb67c782106558b04c575efb7",
|
||||
"audit.json": "aa1c372c476229f6469aaea93f07a52d1cee165e4f3482f6035f0b6ea1906669",
|
||||
"accounts.json.gz": "dbc3889f4a96097aa847701d95e11563c8b540204614c43d189b1d4d990460fc",
|
||||
"supplement_accounts.json.gz": "3008d01cd9c5493f4c95f115cf6f02f6d4984fe8a806243b594c0947b16d9f00",
|
||||
"accounts.csv": "3820186f11d7711a86f0bc01c20e8258270275a26d9748085002b6a1616adab8",
|
||||
"supplement.json": "0b482db068c2b97a6554e95819424e2d87264a226e346fb1483bc6a021bb801e",
|
||||
"grid_asof.csv": "12498003f25a1fdeabee10a4dda9bca7a08601831806b599e230adf17a94181e",
|
||||
"selection.json": "f9188557aa823a2b4f11045af64c7db81f90da92e7426ef710db3b052d20dca5"
|
||||
},
|
||||
"figures_sha256": {
|
||||
"四维切片.png": "bb804859576a294caf1cf727de6d4197893fe55e7fb0e6e261217d35d18335af",
|
||||
"低涨幅热度与持有期.png": "6a25de75bee72362fa11637b8cda1a535dca94dbc3b273c5ec3813f39df23db6",
|
||||
"候选账户净值.png": "ba0d510cd75bd723011b4414b4cc90ef096e234dd7c8d9d95142fc696ae5d2a2"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,952 @@
|
|||
{
|
||||
"baseline": "0.8/0/5/5",
|
||||
"training_winner": {
|
||||
"key": "0.8/0/2/1",
|
||||
"view": "asof",
|
||||
"heat": 0.8,
|
||||
"lower": 0,
|
||||
"upper": 2,
|
||||
"hold": 1,
|
||||
"signals": 262,
|
||||
"signal_days": 37,
|
||||
"filled": 261,
|
||||
"completed": 261,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 1,
|
||||
"stocks": 241,
|
||||
"mean_daily_net30": -0.0030312079068860725,
|
||||
"mean_daily_excess30": 0.0029670141793864597,
|
||||
"mean_daily_net60": -0.008995235927886239,
|
||||
"pooled_mean30": -0.006412958428237882,
|
||||
"pooled_median30": -0.008249775388662783,
|
||||
"win_rate30": 0.3448275862068966,
|
||||
"p10_net30": -0.03678260991672844,
|
||||
"worst_net30": -0.08642281248739336,
|
||||
"delayed_exits": 0,
|
||||
"train_days": 18,
|
||||
"train_completed": 115,
|
||||
"train_net30": -0.002042852847769165,
|
||||
"train_excess_per_day": 0.002445550531664708,
|
||||
"test_days": 10,
|
||||
"test_net30": 0.0006457624562534526,
|
||||
"test_excess30": 0.004218821006532788,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": -0.002042852847769165,
|
||||
"2026-09_net30": -0.0036012675312005232,
|
||||
"2026-10_net30": -0.01056052573333024,
|
||||
"neighbor_score": 0.002445550531664708,
|
||||
"neighbors": 5
|
||||
},
|
||||
"training_top20": [
|
||||
{
|
||||
"key": "0.8/0/2/1",
|
||||
"view": "asof",
|
||||
"heat": 0.8,
|
||||
"lower": 0,
|
||||
"upper": 2,
|
||||
"hold": 1,
|
||||
"signals": 262,
|
||||
"signal_days": 37,
|
||||
"filled": 261,
|
||||
"completed": 261,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 1,
|
||||
"stocks": 241,
|
||||
"mean_daily_net30": -0.0030312079068860725,
|
||||
"mean_daily_excess30": 0.0029670141793864597,
|
||||
"mean_daily_net60": -0.008995235927886239,
|
||||
"pooled_mean30": -0.006412958428237882,
|
||||
"pooled_median30": -0.008249775388662783,
|
||||
"win_rate30": 0.3448275862068966,
|
||||
"p10_net30": -0.03678260991672844,
|
||||
"worst_net30": -0.08642281248739336,
|
||||
"delayed_exits": 0,
|
||||
"train_days": 18,
|
||||
"train_completed": 115,
|
||||
"train_net30": -0.002042852847769165,
|
||||
"train_excess_per_day": 0.002445550531664708,
|
||||
"test_days": 10,
|
||||
"test_net30": 0.0006457624562534526,
|
||||
"test_excess30": 0.004218821006532788,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": -0.002042852847769165,
|
||||
"2026-09_net30": -0.0036012675312005232,
|
||||
"2026-10_net30": -0.01056052573333024,
|
||||
"neighbor_score": 0.002445550531664708,
|
||||
"neighbors": 5
|
||||
},
|
||||
{
|
||||
"key": "0.8/0/2/2",
|
||||
"view": "asof",
|
||||
"heat": 0.8,
|
||||
"lower": 0,
|
||||
"upper": 2,
|
||||
"hold": 2,
|
||||
"signals": 262,
|
||||
"signal_days": 37,
|
||||
"filled": 261,
|
||||
"completed": 261,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 1,
|
||||
"stocks": 241,
|
||||
"mean_daily_net30": -0.0021772864356282453,
|
||||
"mean_daily_excess30": 0.003511023128324277,
|
||||
"mean_daily_net60": -0.008146422752517622,
|
||||
"pooled_mean30": -0.005586857765378655,
|
||||
"pooled_median30": -0.009251849714015936,
|
||||
"win_rate30": 0.3371647509578544,
|
||||
"p10_net30": -0.04257502218618847,
|
||||
"worst_net30": -0.21383091770187967,
|
||||
"delayed_exits": 1,
|
||||
"train_days": 18,
|
||||
"train_completed": 115,
|
||||
"train_net30": 0.0030987823831612675,
|
||||
"train_excess_per_day": 0.0029412157711463565,
|
||||
"test_days": 10,
|
||||
"test_net30": -0.0006038531039292281,
|
||||
"test_excess30": 0.0034953052812539765,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": 0.0030987823831612675,
|
||||
"2026-09_net30": -0.0064134372387250095,
|
||||
"2026-10_net30": -0.020895810718097672,
|
||||
"neighbor_score": 0.002224727348817016,
|
||||
"neighbors": 6
|
||||
},
|
||||
{
|
||||
"key": "0.8/-3/2/2",
|
||||
"view": "asof",
|
||||
"heat": 0.8,
|
||||
"lower": -3,
|
||||
"upper": 2,
|
||||
"hold": 2,
|
||||
"signals": 264,
|
||||
"signal_days": 37,
|
||||
"filled": 263,
|
||||
"completed": 263,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 1,
|
||||
"stocks": 243,
|
||||
"mean_daily_net30": -0.0021542834955984923,
|
||||
"mean_daily_excess30": 0.0031340679779822064,
|
||||
"mean_daily_net60": -0.008123557419783092,
|
||||
"pooled_mean30": -0.00545740158953538,
|
||||
"pooled_median30": -0.009251849714015936,
|
||||
"win_rate30": 0.33840304182509506,
|
||||
"p10_net30": -0.04236195604053985,
|
||||
"worst_net30": -0.21383091770187967,
|
||||
"delayed_exits": 1,
|
||||
"train_days": 18,
|
||||
"train_completed": 117,
|
||||
"train_net30": 0.0031460662043335365,
|
||||
"train_excess_per_day": 0.002219994812045248,
|
||||
"test_days": 10,
|
||||
"test_net30": -0.0006038531039292281,
|
||||
"test_excess30": 0.005313888001026234,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": 0.0031460662043335365,
|
||||
"2026-09_net30": -0.0064134372387250095,
|
||||
"2026-10_net30": -0.020895810718097672,
|
||||
"neighbor_score": 0.0017932523787617266,
|
||||
"neighbors": 7
|
||||
},
|
||||
{
|
||||
"key": "0.8/0/2/3",
|
||||
"view": "asof",
|
||||
"heat": 0.8,
|
||||
"lower": 0,
|
||||
"upper": 2,
|
||||
"hold": 3,
|
||||
"signals": 262,
|
||||
"signal_days": 37,
|
||||
"filled": 261,
|
||||
"completed": 261,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 1,
|
||||
"stocks": 241,
|
||||
"mean_daily_net30": -0.0003638444603083135,
|
||||
"mean_daily_excess30": 0.004658681550446733,
|
||||
"mean_daily_net60": -0.006343829079412381,
|
||||
"pooled_mean30": -0.005625451374871368,
|
||||
"pooled_median30": -0.011010812419402605,
|
||||
"win_rate30": 0.36398467432950193,
|
||||
"p10_net30": -0.05222872450998517,
|
||||
"worst_net30": -0.21383091770187967,
|
||||
"delayed_exits": 0,
|
||||
"train_days": 18,
|
||||
"train_completed": 115,
|
||||
"train_net30": 0.005296989650619229,
|
||||
"train_excess_per_day": 0.0022294598855887838,
|
||||
"test_days": 10,
|
||||
"test_net30": 0.0015527181776838217,
|
||||
"test_excess30": 0.006371226585747946,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": 0.005296989650619229,
|
||||
"2026-09_net30": -0.0043831971034571475,
|
||||
"2026-10_net30": -0.029910510880325102,
|
||||
"neighbor_score": 0.0017591956117681414,
|
||||
"neighbors": 6
|
||||
},
|
||||
{
|
||||
"key": "0.8/-5/2/3",
|
||||
"view": "asof",
|
||||
"heat": 0.8,
|
||||
"lower": -5,
|
||||
"upper": 2,
|
||||
"hold": 3,
|
||||
"signals": 264,
|
||||
"signal_days": 37,
|
||||
"filled": 263,
|
||||
"completed": 263,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 1,
|
||||
"stocks": 243,
|
||||
"mean_daily_net30": -0.00020710865341751553,
|
||||
"mean_daily_excess30": 0.005166972178288175,
|
||||
"mean_daily_net60": -0.0061880308913834885,
|
||||
"pooled_mean30": -0.005533749224527333,
|
||||
"pooled_median30": -0.011010812419402605,
|
||||
"win_rate30": 0.3650190114068441,
|
||||
"p10_net30": -0.051849088972203146,
|
||||
"worst_net30": -0.21383091770187967,
|
||||
"delayed_exits": 0,
|
||||
"train_days": 18,
|
||||
"train_completed": 117,
|
||||
"train_net30": 0.0056191688092280916,
|
||||
"train_excess_per_day": 0.001751318335746659,
|
||||
"test_days": 10,
|
||||
"test_net30": 0.0015527181776838217,
|
||||
"test_excess30": 0.010928622427693354,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": 0.0056191688092280916,
|
||||
"2026-09_net30": -0.0043831971034571475,
|
||||
"2026-10_net30": -0.029910510880325102,
|
||||
"neighbor_score": 0.001751318335746659,
|
||||
"neighbors": 7
|
||||
},
|
||||
{
|
||||
"key": "0.8/-3/2/3",
|
||||
"view": "asof",
|
||||
"heat": 0.8,
|
||||
"lower": -3,
|
||||
"upper": 2,
|
||||
"hold": 3,
|
||||
"signals": 264,
|
||||
"signal_days": 37,
|
||||
"filled": 263,
|
||||
"completed": 263,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 1,
|
||||
"stocks": 243,
|
||||
"mean_daily_net30": -0.00020710865341751553,
|
||||
"mean_daily_excess30": 0.004775019188423759,
|
||||
"mean_daily_net60": -0.0061880308913834885,
|
||||
"pooled_mean30": -0.005533749224527333,
|
||||
"pooled_median30": -0.011010812419402605,
|
||||
"win_rate30": 0.3650190114068441,
|
||||
"p10_net30": -0.051849088972203146,
|
||||
"worst_net30": -0.21383091770187967,
|
||||
"delayed_exits": 0,
|
||||
"train_days": 18,
|
||||
"train_completed": 117,
|
||||
"train_net30": 0.0056191688092280916,
|
||||
"train_excess_per_day": 0.0017932523787617266,
|
||||
"test_days": 10,
|
||||
"test_net30": 0.0015527181776838217,
|
||||
"test_excess30": 0.009399606781476815,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": 0.0056191688092280916,
|
||||
"2026-09_net30": -0.0043831971034571475,
|
||||
"2026-10_net30": -0.029910510880325102,
|
||||
"neighbor_score": 0.001751318335746659,
|
||||
"neighbors": 7
|
||||
},
|
||||
{
|
||||
"key": "0.8/-5/2/2",
|
||||
"view": "asof",
|
||||
"heat": 0.8,
|
||||
"lower": -5,
|
||||
"upper": 2,
|
||||
"hold": 2,
|
||||
"signals": 264,
|
||||
"signal_days": 37,
|
||||
"filled": 263,
|
||||
"completed": 263,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 1,
|
||||
"stocks": 243,
|
||||
"mean_daily_net30": -0.0021542834955984923,
|
||||
"mean_daily_excess30": 0.003279208007158315,
|
||||
"mean_daily_net60": -0.008123557419783092,
|
||||
"pooled_mean30": -0.00545740158953538,
|
||||
"pooled_median30": -0.009251849714015936,
|
||||
"win_rate30": 0.33840304182509506,
|
||||
"p10_net30": -0.04236195604053985,
|
||||
"worst_net30": -0.21383091770187967,
|
||||
"delayed_exits": 1,
|
||||
"train_days": 18,
|
||||
"train_completed": 117,
|
||||
"train_net30": 0.0031460662043335365,
|
||||
"train_excess_per_day": 0.002115180734836655,
|
||||
"test_days": 10,
|
||||
"test_net30": -0.0006038531039292281,
|
||||
"test_excess30": 0.00626429411350297,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": 0.0031460662043335365,
|
||||
"2026-09_net30": -0.0064134372387250095,
|
||||
"2026-10_net30": -0.020895810718097672,
|
||||
"neighbor_score": 0.001751318335746659,
|
||||
"neighbors": 7
|
||||
},
|
||||
{
|
||||
"key": "0.75/0/2/4",
|
||||
"view": "asof",
|
||||
"heat": 0.75,
|
||||
"lower": 0,
|
||||
"upper": 2,
|
||||
"hold": 4,
|
||||
"signals": 657,
|
||||
"signal_days": 40,
|
||||
"filled": 654,
|
||||
"completed": 654,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 3,
|
||||
"stocks": 555,
|
||||
"mean_daily_net30": 0.0017887748382285043,
|
||||
"mean_daily_excess30": 0.0061660877342397035,
|
||||
"mean_daily_net60": -0.004204087096511583,
|
||||
"pooled_mean30": -0.004411632193153936,
|
||||
"pooled_median30": -0.007592233042355068,
|
||||
"win_rate30": 0.40214067278287463,
|
||||
"p10_net30": -0.05993075447619602,
|
||||
"worst_net30": -0.2763780295126237,
|
||||
"delayed_exits": 0,
|
||||
"train_days": 19,
|
||||
"train_completed": 262,
|
||||
"train_net30": 0.01106731643414439,
|
||||
"train_excess_per_day": 0.0026509628862992824,
|
||||
"test_days": 12,
|
||||
"test_net30": -5.914190305315812e-05,
|
||||
"test_excess30": 0.006621541574310407,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": 0.01106731643414439,
|
||||
"2026-09_net30": -0.005052639713489141,
|
||||
"2026-10_net30": -0.03767522444982043,
|
||||
"neighbor_score": 0.0017251388447745563,
|
||||
"neighbors": 7
|
||||
},
|
||||
{
|
||||
"key": "0.8/-10/2/3",
|
||||
"view": "asof",
|
||||
"heat": 0.8,
|
||||
"lower": -10,
|
||||
"upper": 2,
|
||||
"hold": 3,
|
||||
"signals": 264,
|
||||
"signal_days": 37,
|
||||
"filled": 263,
|
||||
"completed": 263,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 1,
|
||||
"stocks": 243,
|
||||
"mean_daily_net30": -0.00020710865341751553,
|
||||
"mean_daily_excess30": 0.005616238818264374,
|
||||
"mean_daily_net60": -0.0061880308913834885,
|
||||
"pooled_mean30": -0.005533749224527333,
|
||||
"pooled_median30": -0.011010812419402605,
|
||||
"win_rate30": 0.3650190114068441,
|
||||
"p10_net30": -0.051849088972203146,
|
||||
"worst_net30": -0.21383091770187967,
|
||||
"delayed_exits": 0,
|
||||
"train_days": 18,
|
||||
"train_completed": 117,
|
||||
"train_net30": 0.0056191688092280916,
|
||||
"train_excess_per_day": 0.0018395889135066643,
|
||||
"test_days": 10,
|
||||
"test_net30": 0.0015527181776838217,
|
||||
"test_excess30": 0.012047450906954622,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": 0.0056191688092280916,
|
||||
"2026-09_net30": -0.0043831971034571475,
|
||||
"2026-10_net30": -0.029910510880325102,
|
||||
"neighbor_score": 0.0015602049900913465,
|
||||
"neighbors": 6
|
||||
},
|
||||
{
|
||||
"key": "0.8/0/2/4",
|
||||
"view": "asof",
|
||||
"heat": 0.8,
|
||||
"lower": 0,
|
||||
"upper": 2,
|
||||
"hold": 4,
|
||||
"signals": 262,
|
||||
"signal_days": 37,
|
||||
"filled": 261,
|
||||
"completed": 261,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 1,
|
||||
"stocks": 241,
|
||||
"mean_daily_net30": 0.0004410994997076872,
|
||||
"mean_daily_excess30": 0.005404320758384134,
|
||||
"mean_daily_net60": -0.005543700423918418,
|
||||
"pooled_mean30": -0.0030091093107791986,
|
||||
"pooled_median30": -0.005982053838484491,
|
||||
"win_rate30": 0.40229885057471265,
|
||||
"p10_net30": -0.0591830143372698,
|
||||
"worst_net30": -0.2763780295126237,
|
||||
"delayed_exits": 0,
|
||||
"train_days": 18,
|
||||
"train_completed": 115,
|
||||
"train_net30": 0.006342304869512037,
|
||||
"train_excess_per_day": 0.0016746188449367847,
|
||||
"test_days": 10,
|
||||
"test_net30": 0.003465248924485103,
|
||||
"test_excess30": 0.010815045962956463,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": 0.006342304869512037,
|
||||
"2026-09_net30": -0.0022727304840988905,
|
||||
"2026-10_net30": -0.05693165744825226,
|
||||
"neighbor_score": 0.001509392217965444,
|
||||
"neighbors": 6
|
||||
},
|
||||
{
|
||||
"key": "0.75/-3/2/4",
|
||||
"view": "asof",
|
||||
"heat": 0.75,
|
||||
"lower": -3,
|
||||
"upper": 2,
|
||||
"hold": 4,
|
||||
"signals": 662,
|
||||
"signal_days": 40,
|
||||
"filled": 659,
|
||||
"completed": 659,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 3,
|
||||
"stocks": 560,
|
||||
"mean_daily_net30": 0.0015894345884437176,
|
||||
"mean_daily_excess30": 0.006361902136379892,
|
||||
"mean_daily_net60": -0.004402234860789442,
|
||||
"pooled_mean30": -0.004448612538282669,
|
||||
"pooled_median30": -0.007663979297302559,
|
||||
"win_rate30": 0.4006069802731411,
|
||||
"p10_net30": -0.06037840031864115,
|
||||
"worst_net30": -0.2763780295126237,
|
||||
"delayed_exits": 0,
|
||||
"train_days": 19,
|
||||
"train_completed": 266,
|
||||
"train_net30": 0.010733188891141362,
|
||||
"train_excess_per_day": 0.0023596683051709277,
|
||||
"test_days": 12,
|
||||
"test_net30": -0.0001945741259143195,
|
||||
"test_excess30": 0.009981635571653248,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": 0.010733188891141362,
|
||||
"2026-09_net30": -0.005133899047205837,
|
||||
"2026-10_net30": -0.03767522444982043,
|
||||
"neighbor_score": 0.0014795119938017026,
|
||||
"neighbors": 8
|
||||
},
|
||||
{
|
||||
"key": "0.75/-5/2/4",
|
||||
"view": "asof",
|
||||
"heat": 0.75,
|
||||
"lower": -5,
|
||||
"upper": 2,
|
||||
"hold": 4,
|
||||
"signals": 662,
|
||||
"signal_days": 40,
|
||||
"filled": 659,
|
||||
"completed": 659,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 3,
|
||||
"stocks": 560,
|
||||
"mean_daily_net30": 0.0015894345884437176,
|
||||
"mean_daily_excess30": 0.006789569123691946,
|
||||
"mean_daily_net60": -0.004402234860789442,
|
||||
"pooled_mean30": -0.004448612538282669,
|
||||
"pooled_median30": -0.007663979297302559,
|
||||
"win_rate30": 0.4006069802731411,
|
||||
"p10_net30": -0.06037840031864115,
|
||||
"worst_net30": -0.2763780295126237,
|
||||
"delayed_exits": 0,
|
||||
"train_days": 19,
|
||||
"train_completed": 266,
|
||||
"train_net30": 0.010733188891141362,
|
||||
"train_excess_per_day": 0.0023301951047364445,
|
||||
"test_days": 12,
|
||||
"test_net30": -0.0001945741259143195,
|
||||
"test_excess30": 0.011701215964246678,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": 0.010733188891141362,
|
||||
"2026-09_net30": -0.005133899047205837,
|
||||
"2026-10_net30": -0.03767522444982043,
|
||||
"neighbor_score": 0.0014581912543679245,
|
||||
"neighbors": 8
|
||||
},
|
||||
{
|
||||
"key": "0.8/0/2/9",
|
||||
"view": "asof",
|
||||
"heat": 0.8,
|
||||
"lower": 0,
|
||||
"upper": 2,
|
||||
"hold": 9,
|
||||
"signals": 262,
|
||||
"signal_days": 37,
|
||||
"filled": 261,
|
||||
"completed": 261,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 1,
|
||||
"stocks": 241,
|
||||
"mean_daily_net30": -0.0061628625010543845,
|
||||
"mean_daily_excess30": 0.007294322412628174,
|
||||
"mean_daily_net60": -0.012108156459464165,
|
||||
"pooled_mean30": -0.0089287551135884,
|
||||
"pooled_median30": -0.013256775341422777,
|
||||
"win_rate30": 0.39846743295019155,
|
||||
"p10_net30": -0.08012151391130473,
|
||||
"worst_net30": -0.2677176601849821,
|
||||
"delayed_exits": 1,
|
||||
"train_days": 18,
|
||||
"train_completed": 115,
|
||||
"train_net30": 0.016525463101917492,
|
||||
"train_excess_per_day": 0.0019035795426064607,
|
||||
"test_days": 10,
|
||||
"test_net30": -0.02340946040185114,
|
||||
"test_excess30": 0.012181057697466352,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": 0.016525463101917492,
|
||||
"2026-09_net30": -0.026361292202208578,
|
||||
"2026-10_net30": -0.0509809887337727,
|
||||
"neighbor_score": 0.0013736259845543463,
|
||||
"neighbors": 6
|
||||
},
|
||||
{
|
||||
"key": "0.75/-10/2/4",
|
||||
"view": "asof",
|
||||
"heat": 0.75,
|
||||
"lower": -10,
|
||||
"upper": 2,
|
||||
"hold": 4,
|
||||
"signals": 662,
|
||||
"signal_days": 40,
|
||||
"filled": 659,
|
||||
"completed": 659,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 3,
|
||||
"stocks": 560,
|
||||
"mean_daily_net30": 0.0015894345884437176,
|
||||
"mean_daily_excess30": 0.007286544766125535,
|
||||
"mean_daily_net60": -0.004402234860789442,
|
||||
"pooled_mean30": -0.004448612538282669,
|
||||
"pooled_median30": -0.007663979297302559,
|
||||
"win_rate30": 0.4006069802731411,
|
||||
"p10_net30": -0.06037840031864115,
|
||||
"worst_net30": -0.2763780295126237,
|
||||
"delayed_exits": 0,
|
||||
"train_days": 19,
|
||||
"train_completed": 266,
|
||||
"train_net30": 0.010733188891141362,
|
||||
"train_excess_per_day": 0.0023834426856853314,
|
||||
"test_days": 12,
|
||||
"test_net30": -0.0001945741259143195,
|
||||
"test_excess30": 0.01305298739006972,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": 0.010733188891141362,
|
||||
"2026-09_net30": -0.005133899047205837,
|
||||
"2026-10_net30": -0.03767522444982043,
|
||||
"neighbor_score": 0.001369091644436034,
|
||||
"neighbors": 7
|
||||
},
|
||||
{
|
||||
"key": "0.8/-5/2/4",
|
||||
"view": "asof",
|
||||
"heat": 0.8,
|
||||
"lower": -5,
|
||||
"upper": 2,
|
||||
"hold": 4,
|
||||
"signals": 264,
|
||||
"signal_days": 37,
|
||||
"filled": 263,
|
||||
"completed": 263,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 1,
|
||||
"stocks": 243,
|
||||
"mean_daily_net30": 0.00029809695346637055,
|
||||
"mean_daily_excess30": 0.00577573098342514,
|
||||
"mean_daily_net60": -0.005685847505876778,
|
||||
"pooled_mean30": -0.0032825275249922965,
|
||||
"pooled_median30": -0.005982053838484491,
|
||||
"win_rate30": 0.39923954372623577,
|
||||
"p10_net30": -0.05910726417739358,
|
||||
"worst_net30": -0.2763780295126237,
|
||||
"delayed_exits": 0,
|
||||
"train_days": 18,
|
||||
"train_completed": 117,
|
||||
"train_net30": 0.006048355191127109,
|
||||
"train_excess_per_day": 0.0013129161476402866,
|
||||
"test_days": 10,
|
||||
"test_net30": 0.003465248924485103,
|
||||
"test_excess30": 0.015957371786379952,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": 0.006048355191127109,
|
||||
"2026-09_net30": -0.0022727304840988905,
|
||||
"2026-10_net30": -0.05693165744825226,
|
||||
"neighbor_score": 0.001344165590994103,
|
||||
"neighbors": 7
|
||||
},
|
||||
{
|
||||
"key": "0.8/-3/2/4",
|
||||
"view": "asof",
|
||||
"heat": 0.8,
|
||||
"lower": -3,
|
||||
"upper": 2,
|
||||
"hold": 4,
|
||||
"signals": 264,
|
||||
"signal_days": 37,
|
||||
"filled": 263,
|
||||
"completed": 263,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 1,
|
||||
"stocks": 243,
|
||||
"mean_daily_net30": 0.00029809695346637055,
|
||||
"mean_daily_excess30": 0.005333371523552558,
|
||||
"mean_daily_net60": -0.005685847505876778,
|
||||
"pooled_mean30": -0.0032825275249922965,
|
||||
"pooled_median30": -0.005982053838484491,
|
||||
"win_rate30": 0.39923954372623577,
|
||||
"p10_net30": -0.05910726417739358,
|
||||
"worst_net30": -0.2763780295126237,
|
||||
"delayed_exits": 0,
|
||||
"train_days": 18,
|
||||
"train_completed": 117,
|
||||
"train_net30": 0.006048355191127109,
|
||||
"train_excess_per_day": 0.001344165590994103,
|
||||
"test_days": 10,
|
||||
"test_net30": 0.003465248924485103,
|
||||
"test_excess30": 0.013966813594142102,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": 0.006048355191127109,
|
||||
"2026-09_net30": -0.0022727304840988905,
|
||||
"2026-10_net30": -0.05693165744825226,
|
||||
"neighbor_score": 0.001344165590994103,
|
||||
"neighbors": 7
|
||||
},
|
||||
{
|
||||
"key": "0.8/-10/2/4",
|
||||
"view": "asof",
|
||||
"heat": 0.8,
|
||||
"lower": -10,
|
||||
"upper": 2,
|
||||
"hold": 4,
|
||||
"signals": 264,
|
||||
"signal_days": 37,
|
||||
"filled": 263,
|
||||
"completed": 263,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 1,
|
||||
"stocks": 243,
|
||||
"mean_daily_net30": 0.00029809695346637055,
|
||||
"mean_daily_excess30": 0.0063139799529662345,
|
||||
"mean_daily_net60": -0.005685847505876778,
|
||||
"pooled_mean30": -0.0032825275249922965,
|
||||
"pooled_median30": -0.005982053838484491,
|
||||
"win_rate30": 0.39923954372623577,
|
||||
"p10_net30": -0.05910726417739358,
|
||||
"worst_net30": -0.2763780295126237,
|
||||
"delayed_exits": 0,
|
||||
"train_days": 18,
|
||||
"train_completed": 117,
|
||||
"train_net30": 0.006048355191127109,
|
||||
"train_excess_per_day": 0.001369091644436034,
|
||||
"test_days": 10,
|
||||
"test_net30": 0.003465248924485103,
|
||||
"test_excess30": 0.017583334153217466,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": 0.006048355191127109,
|
||||
"2026-09_net30": -0.0022727304840988905,
|
||||
"2026-10_net30": -0.05693165744825226,
|
||||
"neighbor_score": 0.0013410038960381602,
|
||||
"neighbors": 6
|
||||
},
|
||||
{
|
||||
"key": "0.75/0/2/1",
|
||||
"view": "asof",
|
||||
"heat": 0.75,
|
||||
"lower": 0,
|
||||
"upper": 2,
|
||||
"hold": 1,
|
||||
"signals": 657,
|
||||
"signal_days": 40,
|
||||
"filled": 654,
|
||||
"completed": 654,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 3,
|
||||
"stocks": 555,
|
||||
"mean_daily_net30": -0.0030927974851989518,
|
||||
"mean_daily_excess30": 0.0026136854441587087,
|
||||
"mean_daily_net60": -0.009056457067413693,
|
||||
"pooled_mean30": -0.0064441642834184255,
|
||||
"pooled_median30": -0.00799697347532885,
|
||||
"win_rate30": 0.3241590214067278,
|
||||
"p10_net30": -0.03663638385192306,
|
||||
"worst_net30": -0.08752577378610671,
|
||||
"delayed_exits": 0,
|
||||
"train_days": 19,
|
||||
"train_completed": 262,
|
||||
"train_net30": -0.0009434289222986829,
|
||||
"train_excess_per_day": 0.0034237443055758795,
|
||||
"test_days": 12,
|
||||
"test_net30": -0.0007321335499397135,
|
||||
"test_excess30": 0.0025904210321610515,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": -0.0009434289222986829,
|
||||
"2026-09_net30": -0.005211692240051463,
|
||||
"2026-10_net30": -0.0015529050832538344,
|
||||
"neighbor_score": 0.0012955301398561952,
|
||||
"neighbors": 6
|
||||
},
|
||||
{
|
||||
"key": "0.8/-5/2/9",
|
||||
"view": "asof",
|
||||
"heat": 0.8,
|
||||
"lower": -5,
|
||||
"upper": 2,
|
||||
"hold": 9,
|
||||
"signals": 264,
|
||||
"signal_days": 37,
|
||||
"filled": 263,
|
||||
"completed": 263,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 1,
|
||||
"stocks": 243,
|
||||
"mean_daily_net30": -0.006709618353968757,
|
||||
"mean_daily_excess30": 0.0056860608652008595,
|
||||
"mean_daily_net60": -0.012651641530731922,
|
||||
"pooled_mean30": -0.009433113066340147,
|
||||
"pooled_median30": -0.013512492824556466,
|
||||
"win_rate30": 0.39543726235741444,
|
||||
"p10_net30": -0.08343003665099093,
|
||||
"worst_net30": -0.2677176601849821,
|
||||
"delayed_exits": 1,
|
||||
"train_days": 18,
|
||||
"train_completed": 117,
|
||||
"train_net30": 0.01540157607092684,
|
||||
"train_excess_per_day": 0.001733296697195903,
|
||||
"test_days": 10,
|
||||
"test_net30": -0.02340946040185114,
|
||||
"test_excess30": 0.0161901241093999,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": 0.01540157607092684,
|
||||
"2026-09_net30": -0.026361292202208578,
|
||||
"2026-10_net30": -0.0509809887337727,
|
||||
"neighbor_score": 0.0012339591579923785,
|
||||
"neighbors": 7
|
||||
},
|
||||
{
|
||||
"key": "0.8/-10/2/9",
|
||||
"view": "asof",
|
||||
"heat": 0.8,
|
||||
"lower": -10,
|
||||
"upper": 2,
|
||||
"hold": 9,
|
||||
"signals": 264,
|
||||
"signal_days": 37,
|
||||
"filled": 263,
|
||||
"completed": 263,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 1,
|
||||
"stocks": 243,
|
||||
"mean_daily_net30": -0.006709618353968757,
|
||||
"mean_daily_excess30": 0.006491813269675931,
|
||||
"mean_daily_net60": -0.012651641530731922,
|
||||
"pooled_mean30": -0.009433113066340147,
|
||||
"pooled_median30": -0.013512492824556466,
|
||||
"win_rate30": 0.39543726235741444,
|
||||
"p10_net30": -0.08343003665099093,
|
||||
"worst_net30": -0.2677176601849821,
|
||||
"delayed_exits": 1,
|
||||
"train_days": 18,
|
||||
"train_completed": 117,
|
||||
"train_net30": 0.01540157607092684,
|
||||
"train_excess_per_day": 0.0018096013621209399,
|
||||
"test_days": 10,
|
||||
"test_net30": -0.02340946040185114,
|
||||
"test_excess30": 0.01827786247011916,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": 0.01540157607092684,
|
||||
"2026-09_net30": -0.026361292202208578,
|
||||
"2026-10_net30": -0.0509809887337727,
|
||||
"neighbor_score": 0.0012268286906689727,
|
||||
"neighbors": 6
|
||||
}
|
||||
],
|
||||
"full_sample_best_excess_per_day": {
|
||||
"key": "0.8/0/2/1",
|
||||
"view": "asof",
|
||||
"heat": 0.8,
|
||||
"lower": 0,
|
||||
"upper": 2,
|
||||
"hold": 1,
|
||||
"signals": 262,
|
||||
"signal_days": 37,
|
||||
"filled": 261,
|
||||
"completed": 261,
|
||||
"unresolved": 0,
|
||||
"skipped_buy": 1,
|
||||
"stocks": 241,
|
||||
"mean_daily_net30": -0.0030312079068860725,
|
||||
"mean_daily_excess30": 0.0029670141793864597,
|
||||
"mean_daily_net60": -0.008995235927886239,
|
||||
"pooled_mean30": -0.006412958428237882,
|
||||
"pooled_median30": -0.008249775388662783,
|
||||
"win_rate30": 0.3448275862068966,
|
||||
"p10_net30": -0.03678260991672844,
|
||||
"worst_net30": -0.08642281248739336,
|
||||
"delayed_exits": 0,
|
||||
"train_days": 18,
|
||||
"train_completed": 115,
|
||||
"train_net30": -0.002042852847769165,
|
||||
"train_excess_per_day": 0.002445550531664708,
|
||||
"test_days": 10,
|
||||
"test_net30": 0.0006457624562534526,
|
||||
"test_excess30": 0.004218821006532788,
|
||||
"2026-04_net30": null,
|
||||
"2026-05_net30": null,
|
||||
"2026-06_net30": null,
|
||||
"2026-07_net30": null,
|
||||
"2026-08_net30": -0.002042852847769165,
|
||||
"2026-09_net30": -0.0036012675312005232,
|
||||
"2026-10_net30": -0.01056052573333024
|
||||
},
|
||||
"sensitivity": {
|
||||
"asof": {
|
||||
"return": -0.09183817866851673,
|
||||
"max_drawdown": -0.106626148101161,
|
||||
"fees_initial_capital": 0.04746774022339881,
|
||||
"buy_count": 3091,
|
||||
"sell_count": 3091,
|
||||
"skipped_buy": 5,
|
||||
"delayed_lots": 2,
|
||||
"ending_cash": 0.9081618213314833,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.055311350425798225,
|
||||
"max_positions": 438,
|
||||
"max_stale_valuation": 0.0032964394156133306,
|
||||
"mean_exposure": 0.8892093746827127
|
||||
},
|
||||
"asof_raw": {
|
||||
"return": -0.09183817866851673,
|
||||
"max_drawdown": -0.106626148101161,
|
||||
"fees_initial_capital": 0.04746774022339881,
|
||||
"buy_count": 3091,
|
||||
"sell_count": 3091,
|
||||
"skipped_buy": 5,
|
||||
"delayed_lots": 2,
|
||||
"ending_cash": 0.9081618213314833,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.055311350425798225,
|
||||
"max_positions": 438,
|
||||
"max_stale_valuation": 0.0032964394156133306,
|
||||
"mean_exposure": 0.8892093746827127
|
||||
},
|
||||
"heat": {
|
||||
"return": -0.22849645800991314,
|
||||
"max_drawdown": -0.25785594429680714,
|
||||
"fees_initial_capital": 0.11324045863764041,
|
||||
"buy_count": 8391,
|
||||
"sell_count": 8391,
|
||||
"skipped_buy": 25,
|
||||
"delayed_lots": 10,
|
||||
"ending_cash": 0.7715035419900869,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.055462641263879675,
|
||||
"max_positions": 568,
|
||||
"max_stale_valuation": 0.04038294443865417,
|
||||
"mean_exposure": 0.9529256725996478
|
||||
},
|
||||
"one_more_day_delay": {
|
||||
"return": -0.09659729626362734,
|
||||
"max_drawdown": -0.1112613518100053,
|
||||
"fees_initial_capital": 0.04761912438471756,
|
||||
"buy_count": 3090,
|
||||
"sell_count": 3090,
|
||||
"skipped_buy": 6,
|
||||
"delayed_lots": 0,
|
||||
"ending_cash": 0.9034027037363727,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.055926060314699357,
|
||||
"max_positions": 437,
|
||||
"max_stale_valuation": 0.0,
|
||||
"mean_exposure": 0.8892436480962356
|
||||
}
|
||||
},
|
||||
"grid_rows_per_view": 3510,
|
||||
"account_cases": 98,
|
||||
"common_last_signal": "2026-10-08"
|
||||
}
|
||||
|
|
@ -0,0 +1,343 @@
|
|||
{
|
||||
"posthoc_accounts": {
|
||||
"0.7/0/2/4@30": {
|
||||
"return": -0.0026845157847824597,
|
||||
"max_drawdown": -0.04671872391844745,
|
||||
"fees_initial_capital": 0.062384247749929116,
|
||||
"buy_count": 1447,
|
||||
"sell_count": 1447,
|
||||
"skipped_buy": 5,
|
||||
"delayed_lots": 0,
|
||||
"ending_cash": 0.9973154842152175,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.2521443654556528,
|
||||
"max_positions": 208,
|
||||
"max_stale_valuation": 0.0,
|
||||
"mean_exposure": 0.9065396562814816
|
||||
},
|
||||
"0.7/0/2/4@60": {
|
||||
"return": -0.06190542980022351,
|
||||
"max_drawdown": -0.09472679207882317,
|
||||
"fees_initial_capital": 0.12106754335432666,
|
||||
"buy_count": 1447,
|
||||
"sell_count": 1447,
|
||||
"skipped_buy": 5,
|
||||
"delayed_lots": 0,
|
||||
"ending_cash": 0.9380945701997765,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.2520488999223807,
|
||||
"max_positions": 208,
|
||||
"max_stale_valuation": 0.0,
|
||||
"mean_exposure": 0.9067525016715905
|
||||
},
|
||||
"0.75/0/2/3@30": {
|
||||
"return": -0.007179528982902195,
|
||||
"max_drawdown": -0.06880300631691072,
|
||||
"fees_initial_capital": 0.08101570634676956,
|
||||
"buy_count": 654,
|
||||
"sell_count": 654,
|
||||
"skipped_buy": 3,
|
||||
"delayed_lots": 0,
|
||||
"ending_cash": 0.9928204710170978,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.35788275988918467,
|
||||
"max_positions": 79,
|
||||
"max_stale_valuation": 0.0,
|
||||
"mean_exposure": 0.9238644623726602
|
||||
},
|
||||
"0.75/0/2/3@60": {
|
||||
"return": -0.08292654240317021,
|
||||
"max_drawdown": -0.12505231863824562,
|
||||
"fees_initial_capital": 0.15584335308812824,
|
||||
"buy_count": 654,
|
||||
"sell_count": 654,
|
||||
"skipped_buy": 3,
|
||||
"delayed_lots": 0,
|
||||
"ending_cash": 0.9170734575968298,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.35719673143644304,
|
||||
"max_positions": 79,
|
||||
"max_stale_valuation": 0.0,
|
||||
"mean_exposure": 0.9240511540123069
|
||||
},
|
||||
"0.75/0/2/4@30": {
|
||||
"return": 0.015898399723051293,
|
||||
"max_drawdown": -0.04815281737541666,
|
||||
"fees_initial_capital": 0.06188366486557985,
|
||||
"buy_count": 654,
|
||||
"sell_count": 654,
|
||||
"skipped_buy": 3,
|
||||
"delayed_lots": 0,
|
||||
"ending_cash": 1.0158983997230513,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.2709060403952206,
|
||||
"max_positions": 100,
|
||||
"max_stale_valuation": 0.0,
|
||||
"mean_exposure": 0.9028298814805737
|
||||
},
|
||||
"0.75/0/2/4@60": {
|
||||
"return": -0.04298491370244539,
|
||||
"max_drawdown": -0.09519947683842711,
|
||||
"fees_initial_capital": 0.12017509779715839,
|
||||
"buy_count": 654,
|
||||
"sell_count": 654,
|
||||
"skipped_buy": 3,
|
||||
"delayed_lots": 0,
|
||||
"ending_cash": 0.9570150862975546,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.27031655037311225,
|
||||
"max_positions": 100,
|
||||
"max_stale_valuation": 0.0,
|
||||
"mean_exposure": 0.9030259251196501
|
||||
},
|
||||
"0.75/0/2/5@30": {
|
||||
"return": -0.0017224352227815931,
|
||||
"max_drawdown": -0.06037435550461101,
|
||||
"fees_initial_capital": 0.048962068174153425,
|
||||
"buy_count": 654,
|
||||
"sell_count": 654,
|
||||
"skipped_buy": 3,
|
||||
"delayed_lots": 1,
|
||||
"ending_cash": 0.9982775647772184,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.2179398347130401,
|
||||
"max_positions": 109,
|
||||
"max_stale_valuation": 0.0,
|
||||
"mean_exposure": 0.8841533679347163
|
||||
},
|
||||
"0.75/0/2/5@60": {
|
||||
"return": -0.04825429854677121,
|
||||
"max_drawdown": -0.09770222316707966,
|
||||
"fees_initial_capital": 0.0956449053990691,
|
||||
"buy_count": 654,
|
||||
"sell_count": 654,
|
||||
"skipped_buy": 3,
|
||||
"delayed_lots": 1,
|
||||
"ending_cash": 0.9517457014532288,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.21743122762883885,
|
||||
"max_positions": 109,
|
||||
"max_stale_valuation": 0.0,
|
||||
"mean_exposure": 0.884238557385914
|
||||
},
|
||||
"0.8/0/2/4@30": {
|
||||
"return": -0.00018803266690303744,
|
||||
"max_drawdown": -0.052900444380809764,
|
||||
"fees_initial_capital": 0.05558976221559348,
|
||||
"buy_count": 261,
|
||||
"sell_count": 261,
|
||||
"skipped_buy": 1,
|
||||
"delayed_lots": 0,
|
||||
"ending_cash": 0.999811967333097,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.25996149173673877,
|
||||
"max_positions": 46,
|
||||
"max_stale_valuation": 0.0,
|
||||
"mean_exposure": 0.8541847808804759
|
||||
},
|
||||
"0.8/0/2/4@60": {
|
||||
"return": -0.05370057658733984,
|
||||
"max_drawdown": -0.08380600859202747,
|
||||
"fees_initial_capital": 0.10818587880806764,
|
||||
"buy_count": 261,
|
||||
"sell_count": 261,
|
||||
"skipped_buy": 1,
|
||||
"delayed_lots": 0,
|
||||
"ending_cash": 0.9462994234126602,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.2603512703672914,
|
||||
"max_positions": 46,
|
||||
"max_stale_valuation": 0.0,
|
||||
"mean_exposure": 0.8543002159471661
|
||||
},
|
||||
"0/0/2/4@30": {
|
||||
"return": -0.03901539522667752,
|
||||
"max_drawdown": -0.06677677189594755,
|
||||
"fees_initial_capital": 0.06129509858085324,
|
||||
"buy_count": 63461,
|
||||
"sell_count": 63459,
|
||||
"skipped_buy": 48,
|
||||
"delayed_lots": 50,
|
||||
"ending_cash": 0.9609846047733225,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 2,
|
||||
"max_stock_weight": 0.0019915151832552956,
|
||||
"max_positions": 4249,
|
||||
"max_stale_valuation": 0.002826805168153075,
|
||||
"mean_exposure": 0.8192716238508244
|
||||
},
|
||||
"0/0/2/4@60": {
|
||||
"return": -0.09626399311106737,
|
||||
"max_drawdown": -0.11467556596698547,
|
||||
"fees_initial_capital": 0.11894793028844759,
|
||||
"buy_count": 63461,
|
||||
"sell_count": 63459,
|
||||
"skipped_buy": 48,
|
||||
"delayed_lots": 50,
|
||||
"ending_cash": 0.9037360068889326,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 2,
|
||||
"max_stock_weight": 0.0019920439042431974,
|
||||
"max_positions": 4249,
|
||||
"max_stale_valuation": 0.002686616346752929,
|
||||
"mean_exposure": 0.8194395650655021
|
||||
}
|
||||
},
|
||||
"validation_accounts": [
|
||||
{
|
||||
"key": "0.8/0/2/1",
|
||||
"cost_bps": 30,
|
||||
"return": -0.002189571606523555,
|
||||
"max_drawdown": -0.058906439324911575,
|
||||
"fees_initial_capital": 0.05989631419717043,
|
||||
"buy_count": 61,
|
||||
"sell_count": 61,
|
||||
"skipped_buy": 1,
|
||||
"delayed_lots": 0,
|
||||
"ending_cash": 0.9978104283934764,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 1.0000000000000002,
|
||||
"max_positions": 13,
|
||||
"max_stale_valuation": 0.0,
|
||||
"mean_exposure": 0.9749873425858302
|
||||
},
|
||||
{
|
||||
"key": "0.8/0/2/1",
|
||||
"cost_bps": 60,
|
||||
"return": -0.0588683268523551,
|
||||
"max_drawdown": -0.09489979280463667,
|
||||
"fees_initial_capital": 0.11641571154491374,
|
||||
"buy_count": 61,
|
||||
"sell_count": 61,
|
||||
"skipped_buy": 1,
|
||||
"delayed_lots": 0,
|
||||
"ending_cash": 0.9411316731476449,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 1.0,
|
||||
"max_positions": 13,
|
||||
"max_stale_valuation": 0.0,
|
||||
"mean_exposure": 0.9753424591610385
|
||||
},
|
||||
{
|
||||
"key": "0/0/2/1",
|
||||
"cost_bps": 30,
|
||||
"return": -0.03970740318674626,
|
||||
"max_drawdown": -0.07139590781026928,
|
||||
"fees_initial_capital": 0.07181393629806136,
|
||||
"buy_count": 18844,
|
||||
"sell_count": 18844,
|
||||
"skipped_buy": 10,
|
||||
"delayed_lots": 3,
|
||||
"ending_cash": 0.9602925968132537,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.0016811308145384795,
|
||||
"max_positions": 2409,
|
||||
"max_stale_valuation": 0.0004216243496333634,
|
||||
"mean_exposure": 0.7055093627822026
|
||||
},
|
||||
{
|
||||
"key": "0/0/2/1",
|
||||
"cost_bps": 60,
|
||||
"return": -0.10635783380190156,
|
||||
"max_drawdown": -0.11944519543029786,
|
||||
"fees_initial_capital": 0.1386571087558178,
|
||||
"buy_count": 18844,
|
||||
"sell_count": 18844,
|
||||
"skipped_buy": 10,
|
||||
"delayed_lots": 3,
|
||||
"ending_cash": 0.8936421661980984,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.0016811308145384793,
|
||||
"max_positions": 2409,
|
||||
"max_stale_valuation": 0.00039828304262911083,
|
||||
"mean_exposure": 0.7055875764830732
|
||||
},
|
||||
{
|
||||
"key": "0.8/0/5/5",
|
||||
"cost_bps": 30,
|
||||
"return": -0.04555746739065114,
|
||||
"max_drawdown": -0.06738180901027935,
|
||||
"fees_initial_capital": 0.01422306096593504,
|
||||
"buy_count": 930,
|
||||
"sell_count": 930,
|
||||
"skipped_buy": 1,
|
||||
"delayed_lots": 1,
|
||||
"ending_cash": 0.9544425326093489,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.012070667615289037,
|
||||
"max_positions": 412,
|
||||
"max_stale_valuation": 0.0034766574637057936,
|
||||
"mean_exposure": 0.7488253633226178
|
||||
},
|
||||
{
|
||||
"key": "0.8/0/5/5",
|
||||
"cost_bps": 60,
|
||||
"return": -0.05920773353223707,
|
||||
"max_drawdown": -0.07795921384840254,
|
||||
"fees_initial_capital": 0.028246916298214044,
|
||||
"buy_count": 930,
|
||||
"sell_count": 930,
|
||||
"skipped_buy": 1,
|
||||
"delayed_lots": 1,
|
||||
"ending_cash": 0.9407922664677629,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.01206430889633321,
|
||||
"max_positions": 412,
|
||||
"max_stale_valuation": 0.003443306485038265,
|
||||
"mean_exposure": 0.748910540580828
|
||||
},
|
||||
{
|
||||
"key": "0/0/5/5",
|
||||
"cost_bps": 30,
|
||||
"return": -0.03564818184162544,
|
||||
"max_drawdown": -0.06261597240985728,
|
||||
"fees_initial_capital": 0.014282524582265563,
|
||||
"buy_count": 25990,
|
||||
"sell_count": 25990,
|
||||
"skipped_buy": 18,
|
||||
"delayed_lots": 22,
|
||||
"ending_cash": 0.9643518181583746,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.0008314690645629325,
|
||||
"max_positions": 4831,
|
||||
"max_stale_valuation": 0.0026516108404186266,
|
||||
"mean_exposure": 0.5987446694192406
|
||||
},
|
||||
{
|
||||
"key": "0/0/5/5",
|
||||
"cost_bps": 60,
|
||||
"return": -0.049433376357558845,
|
||||
"max_drawdown": -0.07269065582155187,
|
||||
"fees_initial_capital": 0.028364588740666403,
|
||||
"buy_count": 25990,
|
||||
"sell_count": 25990,
|
||||
"skipped_buy": 18,
|
||||
"delayed_lots": 22,
|
||||
"ending_cash": 0.9505666236424412,
|
||||
"ending_stock_value": 0.0,
|
||||
"open_lots": 0,
|
||||
"max_stock_weight": 0.0008357462978001849,
|
||||
"max_positions": 4831,
|
||||
"max_stale_valuation": 0.002631362256159746,
|
||||
"mean_exposure": 0.5988122866887273
|
||||
}
|
||||
],
|
||||
"protocol_sha256": "011e111d9028968ae1bda568402d636da9e5dee9ed4320d4bd1c0dbe8dba5dca"
|
||||
}
|
||||
Binary file not shown.
|
|
@ -0,0 +1,45 @@
|
|||
"""主网格完成后的账户解释;不改变网格或训练选参规则。"""
|
||||
import csv
|
||||
import datetime as dt
|
||||
import gzip
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
from calibrate import account, stock_mask
|
||||
from prepare import ROOT, digest, dump, offline, read
|
||||
|
||||
def main():
|
||||
sys.addaudithook(offline)
|
||||
data=dict(np.load(ROOT/'cache/panel.npz'));selection=read(ROOT/'results/selection.json')
|
||||
protocol=ROOT/'supplement_protocol.json'
|
||||
if not protocol.exists():
|
||||
dump(protocol,{'created_at_beijing':dt.datetime.now(dt.timezone(dt.timedelta(hours=8))).isoformat(),
|
||||
'reason':'主网格可见后追加解释:0.75/0/2/4的平均每批绝对收益最高;不能称预设候选或验证赢家。',
|
||||
'keys':['0.7/0/2/4','0.75/0/2/3','0.75/0/2/4','0.75/0/2/5','0.8/0/2/4','0/0/2/4'],
|
||||
'validation':'原协议选出的训练赢家及原基线、匹配无热度对照,以9月15日开始的信号建立新研究账户;没有从完整样本重新选参数。',
|
||||
'cost_bps':[30,60]})
|
||||
s=read(protocol);accounts={}
|
||||
for key in s['keys']:
|
||||
ht,lo,hi,h=map(float,key.split('/'));h=int(h)
|
||||
m=stock_mask(data,'asof',ht,lo,hi,len(data['dates'])-12)
|
||||
for fee in s['cost_bps']:
|
||||
accounts[key+'@'+str(fee)]=account(data,m,h,fee/10000,detail=True)
|
||||
validate=[]
|
||||
for key in [selection['training_winner']['key'],selection['baseline']]:
|
||||
ht,lo,hi,h=map(float,key.split('/'));h=int(h)
|
||||
for heat in [ht,0]:
|
||||
m=stock_mask(data,'asof',heat,lo,hi,len(data['dates'])-12)
|
||||
m[data['dates']<'2026-09-15']=False
|
||||
for fee in s['cost_bps']:
|
||||
a=account(data,m,h,fee/10000,detail=True)
|
||||
label=f'{heat:g}/{lo:g}/{hi:g}/{h}'
|
||||
accounts['validation:'+label+'@'+str(fee)]=a
|
||||
validate.append({'key':label,'cost_bps':fee,**a['summary']})
|
||||
with gzip.open(ROOT/'results/supplement_accounts.json.gz','wt') as f:json.dump(accounts,f,separators=(',',':'))
|
||||
dump(ROOT/'results/supplement.json',{'posthoc_accounts':{k:a['summary'] for k,a in accounts.items() if not k.startswith('validation')},
|
||||
'validation_accounts':validate,'protocol_sha256':digest(protocol)})
|
||||
print('追加账户完成',len(accounts))
|
||||
|
||||
if __name__=='__main__':main()
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"created_at_beijing": "2026-10-28T15:23:45.615654+08:00",
|
||||
"reason": "主网格可见后追加解释:0.75/0/2/4的平均每批绝对收益最高;不能称预设候选或验证赢家。",
|
||||
"keys": [
|
||||
"0.7/0/2/4",
|
||||
"0.75/0/2/3",
|
||||
"0.75/0/2/4",
|
||||
"0.75/0/2/5",
|
||||
"0.8/0/2/4",
|
||||
"0/0/2/4"
|
||||
],
|
||||
"validation": "原协议选出的训练赢家及原基线、匹配无热度对照,以9月15日开始的信号建立新研究账户;没有从完整样本重新选参数。",
|
||||
"cost_bps": [
|
||||
30,
|
||||
60
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
"""只用内存行情,经unit_test_guard隔离运行。"""
|
||||
import datetime as dt
|
||||
import unittest
|
||||
import numpy as np
|
||||
from calibrate import account, future_exits, stock_mask
|
||||
from prepare import chosen_batch
|
||||
|
||||
def panel():
|
||||
t,n=15,2
|
||||
p={k:np.ones((t,n))*10 for k in ['open','close','mark']}
|
||||
p.update(dates=np.array([f'2026-01-{i+1:02}' for i in range(t)]),
|
||||
codes=np.array(['000001.SZ','600000.SH']),eligible=np.ones((t,n),bool),
|
||||
can_buy=np.ones((t,n),bool),can_sell=np.ones((t,n),bool),
|
||||
asof=np.full((t,n),.8),pct=np.zeros((t,n)))
|
||||
return p
|
||||
|
||||
class ResearchTests(unittest.TestCase):
|
||||
def test_no_backfill_or_mixed_batch(self):
|
||||
rows=[{'batch_no':1,'create_time':'2026-01-01T20:00:00'},
|
||||
{'batch_no':2,'create_time':'2026-02-01T09:00:00'}]
|
||||
self.assertEqual(chosen_batch(rows,dt.datetime(2026,1,2,9,25))[0]['batch_no'],1)
|
||||
self.assertEqual(chosen_batch(rows,dt.datetime(2026,1,1,9,25)),[])
|
||||
rows.append({'batch_no':1,'create_time':'2026-02-02T09:00:00'})
|
||||
self.assertEqual(chosen_batch(rows,dt.datetime(2026,1,2,9,25)),[])
|
||||
|
||||
def test_entry_next_day_exit_t_plus_one(self):
|
||||
p=panel();m=np.zeros((15,2),bool);m[0,0]=True
|
||||
a=account(p,m,1,0,detail=True)
|
||||
self.assertEqual([(x['day'],x['side']) for x in a['journal']],[(1,'buy'),(2,'sell')])
|
||||
self.assertEqual(a['summary']['return'],0)
|
||||
|
||||
def test_unfillable_buy_keeps_allocation_cash(self):
|
||||
p=panel();m=np.zeros((15,2),bool);m[0]=True;p['can_buy'][1,1]=False
|
||||
a=account(p,m,1,0)
|
||||
self.assertAlmostEqual(a['daily'][1]['cash'],.5)
|
||||
self.assertAlmostEqual(a['daily'][1]['stock_value'],.5)
|
||||
self.assertEqual(a['summary']['skipped_buy'],1)
|
||||
|
||||
def test_delayed_exit_and_no_new_holding_clock(self):
|
||||
p=panel();m=np.zeros((15,2),bool);m[0:3,0]=True;p['can_sell'][3,0]=False
|
||||
a=account(p,m,2,0,detail=True)
|
||||
first=[x for x in a['journal'] if x['signal']==0]
|
||||
self.assertEqual([(x['day'],x['side']) for x in first],[(1,'buy'),(4,'sell')])
|
||||
self.assertGreater(a['summary']['delayed_lots'],0)
|
||||
self.assertTrue(all(r['cash']>=-1e-12 for r in a['daily']))
|
||||
|
||||
def test_net_cost_formula(self):
|
||||
p=panel();m=np.zeros((15,2),bool);m[0,0]=True
|
||||
a=account(p,m,1,.003)
|
||||
self.assertAlmostEqual(a['summary']['return'],.997/1.003-1)
|
||||
|
||||
def test_future_change_preserves_past(self):
|
||||
p=panel();m=np.zeros((15,2),bool);m[:10]=True
|
||||
a=account(p,m,3,.003,stop=7)
|
||||
for k in ['open','close','mark']:p[k][7:]*=100
|
||||
p['can_sell'][7:]=False;m[7:]=False
|
||||
b=account(p,m,3,.003,stop=7)
|
||||
self.assertEqual(a,b)
|
||||
|
||||
def test_event_labels_match_account_exit(self):
|
||||
p=panel();p['open'][3:,0]=12;p['can_sell'][2,0]=False
|
||||
exits,gross=future_exits(p,1)
|
||||
self.assertEqual(exits[0,0],3);self.assertAlmostEqual(gross[0,0],1.2)
|
||||
|
||||
def test_missing_heat_and_range_boundaries(self):
|
||||
p=panel();p['asof'][0,0]=np.nan;p['pct'][1]=[0,5]
|
||||
m=stock_mask(p,'asof',.8,0,5,2)
|
||||
self.assertFalse(m[0,0]);self.assertTrue(m[1,0]);self.assertFalse(m[1,1])
|
||||
self.assertFalse(m[3:].any())
|
||||
|
||||
if __name__=='__main__':unittest.main()
|
||||
|
|
@ -0,0 +1,175 @@
|
|||
# 全市场热度、涨跌幅与持有期四维标定
|
||||
|
||||
核验日期:2026年10月28日。使用系统现有资金热度,不重算信号。计算在开发机离线完成;155只用于导出源数据,没有写业务表或修改运行策略。
|
||||
|
||||
## 可以据此做什么判断
|
||||
|
||||
**首轮不支持直接上线“高热度追涨、最多持有10日”。热度越高、当日涨幅越大或持有越久,并没有在这段样本中带来更好的结果。**
|
||||
|
||||
若继续缩小研究范围,可保留 **热度0.70至0.80、当日涨幅0%至2%、持有3至5个交易日**。其中 **0.75 / [0%,2%) / 4日** 是看完本次历史后得到的候选点:平均每批净收益+0.18%,现金约束账户累计+1.59%、最大回撤-4.82%;费用从每边30提高到60基点后,账户变为-4.30%。相邻3日和5日账户也未保持正收益,因此不能称为稳健最优。
|
||||
|
||||
样本量门槛为至少20个有选股信号日、100笔完成交易。2,770组非零热度组合满足门槛,只有15组的平均每批净收益在30基点费用下为正,60基点下为正的有0组。该计数衡量每批收益,不是对全部参数资金账户盈利数量的统计。
|
||||
|
||||
| 参数 | 30基点累计收益 | 最大回撤 | 60基点累计收益 | 单股最大权重 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| 0.8/0/5/5 | -9.18% | -10.66% | -13.54% | 5.53% |
|
||||
| 0/0/5/5 | -4.82% | -8.03% | -9.38% | 0.12% |
|
||||
| 0.75/0/2/4 | +1.59% | -4.82% | -4.30% | 27.09% |
|
||||
| 0/0/2/4 | -3.90% | -6.68% | -9.63% | 0.20% |
|
||||
| 0.8/0/2/1 | -11.88% | -18.53% | -29.32% | 100.00% |
|
||||
|
||||
参数写法为“热度下限 / 涨跌幅下限 / 上限 / 持有日数”,涨跌幅单位为百分数,区间下限包含、上限不含。0表示不筛热度。累计收益来自独立现金约束研究账户,空仓不计息;不是指数超额收益、PMS账户收益或联合策略收益。
|
||||
|
||||
## 先说明历史数据能支持多长的实验
|
||||
|
||||
热度表共有636,116行、120个数据日期,最早2026年4月27日,最新10月27日。行情复用已经导出的全市场月度因子数据,截止10月23日;10月26日至27日的热度不参与信号或收益计算。本次没有套用原微盘股票名单。
|
||||
|
||||
**4月27日至8月3日的热度是在8月4日集中入库的。** 主研究要求次日开盘前整批数据已入库,因此这些回填值不能当作历史上当时可用的信号。完整历史另做诊断,并明确标记含回填。
|
||||
|
||||
| 口径 | 信号区间 | 有热度信号日 | 用途 |
|
||||
| --- | --- | --- | --- |
|
||||
| 按入库时间可用,主样本 | 2026-08-04至2026-10-08 | 41 | 阈值主比较;8月5日起成交 |
|
||||
| 最大批次历史分数 | 2026-04-27至2026-10-08 | 108 | 包含回填,只作历史关联诊断 |
|
||||
| 行情尾段 | 至2026-10-23 | — | 留出最长10日的退出观察 |
|
||||
|
||||
选择每个交易日、在下一个交易日09:25前整批可用的最大batch_no,不逐股拼接不同批次,也不在热度缺失日沿用旧分数。create_time为DATETIME,未找到上游写入代码确认时区;主口径将原值加8小时作为保守时点,原值另作敏感性。两种假设在本次主网格共同信号区间选出的批次一致,基线净值也一致;这不是对源时间语义或热度算法的完整审计。
|
||||
|
||||
源表只有沪深代码,没有北交所热度,实际覆盖5,232只历史股票并集;所以“全市场”在本轮指已有热度覆盖的沪深A股。每日先排除历史ST、退市整理、上市未满120个交易日、缺历史名称或必要行情的股票。78只股票缺有效上市日期而被排除。历史ST与名称数据及退市覆盖仍可能不完整。
|
||||
|
||||
9月7日、10月13日整日缺热度;5月7日、10月14日和15日覆盖不足5,000只。主比较的共同末日是10月8日,所以10月中旬缺口不影响本轮选股,但不能据此声称目前每日数据已齐。完整批次和行情摘要见[coverage.json](coverage.json)。
|
||||
|
||||
## 只改变四个维度
|
||||
|
||||
协议于北京时间2026年10月28日15:14冻结,先于收益计算,见[protocol.json](protocol.json)及SHA-256摘要。基线0.80 / [0%,5%) / 5日是本次研究的参考锚点,并非已经运行的线上策略。
|
||||
|
||||
- 热度下限:0.50、0.60、0.70、0.75、0.80、0.85、0.90、0.95,另设不筛热度对照。
|
||||
- 当日涨跌幅下限:−10%、−5%、−3%、0%、2%、3%、5%。
|
||||
- 当日涨跌幅上限:0%、2%、3%、5%、7%、10%、20%,只保留下限小于上限的39种区间。
|
||||
- 持有期:1至10个交易日,按用户确认口径。
|
||||
|
||||
9×39×10共3,510组,其中3,120组带热度筛选、390组为对照。主样本和含回填诊断各计算一遍;每笔收益同时给出30和60基点费用。完整网格是事件收益标定,随后对固定四维切片、训练赢家及候选补充118条费用分支账户。没有宣称已经给3,510组全部计算累计账户收益。
|
||||
|
||||
信号日收盘涨跌幅取pct_chg,热度至少达到阈值;次交易日开盘买入。买入后经过H个交易日,在开盘卖出,所以H=1也是买入后的下一个交易日卖出。没有另加止盈止损。同股连续入选分别建批次,旧批次的到期日不会被新信号重置。
|
||||
|
||||
事件表先计算每天所有已完成个股交易的等权净收益,再对有成交的信号日等权平均,称“平均每批净收益”。个股胜率、个股中位数和尾部按全部完成交易统计,两种加权不同。同涨跌幅对照使用同日、同资格、同持有期和同费用,仅不筛热度;相对差异取热度组合有成交的匹配日。未完成交易数在明细单列,不能当成盈利退出。
|
||||
|
||||
资金账户每天以前日收盘资产除以H作为新批预算,先卖后买且不超过可用现金;全部入选股等额分配,买入失败部分留现金。同股重叠持有消耗各自批次资金,不重复使用资本。H=1会高频换手;持股数量未设固定上限。
|
||||
|
||||
买入开盘触涨停或跌停、零成交量、缺有效复权价或限制价时放弃该笔;卖出遇跌停、零量、缺价时保留原退出任务,之后每个交易日重试。10日是计划持有上限,无法保证跌停或停牌时10日内实际卖出。缺收盘价时只延用最后已知复权价,连续缺价超过20日暂记零,既不倒填未来价格,也不把零估值当作成交。
|
||||
|
||||
## 热度线:在普通追涨区间,提高阈值反而更差
|
||||
|
||||
固定当日涨幅[0%,5%)、持有5日。
|
||||
|
||||
| 热度 / 涨跌幅区间 / 日数 | 入选信号日 | 完成笔数 | 平均每批净收益 | 相对同涨跌幅对照(百分点) | 个股胜率 | 60基点平均每批 |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| 0/0/5/5 | 41 | 89597 | -0.57% | +0.00 | 41.66% | -1.16% |
|
||||
| 0.5/0/5/5 | 41 | 69168 | -0.57% | -0.01 | 41.47% | -1.17% |
|
||||
| 0.6/0/5/5 | 41 | 17998 | -0.78% | -0.21 | 38.20% | -1.37% |
|
||||
| 0.7/0/5/5 | 41 | 7453 | -0.98% | -0.41 | 35.91% | -1.57% |
|
||||
| 0.75/0/5/5 | 41 | 4877 | -0.99% | -0.42 | 35.76% | -1.58% |
|
||||
| 0.8/0/5/5 | 41 | 3091 | -1.15% | -0.58 | 34.91% | -1.74% |
|
||||
| 0.85/0/5/5 | 41 | 1815 | -1.18% | -0.62 | 33.50% | -1.78% |
|
||||
| 0.9/0/5/5 | 41 | 897 | -1.36% | -0.80 | 32.11% | -1.95% |
|
||||
| 0.95/0/5/5 | 40 | 316 | -2.00% | -1.33 | 32.91% | -2.59% |
|
||||
|
||||
从0.50提高到0.95,平均每批净收益总体恶化;高热度不是这个区间里的正向收益保证。基线的3,091笔完成交易涉及2,147只股票,但只有41个信号日,不能把3,091笔视为相互独立的试验。
|
||||
|
||||
## 涨跌幅区间:限制追涨比继续抬高热度更有价值
|
||||
|
||||
固定热度0.80、持有5日,只改变涨幅上限。
|
||||
|
||||
| 热度 / 涨跌幅区间 / 日数 | 入选信号日 | 完成笔数 | 平均每批净收益 | 相对同涨跌幅对照(百分点) | 个股胜率 | 60基点平均每批 |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| 0.8/0/2/5 | 37 | 261 | -0.11% | +0.60 | 42.15% | -0.71% |
|
||||
| 0.8/0/3/5 | 40 | 1006 | -0.89% | -0.26 | 35.29% | -1.49% |
|
||||
| 0.8/0/5/5 | 41 | 3091 | -1.15% | -0.58 | 34.91% | -1.74% |
|
||||
| 0.8/0/7/5 | 41 | 4862 | -1.19% | -0.62 | 36.28% | -1.78% |
|
||||
| 0.8/0/10/5 | 41 | 6608 | -1.34% | -0.75 | 36.49% | -1.93% |
|
||||
| 0.8/0/20/5 | 41 | 8193 | -1.43% | -0.80 | 36.36% | -2.02% |
|
||||
|
||||
把涨幅上限从5%收窄到2%后,每批收益由−1.15%改善到−0.11%,但仍为负。并且完成交易从3,091笔降至261笔、信号日从41降至37,集中度和样本稀疏风险增加。这里体现的是更少追涨,不能直接解释成热度本身产生了利润。
|
||||
|
||||
固定上限5%,把下限从0%放宽到−3%、−5%或−10%,都只增加2笔完成交易,三档产生相同的高热度选股集合。这个样本几乎没有“高热度但当天下跌”的股票,无法精确标定负涨幅下限;不能据此得出所有下跌股票都不适合买入。
|
||||
|
||||

|
||||
|
||||
## 持有期:基线延长到10日更差,低涨幅候选只有窄峰
|
||||
|
||||
| 热度 / 涨跌幅区间 / 日数 | 入选信号日 | 完成笔数 | 平均每批净收益 | 相对同涨跌幅对照(百分点) | 个股胜率 | 60基点平均每批 |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| 0.8/0/5/1 | 41 | 3091 | -0.80% | -0.22 | 33.48% | -1.39% |
|
||||
| 0.8/0/5/2 | 41 | 3091 | -0.88% | -0.36 | 34.23% | -1.47% |
|
||||
| 0.8/0/5/3 | 41 | 3091 | -0.84% | -0.46 | 33.94% | -1.43% |
|
||||
| 0.8/0/5/4 | 41 | 3091 | -0.94% | -0.52 | 34.97% | -1.53% |
|
||||
| 0.8/0/5/5 | 41 | 3091 | -1.15% | -0.58 | 34.91% | -1.74% |
|
||||
| 0.8/0/5/6 | 41 | 3091 | -1.41% | -0.69 | 34.45% | -2.00% |
|
||||
| 0.8/0/5/7 | 41 | 3091 | -1.80% | -0.89 | 32.61% | -2.39% |
|
||||
| 0.8/0/5/8 | 41 | 3091 | -2.00% | -0.86 | 31.64% | -2.59% |
|
||||
| 0.8/0/5/9 | 41 | 3091 | -2.34% | -0.99 | 29.86% | -2.92% |
|
||||
| 0.8/0/5/10 | 41 | 3091 | -2.73% | -0.99 | 28.70% | -3.31% |
|
||||
|
||||
基线从1日延长到10日,平均每批净收益从−0.80%降至−2.73%。这比较的是一笔交易的持有期,不能把它直接当成资金账户累计收益:1日方案虽然每笔亏损较小,却支付更高频的交易摩擦。
|
||||
|
||||
| 参数 | 30基点累计收益 | 最大回撤 | 60基点累计收益 | 单股最大权重 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| 0.7/0/2/4 | -0.27% | -4.67% | -6.19% | 25.21% |
|
||||
| 0.75/0/2/3 | -0.72% | -6.88% | -8.29% | 35.79% |
|
||||
| 0.75/0/2/4 | +1.59% | -4.82% | -4.30% | 27.09% |
|
||||
| 0.75/0/2/5 | -0.17% | -6.04% | -4.83% | 21.79% |
|
||||
| 0.8/0/2/4 | -0.02% | -5.29% | -5.37% | 26.00% |
|
||||
|
||||
0.75 / [0%,2%) / 4日的40个有成交信号日、654笔交易,平均每批净收益约+0.18%。相邻的3日和5日账户累计分别为−0.72%和−0.17%,热度改到0.70或0.80时4日账户也略亏。最高点缺乏稳定的相邻正收益区域。候选单股最大权重27.09%,说明当日少量选股可能使组合集中。
|
||||
|
||||

|
||||
|
||||
## 时间顺序检验:相对改善没有转化为可靠绝对利润
|
||||
|
||||
训练只用8月4日至8月31日信号,且实际退出必须早于9月15日。9月1日至14日不参与训练选参或验证信号,形成最长持有期的间隔。验证信号从9月15日到10月8日,总共只有12个有热度的日期。
|
||||
|
||||
预设评分为每日等权净超额收益除以持有日数,取本点及四维相邻一档合格组合的中位数。训练至少10个有成交日、100笔完成交易。这个评分偏重单位持有期的相对优势,允许绝对收益为负;它不是自动上线条件。
|
||||
|
||||
训练选出 **0.8/0/2/1**。其训练有18个成交信号日、115笔,训练平均每批净收益−0.20%;验证有10个成交日、61笔,平均每批净收益+0.06%,比同日不筛热度对照高0.42个百分点。验证新研究账户实际累计-0.22%,费用加倍后-5.89%。平均每批略正与复利账户略负并不矛盾:批次收益波动、现金分配和复利影响最终资金结果。
|
||||
|
||||
| 验证新账户 | 30基点累计收益 | 最大回撤 | 60基点累计收益 |
|
||||
| --- | --- | --- | --- |
|
||||
| 0.8/0/2/1 | -0.22% | -5.89% | -5.89% |
|
||||
| 0/0/2/1 | -3.97% | -7.14% | -10.64% |
|
||||
| 0.8/0/5/5 | -4.56% | -6.74% | -5.92% |
|
||||
| 0/0/5/5 | -3.56% | -6.26% | -4.94% |
|
||||
|
||||
验证账户在验证起点持有现金,没有接入训练期持仓,也不是年末换参连续账户。0.75 / [0%,2%) / 4日是看完主网格后挑出的最高平均绝对收益点,只作为事后候选;追加账户协议见[supplement_protocol.json](supplement_protocol.json)。不把它冒充预先固定参数或样本外赢家。
|
||||
|
||||
只有2026年几个月的数据,无法复刻参考报告的跨年度比较。更长的含回填历史里,0.75 / [0%,2%) / 4日平均每批净收益为−0.35%,相对同区间对照+0.54个百分点;并未显示出稳定绝对盈利。多参数共享同一历史、反复选择会带来选择偏差,参见[Bailey等人的回测过拟合研究](https://www.davidhbailey.com/dhbpapers/backtest-prob.pdf)。本报告不计算或宣称统计显著性。
|
||||
|
||||

|
||||
|
||||
## 费用、成交和可信边界
|
||||
|
||||
每边30基点和60基点是统一佣金、税费、滑点等摩擦的研究假设,不是新核验的实际券商收费。使用可分割复权单位,没有模拟整手、单笔最低佣金、分红现金账或逐笔开盘容量。无热度对照可能同时持有数千只股票,只用于识别热度增量价值,不代表实际可实施的资金配置。
|
||||
|
||||
基线买入3,091笔,跳过5笔无法买入,2笔到期退出延迟;最终无残仓。两个无热度的较长持有对照仍各有2笔未退出,它们按超过20日缺价记零,不能描述为已全部平仓。候选0.75 / [0%,2%) / 4日最终无残仓。研究不能保证实际开盘撮合、容量和退市损失与这些估值相同。
|
||||
|
||||
主样本的create_time两种时区假设得到相同信号;基线把入场再延后一个交易日的账户累计约-9.66%,仍为负。没有重建热度算法历史版本,也未证明数据库中的已入库分数从未被改写。因此本研究是带入库时点限制的历史复算,不是不可变执行日志回放。
|
||||
|
||||
**结论是缩小后续研究范围,而非找到上线阈值。** 若保留一个具体研究点,使用热度≥0.75、当日涨幅[0%,2%)、持有4个交易日;同时保留0.70和0.80、持有3日和5日作相邻对照。当前证据不支持通过抬高热度、追更大涨幅或延长到10日解决盈利问题。
|
||||
|
||||
## 复核、复现与接续
|
||||
|
||||
开发机通过8项隔离配置、断网内存测试,覆盖回填与整批可用时点、次日买入与T+1卖出、失败买单留现金、退出延期、重复信号不延长旧批持有期、费用公式、未来数据不改变过去及区间边界。独立逐笔复算24条账户,最大现金和估值误差1.50e-13;118条账户现金收支检查通过,3个日期截断重跑与完整基线前缀完全一致,另从成交逐笔复算3个候选的事件均值。详见[audit.json](results/audit.json)。
|
||||
|
||||
155取数时核对主机factorevaluation、模拟实例空表前缀和实际镜像pms:micro50-9e14f92;只启动受资源限制、只读文件系统、无下单凭证的一次性研究容器执行单表SELECT/SHOW。应用只挂载logs,没有/app源码覆盖。本次没有更改应用Python代码,因此没有需要更新的业务镜像或受影响业务容器。188未访问,执行链路本轮未判收。
|
||||
|
||||
原始热度与派生矩阵保存在本地忽略目录,源摘要在coverage.json;行情依赖既有macro_timing_20261026/raw缓存,未随本次Git提交重复加入。运行需要Python、NumPy、Pandas、Matplotlib。只读导出fetch.py与离线计算分开,研究测试不连接服务器。
|
||||
|
||||
```bash
|
||||
# 从仓库根目录执行;prepare起均为本地离线运算。
|
||||
python research/heat_calibration_20261028/prepare.py
|
||||
python research/heat_calibration_20261028/calibrate.py
|
||||
python research/heat_calibration_20261028/supplement.py
|
||||
python scripts/unit_test_guard.py research/heat_calibration_20261028/test_calibration.py
|
||||
python scripts/unit_test_guard.py research/heat_calibration_20261028/audit.py
|
||||
python research/heat_calibration_20261028/report.py
|
||||
```
|
||||
|
||||
主结果:[3,510组主样本明细](results/grid_asof.csv)、[含回填诊断](results/grid_heat.csv)、[原设候选账户明细](results/accounts.csv)、[训练选参及敏感性](results/selection.json)、[事后候选与验证账户](results/supplement.json)、[运行摘要](results/manifest.json)。原始热度来源为2026年10月28日只读导出;最后核验时间见运行摘要。
|
||||
Loading…
Reference in New Issue