Dasha Algorithms Explained: A Developer Guide
Technical deep-dive into Vimshottari Dasha calculation algorithms. How birth chart data maps to life period predictions. With code examples.
Vimshottari Dasha System
The Vimshottari Dasha system divides a 120-year life cycle among 9 planets in a fixed sequence: Ketu(7) → Venus(20) → Sun(6) → Moon(10) → Mars(7) → Rahu(18) → Jupiter(16) → Saturn(19) → Mercury(17). The starting point is determined by the Moon nakshatra at birth.
Each of the 27 nakshatras is ruled by one of the 9 planets. The Moon degree within the nakshatra determines how much of the first dasha period has already elapsed at birth. This fraction is calculated as: remaining = (nakshatra_end_degree - moon_degree) / 13.333 * total_period_years.
Algorithm Implementation
// Dasha calculation pseudocode
const DASHA_YEARS = {
Ketu: 7, Venus: 20, Sun: 6, Moon: 10, Mars: 7,
Rahu: 18, Jupiter: 16, Saturn: 19, Mercury: 17
};
const SEQUENCE = ['Ketu','Venus','Sun','Moon','Mars','Rahu','Jupiter','Saturn','Mercury'];
function calculateDasha(moonDegree: number, birthDate: Date) {
const nakshatraIndex = Math.floor(moonDegree / (360/27));
const nakshatraLord = NAKSHATRA_LORDS[nakshatraIndex];
const startIndex = SEQUENCE.indexOf(nakshatraLord);
// Calculate elapsed portion of first dasha
const posInNakshatra = moonDegree % (360/27);
const fractionElapsed = posInNakshatra / (360/27);
const firstDashaRemaining = DASHA_YEARS[nakshatraLord] * (1 - fractionElapsed);
// Build dasha timeline from birth
let timeline = [];
let currentDate = new Date(birthDate);
// First (partial) dasha
timeline.push({ planet: nakshatraLord, years: firstDashaRemaining, start: currentDate });
currentDate = addYears(currentDate, firstDashaRemaining);
// Remaining dashas in sequence
for (let i = 1; i < 9; i++) {
const idx = (startIndex + i) % 9;
const planet = SEQUENCE[idx];
timeline.push({ planet, years: DASHA_YEARS[planet], start: currentDate });
currentDate = addYears(currentDate, DASHA_YEARS[planet]);
}
return timeline;
} Vedika API handles all this complexity. Call /v2/astrology/vimshottari-dasha with birth details and get the complete Mahadasha, Antardasha, and Pratyantardasha timeline with start/end dates. No need to implement the algorithm yourself.
Ready to integrate astrology into your app?
Start with our free sandbox — no API key required.
Try Sandbox Free