Back to home

Nzssm1

dsh-factor-investing

A DeepSeek Harness (DSH) agent preset for institutional multi-factor stock-selection research: methodology knowledge base + zero-dependency factor statistics.

Stars
1
Language
JavaScript
Created
Aug 15, 2026
Updated
Aug 15, 2026

Introduction

dsh-factor-investing · Multi-Factor Stock-Selection Quant Researcher

A DeepSeek Harness (DSH) community agent preset for institutional multi-factor stock selection (A-share oriented). It turns the broker/hedge-fund multi-factor pipeline into a discipline-aware researcher: a methodology knowledge base covering the full pipeline, plus a zero-dependency factor-statistics module.

Community project — NOT an official DeepSeek preset and not endorsed by DeepSeek. See Relationship with DeepSeek.

1. Introduction

  • preset id: dsh-factor-investing (the directory name; must match [a-z0-9][a-z0-9-]*)
  • display name: 多因子选股量化研究员 (Multi-Factor Stock-Selection Quant Researcher)
  • positioning: institutional research assistant for data → factors → testing → synthesis → portfolio → backtest → monitoring
  • scenarios: factor mining & testing (IC/IR, Fama-MacBeth, incremental alpha), factor preprocessing & synthesis, Barra risk models, portfolio optimization, backtesting & live monitoring, quant code reproduction

2. Why this preset

A generic chat model reduces "multi-factor" to "sum a few factors" and treats "good backtest = valid factor". Institutional multi-factor is an industrial pipeline, and its real edge over retail practice is statistical discipline:

  • A factor's IC looking good ≠ useful — a new factor must pass an incremental-alpha test (regress its returns on known factors; the intercept α must be significant) to be genuinely new information;
  • skipping size neutralization = an implicit small-cap bet; skipping industry neutralization = a value factor that always picks banks;
  • multiple-testing correction (t>3 for novel factors), out-of-sample discipline, and cost/fill-rate assumptions decide whether a backtest is believable at all.

This preset writes that discipline into the system prompt via the persona, ships the methodology as a skill for on-demand loading, and makes the model interrogate methodology before concluding.

3. How it works

Three parts, all shipped with the repo:

  1. persona (system prompt)agent.cordis.yml injects a quant-researcher identity through @deepseek-ai/dsh-persona, embedding the pipeline and core discipline.
  2. skill (on-demand methodology)skills/factor-investing-pipeline/ is registered through @deepseek-ai/dsh-skill-filesystem's customSkillDirs; the model loads the relevant chapter with the skill tool.
  3. lib (zero-dependency stats)lib/factor-stats.mjs provides winsorization (MAD/3σ/percentile), standardization, neutralization, IC/ICIR, two-stage Fama-MacBeth, Gram-Schmidt orthogonalization; npm test covers it.

The toolset keeps the full standard coding capability; only the identity and knowledge change, so the tool catalog — and thus the request-prefix cache — stays stable.

4. Layout

dsh-factor-investing/
├── preset.yml                    # display metadata (name + description)
├── agent.cordis.yml              # Cordis composition: persona + tools + skill
├── skills/factor-investing-pipeline/
│   ├── SKILL.md                  # core framework + chapter/topic index
│   ├── chapters/ch00…ch09.md     # ten pipeline stages
│   ├── glossary.md / patterns.md / cheatsheet.md
├── lib/factor-stats.mjs          # zero-dependency factor statistics
├── test/factor-stats.test.mjs    # node:test unit tests
├── package.json                  # npm test, type: module, zero runtime deps
├── README.md / README.zh-CN.md
├── LICENSE (MIT) / NOTICE
├── .gitignore
└── .github/workflows/test.yml    # CI

5. Installation

DSH discovers local presets under <dshHome>/.agent-presets/ (dshHome defaults to ~/.dsh; %USERPROFILE%\.dsh on Windows). The preset id is the directory name, so clone the repo as that directory.

Linux / macOS:

