#5 - How to create an investment app using python
The Datapreneurs - Find new SaaS ideas to build with Python
If you’re an investor, especially a dividend investor, you know how important financial metrics are when evaluating stocks. Dividend yield, payout ratio, earnings per share, sector data—all these factors help you refine your investment choices to match your strategy. While spreadsheets or premium tools like Dividends.com or Simply Safe Dividends can assist, these options can be expensive.
So, what if you built your own dividend investment app? Today, I’ll walk you through how to create an investment app with essential features, such as :
a stock screener
and portfolio tracker
using a scalable tech stack.
ICP
Solo Dividend Investors
Our target is the solo dividend investor who’s looking for a personalised tool to track stocks and identify new dividend opportunities. With this focus, we’ll concentrate on features and workflows that provide value specifically for dividend-centered strategies.
Acquiring Your First Users
To build a user base, start small and targeted. Here are some community-driven channels to consider:
Facebook groups: Join dividend investing or finance-focused groups to share updates on your app.
Subreddits: Explore relevant subreddits like r/dividends or r/investing.
Finance forums: Look for forums dedicated to investing discussions.
Marketing influencers: Connect with finance influencers who can help you spread the word.
These communities can give you direct feedback on the app’s usefulness and help create early buzz.
Tech Stack
API for Financial Data: Intrinio Financial API
Data Pipeline:
OLTP (Online Transactional Processing)
OLAP (Online Analytical Processing)
Google Cloud Platform (GCP):
Cloud Functions: For serverless execution of specific tasks.
Cloud Run: To handle services that may need scaling and flexibility.
Pub/Sub with BigQuery Connector: For streaming data processing.
Cloud SQL: Managed PostgreSQL database for storing and serving data.
App Engine: For deploying the web application.
Programming Frameworks: Python and Django for the backend, allowing us to build a robust and secure app while maintaining simplicity.
Architecture Overview
To understand the architecture, here’s a simplified view of our data flow:
API => BigQuery => Cloud SQL => Backend (Python/Django) => Frontend
1. Fetching Financial Data
The app will connect to Intrinio’s API to retrieve stock metrics.
Instead of creating a complex streaming data platform right away, we’ll use a more affordable ELT (Extract, Load, Transform) approach.
In the future, you could consider integrating a streaming data pipeline with tools like Kafka or Dataflow to handle real-time data ingestion and transformation.
2. ELT Batch Pipeline
Extract: Financial data will be extracted from the Intrinio API.
Load: The data is then loaded into BigQuery, Google’s data warehouse, where we can store it for future analysis.
Transform: Using SQL in BigQuery, we perform the necessary transformations and aggregations to create meaningful metrics (like dividend yield, payout ratio, and EPS).
3. Data Transformation and Storage
BigQuery is set up with a DMT (Data Mart Transformation) layer, where we keep the transformed and aggregated data ready for use.
Using Pub/Sub with a BigQuery connector (configured with an Avro schema), we ensure fast extraction and transfer of data. This setup minimizes latency and allows for scalability as data volumes grow.
4. Storing Processed Data
Once transformed, the data is transferred from BigQuery to Cloud SQL, a managed PostgreSQL database by Google.
This database allows for easy and secure data management, making it ideal for serving data to the app.
5. Serving Data to the App
Using Django, the backend app pulls data from Cloud SQL and processes it as needed.
Our app will be deployed on Google App Engine, making it easy to scale as user demand grows.
6. Frontend Access
Users can interact with the app’s frontend, accessing features like stock filtering and portfolio tracking.
The app interface should be simple and intuitive, allowing users to view filtered stocks or monitor their portfolio in real-time.
Conclusion
Creating a custom dividend investment app is not only a practical solution for DIY investors but also a fun project to explore Python, Django, Data engineering and GCP’s cloud capabilities. With features like stock screening and portfolio tracking, you’ll have a powerful tool at your fingertips without the high cost of commercial investment platforms. So, roll up your sleeves and Launch it!