Overview of the AI Stock Trading Support System—from candidate extraction to LINE notifications and air trading
Nice to meet you. We are “Suruwo” (which stands for “Systematizing Stock Trading”). While working as a company employee in the Kansai region, I’m independently developing a stock trading support system using Python and AI.
The reason I started building it was to reduce trading that relies on gut feeling or daily mood. I wanted to not only search for reasons to buy but also predefine conditions for passing and preparedness for losses.
This time, I will introduce what my system does, from candidate stock extraction to LINE notifications and verification with air trading, outlining the overall flow.
Narrow the candidates, evaluate them under multiple criteria, and then record the results. The final decision is made by humans. This is a “system to support stock trading decisions and verification.”
As of the writing, I’m validating with air trades and a dry-run that actually sends no orders to confirm the content. The virtual trading records introduced in this article are not actual fund trading results.
(It hasn’t reached the point where AI makes all the money while you sleep. I admit I once hoped for that.)
The whole process is divided into seven stages
The main flow consists of the following seven steps.
1. Collect candidate stocks from the market
2. Update daily price data and technical indicators
3. Narrow candidates with trading rules
4. Evaluate candidates with machine learning
5. Classify into Entry, Watch, and Skip
6. Notify via LINE
7. Track results with air trading
The flow is: candidate collection → data update → rule judgement → AI evaluation → classification → notification → result verification.
Initially, it was just a script to obtain stock prices. Then I added candidate extraction, notifications, machine learning, and result tracking, and before I knew it, there were seven stages.
(I only wanted to add a little convenience, and it ballooned quite a bit.)
1. Collect candidate stocks from the market
First, collect the candidate stocks to review that day.
It isn’t realistic for a human to check every Japanese stock one by one. Therefore, my system uses ranking information obtained from the kabu Station API, among others, to gather stocks whose price movement and trading activity meet certain conditions.
An API is a gateway for programmatic information retrieval. Here, it is used from Python to collect “candidates to review today.”
At this stage, the target is reduced to a practical number. It does not decide to buy just because a stock is in the candidate list, nor does it automatically place orders. It is closer to a preliminary screening to proceed to the next stage.
2. Update stock price data and technical indicators
Once candidates are gathered, I use Python’s yfinance library to update daily bars that represent day-to-day price movement. In my system, I collect past daily data to compute indicators for verification.
For the data obtained, it is necessary to check the provider and tool usage terms. This article does not sell or distribute original stock price data; it introduces my development and verification approach.
In addition to closing price and volume, we compute moving averages, Bollinger Bands, distance from recent highs, and volume changes. For example, we look at points like the following.
・Where the short-term and medium-term moving averages lie
・Whether volume is higher than usual
・Whether we are approaching recent highs
・Whether it is overheating after an ascent
・Whether it is in a dip-like position
In the past I judged “it’s rising somewhat just by looking at the chart.” Now I try to break that “gut feeling” down into numbers as much as possible.
Turning it into numbers doesn’t guarantee accuracy. Still, it makes it easier to compare under the same conditions even if my mood changes, and to reflect on judgments later.
3. Narrow candidates with trading rules
Using the calculated indicators, we further narrow down the candidates.
mainly focusing on “candidates showing stronger upward movement” and “candidates that rose and then dipped within an uptrend.”
On the other hand, candidates that rose too quickly, had too large price movement, or don’t fit budget we exclude or downgrade at this stage.
Importantly, we record not only good reasons but also reasons for passing.
When humans look at charts, they tend to seek favorable materials when they want to buy.
(I myself look quite a lot.)
Therefore, we set it up so that if they do not meet the predefined conditions, they get a pass verdict.
4. Evaluate candidates with machine learning
In addition to the trading-rule evaluation, we evaluate candidates with a machine-learning model called LightGBM. The AI evaluation referred to in this article mainly corresponds to this part.
The central question is, “How likely is a candidate to reach the target price movement within a certain period?”
The model also takes into account each stock’s price movement and technical indicators, along with a partial view of the overall market conditions.
However, the probabilities the model outputs are estimates learned from past data. They do not guarantee future success at the same rate. A candidate given a high score might miss, and a low-scored candidate might rise.
Therefore, the machine-learning output is used in combination with the trading rules as one piece of evidence for decision-making.
5. Classify into Entry, Watch, and Skip
We consolidate technical indicators, trading rules, and machine-learning evaluations to categorize candidates into three groups.
・Entry candidates: items to review with priority
・Watch candidates: items to keep monitoring until conditions are met
・Skip/Reference: items to pass on this time
Although named Entry, it means “candidates to review with priority.” It does not instruct buying.
We keep Watch and Skip to verify what happened to those passed-on candidates afterward. With only Entry candidates, comparing the screening method becomes difficult.
We also record outcomes like “the skipped stock rose more than expected,” which is not a pleasant result to see.
(The less you want to see it, the more it tends to be a source for improvement.)
6. Notify results via LINE
Once classification is finished, we send the day’s candidates to my LINE.
This is so that I can review the overview of Entry and Watch candidates on my smartphone without opening CSV files. The notification shows the classification, main evaluations, and proposed trading plans.
The notification is an entry point that says “Today, there are items to review with priority.” Rather than placing orders immediately after viewing the content, I review more detailed data and dashboards.
When I started, just receiving notifications gave me a small sense of completion.
(Notifications are not profits. They are quietly important here.)
7. Track further with air trading
If you stop at just generating candidates, you won’t know whether the judgments were good. Therefore, I record price movements afterward as if I had purchased under certain conditions.
What I verify includes, for example, the following:
・Whether the assumed purchase price was reached
・Whether profit-taking or stop-loss levels were reached
・How high it rose or fell while held
・Whether there was a difference between Entry and Watch candidates
・Whether results changed under strict vs. lenient conditions
I also verify differences in selling methods after reaching a certain profit and methods that adapt to price movement with a fixed stop-loss.
However, even if you record reaching a price, it doesn’t mean you could have actually bought or sold at that exact time and price. When looking at air-trade results, you must also check which moment's information you assumed and under what conditions you could have traded.
What matters is not only whether one instance hit, but what happens when you repeat the same rule. A single successful instance can be explained after the fact, but as the number of cases grows, explanations based on a single incident are no longer sufficient.
(Data is unforgiving.)
Even with automation, the human verification part remains
Most of candidate collection, data updating, indicator calculation, machine-learning evaluation, notifications, and result recording are automated.
On the other hand, before proceeding to actual orders, I plan for humans to verify the following points:
・Is the data updating normally?
・Is there no major abnormality in the market overall?
・Is the assumed loss amount acceptable?
・Are there no issues with buying power or existing holdings?
・Are there no unreasonable liquidity or sudden price move concerns?
・Is the system not in an unexpected state?
I also create checks to verify whether a dry-run can confirm content without sending orders or whether we are ready to move to live operation.
By entrusting daily repetitive tasks to the system, I hope to free humans to focus on exceptions and risk checks.
Behind the scenes, more modest checks are running
In actual development, I spend a lot of time ensuring stable operation.
・Did we successfully retrieve data from the API?
・Was the day’s file created?
・Are we not duplicating the same process?
・What causes candidate changes before market close and after the daily bar is confirmed?
・Did virtual orders and settlements record as expected?
・Can we stop processing when an error occurs?
Sometimes it takes longer to improve the model’s accuracy than to run these checks.
(There are days when I doubt the file dates before the AI.)
It may not be flashy, but it is an indispensable part for running daily and comparing results.
Current status: verification before actual operation
As of writing, I’m using air trades and dry-run to confirm conditions before moving to actual funds verification.
I’m verifying whether virtual purchases are recorded stably, whether profit-taking or stop-loss is determined as expected, and how results vary with different conditions. I’m accumulating these checks.
If I move to actual operation, I plan to start with a small scope: few stocks, minimal money, and human final confirmation. I’ve learned from a past hesitation on stop-loss that I want to reflect that lesson in the system.
When I started, I thought finding rising stocks was the most important. Now I also emphasize leaving reasons to pass, setting loss-limiting conditions, recording results under the same conditions, and stopping when things go unexpectedly wrong.
Compared to when I traded by gut, I can now explain my reasoning and reflect on it. I will continue to record what I learn from verification and what didn’t go well.
Note: This article is a personal record of system development and verification by the author. It does not advocate buying or selling specific financial products, nor does it guarantee future performance. Air-trade results differ from actual trading results. Investment decisions are your own responsibility.