This repository contains the official implementation of MEME (Modeling the evolution modes of financial markets), a logic-oriented perspective modeling the financial market as a dynamic, evolutionary ecosystem of competing investment narratives, termed Modes of Thought in quantitative finance.
Current LLM-based financial trading methods are primarily objected-oriented, i.e, focusing on what to buy and how much should buy. We therefore want to investigate the underlying 'why' -- capturing the evolving investment logics of financial markets and using this to guide trading.
However, the path to capturing the logics is challenging:
-
Low signal-to-noise ratio of financial markets.
-
The sparse, contradictory nature of existing narratives in the financial markets.
-
The non-stationary nature of financial markets.
MEME addresses these challenges by:
- Structural argument extraction pipeline from the financial markets.
- Mode identification through probabilistic clustering
- Modes evolution through temporal alignment.
- Portfolio construction through systematic mode evaluation.
conda create --name MEME python==3.10.12 -y
conda activate MEME
pip install pdm
pdm install
The dataset used in this project is private and cannot be released due to compliance requirements. We apologize for the inconvenience. You could use these public data sources as an alternative:
-
Stock Basic Data and Fundamental Data
-
Financial News and Report
Configure the pool name (default csi_300), your model url and model api_key in train_pattern.py.
python train_pattern.pyThe extracted arguments are stored in res/analysis/{analyst_type}/{pool_name} in default. Below is an example of extracted arguments for stock 000001.SZ:
{
"stock_code": "000001",
"analysis_date": 20231023,
"analyst_type": "FundamentalAnalyst",
"analysis_content": [
{
"thesis_polar": true,
"thesis_content": "Ping An Bank's valuation is at an extremely low historical level, with potential for mean reversion. The stock's current P/E ratio of 4.17 and P/B ratio of 0.45 are both at the 0th percentile of historical levels, significantly below the historical medians of 8.84 and 0.82, respectively. Moreover, its return on equity (ROE) has remained stable between 9.9% and 10.8% for five consecutive quarters, indicating robust profitability. This creates a mismatch between the low valuation and sustained earnings."
},
{
"thesis_polar": false,
"thesis_content": "Continued deterioration in industry fundamentals may negatively impact individual stock performance. The Joint-stock Banks II industry has seen its trailing-twelve-month (TTM) operating revenue growth rate decline from 0.033 to -0.037 over the last five quarters, and its TTM net profit attributable to shareholders growth rate drop from 0.086 to 0.023. This indicates a weakening growth momentum in the sector. During the same period, Ping An Bank's TTM operating revenue growth rate fell from 0.105 to -0.001, reflecting pressure from industry-wide challenges."
},
{
"thesis_polar": true,
"thesis_content": "High dividend yield provides downside protection and attracts long-term capital. Ping An Bank's current dividend yield of 2.71% is at the 99.9th historical percentile, close to its historical maximum. It is also significantly higher than the industry's historical median dividend yield of 4.86% (with the current industry yield at 5.69%). This high cash return offers allocation value in a low-interest-rate environment."
},
{
"thesis_polar": false,
"thesis_content": "Slowing asset expansion may limit future growth potential. Ping An Bank's total assets grew from RMB 5.11 trillion in June 2022 to RMB 5.50 trillion in June 2023, representing an annualized growth rate of approximately 7.6%. However, operating revenue declined in the last two quarters (-0.050 and -0.024), indicating that asset expansion has not effectively translated into revenue growth."
}
]
}
Configure your embedding model api key on openrouter in train_pattern_aggregation.py.
python train_pattern_aggregation.pyPlease contact the authors below for queries.
- Taian Guo, taianguo@stu.pku.edu.cn
- Haiyang Shen, hyshen@stu.pku.edu.cn
If you find our work useful, please kindly consider citing our work as follows:
@misc{guo2026mememodelingevolutionarymodes,
title={MEME: Modeling the Evolutionary Modes of Financial Markets},
author={Taian Guo and Haiyang Shen and Junyu Luo and Zhongshi Xing and Hanchun Lian and Jinsheng Huang and Binqi Chen and Luchen Liu and Yun Ma and Ming Zhang},
year={2026},
eprint={2602.11918},
archivePrefix={arXiv},
primaryClass={cs.AI},
url={https://arxiv.org/abs/2602.11918},
}