You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the app that helps in analysing the market, generate automated reports and send news on subscribers' mails about tickers they are subscribed on
Acknowledgements
NestJS Framework - A progressive Node.js framework for building efficient and scalable server-side applications
Prisma ORM - Next-generation ORM for Node.js and TypeScript
React - JavaScript library for building user interfaces
OpenAI API - AI-powered market analysis and report generation
Environment Variables
To run this project, you will need to add the following environment variables to your .env file
All authenticated endpoints require a valid JWT token in the Authorization header.
Usage Examples
Start the Application
npm install
npm run start:dev
Example: Get All Watchlists
GET /api/watchlistAuthorization: Bearer <your_token>
Example: Create a Report
POST /api/reportAuthorization: Bearer <your_token>Content-Type: application/json
{
"title": "Weekly Market Overview",
<!-- Either tickers or watchlistId must be provided -->"tickers": ["AAPL", "GOOGL"],
"watchlistId": "your_watchlist_id"
}
Example: Add Ticker to Watchlist
POST /api/watchlist/{id}/tickersAuthorization: Bearer <your_token>Content-Type: application/json
{
"ticker": "MSFT"
}
Subscriber
Get current subscriber
GET /api/subscriber/me
Header
Type
Description
Authorization
string
Required. Bearer token
Get subscriber by ID
GET /api/subscriber/${id}
Parameter
Type
Description
id
string
Required. ID of subscriber to fetch
Create subscriber
POST /api/subscriber
Header
Type
Description
Authorization
string
Required. Bearer token
Body Parameter
Type
Description
displayName
string
Optional. Display name (max 100 chars)
Update subscriber
PATCH /api/subscriber
Header
Type
Description
Authorization
string
Required. Bearer token
Body Parameter
Type
Description
displayName
string
Optional. Updated display name
Delete subscriber
DELETE /api/subscriber
Header
Type
Description
Authorization
string
Required. Bearer token
Watchlist
All watchlist endpoints require authentication.
Get all watchlists
GET /api/watchlist
Header
Type
Description
Authorization
string
Required. Bearer token
Get watchlist by ID
GET /api/watchlist/${id}
Parameter
Type
Description
id
string
Required. ID of watchlist to fetch
Header
Type
Description
Authorization
string
Required. Bearer token
Create watchlist
POST /api/watchlist
Header
Type
Description
Authorization
string
Required. Bearer token
Body Parameter
Type
Description
name
string
Required. Watchlist name (2-50 chars)
Update watchlist
PUT /api/watchlist/${id}
Parameter
Type
Description
id
string
Required. ID of watchlist to update
Header
Type
Description
Authorization
string
Required. Bearer token
Body Parameter
Type
Description
name
string
Required. Updated watchlist name (2-50 chars)
Add ticker to watchlist
POST /api/watchlist/${id}/tickers
Parameter
Type
Description
id
string
Required. ID of watchlist
Header
Type
Description
Authorization
string
Required. Bearer token
Body Parameter
Type
Description
ticker
string
Required. Ticker symbol (uppercase, max 10 chars)
Remove ticker from watchlist
DELETE /api/watchlist/${id}/tickers
Parameter
Type
Description
id
string
Required. ID of watchlist
Header
Type
Description
Authorization
string
Required. Bearer token
Body Parameter
Type
Description
ticker
string
Required. Ticker symbol to remove
Delete watchlist
DELETE /api/watchlist/${id}
Parameter
Type
Description
id
string
Required. ID of watchlist to delete
Header
Type
Description
Authorization
string
Required. Bearer token
Market
Get market data
GET /api/market?ticker=${ticker}
Retrieves cached market data from database (fast).
Query Parameter
Type
Description
ticker
string
Required. Stock ticker symbol
Sync market data
POST /api/market/sync?ticker=${ticker}
Fetches fresh data from external API and saves to database (slow, deliberate).
Query Parameter
Type
Description
ticker
string
Required. Stock ticker symbol
Notification
All notification endpoints require authentication.
Get all notifications
GET /api/notification
Header
Type
Description
Authorization
string
Required. Bearer token
Get notification by ID
GET /api/notification/${id}
Parameter
Type
Description
id
string
Required. ID of notification to fetch
Header
Type
Description
Authorization
string
Required. Bearer token
Create notification
POST /api/notification
Header
Type
Description
Authorization
string
Required. Bearer token
Body Parameter
Type
Description
title
string
Required. Notification title
message
string
Required. Notification message
tickers
string[]
Optional. Array of ticker symbols if no watchlistId is provided
watchlistId
string
Optional. Associated watchlist ID if no tickers are provided
Update notification
PATCH /api/notification/${id}
Parameter
Type
Description
id
string
Required. ID of notification to update
Header
Type
Description
Authorization
string
Required. Bearer token
Body Parameter
Type
Description
title
string
Optional. Updated title
message
string
Optional. Updated message
tickers
string[]
Optional. Updated array of tickers
Delete notification
DELETE /api/notification/${id}
Parameter
Type
Description
id
string
Required. ID of notification to delete
Header
Type
Description
Authorization
string
Required. Bearer token
Report
All report endpoints require authentication.
Get all reports
GET /api/report
Header
Type
Description
Authorization
string
Required. Bearer token
Get report by ID
GET /api/report/${id}
Parameter
Type
Description
id
string
Required. ID of report to fetch
Header
Type
Description
Authorization
string
Required. Bearer token
Create report
POST /api/report
Header
Type
Description
Authorization
string
Required. Bearer token
Body Parameter
Type
Description
title
string
Required. Report title
tickers
string[]
Optional. Array of ticker symbols if no watchlistId is provided
watchlistId
string
Optional. Associated watchlist ID if no tickers are provided
Update report
PATCH /api/report/${id}
Parameter
Type
Description
id
string
Required. ID of report to update
Header
Type
Description
Authorization
string
Required. Bearer token
Body Parameter
Type
Description
title
string
Required. Updated report title
tickers
string[]
Optional. Updated array of tickers
Delete report
DELETE /api/report/${id}
Parameter
Type
Description
id
string
Required. ID of report to delete
Header
Type
Description
Authorization
string
Required. Bearer token
Appendix
Authentication
All authenticated endpoints require a valid JWT token obtained from your authentication provider. Include the token in the Authorization header as: Bearer <your_token>
Rate Limiting
API endpoints are cached for 300 seconds (5 minutes) to optimize performance and reduce database load.
Ticker Symbol Format
Ticker symbols must be uppercase letters/numbers (A-Z, 0-9) and up to 10 characters long. Examples: AAPL, GOOGL, MSFT
Error Handling
The API returns standard HTTP status codes:
200 OK - Successful GET/PATCH requests
201 Created - Successful POST requests
204 No Content - Successful DELETE requests
400 Bad Request - Invalid request data
401 Unauthorized - Missing or invalid authentication