I built an AI trading bot that runs simulated trades with fake money on the NSE, and today it made no trades and stood aside. Its gross result was flat, leaving the balance unchanged at ₹101,430.60. The AI reads headlines and suggests ratings; code applies the trading rules, records each decision and gives me a post-mortem after the session.

Every stock the bot looked at
| # | Stock | Sector | Up at start | Volume vs usual | Headlines | Decision |
|---|---|---|---|---|---|---|
| 1 | Bajaj Finance (BAJFINANCE) | Financial Services | +3.34% | 4.27x | 5 | Not bought: no specific company event; news not positive |
| 2 | HDFC Life Insurance Company (HDFCLIFE) | Financial Services | +3.26% | 12.33x | 5 | Not bought: no specific company event |
| 3 | Bajaj Finserv (BAJAJFINSV) | Financial Services | +2.98% | 5.63x | 5 | Not bought: news not positive |
| 4 | Cholamandalam Investment and Finance Company (CHOLAFIN) | Financial Services | +3.66% | 2.35x | 5 | Not bought: no specific company event; event still to come; news not positive |
| 5 | Axis Bank (AXISBANK) | Financial Services | +3.01% | 2.62x | 5 | Not bought: sector news news is not a kind the bot trades on |
| 6 | Tata Motors (TMCV) | Capital Goods | +2.28% | 5.36x | 5 | Not bought: product or partnership news is not a kind the bot trades on |
| 7 | Shriram Finance (SHRIRAMFIN) | Financial Services | +2.08% | 3.41x | 5 | Not bought: dividend news is not a kind the bot trades on |
| 8 | Polycab India (POLYCAB) | Capital Goods | +2.04% | 2.94x | 5 | Not bought: product or partnership news is not a kind the bot trades on; event still to come |
| 9 | Siemens Energy India (ENRIN) | Capital Goods | +1.97% | 8.50x | 5 | Not bought: no specific company event; news not positive; headline did not name the company |
| 10 | ITC (ITC) | Fast Moving Consumer Goods | +1.60% | 5.48x | 5 | Not bought: no specific company event |
Up at the start is the rise from the previous close when the bot started (about 09:35 IST). Volume vs usual compares the morning's trading volume with the stock's normal pace.
How the Nifty 50 and my trading bot moved
The Nifty 50 fell 0.24%, while my bot’s balance did not change. These are measured differently: the bot’s result is against its whole balance, while the index move covers the same trading window. The bot checks headlines from Google News and prices from Yahoo Finance, then code—not the AI—decides whether any trade is permitted.
Which NSE stocks the AI trading bot picked
The morning screen checked 100 stocks and 40 passed its rise-and-volume filters. The top 10 candidates went to the news step. Those thresholds are a rise of at least 0.5% and volume pace of at least 1.0; passing them only earns a closer news review, not a trade.
Bajaj Finance and HDFC Life were among the sharpest movers, up 3.34% and 3.26%, with relative volume of 4.27 and 12.33. Cholamandalam Investment and Finance rose 3.66%, the largest morning move among these candidates, on relative volume of 2.35. Siemens Energy India showed relative volume of 8.5 despite a 1.97% rise. These are screening figures, not explanations for why a stock moved.
What the news said about each stock
Bajaj Finance’s cited Reuters headline from 11 November said it launched a share sale of more than $1 billion; TradingView on 12 November reported warrants issued to its promoter. The AI described these as capital-raising actions, not a clear positive share-price catalyst, and rated the news weak. Bajaj Finserv’s cited TradingView and Fortune India headlines, dated 12 and 11 November, respectively, also covered the warrant transaction. The recorded assessment said the deal did not establish a benefit to Bajaj Finserv’s share price.
HDFC Life’s NDTV Profit headline on 12 November described robust October growth and a stronger position among “Street Favourites.” The AI called this general news and rated it weak rather than a specific company event. Cholamandalam’s Multibagg AI headline on 9 November said it planned a ₹5,000 crore QIP; Univest’s 11 November headline compared its share-price performance with PNB Housing. The AI noted that the QIP had not happened yet and that the headlines did not establish a positive effect.
Axis Bank’s cited Upstox headline from 11 November described a banking-sector rally, not company-specific news. Tata Motors had headlines from the Tata group on 12 November about joining with Iveco Group, and ET Auto and Telugu Times on 11 November about EV financing and an assured buyback. The AI rated the product and partnership news weak; its recorded reason was that this was not a news category the bot trades on.
Shriram Finance’s cited scanx.trade, Kalkine India and ad-hoc-news.de headlines, from 9 and 10 November, reported an interim dividend already paid. The AI rated that news weak because dividend headlines are outside the categories it trades. Polycab’s pv magazine India headline on 11 November reported crossing 6 GW in solar inverter shipments and a planned future launch; the AI rated the product news weak and noted that the launch was still ahead.
For Siemens Energy India, the AI found no specific company event: some headlines referred to Siemens Energy AG, while another was sector-wide. ITC headlines from Upstox and CNBC TV18 on 12 November reported Gold Flake price increases, but the AI said the coverage did not establish a specific event with a quantified financial impact. Other results included general commentary, price pages or material about different companies. The AI reads headline titles, not the full articles.
Why the trading bot skipped every stock
None of the 10 candidates received a strong rating, so the bot bought none. In the recorded reasons, the financial-company headlines did not qualify as clearly positive company news; Axis Bank’s coverage was sector news; Tata Motors and Polycab had product or partnership stories; Shriram Finance had dividend news; and Siemens Energy India’s results did not identify the NSE company. ITC’s price-rise coverage lacked the specific impact the AI required. These are the recorded screening decisions, not claims about what drove each stock’s price.
The close-to-close review showed six no-catalyst candidates averaged -0.24%, while four with weak catalysts averaged -0.21%. Bajaj Finance, which was not bought, finished the day up 1.24%; ITC was down 1.9%. These are candidate outcomes, not bot trades.
How the trading bot behaved
The AI rated all 10 candidates and none strong. No trade reached the final rule checks, so no trades were accepted or rejected there. The current risk rules cap risk at 0.5% of the balance per trade, require possible reward of at least twice the possible loss, and allow at most three positions. The softer sector rule is also in force: first-choice strong stocks come first, and a same-sector extra can fill a slot only if one remains. With no strong candidates today, there were no reserve choices and no sector overlap to resolve.
Software Engineer's Corner: Before my bot trades, it has to pass a safety check
One standalone lesson taken from the code of my trading bot. The bot is a simulation with fake money: it places no real orders.
Where this fits in my bot
Before my bot looks at a single stock, it performs a preliminary check called preflight.
Think of it as the security checkpoint before a flight. The aircraft doesn't take off simply because the pilot has a destination. Several conditions must be checked first.
My bot follows a similar principle.
Before starting its daily screening process, it checks two things:
- Is the stock market open?
- Can the application successfully read its available trading balance?
If a mandatory check fails, the bot stops the day's process. It doesn't attempt to screen stocks, analyse news or create trades.
This is an example of defensive programming: anticipating problems before they cause trouble.
There is an interesting engineering principle behind this approach.
First, what does fail-closed mean?
Every software system eventually encounters situations where something goes wrong.
A database might become unavailable. An external API might stop responding. A required piece of information might be missing.
When that happens, the application needs to decide what to do.
There are two common approaches:
| Approach | Behaviour | Example |
|---|---|---|
| Fail open | Allows the operation to continue | A security door unlocks when its control system fails |
| Fail closed | Blocks the operation | A security door remains locked when its control system fails |
Think of a firewall configured with a deny-by-default policy.
Unless a connection is explicitly allowed, it is blocked.
The same principle applies to a trading application.
If the bot cannot establish that an essential condition is satisfied, it should not blindly continue.
The default should be safety, not convenience.
How I use it in my bot
My preflight process has two main checks.
1. Check whether the market is open
The first check determines whether the bot should run its morning trading process.
I have a function called check_market_open in morning_run.py.
python
def check_market_open(now: datetime, nifty_has_today_candle) -> tuple[bool, str]:
"""Plain rules, no network. nifty_has_today_candle is True, False, or None (could not check)."""
if now.weekday() >= 5:
return False, "it is the weekend"
if now.date().isoformat() in NSE_HOLIDAYS:
return False, "today is listed in NSE_HOLIDAYS"
if now.time() < RUN_FROM:
return False, f"too early (the app runs from {RUN_FROM:%H:%M} IST; the market opens at 09:15)"
if now.time() > RUN_UNTIL:
return False, f"too late (no new trades after {RUN_UNTIL:%H:%M} IST)"
if nifty_has_today_candle is False:
return False, "no Nifty price candle for today, so the market looks closed (a holiday?)"
return True, "market is open"
The function returns two values together:
- A Boolean indicating whether the market is considered open.
- A text message explaining the reason.
For example:
python
(True, "market is open")
or:
python
(False, "it is the weekend")
This is useful because the calling application doesn't just receive a yes or no. It also knows why the check passed or failed.
The market check uses multiple steps.
Step 1: Check the calendar and time
Before making any external requests, the bot checks some basic conditions:
- Is today a weekday?
- Is today a known market holiday?
- Has the market opened yet?
- Has the cutoff time for taking new trades passed?
These are inexpensive checks that can be performed locally, without contacting an external service.
For example, there is no reason to ask Yahoo Finance whether the market is open on a Sunday.
Step 2: Verify market activity
If the basic checks pass, the bot checks Yahoo Finance for a Nifty 50 price candle for the current trading day.
The Nifty 50 is one of India's major stock-market indices.
If no candle is available, the application treats this as a possible market holiday or closed-market condition and stops.
This gives the bot an additional source of confirmation beyond its own calendar and time rules.
2. Check the trading balance
The second check is about money.
My bot uses a simulated trading balance stored in its database.
Before screening stocks, it needs to know how much virtual capital is available.
What happens if the database is unavailable or the balance cannot be retrieved?
The bot stops.
It does not: - Assume the previous balance. - Start with a default amount. - Guess how much money is available. - Continue with potentially incorrect position sizing.
Instead, it records the problem and sends me a Telegram notification.
This is a straightforward example of fail-closed behaviour.
A missing balance is not a small inconvenience. It is information the application needs before it can safely calculate position sizes.
An interesting exception: What if Yahoo Finance is unavailable?
There is a subtle distinction in my market-check implementation.
Suppose all the local checks pass, but Yahoo Finance cannot be contacted.
This is different from Yahoo explicitly reporting that there is no price candle for today.
Consider these two situations:
Situation A: Yahoo responds, but no candle exists.
The application has received an answer suggesting that the market is closed.
It returns:
python
(False, "no Nifty price candle for today, so the market looks closed (a holiday?)")
The bot stops.
Situation B: Yahoo cannot be contacted.
The application has not received an answer either way.
In my current implementation, it treats this as an inconclusive external check and allows the process to continue, provided the earlier local checks passed.
This is an availability trade-off in my implementation, rather than strict fail-closed behaviour.
There is an important limitation here: local weekday and time checks cannot guarantee that the market is actually trading. If I wanted the strictest possible safety policy, I would also stop whenever market status could not be independently verified.
I prefer to make this distinction explicit rather than pretend that an unavailable API is the same as a successful market-open confirmation.
Testing the preflight checks
I tested the market-check function on 4 November 2026 using six different scenarios.
The dates and times below are test inputs. The outputs are from the actual function.
```text Wed 10:00 -> (True, 'market is open')
Sat 10:00 -> (False, 'it is the weekend')
Wed 09:00 -> (False, 'too early (the app runs from 09:30 IST; the market opens at 09:15)')
Wed 15:00 -> (False, 'too late (no new trades after 14:30 IST)')
Wed 10:00, no candle -> (False, 'no Nifty price candle for today, so the market looks closed (a holiday?)')
Wed 10:00, couldn't check Yahoo -> (True, 'market is open') ```
The last result is particularly interesting.
It demonstrates that the function distinguishes between a definite negative result and an unavailable external check.
This is also why testing different failure scenarios matters. Testing only the happy path would never reveal this behaviour.
Why this matters
My bot currently trades with virtual money. No real broker orders are being placed.
But I still want to build it using engineering practices that would matter in a real trading system.
A small mistake in a simulated application might not cost anything today, but the same mistake could become expensive if the architecture is later connected to real money.
There are three principles I want to follow:
1. Explicit rules
The application should know exactly which conditions must be satisfied before it starts trading.
2. Meaningful failure messages
Stopping is useful, but knowing why the application stopped is equally important.
Returning a reason alongside the Boolean makes debugging and monitoring much easier.
3. No-trade days are perfectly valid
A trading application doesn't need to produce a trade every day.
If the market is closed, the balance cannot be retrieved, or no stocks qualify, doing nothing is a legitimate outcome.
The goal is not to maximise the number of trades. It is to execute the strategy only when its required conditions are satisfied.
What else to explore
If you want to experiment with these ideas, try the following:
- Write a function that returns
(True, "reason")or(False, "reason"). tuple[bool, str]– a Python type annotation describing a pair containing a Boolean and a string.now.weekday()– returns the day of the week as a number, from 0 (Monday) to 6 (Sunday).- Use
tryandexceptto handle external API failures. - Create tests for weekends, holidays, missing data and database errors.
- Explore the circuit-breaker pattern in Java using Resilience4j.
If you come from a Java and Spring Boot background, the circuit-breaker pattern will look familiar. It addresses a related problem: preventing an application from repeatedly depending on an external service that is currently failing.
Today's numbers
The preflight process determines whether the bot is allowed to begin its daily trading cycle.
If a mandatory check fails, the process stops before any stocks are screened.
Sometimes the best trade a bot can make is no trade at all.
Follow the experiment live: the full record is on the dashboard at niftyexperiment.com.
More from the experiment
- Previous daily post: AI trading bot on NSE: 11 November 2026 daily paper results
- All weekly summaries from the AI trading bot
- All daily reports from the AI trading bot
Where the information came from
Headlines come from Google News and prices and volume from Yahoo Finance. A star marks a headline the AI cited as the basis of its rating.
BAJFINANCE (Bajaj Finance Ltd.)
- ★ India's Bajaj Finance launches over $1 billion share sale to institutional investors (Reuters, 11 Nov)
- Stocks to watch: Bajaj Finance, GRSE, LIC, Meesho, ITC, Tata Investment (Business Standard, 12 Nov)
- Buzzing stocks: Bajaj Finance, Tata Power, Adani Enterprises, Sandur Manganese, Alivus Life, Aurobindo Pharma (BusinessLine, 12 Nov)
- Bajaj Finance Said Set to Launch Up to $1.2 Billion Share Sale (Bloomberg.com, 11 Nov)
- ★ Bajaj Finance issues 5.74 cr warrants to promoter for Rs 5,799 cr (TradingView, 12 Nov)
HDFCLIFE (HDFC Life Insurance Company Ltd.)
- HDFC Life to approve terms for Rs 500 crore subordinated NCD issuance (scanx.trade, 11 Nov)
- HDFC Life (HDFCLIFE) Share Price Today (BSE), Market News (TechGraph, 9 Nov)
- HDFC Life schedules investor meets in Mumbai and Dubai from Nov 16 to 30 (scanx.trade, 10 Nov)
- HDFC Life Insurance Company Ltd is Rated Sell (MarketsMojo, 9 Nov)
- ★ HDFC Life Strengthens Position Among Street Favourites After Robust October Growth; Axis Max Life Follows (NDTV Profit, 12 Nov)
BAJAJFINSV (Bajaj Finserv Ltd.)
- ★ Bajaj Finserv subscribes to warrants issued by Bajaj Finance at Rs 1,010/ warrant aggregating to Rs 5,800 cr (TradingView, 12 Nov)
- ★ Bajaj Finance allots Rs 5,800 crore warrants to Bajaj Finserv; looks to raise another Rs 11,700 crore via QIP (Fortune India, 11 Nov)
- Bajaj Finance launches Rs 11,700 crore QIP at 5% discount to closing price (Business Standard, 11 Nov)
- Bajaj Finserv subscribes to warrants issued by Bajaj Finance at Rs 1,010/ warrant aggregating to Rs 5,800 cr (BusinessLine, 10 Nov)
- Bajaj Finance Allots Rs 5,800 Crore Warrants to Bajaj Finserv (Multibagg AI, 10 Nov)
CHOLAFIN (Cholamandalam Investment and Finance Company Ltd.)
- ★ Cholamandalam Investment & Finance Plans Rs 5,000 Crore QIP (Multibagg AI, 9 Nov)
- P N Vasudevan Appointed Chief Executive Officer of Unico Housing Finance (https://hrtoday.in/, 10 Nov)
- ★ Cholamandalam Share Price: 15.8% CAGR vs PNB Housing (Univest, 11 Nov)
- Business, Technology, Finance and Sport Leaders Come Together at CNBC-TV18 IBLA 2026 Jury to Discuss India’s AI Edge (MediaNews4U, 10 Nov)
- Aditya Birla Capital, Poonawalla Fincorp, PNB Housing shares among JM's top NBFC picks (Business Today, 11 Nov)
AXISBANK (Axis Bank Ltd.)
- REG - Axis Bank Ltd Axis Bank Ltd (AXBA) - Updates (TradingView, 11 Nov)
- Axis Bank schedules investor meetings in Mumbai and Singapore for Nov 16-19 (scanx.trade, 11 Nov)
- Rupee at seven-month high of 93.69; Axis Bank retains Rs 100 target for June 2027 (BusinessLine, 11 Nov)
- ★ NIFTY Bank reclaims 61,000: HDFC Bank, Axis Bank, Federal Bank, other banking stocks rally up to 6%; here's why (Upstox, 11 Nov)
- Axis Bank’s ‘open ki aadat’ campaign uses creators to showcase its mobile banking app (ET BrandEquity, 11 Nov)
TMCV (Tata Motors Ltd.)
- ★ Tata Motors and Iveco Group Come Together to Build for the Future (The Tata group. Leadership with Trust., 12 Nov)
- ★ Tata Motors Partners with Turno for Customized Financing and 25% Assured Buyback on Electric SCVs and Pickups (Telugu Times, 11 Nov)
- Tata Motors Passenger Vehicles to host analyst meetings on November 16 (scanx.trade, 11 Nov)
- ★ Tata Motors partners with Turno to offer financing schemes, 25% assured buyback for electric CVs (ET Auto, 11 Nov)
- ★ Tata Motors Partners with Finzo EV Solutions to Offer Financing, 25% Buyback Guarantee on Electric Commercial Vehicles – India Business Trade (India Business Trade, 11 Nov)
SHRIRAMFIN (Shriram Finance Ltd.)
- ★ Shriram Finance pays Rs 6.50 interim dividend for FY26 (scanx.trade, 9 Nov)
- Bajaj Finance Share Price: 13.0% CAGR vs Chola, Shriram (Univest, 11 Nov)
- ★ Shriram Finance Limited (NSE:SHRIRAMFIN) Pays Rs 6.50 Interim Dividend for FY 2026-27 Ahead of Deadline (Kalkine India, 10 Nov)
- Buy, Sell Or Hold: Divi's Labs, Tata Power, Kalyan Jewellers, Reliance Industries, L&T And Shriram Finance — Ask Profit (NDTV Profit, 9 Nov)
- ★ Shriram Finance stock pays INR 6.50 interim dividend (ad-hoc-news.de, 10 Nov)
POLYCAB (Polycab India Ltd.)
- ★ Polycab crosses 6 GW in solar inverter shipments, plans 500 kW utility-scale launch next year (pv magazine India, 11 Nov)
- Polycab India Ltd is Rated Hold by MarketsMOJO (MarketsMojo, 9 Nov)
- Six powerful stocks fell by up to 44%, generated up to 3000% returns in 5 years: Know details (News9live, 11 Nov)
- Laser Power & Infra Ltd (LASERPOWER) Share Price (Business Today, 12 Nov)
- 3 Indian Companies with Semiconductor Exposure and Large Order Books (The Financial Express, 11 Nov)
ENRIN (Siemens Energy India Ltd.)
- Earnings call transcript: Siemens Energy shares jump on record Q4 2026 results (Investing.com, 11 Nov)
- Siemens Energy AG (SMEGF) (Q4 2026) Earnings Call Highlights: Record Results, EUR164 Billion ... (Yahoo Finance, 12 Nov)
- Grid equipment backlogs grow across manufacturers (Transformer Magazine, 11 Nov)
- Earnings call transcript: Siemens Energy posts record FY 2026, shares rise 7.8% (Investing.com UK, 11 Nov)
- Samir Arora-backed Helios Flexi Cap Fund increases stake in Eternal, ICICI Bank, MCX, and 7 others in Octo (The Economic Times, 10 Nov)
ITC (ITC Ltd.)
- Stocks to watch: Bajaj Finance, GRSE, LIC, Meesho, ITC, Tata Investment (Business Standard, 12 Nov)
- ★ ITC shares in focus amid reports of cigarette price hikes; here is what we know so far (Upstox, 12 Nov)
- Corporate Diwali Parties: Can Businesses Claim ITC on Festive Celebrations? (CAclubindia, 12 Nov)
- ★ ITC shares in focus after it raises Gold Flake cigarette prices for the second time this year (CNBC TV18, 12 Nov)
- Why ITC's cigarette biz may remain under pressure in H2FY27 (Rediff, 11 Nov)
How these numbers are measured
- Gross: before brokerage, taxes and slippage, which are not modelled yet.
- R: profit or loss divided by the amount risked at the stop-loss (a stop-loss hit is about −1.00R, and a little worse if the price jumps past the stop-loss before it can be sold).
- Exit time: the minute in which the stop-loss or target was touched; trades that touched neither are sold at the 3:15 PM close.
- Nifty 50: price index, from the moment the bot starts (about 09:35 IST) to 15:15 IST. The bot's percentage is on its whole starting balance, so the two are not like-for-like.
Simulation notice: this is a paper-trading experiment with fake money. No real orders are placed. All results are gross, before brokerage, taxes and slippage, and a few days of results prove nothing. Nothing here is investment advice or a recommendation to buy or sell any security; stocks named are examples from the simulation. This post was written by an AI from the app's recorded data, and the tables are produced directly from the database.
Comments
Post a Comment