Coding with Mohit
Open in Telegram
702
Subscribers
+124 hours
+37 days
+730 days
Posts Archive
This keeps the game logic and rating logic separate, allowing the rating system to be improved independently from the Telegram bot.
Current Design Philosophy
The rating system is a custom analytical model and not an official ICC rating.
The purpose is to create a consistent numerical representation of player performance for use inside the cricket draft game.
The model is designed to be configurable so that benchmarks, component weights, eligibility requirements and normalization methods can be improved as more player data is evaluated.
A future version can additionally use the complete Test/ODI player population to calculate statistical distributions and percentile-based normalization instead of relying primarily on manually configured benchmark anchors.
Future Expansion
The architecture is designed to support additional cricket competitions and rating models.
Potential extensions include:
IPL ratings
T20 international ratings
Additional domestic leagues
Season-specific ratings
Current-form ratings
Head-to-head comparisons
Player ranking endpoints
Squad comparison APIs
Draft-specific scoring
Historical player ratings
The API therefore acts as an independent cricket performance/rating service that can be consumed by the Telegram bot or any other application.
Player Name
β
ICC Player Search
β
ICC Player ID
β
Player Detail API
β
Statistics
β
Rating Engine
This makes the API easier to use for external applications such as Telegram bots, websites, games, dashboards and other cricket projects.
Name Normalization
The API also handles common URL formats such as:
virat-kohli virat+kohli Virat KohliThe input is normalized before searching the ICC feed so that URL formatting does not prevent player resolution. Caching Player data is cached internally to reduce unnecessary requests to the external ICC API. Once a player's data has been fetched, subsequent requests can reuse the cached data until the configured cache lifetime expires. This reduces: External API requests Response latency Unnecessary repeated player searches Dependency on repeated external calls Error & Eligibility Handling The API handles cases such as: Invalid format Invalid position Player not found Format statistics unavailable Insufficient bowling data Insufficient sample size Invalid or missing statistical values Instead of silently producing a misleading rating, the API can mark a player as ineligible and provide an explanation. Technology Stack Backend Node.js Express.js JavaScript ES Modules Native
fetch
Data Source
ICC Sportz player data feed
Architecture
The project is divided into separate layers:
src/
βββ server.js
βββ routes.js
β
βββ config/
β βββ constants.js
β βββ env.js
β βββ weights.js
β
βββ services/
β βββ icc.js
β βββ player-service.js
β βββ data-extractor.js
β
βββ rating/
β βββ engine.js
β βββ batting.js
β βββ bowling.js
β βββ wicketkeeper.js
β βββ fielding.js
β βββ normalizer.js
β
βββ utils/
βββ number.js
βββ cache.js
The separation between data fetching, data extraction, rating calculation and API routing makes the system easier to maintain and extend.
Example Response
A successful request can return:
{
"player": {
"id": "3676",
"name": "MS Dhoni",
"fullname": "Mahendra Singh Dhoni",
"nationality": "India",
"role": "wicketkeeper"
},
"format": "odi",
"position": "wk",
"rating": 9.77,
"scale": 10,
"eligible": true,
"notes": [],
"metadata": {
"matches": 350,
"battingInnings": 297,
"bowlingInnings": 2,
"catches": 321,
"stumpings": 123,
"runOuts": 22
}
}
Why This API Was Built
The API was created as the backend rating engine for a Telegram cricket draft game.
The planned game allows users to:
Select cricket players
Build their own squads
Participate in Test, ODI and IPL drafts
Challenge other users
Compare player performances
Earn points based on player ratings
Compete on a global leaderboard
Instead of manually assigning arbitrary player scores inside the Telegram bot, the bot can request a player's rating from this API.
For example:
Telegram Bot
β
User selects Virat Kohli
β
Bot requests:
/rating/virat-kohli/odi/bat
β
CWM Cricket Rating API
β
ICC player data
β
Rating Engine
β
8.xx / 10
β
Telegram DraftCWM Cricket Rating API
CWM Cricket Rating API is a custom Node.js-based cricket player rating API built to calculate performance ratings for cricket players using real player statistics from the ICC Sportz data feed.
The API was originally developed as the rating engine for a Telegram-based cricket draft game, where users can create squads, compare players, and compete against other users based on player performance.
What the API Does
The API accepts a player's name, cricket format, and playing position and returns a calculated performance rating on a 0β10 scale.
Example:
GET /api/rating/virat-kohli/odi/bat
The API internally:
Resolves the player name through the ICC player search API.
Retrieves the player's unique ICC player ID.
Fetches the player's detailed statistical data.
Extracts the required format-specific statistics.
Calculates performance metrics.
Normalizes those metrics against configurable benchmarks.
Calculates the final position-specific rating.
Returns the rating together with player information, eligibility and statistical metadata.
Supported Formats
Test Cricket
Test ratings are calculated independently from ODI ratings using Test-specific statistics and normalization benchmarks.
ODI Cricket
ODI ratings use ODI-specific career statistics and benchmarks.
IPL
The IPL system is planned as a separate rating model because the ICC international player feed used for Test/ODI ratings is not the source for IPL statistics. IPL data therefore requires its own player dataset/data source and separate rating logic.
Supported Positions
The API supports:
BAT β Batter
BALL β Bowler
WK β Wicketkeeper
FIELD β Fielding
ALL β Overall/All-round performance
The system does not use one generic formula for every player. Each position has its own rating model.
Batting Rating
The batting model considers multiple performance indicators, including:
Batting average
Runs per innings
Strike rate
Hundreds
Fifties
High score
Batting consistency
Career/sample longevity
These metrics are normalized and combined to produce a batting rating out of 10.
Bowling Rating
The bowling model uses statistics such as:
Bowling average
Bowling strike rate
Economy rate
Wickets per match
Five-wicket hauls
Ten-wicket hauls
Bowling consistency
Career/sample longevity
The API also includes eligibility checks so that players with insufficient bowling data are not incorrectly given a meaningful bowling rating.
For example, a player with only a few bowling innings can return:
{
"rating": null,
"eligible": false,
"notes": [
"insufficient ball data in ICC feed"
]
}
This prevents non-bowlers or players with extremely small bowling samples from receiving misleading ratings.
Wicketkeeping Rating
The wicketkeeping model evaluates available wicketkeeping statistics such as:
Catches
Stumpings
Dismissals per match
Stumping share
Wicketkeeping volume
Career/sample longevity
Only statistics actually available from the underlying data source are used.
Fielding Rating
The fielding model uses measurable fielding output from the ICC feed, including:
Catches
Run-outs
Dismissals
Fielding volume
Fielding output per match
Career/sample longevity
The system does not attempt to invent unavailable metrics such as dropped catches prevented, runs saved, or subjective fielding quality.
Overall Rating
The ALL position is not calculated as a simple average.
Different player types use different component weights.
For a wicketkeeper, for example:
55% Batting
25% Wicketkeeping
20% Fielding
For other roles, the weighting changes according to the player's role:
Batter β Batting + Fielding
Bowler β Bowling + Fielding
Wicketkeeper β Batting + Wicketkeeping + Fielding
All-rounder β Batting + Bowling + Fielding
This allows the API to evaluate players according to their actual cricketing role instead of treating every player identically.
Player Resolution
The public API does not require users to know ICC player IDs.
Instead, a request such as:
/api/rating/ms-dhoni/odi/wk
is converted internally into:+1
πββοΈ Baithe baithe kuchh bana liya, live kardu?
π As such kuchh khaas useful nahi hai....
π€― Render ke bhi Free services me limit hai..... Itna use ho gaya ki limit lag gayi π
π Ek aur chhota sa question:
βWhat is the difference between both:
git add --all
git add .
π Comment your answer (then isse related next question):π Agar fund karoge to live kar dunga.... kyunki abhi mai FREE access wali api ke liye inta paisa nahi daal sakta
+2
π Kal hi Fiverr pe account banaya aur unke automated system ne pata nahi kya detect karke account suspend kar diya, and mail karne par ye aaya unka response, "ok, just it as clinet.."
β€οΈβπ₯ https://amzn.in/d/03HJttfz
π₯ Redmi 17 5G, launched today! Kaisa hai? comments me batana zara π
π Finally! API fixed and also optimized the response from 30 secs to 0.3-0.4 secs π₯
π€ Live kardu?
π Finally! Guys, koi achha sa FREE INDIAN PROXY SITE jiske proxies ka uptime achha ho suggest karo, jaldi..........
