An intelligent algorithm that automatically calculates the optimal bid price for OFS (Offer for Sale) by analyzing live market data from BSE India. Get real-time recommendations via Telegram notifications.
- Live Market Analysis: Scrapes real-time OFS bidding data from BSE India
- Intelligent Price Discovery: Finds the cut-off price where demand meets supply
- Optimal Bid Calculation: Recommends the next available price above cut-off for guaranteed full allocation
- Dual Scenario Analysis: Analyzes both base offering and green shoe option scenarios
- Telegram Notifications: Get instant updates when market conditions change
- Change Detection: Only notifies when subscription, bid price, quantity, or cost changes
- Fetch Live Data: Scrapes current bid data from BSE website every second
- Calculate Subscription Ratio:
Total Demand / Total Offered- < 1.0: Under-subscribed (everyone gets full allocation)
-
1.0: Over-subscribed (price-based allocation)
- Find Cut-off Price: The price where cumulative demand crosses total shares offered
- Bids above cut-off: 100% allocation
- Bids at cut-off: Partial allocation
- Bids below cut-off: No allocation
- Recommend Optimal Bid: Next available price from actual bid table above cut-off
- Monitor & Notify: Continuously monitors and sends Telegram updates on changes
Total Shares Offered: 40,58,325
Total Current Demand: 80,00,000 shares
Subscription Ratio: 1.97x (over-subscribed)
Cut-off Price: ₹280.00
- Demand above ₹280: 30,55,789 shares (gets full allocation)
- Demand at ₹280: 14,02,530 shares (partial allocation)
Recommended Bid: ₹280.05 (next price in bid table)
- Ensures full allocation
- Minimizes premium paid
- Python 3.8+
curlcommand (pre-installed on macOS/Linux)
- Clone the repository:
git clone https://github.com/yourusername/ofsTrader.git
cd ofsTrader- Create virtual environment:
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install beautifulsoup4 requests- Configure settings:
cp config.example.json config.json- Edit
config.jsonwith your details:
{
"telegram": {
"bot_token": "YOUR_BOT_TOKEN",
"chat_id": "YOUR_CHAT_ID"
},
"default_values": {
"investment_amount": 1900000,
"scrip_code": "500414",
"base_shares_offered": 4058325
}
}-
Create Bot:
- Message @BotFather on Telegram
- Send
/newbotand follow instructions - Copy the bot token
-
Get Chat ID:
- Start a chat with your bot
- Send any message
- Visit:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates - Find your
chat.idin the response
source venv/bin/activate
python ofs_pricing_algorithm.pyThe script will prompt you for:
- Investment amount (₹)
- BSE Scrip Code
- Base shares offered
- Telegram Chat ID
============================================================
OFS PRICING ALGORITHM - SETUP
============================================================
1. Enter investment amount (₹) [1900000]: 2000000
2. Enter SCRIP CODE [500414]: 500414
3. Enter base shares offered [4058325]: 4058325
4. Enter Telegram Chat ID [718712561]:
✓ Configuration:
Investment: ₹20,00,000
Scrip Code: 500414
Base Shares: 40,58,325
Green Shoe Shares: 81,16,650
Telegram Chat ID: 718712561
🔄 Starting live monitoring | Updates when changes detected | Press Ctrl+C to stop
[14:12:45]
Base (40.58L): Subscription: 2.07x | Bid: ₹280.05 | Qty: 7,141 | Cost: ₹1,999,837
Green (81.17L): Subscription: 1.03x | Bid: ₹275.05 | Qty: 7,272 | Cost: ₹1,999,964
Receive formatted updates like this:
📊 OFS Update [14:12:45]
Base (40.58L shares)
Subscription: 2.07x
Bid: ₹280.05
Qty: 7,141
Cost: ₹1,999,837
Green Shoe (81.17L shares)
Subscription: 1.03x
Bid: ₹275.05
Qty: 7,272
Cost: ₹1,999,964
ofsTrader/
├── src/
│ └── data/
│ └── bse_ofs_scraper.py # BSE website scraper
├── ofs_pricing_algorithm.py # Main algorithm
├── config.json # Your configuration (gitignored)
├── config.example.json # Configuration template
├── .gitignore # Git ignore rules
└── README.md # This file
{
"telegram": {
"bot_token": "YOUR_TELEGRAM_BOT_TOKEN",
"chat_id": "YOUR_TELEGRAM_CHAT_ID"
},
"default_values": {
"investment_amount": 1900000,
"scrip_code": "500414",
"base_shares_offered": 4058325
}
}telegram.bot_token: Your Telegram bot token from @BotFathertelegram.chat_id: Your Telegram chat ID (numeric)default_values: Pre-filled values for quick setup (optional)
- Visit BSE OFS Page
- Find your company's OFS
- Note the Scrip Code (e.g., 500414)
- Check Total Shares Offered in the announcement
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This tool is for educational and informational purposes only. It does not constitute financial advice. Always do your own research and consult with a qualified financial advisor before making investment decisions.
This project is licensed under the MIT License - see the LICENSE file for details.
- BSE India for providing publicly accessible OFS data
- BeautifulSoup4 for HTML parsing capabilities
- Telegram Bot API for notification delivery
If you have any questions or run into issues, please open an issue on GitHub.
Made with ❤️ for smarter OFS bidding