# rockyzsu/stock architecture

> Architecture diagram of the GitHub repository rockyzsu/stock, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rockyzsu/stock
- Repository: https://github.com/rockyzsu/stock

## Overview

This repository is a collection of Python tools for personal quantitative investing: it gathers market and fund data, analyzes securities and technical patterns, monitors prices and events, and includes backtesting and trading utilities. A representative user journey is to run a stock-selection or analysis tool, use market data and shared utilities, and inspect results or receive alerts; the tree does not establish a single application entry point. The README documents broad capabilities, while sampled source/index references support only the specific module links shown below; many feature branches therefore remain unconnected.

Main entry points: [`configure/settings.py`](https://github.com/rockyzsu/stock/blob/master/configure/settings.py) (Database configuration), [`common/BaseService.py`](https://github.com/rockyzsu/stock/blob/master/common/BaseService.py) (HTTP utilities), [`datahub/jisilu.py`](https://github.com/rockyzsu/stock/blob/master/datahub/jisilu.py) (Bond data), [`monitor/realtime_monitor_ts.py`](https://github.com/rockyzsu/stock/blob/master/monitor/realtime_monitor_ts.py) (Realtime monitoring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Analysis and research"]
  node_stock_filter["Stock filters<br/>[filterstock.py]"]
  node_stock_selection["Stock selection<br/>[select_stock.py]"]
  node_backtests["Strategy backtests"]
  node_pattern_search["K-line patterns<br/>[recognize_form.py]"]
  node_ipo_analysis["IPO analysis<br/>[ipospeed.py]"]
end

subgraph group_collection["Market data collection"]
  node_data_collection["Market data collection"]
  node_limitup_data["Limit-up data<br/>[dfcf_hot_block.py]"]
  node_bond_data["Bond data<br/>[jisilu.py]"]
  node_jsl_login["Jisilu login<br/>[jsl_login.py]"]
end

subgraph group_funds["Fund tools"]
  node_fund_data["Fund data<br/>[ttjj.py]"]
  node_private_funds["Private fund data"]
  node_fund_arbitrage["LOF arbitrage<br/>[LOF_arbitrage.py]"]
  node_fund_backtest["Fund backtests"]
  node_fund_source["Fund data source"]
end

subgraph group_runtime["Shared runtime"]
  node_settings["Database configuration<br/>[settings.py]"]
  node_base_service["HTTP utilities<br/>[BaseService.py]"]
  node_toolkit["Shared toolkit<br/>[toolkit.py]"]
  node_encryption["Encryption utility<br/>[aes.py]"]
end

subgraph group_trading["Monitoring and trading"]
  node_broker_api["Futu API examples<br/>[basic_usage.py]"]
  node_realtime_monitor["Realtime monitoring"]
  node_alerts["Alert services<br/>[util.py]"]
  node_auto_trader["Automated trading<br/>[auto_trader.py]"]
  node_ptrade["Ptrade scripts<br/>[逆回购.py]"]
  node_delivery["Trade records<br/>[delivery_order.py]"]
end

node_investor(("Investor"))

node_investor -.->|"runs strategy"| node_stock_selection
node_stock_selection -->|"uses utilities"| node_toolkit
node_stock_selection -->|"reads config"| node_settings
node_stock_filter -->|"reads config"| node_settings
node_limitup_data -->|"reads config"| node_settings
node_limitup_data -->|"sends alerts"| node_alerts
node_bond_data -->|"reads config"| node_settings
node_bond_data -->|"uses HTTP"| node_base_service
node_bond_data -->|"uses login"| node_jsl_login
node_fund_data -->|"reads config"| node_settings
node_fund_data -->|"uses HTTP"| node_base_service
node_private_funds -->|"reads config"| node_settings
node_private_funds -->|"uses HTTP"| node_base_service
node_fund_arbitrage -->|"reads config"| node_settings
node_fund_backtest -->|"uses data"| node_fund_source
node_realtime_monitor -->|"reads config"| node_settings
node_realtime_monitor -->|"extends service"| node_base_service
node_realtime_monitor -.->|"sends notifications"| node_alerts
node_auto_trader -->|"reads config"| node_settings
node_delivery -->|"opens database"| node_settings
node_investor -.->|"runs pattern scan"| node_pattern_search

click node_stock_filter "https://github.com/rockyzsu/stock/blob/master/analysis/filterstock.py"
click node_stock_selection "https://github.com/rockyzsu/stock/blob/master/select_stock.py"
click node_backtests "https://github.com/rockyzsu/stock/tree/master/backtest"
click node_pattern_search "https://github.com/rockyzsu/stock/blob/master/k-line/recognize_form.py"
click node_ipo_analysis "https://github.com/rockyzsu/stock/blob/master/analysis/ipospeed.py"
click node_data_collection "https://github.com/rockyzsu/stock/tree/master/datahub"
click node_limitup_data "https://github.com/rockyzsu/stock/blob/master/datahub/dfcf_hot_block.py"
click node_bond_data "https://github.com/rockyzsu/stock/blob/master/datahub/jisilu.py"
click node_fund_data "https://github.com/rockyzsu/stock/blob/master/fund/ttjj.py"
click node_private_funds "https://github.com/rockyzsu/stock/blob/master/fund/xueqiu_private_fund.py"
click node_fund_arbitrage "https://github.com/rockyzsu/stock/blob/master/fund/LOF_arbitrage.py"
click node_fund_backtest "https://github.com/rockyzsu/stock/blob/master/fund/closed_end_fund_backtrade/backtrade_fund_weekly_share_increment.py"
click node_fund_source "https://github.com/rockyzsu/stock/blob/master/fund/closed_end_fund_backtrade/fund_data_source.py"
click node_settings "https://github.com/rockyzsu/stock/blob/master/configure/settings.py"
click node_base_service "https://github.com/rockyzsu/stock/blob/master/common/BaseService.py"
click node_toolkit "https://github.com/rockyzsu/stock/blob/master/toolkit.py"
click node_encryption "https://github.com/rockyzsu/stock/blob/master/common/aes.py"
click node_broker_api "https://github.com/rockyzsu/stock/blob/master/futu/basic_usage.py"
click node_realtime_monitor "https://github.com/rockyzsu/stock/blob/master/monitor/realtime_monitor_ts.py"
click node_alerts "https://github.com/rockyzsu/stock/blob/master/configure/util.py"
click node_auto_trader "https://github.com/rockyzsu/stock/blob/master/trader/auto_trader.py"
click node_ptrade "https://github.com/rockyzsu/stock/blob/master/ptrade/%E9%80%86%E5%9B%9E%E8%B4%AD.py"
click node_delivery "https://github.com/rockyzsu/stock/blob/master/utils/delivery_order.py"
click node_jsl_login "https://github.com/rockyzsu/stock/blob/master/datahub/jsl_login.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_stock_filter,node_stock_selection,node_backtests,node_pattern_search,node_ipo_analysis toneBlue
class node_data_collection,node_limitup_data,node_bond_data,node_jsl_login toneAmber
class node_fund_data,node_private_funds,node_fund_arbitrage,node_fund_backtest,node_fund_source toneMint
class node_settings,node_base_service,node_toolkit,node_encryption toneRose
class node_broker_api,node_realtime_monitor,node_alerts,node_auto_trader,node_ptrade,node_delivery,node_investor toneIndigo
```

## Components

### Analysis and research

- [Stock filters](https://github.com/rockyzsu/stock/blob/master/analysis/filterstock.py): `analysis/filterstock.py`
- [Stock selection](https://github.com/rockyzsu/stock/blob/master/select_stock.py): `select_stock.py`
- [Strategy backtests](https://github.com/rockyzsu/stock/tree/master/backtest): `backtest`
- [K-line patterns](https://github.com/rockyzsu/stock/blob/master/k-line/recognize_form.py): `k-line/recognize_form.py`
- [IPO analysis](https://github.com/rockyzsu/stock/blob/master/analysis/ipospeed.py): `analysis/ipospeed.py`

### Market data collection

- [Market data collection](https://github.com/rockyzsu/stock/tree/master/datahub): `datahub`
- [Limit-up data](https://github.com/rockyzsu/stock/blob/master/datahub/dfcf_hot_block.py): `datahub/dfcf_hot_block.py`
- [Bond data](https://github.com/rockyzsu/stock/blob/master/datahub/jisilu.py): `datahub/jisilu.py`
- [Jisilu login](https://github.com/rockyzsu/stock/blob/master/datahub/jsl_login.py): `datahub/jsl_login.py`

### Fund tools

- [Fund data](https://github.com/rockyzsu/stock/blob/master/fund/ttjj.py): `fund/ttjj.py`
- [Private fund data](https://github.com/rockyzsu/stock/blob/master/fund/xueqiu_private_fund.py): `fund/xueqiu_private_fund.py`
- [LOF arbitrage](https://github.com/rockyzsu/stock/blob/master/fund/LOF_arbitrage.py): `fund/LOF_arbitrage.py`
- [Fund backtests](https://github.com/rockyzsu/stock/blob/master/fund/closed_end_fund_backtrade/backtrade_fund_weekly_share_increment.py): `fund/closed_end_fund_backtrade/backtrade_fund_weekly_share_increment.py`
- [Fund data source](https://github.com/rockyzsu/stock/blob/master/fund/closed_end_fund_backtrade/fund_data_source.py): `fund/closed_end_fund_backtrade/fund_data_source.py`

### Shared runtime

- [Database configuration](https://github.com/rockyzsu/stock/blob/master/configure/settings.py): `configure/settings.py`
- [HTTP utilities](https://github.com/rockyzsu/stock/blob/master/common/BaseService.py): `common/BaseService.py`
- [Shared toolkit](https://github.com/rockyzsu/stock/blob/master/toolkit.py): `toolkit.py`
- [Encryption utility](https://github.com/rockyzsu/stock/blob/master/common/aes.py): `common/aes.py`

### Monitoring and trading

- [Futu API examples](https://github.com/rockyzsu/stock/blob/master/futu/basic_usage.py): `futu/basic_usage.py`
- [Realtime monitoring](https://github.com/rockyzsu/stock/blob/master/monitor/realtime_monitor_ts.py): `monitor/realtime_monitor_ts.py`
- [Alert services](https://github.com/rockyzsu/stock/blob/master/configure/util.py): `configure/util.py`
- [Automated trading](https://github.com/rockyzsu/stock/blob/master/trader/auto_trader.py): `trader/auto_trader.py`
- [Ptrade scripts](https://github.com/rockyzsu/stock/blob/master/ptrade/%E9%80%86%E5%9B%9E%E8%B4%AD.py): `ptrade/逆回购.py`
- [Trade records](https://github.com/rockyzsu/stock/blob/master/utils/delivery_order.py): `utils/delivery_order.py`

### Other components

- **Investor**

## Connections

- Investor → Stock selection: runs strategy
- Stock selection → Shared toolkit: uses utilities (evidence: `select_stock.py`)
- Stock selection → Database configuration: reads config (evidence: `select_stock.py`)
- Stock filters → Database configuration: reads config (evidence: `analysis/filterstock.py`)
- Limit-up data → Database configuration: reads config (evidence: `datahub/dfcf_hot_block.py`)
- Limit-up data → Alert services: sends alerts (evidence: `datahub/dfcf_hot_block.py`)
- Bond data → Database configuration: reads config (evidence: `datahub/jisilu.py`)
- Bond data → HTTP utilities: uses HTTP (evidence: `datahub/jisilu.py`)
- Bond data → Jisilu login: uses login (evidence: `datahub/jisilu.py`)
- Fund data → Database configuration: reads config (evidence: `fund/ttjj.py`)
- Fund data → HTTP utilities: uses HTTP (evidence: `fund/ttjj.py`)
- Private fund data → Database configuration: reads config (evidence: `fund/xueqiu_private_fund.py`)
- Private fund data → HTTP utilities: uses HTTP (evidence: `fund/xueqiu_private_fund.py`)
- LOF arbitrage → Database configuration: reads config (evidence: `fund/LOF_arbitrage.py`)
- Fund backtests → Fund data source: uses data (evidence: `fund/closed_end_fund_backtrade/backtrade_fund_weekly_share_increment.py`)
- Realtime monitoring → Database configuration: reads config (evidence: `monitor/realtime_monitor_ts.py`)
- Realtime monitoring → HTTP utilities: extends service (evidence: `monitor/realtime_monitor_ts.py`)
- Realtime monitoring → Alert services: sends notifications
- Automated trading → Database configuration: reads config (evidence: `trader/auto_trader.py`)
- Trade records → Database configuration: opens database (evidence: `utils/delivery_order.py`)
- Investor → K-line patterns: runs pattern scan
