Install Ascendant and run your first Effect-based chart calculation.
Ascendant is an Effect-first TypeScript library for sidereal astrology. Start by calculating D1 and D9 for a UTC moment and location. The result contains shared Placements and cusp-aware Charts that you can reuse with the other calculation modules.
Python SDK is not recommended
The Python SDK (astro-ascendant
on PyPI) shares its name with the TypeScript SDK but is not at feature
parity and is not actively developed. Use the TypeScript SDK instead. If
you need it maintained, fork it on
GitHub.
bun add astro-ascendant effectThis example uses Bun, KrishnamurtiVP291 ayanamsa, and Placidus houses
(AstroParams.DefaultAstroParams).
import { BunRuntime, BunServices } from "@effect/platform-bun";
import { AstroParams, Chart, Swisseph } from "astro-ascendant";
import { Console, DateTime, Effect, Layer } from "effect";const runtimeLayer = Layer.mergeAll(
BunServices.layer,
Swisseph.SwissephLayer,
AstroParams.DefaultAstroParams,
);runtimeLayer provides the Bun services, Swiss Ephemeris implementation, and
default astrological parameters at the root of the program.
const input = Chart.ChartParams.make({
moment: Chart.Moment.make({
date: DateTime.makeUnsafe("2000-01-01T12:00:00.000Z"),
}),
latitude: 12.9716,
longitude: 77.5946,
sex: "Male",
});ChartParams combines a UTC Moment with latitude, longitude, and optional
birth sex.
Chart.generate always returns D1 first. Passing [9] adds the D9 divisional
chart.
const examples = Chart.generate(input, [9]).pipe(Effect.provide(runtimeLayer));Use Console.table to inspect the shared placements and generated charts:
const examplesWithOutput = examples.pipe(
Effect.tap((calculation) =>
Effect.gen(function* () {
yield* Console.log("Placements");
yield* Console.table([
{
Point: calculation.placements.lagna.name,
Longitude: calculation.placements.lagna.longitude,
Retrograde: "—",
},
...calculation.placements.planets.map((planet) => ({
Point: planet.name,
Longitude: planet.longitude,
Retrograde: planet.is_retrograde,
})),
]);
yield* Console.log("Charts");
yield* Console.table(
calculation.charts.map((chart) => ({
Division: `D${chart.division}`,
HouseSystem: calculation.astroParams.houseSystem,
Ayanamsa: calculation.astroParams.ayanamsa,
})),
);
}),
),
);BunRuntime.runMain(examplesWithOutput);calculation.placements contains the shared sidereal positions. Reuse it with
the Dasha, Ashtakavarga, and
Jaimini calculators.