年运API文档
本API提供年运预测功能,基于占星学原理进行计算。
POST /year
年运计算接口 - 计算指定年份的运势
接口说明
计算指定年份的年运,包括次限相位、日返数据、本命宫位、次限行星落入本命宫位及各领域评分。
基本信息
| 参数 | 值 |
|---|---|
| Base URL | https://chart.12sign.top |
| 接口URL | /year |
| 请求方式 | POST |
| Content-Type | application/json |
请求参数
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| birth_data.year | integer | 是 | 出生年份 |
| birth_data.month | integer | 是 | 出生月份 |
| birth_data.day | integer | 是 | 出生日 |
| birth_data.hour | integer | 是 | 出生小时 |
| birth_data.minute | integer | 是 | 出生分钟 |
| birth_data.latitude | number | 是 | 出生地纬度 |
| birth_data.longitude | number | 是 | 出生地经度 |
| birth_data.timezone | number | 是 | 时区,如:8.0表示UTC+8 |
| target_date | string | 是 | 目标日期,格式:YYYY-MM-DD |
| years_range | integer | 否 | 计算范围(年),默认15年 |
请求示例
{
"birth_data": {
"year": 1990,
"month": 1,
"day": 1,
"hour": 12,
"minute": 0,
"latitude": 31.23,
"longitude": 121.47,
"timezone": 8.0
},
"target_date": "2026-01-01",
"years_range": 15
}
返回参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| target_date | string | 目标日期 |
| calculation_date | string | 计算日期时间 |
| build | string | 版本标识 |
| birth_data | object | 出生数据 |
| aspects | object | 次限相位数据 |
| natal_houses | object | 本命宫位数据 |
| secondary_in_natal_houses | object | 次限行星落入本命宫位 |
| secondary_positions | object | 次限行星位置 |
| solar_return | object | 日返数据 |
| scores | object | 各领域评分 |
| summary | object | 摘要信息 |
返回示例
{
"target_date": "2026-01-01",
"calculation_date": "2026-01-01 12:00:00",
"build": "year-v2-scores",
"birth_data": {
"year": 1990,
"month": 1,
"day": 1,
"hour": 12,
"minute": 0,
"latitude": 31.23,
"longitude": 121.47,
"timezone": 8.0
},
"aspects": {
"s_sun_n_moon_0_2026": {
"cn": "次限太阳合相本命月亮",
"start_date": "2026-01-01",
"end_date": "2026-12-31",
"orb": 0.8,
"s": "Sun",
"n": "Moon",
"a": "0"
}
},
"natal_houses": {
"raw_houses": [17.6, 52.1, 78.0, 101.1, 125.7, 156.6, 197.6, 235.4, 267.8, 293.5, 319.2, 354.1]
},
"secondary_in_natal_houses": {
"sun": 1,
"moon": 2,
"mercury": 3
},
"secondary_positions": {
"sun": 280.5,
"moon": 125.3,
"mercury": 295.8
},
"solar_return": {
"success": true,
"year": 2026,
"sun_house": 5,
"sun_sign": "摩羯座",
"sun_degree": 280.5
},
"scores": {
"love": 82,
"career": 88,
"wealth": 75,
"study": 80,
"health": 78
},
"summary": {
"total_aspects": 12,
"secondary_vs_natal": 8,
"secondary_vs_secondary": 4,
"solar_return_available": true,
"secondary_houses_count": 10
}
}
Python测试代码示例
import requests
import json
def test_year_fortune(base_url="https://chart.12sign.top"):
url = f"{base_url}/year"
payload = {
"birth_data": {
"year": 1990,
"month": 1,
"day": 1,
"hour": 12,
"minute": 0,
"latitude": 31.23,
"longitude": 121.47,
"timezone": 8.0
},
"target_date": "2026-01-01",
"years_range": 15
}
try:
print("正在测试年运API...")
response = requests.post(url, json=payload, headers={'Content-Type': 'application/json'})
print(f"响应状态码: {response.status_code}")
if response.status_code == 200:
data = response.json()
print("年运API测试成功!")
print(f"次限相位数量: {len(data.get('aspects', {}))}")
print(f"日返数据: {data.get('solar_return', {})}")
print(f"评分: {data.get('scores', {})}")
return data
else:
print(f"API请求失败: {response.status_code}")
print(f"错误信息: {response.text}")
return None
except Exception as e:
print(f"请求出错: {e}")
return None
if __name__ == "__main__":
test_year_fortune()
注意事项
- 年运计算使用次限(Secondary Progressions)方法
- 日返数据现在使用本地计算,不再依赖外部API
- 计算时间点为目标年份生日时间
- 相位包括次限vs本命、次限vs次限
- 容差设置为3度
- 日返数据包含太阳宫位、星座和度数
- years_range控制计算的时间范围,默认为15年