-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.ts
More file actions
52 lines (44 loc) · 1.79 KB
/
Copy pathexample.ts
File metadata and controls
52 lines (44 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { createRoxy } from '@roxyapi/sdk';
const roxy = createRoxy(process.env.ROXY_API_KEY!);
/**
* Transit Forecast API: the astrology transits ahead for one birth chart over a
* window up to 90 days. Every transit to natal aspect, sign ingress, retrograde
* or direct station, eclipse, and new and full moon, each refined to its exact
* instant and significance scored. Roxy Ephemeris, verified against NASA JPL
* Horizons. The forecast is driven by the birth instant, so no coordinates.
*/
async function main() {
const { data, error } = await roxy.forecast.forecastTransits({
body: {
birthData: {
date: '1990-07-15',
time: '13:30:00',
timezone: 'America/New_York',
},
startDate: '2026-07-08',
endDate: '2026-10-05',
minSignificance: 40,
},
});
if (error) throw new Error(error.error);
console.log(`Window: ${data.startDate} to ${data.endDate}`);
console.log(`Events in this transit forecast: ${data.count}`);
const byType = new Map<string, number>();
for (const e of data.events) byType.set(e.type, (byType.get(e.type) ?? 0) + 1);
console.log('\nBy event type:');
for (const [type, n] of byType) console.log(` ${type.padEnd(20)} ${n}`);
console.log('\nFirst 8 events:');
for (const e of data.events.slice(0, 8)) {
const detail = e.aspect
? `${e.aspect} natal ${e.target}`
: e.station ?? e.phase ?? e.kind ?? e.target ?? '';
console.log(` ${e.date} ${e.body.padEnd(10)} ${String(detail).padEnd(24)} sig ${e.significance}`);
}
const top = [...data.events].sort((a, b) => b.significance - a.significance)[0];
if (top) {
console.log('\nMost significant upcoming event:');
console.log(` ${top.date} (${top.datetime})`);
console.log(` ${top.description}`);
}
}
main().catch(console.error);