diff --git a/2025-2-10.md b/2025-2-10.md deleted file mode 100644 index d3face5..0000000 --- a/2025-2-10.md +++ /dev/null @@ -1,13 +0,0 @@ -# 总结 - -**核心观点:** - -* **指数层面:** 虽然今天收小阳线,但存在隐患,主要问题是成交量大幅萎缩,即便突破3322点(60日线)问题可能更大。下午的上攻伴随量能萎缩,呈现量价背离,需要警惕。 -* **操作建议:** 如果明天高开个股出现进攻衰竭信号,可适当减仓,以防量能持续萎缩导致市场降温。但由于今天只是第一天量价不匹配,若未来量能能再次放大,则个股仍有操作空间。 -* **仓位:** 个人维持5-5.5成仓位,消费和医药持仓为主,不考虑加仓。目前位置不适合中线布局,除非是长线布局。 -* **DS题材(可能指数字经济或算力概念):** 目前已进入深度博傻阶段,等待接盘侠。三大运营商(电信、联通)必须持续冲新高,否则可能面临负反馈。资金不会立刻撤出DS,仍会在科技股中流动,直到更大的利好出现。 -* **风险提示:** 不建议追高DS题材,现在入场已经太晚,如果要参与只能小仓位短线投机,并设置止损。不要盲目相信科技信仰,避免高位接盘。 - -**总结:** - -作者认为当前市场存在量价背离的隐患,建议谨慎操作,注意控制仓位。对于近期火热的DS题材,作者持谨慎态度,认为已进入博傻阶段,不建议追高。 diff --git a/README.md b/README.md index b4a02e7..f7d3e50 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,67 @@ # info_flow -To install dependencies: +一个用于总结微信文章并生成投资策略的项目。 + +## **功能:** + +* 抓取微信文章内容 +* 利用 Gemini API 总结文章 +* 根据文章内容生成短、中、长线投资策略 (如果文章是投资主题) +* 将总结和投资策略保存到 Markdown 文件 + +## **技术栈:** + +* [Bun](https://bun.sh):快速的 all-in-one JavaScript 运行时 +* [Elysia.js](https://elysiajs.com/):Web 框架 +* [Google Gemini API](https://ai.google.dev/):用于生成文本 +* [JSDOM](https://github.com/jsdom/jsdom):在 Node.js 中模拟 DOM 环境 +* [Cheerio](https://github.com/cheeriojs/cheerio):快速灵活的 HTML 解析器 + +## **安装依赖:** ```bash bun install ``` -To run: +## **运行项目:** ```bash -bun run index.js +bun run index.ts ``` -This project was created using `bun init` in bun v1.1.37. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. +## **构建项目:** + +```bash +bun build index.ts --outfile=dist/lockon --compile +``` + +## **运行构建后的项目:** + +```bash +dist/lockon +``` + +## **项目结构:** + +* `index.ts`:Elysia.js 应用入口,包含路由和主要逻辑 (typescript:index.ts) +* `package.json`:项目依赖和脚本 (json:package.json) +* `jsconfig.json`:TypeScript 配置文件 (json:jsconfig.json) +* `.gitignore`:Git 忽略文件 (.gitignore) +* `global.d.ts`:全局类型声明 (typescript:global.d.ts) +* `history/`:存放历史总结和投资策略的目录 +* `README.md`:项目介绍 (markdown:README.md) + +## **环境变量:** + +* `API_KEY`:Google Gemini API 的 API 密钥 + +## **使用方法:** + +1. 在根目录下创建 `.env` 文件,并添加 `API_KEY=YOUR_API_KEY`。 +2. 运行项目:`bun run index.js` +3. 在浏览器中打开 `http://localhost:3000`,输入微信文章链接,点击提交。 +4. 总结和投资策略将保存在 `history/` 目录下,并显示在浏览器中。 + +## **贡献:** + +欢迎提交 issue 和 pull request! diff --git a/bak/ai.js b/bak/ai.js deleted file mode 100644 index edccd1a..0000000 --- a/bak/ai.js +++ /dev/null @@ -1,15 +0,0 @@ -// ai.js -export async function analyzeContent(content) { - // 假设DeepSeek API的调用方式 - const response = await fetch("https://api.deepseek.com/v1/analyze", { - method: "POST", - headers: { - "Content-Type": "application/json", - "Authorization": "Bearer sk-75972dd6431e4440a0428fa8922ed6b1", - }, - body: JSON.stringify({ content }), - }); - const result = await response.json(); - console.log('Result:', result); - return result.summary; // 假设返回的是Markdown格式的总结 -} diff --git a/bak/rss.js b/bak/rss.js deleted file mode 100644 index 003d34f..0000000 --- a/bak/rss.js +++ /dev/null @@ -1,21 +0,0 @@ -// ... existing code ... -export async function fetchRSS(url, maxRetries = 3) { - let retries = 0; - while (retries < maxRetries) { - try { - const response = await fetch(url, { verbose: true, keepalive: true, timeout: 10000, compress: false }); - // console.log('Response:', response); - const text = await response.text(); - // console.log('Response Text:', text); - return text; - } catch (error) { - console.error(`Fetch Error (Attempt ${retries + 1}):`, error); - retries++; - // 等待一段时间再重试,避免过于频繁的请求 - await new Promise(resolve => setTimeout(resolve, 1000)); - } - } - console.error('Fetch failed after multiple retries.'); - return null; -} -// ... existing code ... \ No newline at end of file diff --git a/bak/server.js b/bak/server.js deleted file mode 100644 index bfbd872..0000000 --- a/bak/server.js +++ /dev/null @@ -1,29 +0,0 @@ -// server.js -import { serve } from "bun"; -import { fetchRSS } from "./rss.js"; -import { analyzeContent } from "./ai.js"; -import { getWeChatArticleLinks } from "./wechat.js"; -const PORT = 3000; - -async function handleRequest(request) { - // 从环境变量中获取 RSS URL,如果没有则使用默认值 - const rssUrl = "https://mp.weixin.qq.com/s/vQgsMuxXffpFZkNFj89wUQ"; - try { - const rssContent = await fetchRSS(rssUrl); - const analyzedContent = await analyzeContent(rssContent); - - return new Response(analyzedContent, { - headers: { "Content-Type": "text/markdown" }, - }); - } catch (error) { - console.error("Error processing request:", error); - return new Response("Error processing request", { status: 500 }); - } -} - -serve({ - port: PORT, - fetch: handleRequest, -}); - -console.log(`Server running at http://localhost:${PORT}`); diff --git a/bak/wechat.js b/bak/wechat.js deleted file mode 100644 index c7f4851..0000000 --- a/bak/wechat.js +++ /dev/null @@ -1,24 +0,0 @@ -import { JSDOM } from 'jsdom'; - -async function getWeChatArticleLinks(publicAccountName) { - // const searchUrl = `https://weixin.sogou.com/weixin?p=01030402&query=${encodeURIComponent(publicAccountName)}&type=2&ie=utf8`; - // const response = await fetch(searchUrl); - console.log(`https://mp.weixin.qq.com/mp/profile_ext?action=getmsg&__biz=${publicAccountName}`); - const response = await fetch(`https://mp.weixin.qq.com/mp/profile_ext?action=getmsg&__biz=${publicAccountName}`, { - headers: { - 'Referer': `https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=${publicAccountName}` - } -}); - const html = await response.text(); - - const { document } = new JSDOM(html).window; - const articleLinks = []; - const articleElements = document.querySelectorAll('.news-box .news-list li a'); - articleElements.forEach((element) => { - const link = element.href; - articleLinks.push(link); - }); - return articleLinks; -} - -export { getWeChatArticleLinks }; \ No newline at end of file diff --git a/config.json b/config.json deleted file mode 100644 index e69de29..0000000 diff --git a/package.json b/package.json index 871be67..0ef13f1 100644 --- a/package.json +++ b/package.json @@ -7,14 +7,17 @@ "peerDependencies": { "typescript": "^5.0.0" }, + "scripts": { + "start": "bun run dev", + "build": "bun build index.ts --outfile=dist/lockon --compile", + "dev": "bun run index.ts --watch" + }, "type": "module", "dependencies": { "@elysiajs/html": "^1.2.0", "@google/generative-ai": "^0.21.0", - "cheerio": "^1.0.0", "dotenv": "^16.4.7", "elysia": "^1.2.12", - "jsdom": "^26.0.0", - "openai": "^4.83.0" + "jsdom": "^26.0.0" } } \ No newline at end of file diff --git a/style.css b/style.css deleted file mode 100644 index 749ab24..0000000 --- a/style.css +++ /dev/null @@ -1,11 +0,0 @@ -/* style.css */ -body { - max-width: 768px; - margin: 0 auto; - font-family: system-ui; - line-height: 1.6; -} -.timestamp { - color: #666; - font-size: 0.8em -} diff --git a/wechat.js b/wechat.js deleted file mode 100644 index e1bd9ca..0000000 --- a/wechat.js +++ /dev/null @@ -1,16 +0,0 @@ -import { JSDOM } from 'jsdom'; - -async function getWeChatArticleLinks(publicAccountName) { - const html = await response.text(); - - const { document } = new JSDOM(html).window; - const articleLinks = []; - const articleElements = document.querySelectorAll('.news-box .news-list li a'); - articleElements.forEach((element) => { - const link = element.href; - articleLinks.push(link); - }); - return articleLinks; -} - -export { getWeChatArticleLinks }; \ No newline at end of file