mkdir -p ~/.dsh/.agent-presets
git clone https://github.com/Nzssm1/dsh-factor-investing.git \
  ~/.dsh/.agent-presets/dsh-factor-investing

Windows (PowerShell):

New-Item -ItemType Directory -Force "$env:USERPROFILE\.dsh\.agent-presets"
git clone https://github.com/Nzssm1/dsh-factor-investing.git `
  "$env:USERPROFILE\.dsh\.agent-presets\dsh-factor-investing"

Restart DSH and pick 「多因子选股量化研究员」 for a new session. If your deployment configures custom preset roots, place the repo under that root instead (dsh-agent-presets roots).

6. Verification

  1. persona active — the first system prompt of a new session carries the quant-researcher identity and pipeline/discipline.
  2. skill registered — ask "list skills"; factor-investing-pipeline should appear, or ask it to "load chapter ch04 of factor-investing-pipeline".
  3. stats module — run npm test; all 15 cases should pass.

7. Important behaviors

  • The preset does not change the tool catalog; it keeps standard's tools and only replaces the persona and registers the skill, so there is no bootstrap/full switching and the prefix cache stays stable.
  • Knowledge-base thresholds are rough heuristics (|IC|>0.03 keep, >0.05 usable, ICIR 0.2–0.5 common, 20–40bp cost), tied to stock-pool breadth, dispersion, and IC frequency — not universal targets; verify sample in/out-of-sample, cost, annualization, and multiple-testing before citing.
  • Broker figures (e.g. 湘财 "59 → 22" factors, long-short Sharpe 2.92) are magnitude references from a single, unspecified-cost sample.
  • lib/factor-stats.mjs is a reference implementation for teaching, testing, and light recomputation; production backtests should use pandas/numpy or a proper quant framework, always with out-of-sample validation.

8. Compatibility

  • Built for DeepSeek Harness 0.1.0-rc.6: preset.yml (display metadata) + agent.cordis.yml (Cordis composition) + @deepseek-ai/dsh-persona (persona) + @deepseek-ai/dsh-skill-filesystem customSkillDirs (preset-local skill).
  • This is a domain-expert preset, not the older (0.1.0-rc.5 / commit 47f9438) "two-stage tool catalog" pattern that hand-wrote a system-prompt/assemble listener. In the current version the system prompt comes from @deepseek-ai/dsh-persona, and "the catalog changes once" is satisfied by not changing it at all.
  • Manual confirmations: ① repo name vs. preset id (rename the directory if they differ); ② the copyright holder in LICENSE (currently Nzssm1); ③ whether your deployment sets custom preset roots (default ~/.dsh/.agent-presets/); ④ on a non-rc.6 deployment, field names for customSkillDirs / dsh-persona may differ — check that version's dsh-agent-presets / dsh-persona README.

9. Relationship with DeepSeek

  • This is a community project by GitHub user Nzssm1;
  • it is not an official DeepSeek preset, is not hosted in an official DeepSeek repo, and the official repo does not accept external PRs;
  • it is not endorsed or sponsored by DeepSeek;
  • agent.cordis.yml is adapted from the standard preset shipped with DeepSeek Harness (Copyright (c) 2026 DeepSeek, MIT) and the MIT notice is retained (see NOTICE); the methodology knowledge base is adapted from the author's own research report, whose cited broker research and 《因子投资:方法与实践》 remain the property of their respective authors/publishers.

10. Tests

Zero dependencies, Node's built-in node:test:

npm test

11. Publishing checklist

  1. Create the repo Nzssm1/dsh-factor-investing on GitHub;
  2. push to main (commands below);
  3. add the topic dsh-plugin under Settings → Topics (this is how community directories and the topic page discover it);
  4. confirm the test.yml workflow passes in Actions;
  5. (optional) publish a release.
git init
git add .
git commit -m "feat: dsh-factor-investing preset"
git branch -M main
git remote add origin https://github.com/Nzssm1/dsh-factor-investing.git
git push -u origin main

Adding topics: repo page → right-side About gear → Topicsdsh-plugin (suggest also deepseek-harness, dsh, factor-investing, quant).