Files
2026-05-07 10:49:58 +08:00

56 lines
1004 B
Python

import pandas as pd
from data import get_stock_list, get_hist
from strategy import calc_score
from dingding import send
from config import TOP_N, MIN_HISTORY
def run():
stock_list = get_stock_list()
results = []
for _, row in stock_list.iterrows():
code = row["code"]
name = row["name"]
try:
df = get_hist(code)
if len(df) < MIN_HISTORY:
continue
score = calc_score(df)
if score > 60:
results.append({
"code": code,
"name": name,
"score": score
})
except:
continue
df = pd.DataFrame(results)
df = df.sort_values(by="score", ascending=False)
top = df.head(TOP_N)
msg = "今日短线选股\n\n"
for _, r in top.iterrows():
msg += f"{r['code']} {r['name']} 评分:{r['score']}\n"
print(msg)
send(msg)
if __name__ == "__main__":
run()