An investment assistant in your pocket and in the cloud:
- Always monitoring your existing investments for risks and surprises
- Periodically scanning the markets for new opportunities
- Suggesting new investments, based on your criteria, when capital is available
- And executing trades upon user approval
Business model
-
Subscription-based
-
Features for premium subscription?
- redundant / HA setup
- voting logic before executing trades
Product
Jobs to be done:
Understand and evaluate this product
Landing page with images
Demo env
- pull pre-baked data or rely on paper trading account ?
- set up strategy
- replay series
- show events
Set up account and fund
Identify investments
- Start from the universe of all investments
- Narrow down by sector, theme, performance
- Compare alternatives/candidates/companies
- Invest
- Let assistant monitor your investments and notify of significant changes
Know when conditions “change"
"Change” has different meaning for each investor, need to be customizable
Features
Whole-market metrics
- Change in total capitalization
- Shiller P/E
- Total earnings
- Total P/E
- Total FCF ??
Historical prices
- zoomable OHLC chart
Example: https://github.com/leeoniya/uPlot/blob/master/demos/candlestick-ohlc.html
Investment strategies
- Store rules locally
- Edit at the bottom of chart (for now)
Positions
- ticker
- margin to nearest guardrail
- color-coded based on margin
- height proportional to amount invested?
- performance relative to market : https://www.morningstar.com/markets
New opportunities
- Screener (external system? ) sending updates to this component
- Opportunities listed in main page with overall score
- Can be expanded with quick company summary and key metrics
Fundamentals view
- usual stats (PE, PS, …)
- x-y chart with cash flow and growth
- background of chart shows dots for total market
- hovering on dots show some representative companies (find a proxy for “well known”)
Editing rules
- each rule had a unique ID. UUID v4 for simplicity
- upsert_rule() method to submit the single new / modified rule to the engine
- check_rule() method to test validity and report to UI any issues
UX awesomeness
- For every rule, calculate how close it is to trigger. Show indication in UI
User / group notifications
- Send notification when a rule triggers
- and when a trade executes
- Summary message at end of day?
https://ajlopez.wordpress.com/2015/02/06/enviando-mensaje-a-slack-con-javascriptnode-js/
Web UI to monitor and edit strategies
Mobile app for simplified view and critical notifications
Strategies to support
Globally-optimized portfolio
See separate note
Broad market, dynamic allocation
- Change the allocation between equities and cash equivalent based on Schiller P/E value
Asset class rotation
https://novelinvestor.com/asset-class-returns/
Sector rotation
https://novelinvestor.com/sector-performance/
Buy quality + value
Whenever new funds available in the account, above a threshold:
- Filter companies by score
- Invest in the N most undervalued (by P/E, below a threshold)
Hand-pick investments
- Search companies
- Filter by fundamental and technical indicators
- Batch buy
Legal
Disclaimer : not to be construed as investment advice, investment strategies are chosen by the user
Liability
Determine liability due to:
- Incorrect market data
- Failure to notify user
- Failure to execute trade after it’s been approved by the user
Architecture
JITA : Just-In-Time Architecture
-
Enough complexity to handle the current product’s use cases.
-
Plan for evolution but don’t over-engineer
-
Start with web UI, not mobile
-
Data pipeline and analytics DB are co-located until that causes performance bottleneck and/or availability risk
Longer term
- Run on isolated Firecracker VMs, one per user (single tenant ⇒ higher security)
- Support subscription model
Open issues
- management of secrets / keys ?
- solution from cloud provider. See how it can be tied to auth / identity service
Tech - Web UI
svelte UI - webview
https://developer.chrome.com/docs/multidevice/webview/gettingstarted/
eCharts
- time series
- charts with confidence bands
- radar (esp. when comparing)
- sankey
- streak on calendar view
- tree map
https://echarts.apache.org/v4/examples/en/index.html
Svelte, data table and store
https://italo-silva.medium.com/svelte-how-to-create-a-dynamic-table-component-1c7d33a307e3
Tech - App backend
- Per-user
- Running in a microVM (Firecracker-based)
- With user profile DB (local Sqlite) replicated off-site
- With company-data DB shared across instances
Scalable, fully-isolated infra
with scale to zero and fast starts
https://fly.io/blog/fly-machines/
Sortable unique IDs
- UUID v7
https://buildkite.com/blog/goodbye-integers-hello-uuids
- timestamp as float64 + random int64 https://www.leebutterman.com/2021/02/01/store-your-unix-epoch-times-as-float64.html
https://github.com/segmentio/ksuid https://github.com/novemberborn/ksuid
Mostly-read-only DB for stock screener
https://www.sqlitetutorial.net/sqlite-nodejs/query/
Tech - data pipeline
Start simple, make it progressively more complex
-
Metaflow running locally
-
Metaflow on single instance, where pipeline is triggered by GitHub Actions
-
GH Actions also used to drive acceptance test (same pipeline processing a subset of entities and writing output to
<branch>
instead of prod /main
destination) -
Ingest into analytics DB only what has changed from previous run
Tech - future mobile UI
Flutter?
Candlestick (syncfusion) chart
https://www.syncfusion.com/flutter-widgets/flutter-charts/chart-types/candle-chart
Local and push notifications
https://pub.dev/packages/awesome_notifications
Local notifications
https://blog.logrocket.com/implementing-local-notifications-in-flutter/
Home widget
https://pub.dev/packages/home_widget/example
Svelte + Capacitor?
https://github.com/drannex42/svelte-capacitor
- YUCK: uses whole Android Studio to build pkg
- 16GB machine freezes during build
Android only, Kotlin?
App + websockets + chart
https://github.com/MohitMandalia/AirQualityVisualizer
https://github.com/therajanmaurya/Stock-Hawk
Mobile home screen widget
https://github.com/premnirmal/StockTicker
native UI - charts
https://github.com/AnyChart/AnyChart-Android
notifications with locked screen
https://developer.android.com/guide/topics/ui/notifiers/notifications
Data sources
http://www.columbia.edu/~tmd2142/best-6-stock-market-apis-for-2020.html
Robinhood realtime data
https://github.com/sanko/Robinhood
Tradier
https://documentation.tradier.com/brokerage-api
Rate limits: https://documentation.tradier.com/brokerage-api/overview/rate-limiting
TradingView
https://github.com/Mathieu2301/Tradingview-API
Misc APIs
https://rapidapi.com/collection/tradingview-api
FinViz
Finnhub.io
Simfin
Https://SimFin.com Company fundamentals
IEXCloud
Deployment
Serving DL models
https://github.com/pytorch/serve
https://medium.datadriveninvestor.com/deploy-your-pytorch-model-to-production-f69460192217
Launch
Blog posts to introduce project
What is it?
- Investment assistant
- Solo developer
- Calm SaaS
- What we’ll cover next (link to 2 articles below as they are published)
Data pipeline
- Design goals: low cost, high developement velocity
- Overview
- Ingestion
- Analytics DB
- Support for data science
App and trading engine
- Design goals: robust, high dev efficiency
- Overview
- Frontend, Svelte
- Backend, data streams, realtime updates, trade execution