CANSLIM_SERVER is the backend server for the CANSLIM Calculator application, designed to implement the investment principles from "How to Make Money in Stocks Getting Started: A Guide to Putting CAN SLIM Concepts into Action" by Matthew Galgani. The server handles requests from the front-end, fetches data from external APIs, processes it, and sends back the necessary information to evaluate the investment potential of stocks based on the CAN SLIM criteria.
- Website: CANSLIM Calculator
- Frontend Repository: CANSLIM Frontend
- Server Repository: CANSLIM Server
This server is developed using Express.js on Node.js and handles the backend operations of the CANSLIM Calculator.
The CANSLIM Calculator evaluates stocks based on the following criteria, each derived from the CAN SLIM methodology:
- Composite Rating: An overall rating combining several fundamental and technical factors, targeting a score of 95 or higher.
- EPS Rating: Earnings Per Share rating of 80 or higher.
- EPS Growth: Growth in EPS of 25% or higher in recent quarters.
- Accelerating Earnings Growth: Evidence of accelerating earnings growth.
- Average Annual EPS Growth: An average annual EPS growth of 25% or more over the last 3 years.
- Sales Growth: Sales growth of 20%-25% or higher in the most recent quarter.
- Return on Equity (ROE): ROE of 17% or higher.
- SMR Rating: Sales + Margins + Return on Equity rating of A or B.
- Increase in Funds Ownership: Increase in the number of institutional funds owning the stock.
- Accumulation/Distribution Rating: Rating of A, B, or C, indicating the buying and selling activity of institutional investors.
- Relative Strength Rating: Measures a stock's price performance relative to all other stocks, targeting a high rating.
- Current Share Price: Share price above $15.
- Average Daily Volume: Average daily trading volume of 400,000 shares or more.
- Breaking Out of Sound Base: Stock breaking out of a sound base or an alternative buy point.
- Volume Above Average on Breakout: Volume at least 40% to 50% above average on breakout.
- Relative Strength Line in New High Ground: Indicates if the relative strength line is in new high ground.
- Within Buy Point: Stock price within 5% of the ideal buy point.
This server is intended for personal and educational use only. Commercial use of this code is not permitted. While I welcome comments and suggestions for improvement, I ask that you do not copy or redistribute the code or the core ideas without my consent.
To install and run the server locally, follow these steps:
- Clone the repository:
git clone https://github.com/simy46/CANSLIM_SERVER.git
cd CANSLIM_SERVER- Install the dependencies:
npm install- Start the server:
npm startFor development purposes, you can use the following command to start the server with nodemon:
npm run devAll server-side HTTP errors and runtime exceptions are sent through one centralized function:
notifyServerError(...)inservices/errorAlert.js
This is wired in:
- Route-level catches/validation errors (
server.js) - Global Express error middleware (
middlewares/errorHandler.js) - Process-level events (
uncaughtException,unhandledRejection) inindex.js
Error alerts are always enabled and use:
TELEGRAM_BOT_TOKENTELEGRAM_CHAT_ID
This project includes two lightweight SEO monitoring jobs designed for Heroku Scheduler (not always-on workers).
npm run seo:daily: health checks for core pages,robots.txt, andsitemap.xmlnpm run seo:weekly: daily checks + weekly Search Console insights (when configured)npm run seo:dry-run: local test mode (prints report and skips Telegram send)
- Check-path URLs status, response time, and content-type sanity
llms.txtreachability + minimum content length sanityrobots.txtSitemap directivesitemap.xmlXML validity, URL count, and required URL coverage (indexable pages only)- Weekly mode: GSC 7-day vs previous 7-day query/page insights (optional)
- Weekly mode: GA4 7-day vs previous 7-day traffic/performance signals (optional)
Copy .env.example and set at least:
TELEGRAM_BOT_TOKENTELEGRAM_CHAT_ID
All non-secret defaults are centralized in:
consts/seo.js
Only add overrides in .env when you intentionally want non-default behavior.
Optional GSC variables:
GSC_PROPERTYGOOGLE_CLIENT_EMAILGOOGLE_PRIVATE_KEY
If GSC variables are missing, weekly job still runs and reports GSC not configured.
Optional GA4 variable:
GA4_PROPERTY_ID(usesGOOGLE_CLIENT_EMAIL+GOOGLE_PRIVATE_KEYalready configured above)
If GA4 variables are missing, weekly job still runs and reports GA4 not configured.
Optional reliability variables:
SEO_FAIL_ON_TELEGRAM_ERROR=trueto fail the job if Telegram send failsSEO_HTTP_TIMEOUT_MS,SEO_ALERT_RESPONSE_MSto tune checksSEO_LOW_CTR_THRESHOLD,SEO_MIN_IMPRESSIONS_FOR_OPPORTUNITY,SEO_MAX_ACTION_ITEMSfor weekly insights
npm run seo:dry-run
npm run seo:daily
npm run seo:weekly
npm testIn Heroku dashboard:
- Install Heroku Scheduler add-on.
- Add config vars from
.env.example. - Create scheduler jobs:
npm run seo:daily
npm run seo:weeklySuggested cadence:
seo:daily: every dayseo:weekly: once per week
SEO WEEKLY REPORT
Environment: production
Run ID: 6b6f2c52-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Overall: WARN
Site: https://www.canslimcalculator.com
Daily checks:
- Paths: pass 6, warn 1, fail 0
- Avg response: 412ms
- llms.txt: PASS (482 chars)
- robots.txt: PASS
- sitemap.xml: PASS (38 URLs)
Weekly insights:
- GA4: configured (2026-02-28 to 2026-03-06)
Basic traffic stats:
- Sessions: 842 (+9.10% vs prev 7d)
- Total users: 601 (+6.22%)
- New users: 280 (+4.48%)
- Page views: 1922 (+11.00%)
- Conversions: 14 (+7.69%)
- Engagement rate: 57.10% (+1.90 pts)
- Avg session duration: 73.40s (+3.20s)
Strong signals:
- Organic search sessions: 476 (+12.80%), share 56.53%
- Top country: 🇺🇸 United States (390 sessions, 282 users, 58.1% eng.)
- Top countries this week:
- 🇺🇸 United States: 390 sessions, 58.1% eng.
- 🇨🇦 Canada: 210 sessions, 54.3% eng.
- GSC: configured (2026-02-28 to 2026-03-06)
- Top gaining queries: 5
- Top losing queries: 3
- Low CTR opportunities: 4
Next actions:
- Rewrite title/meta for query \"canslim calculator\" (impressions 1432, CTR 0.9%).
- Improve response time on /market-news.
The server provides several endpoints to interact with the front-end application. These include fetching stock data, processing CANSLIM criteria, and more. Detailed documentation of the endpoints will be provided in future updates.
Feedback and suggestions are highly encouraged! Please feel free to open issues or pull requests on the project's GitHub repository.
This project is a personal academic exercise and is not affiliated with any company or professional entity, including Yahoo Finance or Matthew Galgani. The results provided by the algorithm should be viewed as educational insights rather than professional investment advice. Always perform your own due diligence before making any investment decisions.