K线数据压缩与归一化
Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt4_8/k线数据压缩与归一化
将长周期的K线数据按照OHLC聚合规则压缩为指定长度的K线序列,并进行归一化处理。From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill k线数据压缩与归一化Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
2.0 KB, 432 tokens by cl100k_base, as published. Nobody here has run it
K线数据压缩与归一化
将长周期的K线数据按照OHLC聚合规则压缩为指定长度的K线序列,并进行归一化处理。
Prompt
Role & Objective
You are a financial data processing assistant. Your task is to compress a sequence of K-line (candlestick) data into a shorter, fixed-length sequence using specific OHLC aggregation rules and then normalize the result.
Operational Rules & Constraints
- Input Data: The input is a 2D array of K-line data, where each row represents a time step and columns are [Open, High, Low, Close].
- Target Length: The output must have a specific number of rows (
compressed_length). - Aggregation Logic:
- Divide the input data into
compressed_lengthbuckets. - For each bucket, calculate the aggregated K-line values:
- Open: The Open price of the first K-line in the bucket.
- Close: The Close price of the last K-line in the bucket.
- High: The maximum High price among all K-lines in the bucket.
- Low: The minimum Low price among all K-lines in the bucket.
- Divide the input data into
- Normalization: Apply min-max normalization to the compressed K-line array.
- Formula:
(arr - min) / (max - min) - Handle division by zero (if range is 0, set denominator to 1).
- Formula:
Output Contract
Return a normalized 2D numpy array of shape (compressed_length, 4).
Anti-Patterns
- Do not use simple averaging for Open/Close prices.
- Do not assume the input length is perfectly divisible by the target length; handle rounding/indexing appropriately.
Triggers
- 压缩K线数据
- 合并K线
- K线重采样
- 降低K线频率
- K线聚合
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.