In my previous post discussing my foray into the world of AI, I mentioned working on a personal project called "Stockmantics". But what exactly is Stockmantics, and why did I decide to build it?
Stockmantics started because I needed a project where I could apply my AI knowledge to a real-world problem. In the end, I didn't have to look further than my own hobbies.
Aside from coding, I’ve become heavily invested (pun intended) in the stock market. It all started shortly after COVID, when there was so much buzz online about people putting money into companies and index funds. Seeing the returns made by those who invested at the right time (during the lockdown of March 2020) opened my eyes to a potential new income stream. I didn't want to miss out on the fun, so I decided to learn the ropes of an area I knew nothing about. I just didn't expect it to turn into a full-time hobby.
However, unlike most hobbies, I considered this one fraught with danger; one must err on the side of caution. After all, real money is at stake, and acting foolhardy or investing incorrectly can lead to significant losses.
The Requirement
When I became more confident in my investment strategy and the type of trader I wanted to be, I found one aspect consistently time-consuming: finding an easy-to-read daily digest in one place. I was tired of hopping from website to website or subscribing to endless newsletters just to get a clear picture.
So, with the help of AI, I decided to build a tool that would do this for me, and Stockmantics was born. My requirements were as follows:
- Market Snapshot: A quick look at key indices (S&P 500, FTSE 100, NASDAQ, Commodities, etc.).
- Daily Summary: A single, concise sentence summarising what happened that day.
- Global News: Key events from the USA, Europe, and Asia.
- Crypto Updates: High-level developments in cryptocurrency, focusing on the majors.
- Investor Action: A conclusion based on the day's news, suggesting what an investor should look out for.
- Smart Glossary: Tooltipped definitions for stock market, investment, and economic terms to assist novice investors (and provide a constant refresher for myself).
- Social-Media Integration: Automatic posting to X, highlighting key stories from the day's article.
My philosophy for this personal project is simple: if it assists my own needs, that is a big win in itself. If someone else finds my method of digesting the day's financial news useful, that will be the icing on the cake. I decided early on that the success of Stockmantics would not be measured by visitor numbers or X followers, but by what I learnt during the development process and whether it truly works for me.
Application Architecture
The application architecture is based on the following Microsoft technologies:
ASP.NET Core Razor Pages
The website is a relatively small and simple application that consisted of the following pages:
- Homepage
- Article Listing
- Article
- Generic Content (for About/Terms/Disclaimer pages)
A CMS wasn't needed as all content and data would be served from Azure Storage Tables. All there is from a content-management perspective is an authenticated "Article Management" area, where content generated by Gemini could be overridden when required.
Azure Storage Tables
I actively decided to use Azure Storage Tables over an SQL database to store all of the Stockmantics data as there was no relational element between each table. It also provided a lower cost alternative and quicker route to development.
List of tables:
- Article
- MarketSnapshot
- SocialShare
- StockmarketGlossary
- AppSetting
Azure Blob
For images that may be used in article content.
Azure Functions
All the grunt work getting the data is done by Timer Triggered Azure Functions that would fire shortly after the US Markets open (around midday GMT) in order to get the most up-to-date goings on in the market.
A breakdown of the Azure Functions are as follows:
- Generate News Article - queries stock market API's and news feeds to send to the Gemini API to construct an article tailored to my requirements. It is then stored in the Article table with related attributes and additional meta data suited to be served in a webpage.
- Generate Social Posts - extracts 10 key facts from the generated news article to be transformed into tweets. The days generated tweets are stored until pushed to social media platforms.
- Market Snapshot - uses the Yahoo Finance API to return the market price and percentage change for the core market indices. These values are then passed to the Gemini APIs "Grounding with Google Search" to provide sentiment and the reasons behind the change in price.
- Post To X - publishes a tweet every 15 minutes.
- Post To Bluesky - publishes a post every 15 minutes.
The Chosen AI Engine
It was always going to be a choice between Google Gemini and OpenAI. I was already familiar with both LLMs (Large Language Models), having casually thrown stock market queries at them—among other things—long before this project was even a glint in my eye. Ultimately, my decision hinged on two key factors:
- API: The ease of use and the reliability of the endpoints in returning structured data.
- Cost Factor: Being unfamiliar with the specific pricing structures of LLMs, I needed to estimate the cost per API call and project my monthly expenditure based on token usage. The OpenAI GPT API Pricing Calculator provided an excellent breakdown of costs across all major AI providers.
I concluded that Google Gemini was the best fit for Stockmantics, primarily because the model I intended to use (gemini-2.5-flash) offered the most competitive pricing. The cost for one million input and output tokens works out to approximately $0.37, compared to OpenAI's $2.00.
Furthermore, I felt that Gemini held a slight edge over OpenAI. They might have been late to the AI party, but they have certainly made up for lost time with impressive speed. It also had a card up its sleeve that I only discovered during development: Grounding with Google Search. This feature allows the model to access real-time information from the web, ensuring that the data returned is current rather than limited to a training cut-off date.
Misjudging the Machine: Data is King!
I initially was under the impression that I could simply ask the likes of OpenAI or Gemini to collate the day's stock market news, which I could then format to my liking. However, this proved to be a mistake. When dealing with fast-moving financial news, I found the results hit-and-miss. The models would frequently return information that was out of date or cite entirely incorrect market prices (even when using Grounding with Google Search).
At this point, I realised I needed to take a step back and reassess my approach. It became clear that without a reliable, accurate data feed, this application would be of no use to man nor beast.
The solution had to start with raw data, which the LLM could then use as its base to expand upon. For this, I found pulling financial data available through the likes of Yahoo Finance feeds to be invaluable, amongst other finance-related news feeds.
Lengthy Vetting Period
The transition from a proof-of-concept to the final version of Stockmantics required a lengthy vetting period, which continued weeks after releasing to live. The raw output from the LLM was rarely perfect on the first try, leading to a many iteratation of refinement. My focus was on four key areas:
- Structure & Flow: Tweaking the system instructions to ensure the output was digestible, preventing the model from generating dense, unreadable paragraphs.
- Sector Balance: Ensuring the article provided a holistic view of the market, rather than fixating solely on volatile tech stocks or the "Magnificent Seven".
- Glossary Precision: Fine-tuning the tooltips to provide definitions that were accessible to novices without losing technical accuracy.
- Geopolitical Neutrality: Ensuring that reports on world affairs, which often drive market sentiment were delivered with an objective and balanced tone.
What I learnt from this process is that while anyone can write a basic AI prompt, getting the granular nuances right takes a significant amount of time. It is less about coding and more about the art of communication; you have to learn how to speak the model's language to get the consistent, high-quality output you need. Even now, I find myself still making ongoing tweaks for further improvement.
If you compare the very first article published against one the more recent, I am hoping a vast difference will be noticed.
Breakdown of Costs
One of my main priorities was to keep the running costs on this project tight and I think things ended up being quite good on value. Here is a monthly breakdown:
- Website and Domain: £6.25
- Azure Services (Functions/Blob Storage/Tables): £1.10
- Google Gemini API: £4.00
So we're looking at around £11.35 in total monthly costs. Not bad. Google Gemini costs will be the only item that I expect to fluctute based on the varied number of tokens utilised for each daily article.
NOTE: Google Gemini and Azure services are only used weekdays for when the stock markets are open. So the costs are based on a 5 day week.
Conclusion
I am unsure what the long-term future holds for Stockmantics. Its lifespan ultimately depends on ongoing costs, maintenance effort, and whether I continue to find it useful for my own needs. However, for now, it serves a valuable purpose beyond just financial news: I have a robust, live application that acts as the perfect test bed for experimenting with new AI features and expanding my technical skillset.
Fortunately, thanks to various architectural decisions and efficiency improvements, the running costs are currently sustainable, and the site itself is very low maintenance—touch wood! I foresee that further development will only be required if the external APIs change. I have already paid for a years worth of web hosting until October 2026 and will reassess things closer to that date.
If you got this far, thank you for taking the time to read through the development process. If you are interested in seeing the final result, you can find all the links to Stockmantics below:












