Project Overview
Ying+ AI Investment Review & Position Advice is the AI content subsystem inside the Ying+ multi-client personal investment app. Rather than handing raw market data straight to a model to "guess the direction," the backend first completes data sync, indicator computation, data validation and context compression, and then lets DeepSeek generate readable, traceable market content grounded in structured facts.
The system has three kinds of AI capability:
- AI Morning Brief: before each trading day, it generates a market overview combining the previous day's market, international markets, sector fund flows, the limit-up ladder and hot concepts;
- AI Daily Review: after each close, it generates a personalized review combining the user's holdings, watchlist, technicals, fund flows and market sentiment;
- AI Position Advice: for the holding structure, return rate, margin flags, trend and risk, it generates a position-management leaning and risk warnings.
The project has stopped productizing for the public, and is kept as a practice in AI content engineering, financial-data modeling and multi-client systems.
Core Architecture
Quotes / sectors / fund flows / holdings / watchlist / international markets
↓
Local database and data-sync jobs
↓
Context Builder: a unified, structured market context
↓
System Prompt + Context + Task Prompt three-layer input
↓
DeepSeek generates Markdown
↓
Record state machine / back-office review and regeneration / user-side history
All AI features share one Context Builder: public market data is built once and reused across users; a user's holdings and watchlist are queried per user. The model does not compute indicators such as MA, trend or fund flow — the backend computes and compresses them first and only hands structured conclusions to the model, reducing token consumption and improving output consistency.
Delivered Capabilities
1. AI Morning Brief
The system automatically generates one market morning brief each trading-day morning, using the previous trading day's closing data and overnight international-market performance, covering major indices, sector fund flows, the limit-up ladder, northbound capital, hot concepts and risk warnings.
Only one brief is generated per day, and the back office supports viewing, editing, manual generation and regeneration. International markets and local quotes are synced into the database in advance, so the AI generation stage does not call external data sources directly, avoiding interface latency blocking the job.
2. AI Daily Review
After each close, a holdings review is generated per user: the full market picture, the account's return-rate distribution, the technicals and capital flow of key holdings, brief notes on watchlist stocks, hot topics and next-day risk points.
The review outputs only a return-rate percentage and never exposes a user's holding amount in the model context or front-end content; each report is bound to a user, date and tier, with a unique constraint ensuring no duplicate generation on the same day.
3. AI Position Advice
Position advice reuses the market context, then adds the user's holding cost, trend, margin flags, the last 5 days of K-lines, weekly K-lines and fund flows, outputting leanings such as add, hold, reduce or stop-loss along with position-concentration risk.
The model prompt forbids deterministic-return statements, target prices and full-position recommendations; every conclusion must be based on the input data and must clearly state risk boundaries and a disclaimer.
Key Engineering Decisions
Context Builder over prompt stacking
Model output quality depends on whether the input facts are complete and the semantics consistent. I split data processing into two layers: the public market Context is built once, and the per-user personalized Context is built separately; the context passes only compressed market conclusions and indicators, not large blocks of raw K-lines or tick data.
This both avoids redundant computation in the model and lets the morning brief, daily review and position advice reuse the same market facts, reducing token consumption and conclusion drift across features.
When data is not ready, prefer to fail rather than generate a hollow report
Before an AI job runs, it checks whether A-share daily lines, indices, northbound capital, global markets and after-hours data have been synced. When core data is not ready, the job is recorded as failed with the reason preserved, instead of generating content that lacks key facts.
This principle fits the financial-content setting: a report that looks complete but lags on data is more dangerous than clearly telling the user "it cannot be generated for now."
Idempotency, failure isolation and concurrency control
The daily review and position advice are unique by "user + report date," and the morning brief is unique by "report date." Job states are unified as pending, running, success and failed; regeneration updates the existing record rather than creating duplicate data.
Batch jobs use a semaphore to limit concurrent AI calls, and one user's failure does not block others; the generation endpoint runs in a background thread, so a long model call does not hold an HTTP request thread.
AI content must be reviewable and correctable
The back-office console can view the AI content, its data source and failure reason, and manually regenerate or edit it. Prompts, Context and job scheduling all keep clear boundaries, making it easy to trace "why the model produced this content" rather than treating the output as an unexplainable black box.
Why Productization Was Stopped
Ying+ validated the technology across iOS, the admin console, the market-data service and the AI content system, but continuing to provide investment-related content to the public would involve long-term costs in market-data licensing, user operations, app distribution, AI-advice boundaries and policy compliance.
I chose to stop expanding after the project was complete: I will not package probabilistic model output as a deterministic investment service, nor keep acquiring users without long-term compliance and operational capability. I will converge my effort into the more clearly bounded local ETF / options watching tool.
The capabilities distilled from this experience are not lost: structured Context, data-readiness checks, job idempotency, cost control, back-office review and prompt boundaries remain the most important engineering foundations for building reliable AI applications.
Related Repositories
- Ying+ iOS client: a SwiftUI / WidgetKit client for quotes, watchlist and K-lines;
- Ying+ admin console: a Vue 3 / TypeScript UI for jobs, data and AI content management;
- Ying+ backend service: FastAPI, TimescaleDB, Redis, scheduling and AI content capabilities.
Tech Stack
FastAPI · PostgreSQL · TimescaleDB · Redis · SQLAlchemy · Alembic · Vue 3 · TypeScript · DeepSeek · APScheduler · Docker
Note
This case is for showcasing AI content engineering and financial-data systems; it does not provide an online investment-advice service and does not constitute investment advice.