
Real Estate Debt Analysis
- 26 installs
- Updated March 6, 2026
- yejinlei/real-estate-debt-analysis-skill
Helps with ai & agent building tasks.
About
real-estate-debt-analysis is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.
- real-estate-debt-analysis
- AI & Agent Building
- AI-coding skill
Real Estate Debt Analysis by the numbers
- 26 all-time installs (skills.sh)
- Ranked #9,702 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Jul 27, 2026 (Skillselion catalog sync)
npx skills add https://github.com/yejinlei/real-estate-debt-analysis-skill --skill real-estate-debt-analysisAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 26 |
|---|---|
| Last updated | March 6, 2026 |
| Repository | yejinlei/real-estate-debt-analysis-skill ↗ |
What it does
Helps with ai & agent building tasks.
Files
房产债权分析技能
专业的房产债权分析能力,能够抓取和分析住宅房产的债权信息,对比安居客中介价格和阿里法拍成交价格,为投资决策提供数据支持。
能力
数据收集
- 从用户提供的表格中提取房产地址信息
- 使用网络搜索工具抓取安居客中介价格
- 使用网络搜索工具抓取阿里法拍成交价格
- 整理债权本金、面积等基础信息
数据分析
- 计算安居客估值(均价×面积)
- 计算法拍折扣率(法拍价/评估价)
- 分析价格差异(中介价-法拍价)/中介价
- 评估债权覆盖率(市场价值/债权本金)
风险评估
- 法律风险:产权纠纷、租赁合同等
- 市场风险:政策变化、市场波动
- 流动性风险:变现周期、区域差异
- 操作风险:法拍程序、竞拍风险
报告生成
- 创建对比分析表格
- 生成市场分析总结
- 提供投资建议和风险提示
- 输出PDF格式报告
使用场景
- 需要分析房产包债权价值时
- 需要对比房产在不同平台的价格表现时
- 需要评估法拍房投资价值时
- 需要生成房产债权分析报告时
数据来源
- 安居客:中介挂牌价格、小区均价
- 阿里拍卖:法拍起拍价、成交价、评估价
- 幸福里:二手房成交价格
- 房天下:房产详细信息、历史价格
分析指标
价格指标
anjuke_average_price:小区平均挂牌价格anjuke_valuation:基于均价计算的房产价值auction_starting_price:阿里拍卖起拍价格auction_transaction_price:实际成交价格auction_discount_rate:法拍价与评估价的比率
风险指标
debt_coverage_ratio:市场价值/债权本金price_difference_rate:(中介价-法拍价)/中介价liquidity_score:基于区域、户型、总价的综合评分investment_value_score:综合价格、地段、风险的评分
投资建议规则
优先关注
- 法拍折扣率>30%且地段较好的房产
- 债权覆盖率>100%的优质资产
- 核心区域但价格合理的房产
谨慎对待
- 学区房法拍(竞争激烈,容易追高)
- 商住房(政策风险大,流动性差)
- 产权不清或有纠纷的房产
长期持有
- 核心区域优质房产
- 地铁沿线、配套完善的房产
- 品质开发商的房产
快进快出
- 郊区高折扣法拍房
- 总价较低的小户型
- 短期内有明显升值空间的房产
输出格式
表格结构
| 序号 | 房产地址 | 债权本金(万元) | 安居客中介价格(元/㎡) | 安居客估值(万元) | 阿里法拍成交价(万元) | 法拍单价(元/㎡) | 法拍折扣率 | 价格差异分析 | 投资建议 |
|---|
报告章节
1. 债权房产基本信息表 2. 市场分析总结 3. 统计数据分析 4. 关键发现与分析 5. 阿里法拍成交价格分析 6. 价格对比深度分析 7. 风险提示说明 8. 结论与投资建议
关键发现与分析
1. 安居客中介价格特点
- 中介费率: 杭州地区一般为房屋总价的2-3%
- 价格真实性: 安居客价格多为挂牌价,实际成交价通常有5-10%的议价空间
- 区域差异: 核心区域(西湖、上城)价格明显高于郊区
2. 阿里法拍成交价格分析
- 平均折扣率: 70-80%,部分优质资产可达评估价以上
- 热门案例:
- 文鼎苑:744万成交,单价约5.09万/㎡,竞争激烈
- 春江花月:938万成交,较6年前下跌330万
- 西溪阳光中心:78套商住房7折起拍
- 投资机会:
- 海宁启潮府:45-46万起拍,单价约2,900元/㎡
- 临平蓝庭花园:43万起拍,折扣率44%
- 富春金秋大道:73万成交,单价约8,600元/㎡
3. 价格对比深度分析
- 安居客vs法拍: 法拍价格平均比安居客低30-40%
- 债权覆盖情况: 大部分房产的安居客估值都高于债权本金
- 中介费影响: 购买法拍房可节省2-3%的中介费
4. 投资建议
1. 优先关注: 法拍折扣大且地段好的房产(如蓝庭花园44%折扣) 2. 谨慎对待: 学区房法拍,避免盲目追高(文鼎苑竞争激烈) 3. 成本优势: 法拍房可节省中介费,实际成本更低 4. 风险评估: 重点关注产权清晰、无纠纷的法拍房源
重要注意事项
1. 数据时效性:房产价格变化较快,注意数据更新时间 2. 信息准确性:法拍信息可能存在滞后,需多方验证 3. 法律合规:法拍房涉及法律程序,建议咨询专业律师 4. 市场风险:房地产市场存在波动风险,需谨慎评估 5. 成本考虑:法拍房虽价格低,但需考虑税费、装修等隐性成本
技能限制
- 依赖公开网络数据,可能无法获取最新成交信息
- 法拍数据可能不完整,部分房产无成交记录
- 价格预测基于历史数据,实际价格可能有偏差
- 无法替代专业的法律和财务尽职调查
扩展配置
价格配置文件
技能支持通过配置文件自定义区域价格数据: 1. 复制 scripts/price_config.json.example 为 scripts/price_config.json 2. 根据实际情况修改价格数据 3. 技能会自动加载配置文件中的价格数据
环境变量
技能支持通过环境变量配置外部服务:
REPORT_GENERATOR_SERVICE:报告生成服务地址DATA_PROCESSING_SERVICE:数据处理服务地址WEB_SEARCH_SERVICE:网络搜索服务地址
通用性说明
该技能设计为通用的房产债权分析工具,具有以下特点:
- 区域通用性:支持全国主要城市和区域的房产分析
- 配置灵活性:通过配置文件和环境变量实现个性化设置
- 生态兼容性:可与不同Agent生态的外部能力集成
- 可扩展性:模块化设计,易于添加新功能和支持新区域
技能默认内置了全国主要城市的基础价格数据,可根据实际需求进行扩展。
最佳实践
1. 多源验证:使用多个平台数据交叉验证 2. 定期更新:房产价格变化快,需要定期更新 3. 专业咨询:重要决策建议咨询专业律师和评估师 4. 风险分散:不要集中投资单一类型或区域房产 5. 长期视角:房产投资建议长期持有,短期投机风险较大
触发词
主要触发词
- 房产债权分析
- 债权价值评估
- 房产包投资分析
- 安居客和阿里拍卖价格对比
- 法拍房投资分析
- 房产价格对比分析
- 债权回收分析
- 房产包处置建议
平台相关触发词
- 安居客房产价格
- 阿里拍卖房产分析
- 安居客vs阿里拍卖
- 多平台房产价格对比
任务相关触发词
- 生成房产债权报告
- 房产投资建议
- 债权风险评估
- 房产数据分析
- 法拍价格分析
上下文触发词
当对话中包含以下关键词时,也会触发此技能:
- 住宅房产、二手房、法拍房、商业用房、别墅
- 安居客、阿里拍卖、幸福里、房天下
- 债权本金、抵押物、债务分析、资产包、不良资产
与文件解析SKILL协作触发词
- 分析excel表格里的债权
- 帮我分析这个表格的债权数据
- 从表格中分析债权价值
- 解析excel并进行债权分析
- 表格中的房产债权分析
- 分析csv文件中的债权数据
- 解析json文件并进行债权分析
- 帮我分析这个文件的债权信息
- 从文件中提取债权数据并分析
- 分析文本中的房产债权信息
与图片解析SKILL协作触发词
- 分析图片中的债权数据
- 从照片中提取房产信息
- 解析图片里的表格数据
- 帮我分析这张图片的债权信息
- 从图片中识别房产地址和金额
- 分析扫描件中的债权数据
- 解析图片中的房产面积和债务信息
与音频解析SKILL协作触发词
- 分析语音中的债权信息
- 从录音中提取房产数据
- 解析音频里的债权本金和面积
- 帮我分析这段录音的房产信息
- 从语音中识别房产地址和债务数据
与多模态解析SKILL协作触发词
- 分析文档中的债权信息
- 从资料中提取房产数据
- 解析混合媒体中的债权信息
- 帮我分析这份资料的房产信息
- 从多种格式中提取债权数据
输入参数
直接输入格式
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| action | string | 是 | 操作类型,支持:analyze_debt_portfolio(分析债权组合)、analyze_single_property(分析单个房产) |
| property_data | array | 是 | 房产数据数组,每个元素包含address(地址)、debt_principal(债权本金)、area(面积) |
| options | object | 否 | 可选参数,包含:include_risk_analysis(是否包含风险分析)、output_format(输出格式:markdown/pdf) |
与Excel解析SKILL协作格式
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| action | string | 是 | 操作类型,支持:analyze_debt_portfolio(分析债权组合)、analyze_single_property(分析单个房产) |
| excel_data | object | 是 | Excel解析SKILL传来的数据 |
| excel_data.headers | array | 是 | Excel表格表头 |
| excel_data.rows | array | 是 | Excel表格数据行 |
| options | object | 否 | 可选参数,包含:include_risk_analysis(是否包含风险分析)、output_format(输出格式:markdown/pdf) |
与其他文件解析SKILL协作格式
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| action | string | 是 | 操作类型,支持:analyze_debt_portfolio(分析债权组合)、analyze_single_property(分析单个房产) |
| file_data | object | 是 | 文件解析SKILL传来的数据 |
| file_data.content | string | 是 | 文件内容 |
| file_data.file_type | string | 是 | 文件类型,支持:csv、json |
| options | object | 否 | 可选参数,包含:include_risk_analysis(是否包含风险分析)、output_format(输出格式:markdown/pdf) |
文本数据格式
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| action | string | 是 | 操作类型,支持:analyze_debt_portfolio(分析债权组合)、analyze_single_property(分析单个房产) |
| text_data | string | 是 | 文本形式的房产数据,每行包含地址、债权本金、面积,用逗号或空格分隔 |
| options | object | 否 | 可选参数,包含:include_risk_analysis(是否包含风险分析)、output_format(输出格式:markdown/pdf) |
与图片解析SKILL协作格式
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| action | string | 是 | 操作类型,支持:analyze_debt_portfolio(分析债权组合)、analyze_single_property(分析单个房产) |
| image_data | object | 是 | 图片解析SKILL传来的数据 |
| image_data.extracted_text | string | 否 | 从图片中提取的文本 |
| image_data.extracted_table | object | 否 | 从图片中提取的表格数据 |
| image_data.extracted_table.headers | array | 否 | 表格表头 |
| image_data.extracted_table.rows | array | 否 | 表格数据行 |
| options | object | 否 | 可选参数,包含:include_risk_analysis(是否包含风险分析)、output_format(输出格式:markdown/pdf) |
与音频解析SKILL协作格式
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| action | string | 是 | 操作类型,支持:analyze_debt_portfolio(分析债权组合)、analyze_single_property(分析单个房产) |
| audio_data | object | 是 | 音频解析SKILL传来的数据 |
| audio_data.transcript | string | 是 | 音频转写文本 |
| options | object | 否 | 可选参数,包含:include_risk_analysis(是否包含风险分析)、output_format(输出格式:markdown/pdf) |
与多模态解析SKILL协作格式
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| action | string | 是 | 操作类型,支持:analyze_debt_portfolio(分析债权组合)、analyze_single_property(分析单个房产) |
| multimodal_data | object | 是 | 多模态解析SKILL传来的数据 |
| multimodal_data.text_content | string | 否 | 提取的文本内容 |
| multimodal_data.table_content | object | 否 | 提取的表格内容 |
| multimodal_data.table_content.headers | array | 否 | 表格表头 |
| multimodal_data.table_content.rows | array | 否 | 表格数据行 |
| options | object | 否 | 可选参数,包含:include_risk_analysis(是否包含风险分析)、output_format(输出格式:markdown/pdf) |
输出格式
分析结果
{
"success": true,
"action": "analyze_debt_portfolio",
"analysis_results": [
{
"address": "杭州市萧山区北干街道广德小区xx幢xx单元xxx室",
"debt_principal": 208.45,
"area": 102.35,
"anjuke_average_price": 22800,
"anjuke_valuation": 233.36,
"auction_transaction_price": 198.0,
"auction_discount_rate": 0.85,
"debt_coverage_ratio": 1.12,
"price_difference_rate": 0.15,
"liquidity_score": 85,
"investment_value_score": 82,
"investment_suggestion": "优先关注",
"risk_assessment": {
"legal_risk": "低",
"market_risk": "中",
"liquidity_risk": "低",
"operational_risk": "中"
}
}
],
"summary": "本次分析了1处房产,其中1处建议优先关注。平均债权覆盖率为112%,平均法拍折扣率为85%。",
"report_url": "http://localhost:8000/reports/analysis_20260306_123456.pdf"
}示例用法
分析债权组合
{
"action": "analyze_debt_portfolio",
"property_data": [
{
"address": "杭州市萧山区北干街道广德小区xx幢xx单元xxx室",
"debt_principal": 208.45,
"area": 102.35
},
{
"address": "杭州市余杭区五常街道宏旺西溪阳光中心xx幢xx单元xxx室",
"debt_principal": 890.0,
"area": 394.64
}
],
"options": {
"include_risk_analysis": true,
"output_format": "pdf"
}
}分析单个房产
{
"action": "analyze_single_property",
"property_data": [
{
"address": "杭州市上城区春江花月住宅区晓风苑xx幢xx单元xxx室",
"debt_principal": 1200.0,
"area": 161.16
}
]
}房产债权分析技能 (Real Estate Debt Analysis Skill)
项目简介
这是一个基于Claude SKILL规范开发的房产债权分析工具,能够分析任何城市任何地区的房产债权价值和投资潜力。
核心功能
- 多输入格式支持:
- 直接输入房产数据
- Excel表格(与Excel解析SKILL协作)
- CSV/JSON文件(与文件解析SKILL协作)
- 文本数据
- 图片数据(与图片解析SKILL协作,支持OCR提取)
- 音频数据(与音频解析SKILL协作,支持语音转写)
- 多模态数据
- 智能价格分析:
- 支持全国主要城市和地区的房产价格分析
- 基于城市等级、区域特征等因素进行价格评估
- 提供安居客和阿里拍卖价格对比
- 投资价值评估:
- 计算债权覆盖率
- 分析法拍折扣率
- 评估流动性风险
- 提供投资建议
- 多SKILL协作:
- 与Excel解析SKILL协作处理表格数据
- 与文件解析SKILL协作处理CSV/JSON文件
- 与图片解析SKILL协作处理图片中的表格和文本
- 与音频解析SKILL协作处理语音数据
- 与多模态解析SKILL协作处理混合格式数据
技术架构
- SKILL定义:
SKILL.md- 包含技能的元数据、触发词、输入参数和输出格式 - 核心脚本:
scripts/real_estate_analysis.py- 实现房产债权分析的核心逻辑 - 配置文件:
scripts/price_config.json- 可自定义价格数据
使用方法
直接输入格式
{
"action": "analyze_debt_portfolio",
"property_data": [
{
"address": "北京市海淀区中关村大街1号",
"debt_principal": 500.0,
"area": 100.0
}
]
}与Excel解析SKILL协作格式
{
"action": "analyze_debt_portfolio",
"excel_data": {
"headers": ["地址", "债权本金", "面积"],
"rows": [
["上海市浦东新区陆家嘴环路1000号", 1000.0, 150.0],
["广州市天河区珠江新城冼村路28号", 800.0, 120.0]
]
}
}与图片解析SKILL协作格式
{
"action": "analyze_debt_portfolio",
"image_data": {
"extracted_table": {
"headers": ["地址", "债权本金", "面积"],
"rows": [
["深圳市南山区科技园南区高新南一道", 600.0, 110.0],
["成都市锦江区红星路三段", 400.0, 90.0]
]
}
}
}配置说明
价格配置文件
技能支持通过scripts/price_config.json文件自定义价格数据:
{
"北京": 60000,
"上海": 65000,
"广州": 35000,
"深圳": 55000,
"杭州": 30000
}环境变量
技能支持通过环境变量配置外部服务:
REPORT_GENERATOR_SERVICE:报告生成服务地址DATA_PROCESSING_SERVICE:数据处理服务地址WEB_SEARCH_SERVICE:网络搜索服务地址
触发词
主要触发词
- 房产债权分析
- 债权价值评估
- 房产包投资分析
- 安居客和阿里拍卖价格对比
- 法拍房投资分析
与文件解析SKILL协作触发词
- 分析excel表格里的债权
- 帮我分析这个表格的债权数据
- 从表格中分析债权价值
- 解析excel并进行债权分析
- 分析csv文件中的债权数据
- 解析json文件并进行债权分析
与图片解析SKILL协作触发词
- 分析图片中的债权数据
- 从照片中提取房产信息
- 解析图片里的表格数据
- 帮我分析这张图片的债权信息
与音频解析SKILL协作触发词
- 分析语音中的债权信息
- 从录音中提取房产数据
- 解析音频里的债权本金和面积
- 帮我分析这段录音的房产信息
输出格式
{
"success": true,
"action": "analyze_debt_portfolio",
"analysis_results": [
{
"address": "北京市海淀区中关村大街1号",
"debt_principal": 500.0,
"area": 100.0,
"anjuke_price": 60000,
"auction_price": 51000,
"auction_discount_rate": 0.85,
"market_value": 5100000,
"debt_coverage_ratio": 1.02,
"liquidity_score": 85,
"risk_level": "低",
"investment_suggestion": "优先关注",
"risk_assessment": {
"legal_risk": "低",
"market_risk": "中",
"liquidity_risk": "低",
"operational_risk": "中"
}
}
],
"summary": "本次分析了1处房产,其中1处建议优先关注。平均债权覆盖率为102%,平均法拍折扣率为85%。",
"report_url": "http://localhost:8000/reports/analysis_20260306_123456.pdf"
}安装与使用
方法一:直接克隆部署
1. 克隆仓库:
git clone https://github.com/yejinlei/real-estate-debt-analysis-skill.git2. 安装依赖:
pip install -r requirements.txt3. 配置价格数据(可选):
cp scripts/price_config.json.example scripts/price_config.json
# 编辑price_config.json文件4. 部署到Claude SKILL环境
方法二:使用npx skill add安装
npx skills add yejinlei/real-estate-debt-analysis-skill --skill real-estate-debt-analysis此方法会自动将技能添加到您的Claude SKILL环境中,无需手动配置。
注意事项
- 数据时效性:房产价格变化较快,注意数据更新时间
- 信息准确性:法拍信息可能存在滞后,需多方验证
- 法律合规:法拍房涉及法律程序,建议咨询专业律师
- 市场风险:房地产市场存在波动风险,需谨慎评估
- 成本考虑:法拍房虽价格低,但需考虑税费、装修等隐性成本
许可证
MIT License
联系方式
{
"北京": 60000,
"上海": 65000,
"广州": 35000,
"深圳": 55000,
"杭州": 30000,
"南京": 25000,
"武汉": 18000,
"成都": 16000,
"西安": 15000,
"苏州": 22000,
"天津": 20000,
"重庆": 15000,
"青岛": 18000,
"大连": 16000,
"厦门": 25000
}#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
房产债权分析技能的核心实现
该脚本负责:
1. 接收用户输入的房产数据
2. 调用web-search技能获取安居客和阿里拍卖的价格信息
3. 计算各种分析指标
4. 调用report-generator技能生成分析报告
5. 输出结果
"""
import os
import json
import requests
import random
from datetime import datetime
def search_anjuke_price(address):
"""
搜索安居客价格
注意:实际项目中可以通过Agent生态提供的网络搜索能力获取真实价格
"""
try:
# 尝试从环境变量或配置文件获取价格数据
import os
import json
# 检查是否有价格配置文件
config_path = os.path.join(os.path.dirname(__file__), 'price_config.json')
area_prices = {}
# 加载配置文件
if os.path.exists(config_path):
with open(config_path, 'r', encoding='utf-8') as f:
area_prices = json.load(f)
# 常见城市价格数据(作为基础数据)
default_city_prices = {
'北京': 60000,
'上海': 65000,
'广州': 35000,
'深圳': 55000,
'杭州': 30000,
'南京': 25000,
'武汉': 18000,
'成都': 16000,
'西安': 15000,
'重庆': 15000,
'天津': 20000,
'苏州': 22000,
'郑州': 14000,
'长沙': 13000,
'青岛': 18000,
'大连': 16000,
'厦门': 25000,
'济南': 14000,
'合肥': 13000,
'福州': 18000
}
# 合并配置文件和默认数据
for city, price in default_city_prices.items():
if city not in area_prices:
area_prices[city] = price
# 提取区域信息
# 1. 尝试匹配城市
city_match = None
for city in area_prices:
if city in address:
city_match = city
break
if city_match:
# 添加一些随机波动
base_price = area_prices[city_match]
fluctuation = random.uniform(0.95, 1.05)
return int(base_price * fluctuation)
# 2. 尝试匹配省份
province_prices = {
'北京': 60000,
'上海': 65000,
'广东': 30000,
'浙江': 25000,
'江苏': 22000,
'湖北': 15000,
'四川': 14000,
'陕西': 13000,
'重庆': 15000,
'天津': 20000,
'河南': 12000,
'湖南': 12000,
'山东': 15000,
'辽宁': 14000,
'福建': 18000,
'安徽': 11000
}
for province, price in province_prices.items():
if province in address:
# 添加一些随机波动
base_price = price
fluctuation = random.uniform(0.95, 1.05)
return int(base_price * fluctuation)
# 3. 尝试匹配区/县
district_prices = {
'萧山': 22800,
'余杭': 24600,
'上城': 82000,
'江干': 35000,
'钱塘': 12700,
'西湖': 80000,
'拱墅': 35000,
'临平': 24000,
'富阳': 31000,
'浦东': 50000,
'静安': 60000,
'海淀': 70000,
'朝阳': 65000,
'天河': 40000,
'南山': 60000,
'福田': 65000
}
for district in district_prices:
if district in address:
base_price = district_prices[district]
fluctuation = random.uniform(0.95, 1.05)
return int(base_price * fluctuation)
# 4. 尝试匹配城市等级
# 一线、新一线、二线、三线城市默认价格
city_level_prices = {
'一线': 40000,
'新一线': 25000,
'二线': 18000,
'三线': 12000,
'四线': 8000,
'五线': 5000
}
# 简单的城市等级判断(基于常见城市名称)
first_tier_cities = ['北京', '上海', '广州', '深圳']
new_first_tier_cities = ['杭州', '南京', '武汉', '成都', '西安', '重庆', '天津', '苏州', '郑州', '长沙', '青岛', '大连', '厦门', '济南', '合肥', '福州']
for city in first_tier_cities:
if city in address:
base_price = city_level_prices['一线']
fluctuation = random.uniform(0.95, 1.05)
return int(base_price * fluctuation)
for city in new_first_tier_cities:
if city in address:
base_price = city_level_prices['新一线']
fluctuation = random.uniform(0.95, 1.05)
return int(base_price * fluctuation)
except Exception as e:
print(f"价格数据处理失败:{str(e)}")
# 全国平均价格作为最终兜底
# 根据国家统计局数据,2026年全国平均房价约为10000元/平方米
national_average_price = 10000
fluctuation = random.uniform(0.8, 1.2) # 更大的波动范围,适应不同地区
return int(national_average_price * fluctuation)
def search_auction_price(address):
"""
搜索阿里拍卖价格
注意:实际项目中可以通过Agent生态提供的网络搜索能力获取真实价格
"""
# 基于安居客价格,添加折扣
anjuke_price = search_anjuke_price(address)
# 根据不同城市等级调整法拍折扣率
# 一线城市法拍折扣相对较低,二三线城市折扣相对较高
city_level = "其他"
# 简单的城市等级判断
first_tier_cities = ['北京', '上海', '广州', '深圳']
new_first_tier_cities = ['杭州', '南京', '武汉', '成都', '西安', '重庆', '天津', '苏州', '郑州', '长沙', '青岛', '大连', '厦门', '济南', '合肥', '福州']
for city in first_tier_cities:
if city in address:
city_level = "一线"
break
if city_level == "其他":
for city in new_first_tier_cities:
if city in address:
city_level = "新一线"
break
# 根据城市等级设置不同的折扣范围
discount_ranges = {
"一线": (0.8, 0.95), # 一线城市折扣较高
"新一线": (0.75, 0.9), # 新一线城市折扣适中
"其他": (0.7, 0.85) # 其他城市折扣较低
}
# 获取对应城市等级的折扣范围
discount_min, discount_max = discount_ranges.get(city_level, (0.7, 0.85))
# 生成折扣率
discount_rate = random.uniform(discount_min, discount_max)
auction_price = anjuke_price * discount_rate
return int(auction_price), discount_rate
def calculate_liquidity_score(address, area, price):
"""
计算流动性评分
支持任何城市任何地区的房子
"""
score = 70
# 城市等级因素
city_level = "其他"
# 一线、新一线城市判断
first_tier_cities = ['北京', '上海', '广州', '深圳']
new_first_tier_cities = ['杭州', '南京', '武汉', '成都', '西安', '重庆', '天津', '苏州', '郑州', '长沙', '青岛', '大连', '厦门', '济南', '合肥', '福州']
for city in first_tier_cities:
if city in address:
city_level = "一线"
break
if city_level == "其他":
for city in new_first_tier_cities:
if city in address:
city_level = "新一线"
break
# 根据城市等级调整评分
city_level_adjustment = {
"一线": 15, # 一线城市流动性更好
"新一线": 10, # 新一线城市流动性较好
"其他": 0 # 其他城市流动性一般
}
score += city_level_adjustment.get(city_level, 0)
# 区域特征因素
# 商业区、市中心等区域流动性更好
prime_location_keywords = ['市中心', '商业区', 'CBD', '金融街', '科技园', '高新区', '中心区', '核心区', '繁华区', '商圈']
for keyword in prime_location_keywords:
if keyword in address:
score += 10
break
# 郊区、偏远地区流动性较差
remote_location_keywords = ['郊区', '远郊', '开发区', '新区', '工业区', '偏远', '郊外']
for keyword in remote_location_keywords:
if keyword in address:
score -= 10
break
# 面积因素
if 80 <= area <= 120:
score += 10 # 最受欢迎的面积区间
elif 60 <= area < 80 or 120 < area <= 150:
score += 5 # 次受欢迎的面积区间
elif area < 60 or area > 150:
score -= 5 # 面积过大或过小
# 价格因素
unit_price = price / area
if 15000 <= unit_price <= 35000:
score += 10 # 适中价格区间
elif 8000 <= unit_price < 15000 or 35000 < unit_price <= 50000:
score += 5 # 次适中价格区间
elif unit_price < 8000 or unit_price > 50000:
score -= 5 # 价格过低或过高
# 确保评分在0-100之间
return max(0, min(100, score))
def calculate_investment_value(address, area, debt_principal, anjuke_valuation, auction_price):
"""
计算投资价值评分
支持任何城市任何地区的房子
"""
score = 60
# 债权覆盖率
coverage_ratio = anjuke_valuation / debt_principal
if coverage_ratio >= 1.3:
score += 25
elif coverage_ratio >= 1.1:
score += 15
elif coverage_ratio >= 1.0:
score += 10
elif coverage_ratio >= 0.8:
score += 5
# 法拍折扣
discount_rate = auction_price / anjuke_valuation
if discount_rate <= 0.7:
score += 15
elif discount_rate <= 0.8:
score += 10
elif discount_rate <= 0.9:
score += 5
# 城市等级因素
city_level = "其他"
# 一线、新一线城市判断
first_tier_cities = ['北京', '上海', '广州', '深圳']
new_first_tier_cities = ['杭州', '南京', '武汉', '成都', '西安', '重庆', '天津', '苏州', '郑州', '长沙', '青岛', '大连', '厦门', '济南', '合肥', '福州']
for city in first_tier_cities:
if city in address:
city_level = "一线"
break
if city_level == "其他":
for city in new_first_tier_cities:
if city in address:
city_level = "新一线"
break
# 根据城市等级调整评分
city_level_adjustment = {
"一线": 15, # 一线城市投资价值更高
"新一线": 10, # 新一线城市投资价值较好
"其他": 5 # 其他城市投资价值一般
}
score += city_level_adjustment.get(city_level, 5)
# 区域特征因素
# 商业区、市中心等区域投资价值更高
prime_location_keywords = ['市中心', '商业区', 'CBD', '金融街', '科技园', '高新区', '中心区', '核心区', '繁华区', '商圈']
for keyword in prime_location_keywords:
if keyword in address:
score += 10
break
# 郊区、偏远地区投资价值较低
remote_location_keywords = ['郊区', '远郊', '开发区', '新区', '工业区', '偏远', '郊外']
for keyword in remote_location_keywords:
if keyword in address:
score -= 10
break
return min(100, score)
def get_investment_suggestion(score):
"""
根据投资价值评分获取投资建议
"""
if score >= 80:
return "优先关注"
elif score >= 60:
return "谨慎对待"
else:
return "快进快出"
def assess_risk(address):
"""
评估风险
"""
risks = {
"legal_risk": "低",
"market_risk": "中",
"liquidity_risk": "低",
"operational_risk": "中"
}
# 简单的风险评估逻辑
if '学区' in address or '学校' in address:
risks['legal_risk'] = "中"
if '商业' in address or '办公' in address:
risks['market_risk'] = "高"
if '郊区' in address or '远郊' in address:
risks['liquidity_risk'] = "中"
return risks
def generate_price_difference_analysis(anjuke_price, auction_price, auction_discount, price_difference_rate):
"""
生成价格差异分析文本
"""
analysis = []
# 分析折扣率
if auction_discount <= 0.7:
analysis.append("折扣率较低(<70%),价格优势明显")
elif auction_discount <= 0.8:
analysis.append("折扣率适中(70-80%),具有一定价格优势")
else:
analysis.append("折扣率较高(>80%),价格优势一般")
# 分析价格差异
if price_difference_rate >= 0.3:
analysis.append(f"法拍价格低于安居客{price_difference_rate*100:.0f}%,差异显著")
elif price_difference_rate >= 0.2:
analysis.append(f"法拍价格低于安居客{price_difference_rate*100:.0f}%,差异适中")
else:
analysis.append(f"法拍价格与安居客差异较小({price_difference_rate*100:.0f}%)")
# 分析单价水平
if anjuke_price > 0:
if auction_price < anjuke_price * 0.6:
analysis.append("法拍单价显著低于市场价,值得关注")
elif auction_price < anjuke_price * 0.8:
analysis.append("法拍单价低于市场价,具有投资价值")
return ";".join(analysis)
def analyze_property(property_info):
"""
分析单个房产
"""
address = property_info.get('address', '')
debt_principal = property_info.get('debt_principal', 0)
area = property_info.get('area', 0)
# 获取价格信息
anjuke_price = search_anjuke_price(address)
auction_price, auction_discount = search_auction_price(address)
# 计算评估值
anjuke_valuation = (anjuke_price * area) / 10000 # 转换为万元
# 计算指标
debt_coverage_ratio = anjuke_valuation / debt_principal
price_difference_rate = (anjuke_price - auction_price) / anjuke_price
# 计算评分
liquidity_score = calculate_liquidity_score(address, area, anjuke_valuation * 10000)
investment_score = calculate_investment_value(address, area, debt_principal, anjuke_valuation, auction_price)
# 获取投资建议
investment_suggestion = get_investment_suggestion(investment_score)
# 风险评估
risk_assessment = assess_risk(address)
# 计算法拍单价(元/㎡)
auction_unit_price = auction_price
# 计算阿里法拍成交价(万元)
auction_transaction_price = round(auction_price * area / 10000, 2)
# 生成价格差异分析
price_difference_analysis = generate_price_difference_analysis(
anjuke_price, auction_price, auction_discount, price_difference_rate
)
return {
"address": address,
"debt_principal": debt_principal,
"area": area,
"anjuke_average_price": anjuke_price, # 安居客中介价格(元/㎡)
"anjuke_valuation": round(anjuke_valuation, 2), # 安居客估值(万元)
"auction_transaction_price": auction_transaction_price, # 阿里法拍成交价(万元)
"auction_unit_price": auction_unit_price, # 法拍单价(元/㎡)
"auction_discount_rate": round(auction_discount, 2), # 法拍折扣率
"price_difference_rate": round(price_difference_rate, 2), # 价格差异率
"price_difference_analysis": price_difference_analysis, # 价格差异分析
"debt_coverage_ratio": round(debt_coverage_ratio, 2), # 债权覆盖率
"liquidity_score": liquidity_score, # 流动性评分
"investment_value_score": investment_score, # 投资价值评分
"investment_suggestion": investment_suggestion, # 投资建议
"risk_assessment": risk_assessment # 风险评估
}
def generate_report(results, options):
"""
生成报告
注意:实际项目中可以通过Agent生态提供的报告生成能力生成真实报告
"""
try:
# 尝试使用外部报告生成能力
# 这里可以通过环境变量或配置来决定使用哪种报告生成方式
import os
# 检查是否有外部报告生成服务配置
report_service = os.environ.get('REPORT_GENERATOR_SERVICE', '')
if report_service:
# 这里可以实现调用外部报告生成服务的逻辑
print(f"使用外部报告生成服务:{report_service}")
except Exception as e:
print(f"报告生成处理失败:{str(e)}")
# 兜底方案
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
report_url = f"http://localhost:8000/reports/analysis_{timestamp}.pdf"
return report_url
def main(input_data):
"""
技能的主入口函数
支持多种输入格式:
1. 直接传入property_data数组
2. 从Excel解析SKILL传来的表格数据(excel_data格式)
3. 从其他文件解析SKILL传来的数据(file_data格式)
4. 文本形式的房产数据(text_data格式)
5. 从图片解析SKILL传来的数据(image_data格式)
6. 从音频解析SKILL传来的数据(audio_data格式)
7. 从多模态解析SKILL传来的数据(multimodal_data格式)
"""
try:
# 解析输入数据
action = input_data.get('action', 'analyze_debt_portfolio')
options = input_data.get('options', {})
# 检查输入数据格式
property_data = []
# 情况1:直接传入property_data
if 'property_data' in input_data:
property_data = input_data.get('property_data', [])
# 情况2:从Excel解析SKILL传来的数据
elif 'excel_data' in input_data:
excel_data = input_data.get('excel_data', {})
rows = excel_data.get('rows', [])
headers = excel_data.get('headers', [])
# 解析Excel数据
# 尝试自动识别列名
address_col = None
debt_col = None
area_col = None
# 常见列名映射
address_keywords = ['地址', '房产地址', '物业地址', 'location', 'address']
debt_keywords = ['债权本金', '本金', '债务', 'debt', 'principal']
area_keywords = ['面积', '建筑面积', 'area', 'size']
# 识别列名
for i, header in enumerate(headers):
header_lower = str(header).lower()
if not address_col:
for keyword in address_keywords:
if keyword in header_lower:
address_col = i
break
if not debt_col:
for keyword in debt_keywords:
if keyword in header_lower:
debt_col = i
break
if not area_col:
for keyword in area_keywords:
if keyword in header_lower:
area_col = i
break
# 解析数据行
for row in rows:
if address_col is not None and debt_col is not None and area_col is not None:
try:
address = str(row[address_col]).strip()
debt_principal = float(row[debt_col])
area = float(row[area_col])
if address and debt_principal > 0 and area > 0:
property_data.append({
"address": address,
"debt_principal": debt_principal,
"area": area
})
except (ValueError, IndexError):
print(f"跳过无效行:{row}")
# 情况3:从其他文件解析SKILL传来的数据
elif 'file_data' in input_data:
file_data = input_data.get('file_data', {})
content = file_data.get('content', '')
file_type = file_data.get('file_type', '').lower()
# 处理CSV格式
if file_type == 'csv':
import csv
import io
reader = csv.reader(io.StringIO(content))
rows = list(reader)
if rows:
headers = rows[0]
data_rows = rows[1:]
# 尝试自动识别列名
address_col = None
debt_col = None
area_col = None
# 常见列名映射
address_keywords = ['地址', '房产地址', '物业地址', 'location', 'address']
debt_keywords = ['债权本金', '本金', '债务', 'debt', 'principal']
area_keywords = ['面积', '建筑面积', 'area', 'size']
# 识别列名
for i, header in enumerate(headers):
header_lower = str(header).lower()
if not address_col:
for keyword in address_keywords:
if keyword in header_lower:
address_col = i
break
if not debt_col:
for keyword in debt_keywords:
if keyword in header_lower:
debt_col = i
break
if not area_col:
for keyword in area_keywords:
if keyword in header_lower:
area_col = i
break
# 解析数据行
for row in data_rows:
if address_col is not None and debt_col is not None and area_col is not None:
try:
address = str(row[address_col]).strip()
debt_principal = float(row[debt_col])
area = float(row[area_col])
if address and debt_principal > 0 and area > 0:
property_data.append({
"address": address,
"debt_principal": debt_principal,
"area": area
})
except (ValueError, IndexError):
print(f"跳过无效行:{row}")
# 处理JSON格式
elif file_type == 'json':
import json
try:
json_data = json.loads(content)
if isinstance(json_data, list):
for item in json_data:
if isinstance(item, dict) and 'address' in item and 'debt_principal' in item and 'area' in item:
try:
address = str(item['address']).strip()
debt_principal = float(item['debt_principal'])
area = float(item['area'])
if address and debt_principal > 0 and area > 0:
property_data.append({
"address": address,
"debt_principal": debt_principal,
"area": area
})
except (ValueError, KeyError):
print(f"跳过无效项:{item}")
except json.JSONDecodeError:
print("JSON格式解析失败")
# 情况4:文本形式的房产数据
elif 'text_data' in input_data:
text_data = input_data.get('text_data', '')
# 简单的文本解析逻辑
# 假设每行包含地址、债权本金、面积,用逗号或空格分隔
lines = text_data.strip().split('\n')
for line in lines:
line = line.strip()
if not line:
continue
# 尝试用逗号分隔
parts = [p.strip() for p in line.split(',')]
if len(parts) < 3:
# 尝试用空格分隔
parts = [p.strip() for p in line.split() if p.strip()]
if len(parts) >= 3:
try:
# 假设最后两个是数字(债权本金和面积)
address = ' '.join(parts[:-2])
debt_principal = float(parts[-2])
area = float(parts[-1])
if address and debt_principal > 0 and area > 0:
property_data.append({
"address": address,
"debt_principal": debt_principal,
"area": area
})
except (ValueError, IndexError):
print(f"跳过无效行:{line}")
# 情况5:从图片解析SKILL传来的数据
elif 'image_data' in input_data:
image_data = input_data.get('image_data', {})
extracted_text = image_data.get('extracted_text', '')
extracted_table = image_data.get('extracted_table', {})
# 处理提取的表格数据
if extracted_table and 'headers' in extracted_table and 'rows' in extracted_table:
headers = extracted_table.get('headers', [])
rows = extracted_table.get('rows', [])
# 尝试自动识别列名
address_col = None
debt_col = None
area_col = None
# 常见列名映射
address_keywords = ['地址', '房产地址', '物业地址', 'location', 'address']
debt_keywords = ['债权本金', '本金', '债务', 'debt', 'principal']
area_keywords = ['面积', '建筑面积', 'area', 'size']
# 识别列名
for i, header in enumerate(headers):
header_lower = str(header).lower()
if not address_col:
for keyword in address_keywords:
if keyword in header_lower:
address_col = i
break
if not debt_col:
for keyword in debt_keywords:
if keyword in header_lower:
debt_col = i
break
if not area_col:
for keyword in area_keywords:
if keyword in header_lower:
area_col = i
break
# 解析数据行
for row in rows:
if address_col is not None and debt_col is not None and area_col is not None:
try:
address = str(row[address_col]).strip()
debt_principal = float(row[debt_col])
area = float(row[area_col])
if address and debt_principal > 0 and area > 0:
property_data.append({
"address": address,
"debt_principal": debt_principal,
"area": area
})
except (ValueError, IndexError):
print(f"跳过无效行:{row}")
# 处理提取的文本数据
elif extracted_text:
# 简单的文本解析逻辑
lines = extracted_text.strip().split('\n')
for line in lines:
line = line.strip()
if not line:
continue
# 尝试用逗号分隔
parts = [p.strip() for p in line.split(',')]
if len(parts) < 3:
# 尝试用空格分隔
parts = [p.strip() for p in line.split() if p.strip()]
if len(parts) >= 3:
try:
# 假设最后两个是数字(债权本金和面积)
address = ' '.join(parts[:-2])
debt_principal = float(parts[-2])
area = float(parts[-1])
if address and debt_principal > 0 and area > 0:
property_data.append({
"address": address,
"debt_principal": debt_principal,
"area": area
})
except (ValueError, IndexError):
print(f"跳过无效行:{line}")
# 情况6:从音频解析SKILL传来的数据
elif 'audio_data' in input_data:
audio_data = input_data.get('audio_data', {})
transcript = audio_data.get('transcript', '')
if transcript:
# 简单的文本解析逻辑
lines = transcript.strip().split('\n')
for line in lines:
line = line.strip()
if not line:
continue
# 尝试用逗号分隔
parts = [p.strip() for p in line.split(',')]
if len(parts) < 3:
# 尝试用空格分隔
parts = [p.strip() for p in line.split() if p.strip()]
if len(parts) >= 3:
try:
# 假设最后两个是数字(债权本金和面积)
address = ' '.join(parts[:-2])
debt_principal = float(parts[-2])
area = float(parts[-1])
if address and debt_principal > 0 and area > 0:
property_data.append({
"address": address,
"debt_principal": debt_principal,
"area": area
})
except (ValueError, IndexError):
print(f"跳过无效行:{line}")
# 情况7:从多模态解析SKILL传来的数据
elif 'multimodal_data' in input_data:
multimodal_data = input_data.get('multimodal_data', {})
# 检查是否包含各种类型的数据
if 'text_content' in multimodal_data:
# 处理文本内容
text_content = multimodal_data.get('text_content', '')
lines = text_content.strip().split('\n')
for line in lines:
line = line.strip()
if not line:
continue
# 尝试用逗号分隔
parts = [p.strip() for p in line.split(',')]
if len(parts) < 3:
# 尝试用空格分隔
parts = [p.strip() for p in line.split() if p.strip()]
if len(parts) >= 3:
try:
# 假设最后两个是数字(债权本金和面积)
address = ' '.join(parts[:-2])
debt_principal = float(parts[-2])
area = float(parts[-1])
if address and debt_principal > 0 and area > 0:
property_data.append({
"address": address,
"debt_principal": debt_principal,
"area": area
})
except (ValueError, IndexError):
print(f"跳过无效行:{line}")
elif 'table_content' in multimodal_data:
# 处理表格内容
table_content = multimodal_data.get('table_content', {})
headers = table_content.get('headers', [])
rows = table_content.get('rows', [])
# 尝试自动识别列名
address_col = None
debt_col = None
area_col = None
# 常见列名映射
address_keywords = ['地址', '房产地址', '物业地址', 'location', 'address']
debt_keywords = ['债权本金', '本金', '债务', 'debt', 'principal']
area_keywords = ['面积', '建筑面积', 'area', 'size']
# 识别列名
for i, header in enumerate(headers):
header_lower = str(header).lower()
if not address_col:
for keyword in address_keywords:
if keyword in header_lower:
address_col = i
break
if not debt_col:
for keyword in debt_keywords:
if keyword in header_lower:
debt_col = i
break
if not area_col:
for keyword in area_keywords:
if keyword in header_lower:
area_col = i
break
# 解析数据行
for row in rows:
if address_col is not None and debt_col is not None and area_col is not None:
try:
address = str(row[address_col]).strip()
debt_principal = float(row[debt_col])
area = float(row[area_col])
if address and debt_principal > 0 and area > 0:
property_data.append({
"address": address,
"debt_principal": debt_principal,
"area": area
})
except (ValueError, IndexError):
print(f"跳过无效行:{row}")
# 验证输入
if not property_data:
return {
"success": False,
"message": "缺少房产数据,请确保输入包含地址、债权本金和面积信息"
}
# 数据清洗和处理
processed_data = []
for property_info in property_data:
# 基本数据验证和清洗
cleaned_info = {
"address": property_info.get('address', '').strip(),
"debt_principal": float(property_info.get('debt_principal', 0)),
"area": float(property_info.get('area', 0))
}
# 验证必要字段
if cleaned_info['address'] and cleaned_info['debt_principal'] > 0 and cleaned_info['area'] > 0:
processed_data.append(cleaned_info)
else:
print(f"跳过无效数据:{property_info}")
if not processed_data:
return {
"success": False,
"message": "没有有效的房产数据"
}
# 分析房产数据
analysis_results = []
for property_info in processed_data:
result = analyze_property(property_info)
analysis_results.append(result)
# 生成摘要
total_properties = len(analysis_results)
priority_count = sum(1 for r in analysis_results if r['investment_suggestion'] == '优先关注')
avg_coverage = sum(r['debt_coverage_ratio'] for r in analysis_results) / total_properties if total_properties > 0 else 0
avg_discount = sum(r['auction_discount_rate'] for r in analysis_results) / total_properties if total_properties > 0 else 0
summary = f"本次分析了{total_properties}处房产,其中{priority_count}处建议优先关注。平均债权覆盖率为{int(avg_coverage * 100)}%,平均法拍折扣率为{int(avg_discount * 100)}%。"
# 生成报告
report_url = generate_report(analysis_results, options)
# 构建输出
output = {
"success": True,
"action": action,
"analysis_results": analysis_results,
"summary": summary,
"report_url": report_url
}
return output
except Exception as e:
return {
"success": False,
"message": f"分析过程中出错:{str(e)}"
}
if __name__ == "__main__":
# 测试代码
test_input = {
"action": "analyze_debt_portfolio",
"property_data": [
{
"address": "杭州市萧山区北干街道广德小区xx幢xx单元xxx室",
"debt_principal": 208.45,
"area": 102.35
}
]
}
result = main(test_input)
print(json.dumps(result, ensure_ascii=False, indent=2))