您需要可靠的、可编程的交易卡价格历史访问,以便您可以评估投资组合、运行盈亏或在本周触发买入/卖出警报。在本指南结束时,您将搜索特定卡片并提取其最近的评级销售价格——准备将其放入您的财务工作流程、仪表板和自动化作业中。
此API提供的功能
体育卡和交易卡API提供了两个对财务和定价工作重要的核心功能:
- 卡片搜索:快速模糊搜索,将人类查询解析为特定卡片身份,并获取card_id及基本元数据。
- 获取卡片价格:在请求的回溯窗口(以天为单位)内,获取给定card_id和等级的时间序列价格数据。
您将使用卡片搜索将查询“LeBron James Topps Chrome 2003”映射到确切的card_id,然后使用获取卡片价格来提取特定等级(例如,PSA 10)的最近销售时间序列。结果是一个轻量级但适合财务的管道,您可以将其连接到估值、NAV快照、警报和报告中。
在Zyla API Hub上开始
打开API页面,订阅并获取您的密钥。Zyla API Hub集中管理超过10,000个公共API,只需一个帐户、一个API密钥和一个订阅+配额模型(不是按调用计费)。对于此API,您可以从7天的试用或50个请求开始——查看列表以获取当前访问选项和定价。
身份验证:在每个请求中发送Authorization: Bearer YOUR_API_KEY。
您将使用的端点
1) 卡片搜索
方法: GET
URL: https://zylalabs.com/api/2511/sports-card-and-trading-card-api/2494/card-search
目的: 将自由文本查询解析为一个或多个匹配的卡片,每个卡片都有card_id和您需要请求价格的元数据。
所需查询参数:
- search (string):您的自由文本查询,例如,Lebron James
官方cURL示例:
curl -s -X GET "https://zylalabs.com/api/2511/sports-card-and-trading-card-api/2494/card-search?search=Lebron+James" \
-H "Authorization: Bearer YOUR_API_KEY"
官方JSON示例响应:
[
{
"description": "LeBron James 2003 Topps Basketball",
"player": "Lebron James",
"set": "2003 Topps Basketball",
"number": "221",
"variant": "Base",
"card_id": "1588290260620x609083468203688000",
"image": "//s3.amazonaws.com/appforest_uf/f1588290324330x374737296708651100/2003-Topps-Basketball-LeBron-James-graded.jpg",
"category": "Basketball",
"category_group": "Sports Cards",
"set_type": "Topps Basketball"
},
{
"description": "LeBron James 2003 Upper Deck Rookie Exclusives Basketball",
"player": "Lebron James",
"set": "2003 Upper Deck Rookie Exclusives Basketball",
"number": "1",
"variant": "Base",
"card_id": "1593982609906x272877681796710400",
"image": "//s3.amazonaws.com/appforest_uf/f1593982606419x316822824595257800/2003-Upper-Deck-Rookie-Exclusives-Lebron-James-1.jpg",
"category": "Basketball",
"category_group": "Sports Cards",
"set_type": "Upper Deck Rookie Exclusives Basketball"
},
{
"description": "LeBron James 2025 Topps Chrome Cactus Jack Basketball",
"player": "LeBron James",
"set": "2025 Topps Chrome Cactus Jack Basketball",
"number": "46",
"variant": "Base",
"card_id": "1782184797693x851477815192830800",
"image": "//s3.amazonaws.com/appforest_uf/f1598843985116x489100344198574160/05-Basketball.jpg",
"category": "Basketball",
"category_group": "Sports Cards",
"set_type": "Topps Chrome Cactus Jack Basketball"
},
{
"description": "LeBron James 2003 Topps Chrome Basketball",
"player": "Lebron James",
"set": "2003 Topps Chrome Basketball",
"number": "111",
"variant": "Base",
"card_id": "1586412050491x786559417729941500",
"image": "//942284f33c575895b4be9de571ca6e40.cdn.bubble.io/d112/f1766768512710x492230808547762700/resize",
"category": "Basketball",
"category_group": "Sports Cards",
"set_type": "Topps Chrome Basketball"
},
{
"description": "LeBron James 2024 Panini Prizm Basketball",
"player": "LeBron James",
"set": "2024 Panini Prizm Basketball",
"number": "130",
"variant": "Base",
"card_id": "1740403688997x505339465151470000",
"image": "//942284f33c575895b4be9de571ca6e40.cdn.bubble.io/d112/f1757384268822x692013733346557700/resize",…
关键字段:
- description, player, set, number, variant:用于UI和日志的人类可读身份。
- card_id:您必须与获取卡片价格一起使用的标识符。
- image:卡片图像的相对路径。
2) 获取卡片价格
方法: GET
URL: https://zylalabs.com/api/2511/sports-card-and-trading-card-api/2495/get-card-prices
目的: 检索特定卡片和等级在请求窗口内的最近价格时间序列。
所需查询参数:
- card_id (string):例如,1586412050491x786559417729941500
- days (string):回溯期(例如,90)
- grade (string):评级标签(例如,PSA 10)
官方cURL示例:
官方JSON示例响应:
[
{
"closing_date": "2026-08-03T23:59:00.000Z",
"Grade": "PSA 10",
"card_id": "1586412050491x786559417729941500",
"price": "16150.00"
},
{
"closing_date": "2026-08-01T23:59:00.000Z",
"Grade": "PSA 10",
"card_id": "1586412050491x786559417729941500",
"price": "18250.00"
},
{
"closing_date": "2026-07-31T23:59:00.000Z",
"Grade": "PSA 10",
"card_id": "1586412050491x786559417729941500",
"price": "17900.00"
},
{
"closing_date": "2026-07-27T23:59:00.000Z",
"Grade": "PSA 10",
"card_id": "1586412050491x786559417729941500",
"price": "17303.00"
},
{
"closing_date": "2026-07-21T23:59:00.000Z",
"Grade": "PSA 10",
"card_id": "1586412050491x786559417729941500",
"price": "17373.00"
},
{
"closing_date": "2026-07-17T23:59:00.000Z",
"Grade": "PSA 10",
"card_id": "1586412050491x786559417729941500",
"price": "15337.20"
},
{
"closing_date": "2026-07-15T23:59:00.000Z",
"Grade": "PSA 10",
"card_id": "1586412050491x786559417729941500",…
您将实际使用的字段:
- closing_date:标记价格关闭时间的ISO 8601 UTC时间戳(Z后缀表示UTC)。
- price:表示销售价格金额的字符串。响应中未指定货币——请相应地存储和呈现。
- Grade:您请求的价格系列的评级标签。
- card_id:回显您查询的卡片;对于连接和多卡管道很有用。
复制粘贴Python:获取价格并计算快速指标
下面的代码片段请求特定card_id在PSA 10等级下的90天系列,并计算简单的最后价格和平均值。您可以根据NAV、回撤或风险限制调整聚合。
import os
import requests
from decimal import Decimal
from statistics import mean
API_KEY = os.getenv("ZYLA_API_KEY", "YOUR_API_KEY")
url = "https://zylalabs.com/api/2511/sports-card-and-trading-card-api/2495/get-card-prices"
params = {
"card_id": "1586412050491x786559417729941500",
"days": "90",
"grade": "PSA 10",
}
headers = {
"Authorization": f"Bearer {API_KEY}",
}
resp = requests.get(url, headers=headers, params=params, timeout=30)
resp.raise_for_status()
data = resp.json() # array of { closing_date, Grade, card_id, price }
# 将价格字符串解析为Decimal以进行财务安全的算术
prices = [Decimal(entry["price"]) for entry in data]
dates = [entry["closing_date"] for entry in data]
last_price = prices[0] if prices else None # 最近的在样本中首先出现
avg_price = (mean(prices) if prices else None)
print("observations:", len(prices))
print("most_recent_date:", dates[0] if dates else None)
print("most_recent_price:", str(last_price) if last_price is not None else None)
print("average_price_lookback:", str(Decimal(avg_price)) if avg_price is not None else None)
您可以在本周交付的财务工作流程
- 投资组合估值:存储card_id + grade对的观察列表;运行每日作业以提取最新价格并计算NAV和盈亏。由于closing_date时间戳是UTC,因此请将所有内容保留在UTC中。
- 风险和敞口监控:在回溯窗口(例如,30–90天)内对滚动平均值或最大回撤设置阈值,并在突破时发出警报。
- 订单路由和价格区间:对于需要交易前检查的市场,将传入的要约与移动平均值或最近的打印进行比较,以拒绝异常值。
- 绩效报告:快照周末价格,并为包括交易卡的替代资产套件生成时间加权回报。
节省时间的实施说明
- 身份验证:每个请求必须包含Authorization: Bearer YOUR_API_KEY。
- 时区:closing_date值为UTC(注意Z)。在UTC中进行所有日期数学运算,以避免在午夜边界附近出现的偏差。
- 排序:如果您依赖于“最近的优先”,请在您的端验证排序。在计算滚动指标之前,持久化按日期排序的视图。
- 解析:将价格视为字符串,并在算术运算之前转换为Decimal(或您语言的确切小数类型),以避免浮点漂移。
- 缓存:对于仪表板,考虑缓存card_id/grade/days元组的最后响应,以避免在同一刷新间隔内重复调用。
- 配额:Zyla使用订阅+配额。对于初始集成,您可以从7天的试用或50个请求开始;查看列表以获取具体信息,因为它们可能会更改。
逐步:解析卡片并提取其价格
1) 解析卡片
使用卡片搜索,尽可能使用包含球员、系列、年份和变体的特定查询字符串。从响应中选择预期的匹配项并复制其card_id。
2) 提取评级时间序列
使用所选的card_id、您所需的天数窗口和等级(例如,PSA 10)调用获取卡片价格。将系列存储在您的数据存储中,并执行下游分析。
通过MCP从AI代理使用API
如果您希望通过一个讲述模型上下文协议(MCP)的AI代理来协调调用,请将您的客户端指向MCP端点并提供您的API密钥。请参阅此处的文档: MCP。配置MCP后,您的代理可以调用上面显示的相同市场端点,使用相同的Authorization头和URL路径。
cURL的端到端示例
验证您的管道的最快方法是复制这两个调用:
- 搜索卡片(替换YOUR_API_KEY):
- 从响应中选择一个card_id(例如,1586412050491x786559417729941500),然后提取其价格:
这在财务堆栈中的位置
交易卡是收藏家、基金和市场日益增长的替代资产套件。卡片搜索和获取卡片价格的组合使您能够:
- 使用card_id规范化身份,以便您可以去重观察列表和持有。
- 为每个等级构建干净的价格系列,以计算回报、滚动波动率和z分数。
- 为投资组合工具、会计系统和风险检查提供结构化的、带时间戳的打印。
由于API返回ISO 8601时间戳和字符串化价格,您可以按原样存储原始值,然后在计算指标时确定性地解析。
订阅并交付
要立即集成,请在市场项目页面上订阅,获取您的密钥,并运行上面的cURL。Zyla API Hub将您的所有API保持在一个密钥和订阅下,因此您不必管理多个供应商帐户。从这里开始: 开始7天的体育卡和交易卡API试用
常见问题
我如何找到正确的card_id?
使用卡片搜索端点,进行详细查询,然后从响应中选择预期的项目并复制其card_id。将其输入获取卡片价格。
closing_date时间戳的时区是什么?
它们是带有Z后缀的ISO 8601,表示UTC。在UTC中进行日期数学运算,以避免边界问题。
价格使用什么货币?
响应中包含价格字段作为字符串金额。响应中未指定货币;在您的应用中一致地处理展示。
是否有免费计划?
访问遵循订阅+配额模型(不是按调用计费)。列表提供7天的试用或50个请求以开始;请查看API页面以获取当前访问选项和定价。
我可以通过AI代理调用这些端点吗?
是的。配置您的MCP兼容客户端以使用MCP端点并包含您的API密钥。请参阅: MCP。
官方API响应
[
{
"description": "LeBron James 2003 Topps Basketball",
"player": "Lebron James",
"set": "2003 Topps Basketball",
"number": "221",
"variant": "Base",
"card_id": "1588290260620x609083468203688000",
"image": "//s3.amazonaws.com/appforest_uf/f1588290324330x374737296708651100/2003-Topps-Basketball-LeBron-James-graded.jpg",
"category": "Basketball",
"category_group": "Sports Cards",
"set_type": "Topps Basketball"
},
{
"description": "LeBron James 2003 Upper Deck Rookie Exclusives Basketball",
"player": "Lebron James",
"set": "2003 Upper Deck Rookie Exclusives Basketball",
"number": "1",
"variant": "Base",
"card_id": "1593982609906x272877681796710400",
"image": "//s3.amazonaws.com/appforest_uf/f1593982606419x316822824595257800/2003-Upper-Deck-Rookie-Exclusives-Lebron-James-1.jpg",
"category": "Basketball",
"category_group": "Sports Cards",
"set_type": "Upper Deck Rookie Exclusives Basketball"
},
{
"description": "LeBron James 2025 Topps Chrome Cactus Jack Basketball",
"player": "LeBron James",
"set": "2025 Topps Chrome Cactus Jack Basketball",
"number": "46",
"variant": "Base",
"card_id": "1782184797693x851477815192830800",
"image": "//s3.amazonaws.com/appforest_uf/f1598843985116x489100344198574160/05-Basketball.jpg",
"category": "Basketball",
"category_group": "Sports Cards",
"set_type": "Topps Chrome Cactus Jack Basketball"
},
{
"description": "LeBron James 2003 Topps Chrome Basketball",
"player": "Lebron James",
"set": "2003 Topps Chrome Basketball",
"number": "111",
"variant": "Base",
"card_id": "1586412050491x786559417729941500",
"image": "//942284f33c575895b4be9de571ca6e40.cdn.bubble.io/d112/f1766768512710x492230808547762700/resize",
"category": "Basketball",
"category_group": "Sports Cards",
"set_type": "Topps Chrome Basketball"
},
{
"description": "LeBron James 2024 Panini Prizm Basketball",
"player": "LeBron James",
"set": "2024 Panini Prizm Basketball",
"number": "130",
"variant": "Base",
"card_id": "1740403688997x505339465151470000",
"image": "//942284f33c575895b4be9de571ca6e40.cdn.bubble.io/d112/f1757384268822x692013733346557700/resize",…
官方API响应
[
{
"description": "LeBron James 2003 Topps Basketball",
"player": "Lebron James",
"set": "2003 Topps Basketball",
"number": "221",
"variant": "Base",
"card_id": "1588290260620x609083468203688000",
"image": "//s3.amazonaws.com/appforest_uf/f1588290324330x374737296708651100/2003-Topps-Basketball-LeBron-James-graded.jpg",
"category": "Basketball",
"category_group": "Sports Cards",
"set_type": "Topps Basketball"
},
{
"description": "LeBron James 2003 Upper Deck Rookie Exclusives Basketball",
"player": "Lebron James",
"set": "2003 Upper Deck Rookie Exclusives Basketball",
"number": "1",
"variant": "Base",
"card_id": "1593982609906x272877681796710400",
"image": "//s3.amazonaws.com/appforest_uf/f1593982606419x316822824595257800/2003-Upper-Deck-Rookie-Exclusives-Lebron-James-1.jpg",
"category": "Basketball",
"category_group": "Sports Cards",
"set_type": "Upper Deck Rookie Exclusives Basketball"
},
{
"description": "LeBron James 2025 Topps Chrome Cactus Jack Basketball",
"player": "LeBron James",
"set": "2025 Topps Chrome Cactus Jack Basketball",
"number": "46",
"variant": "Base",
"card_id": "1782184797693x851477815192830800",
"image": "//s3.amazonaws.com/appforest_uf/f1598843985116x489100344198574160/05-Basketball.jpg",
"category": "Basketball",
"category_group": "Sports Cards",
"set_type": "Topps Chrome Cactus Jack Basketball"
},
{
"description": "LeBron James 2003 Topps Chrome Basketball",
"player": "Lebron James",
"set": "2003 Topps Chrome Basketball",
"number": "111",
"variant": "Base",
"card_id": "1586412050491x786559417729941500",
"image": "//942284f33c575895b4be9de571ca6e40.cdn.bubble.io/d112/f1766768512710x492230808547762700/resize",
"category": "Basketball",
"category_group": "Sports Cards",
"set_type": "Topps Chrome Basketball"
},
{
"description": "LeBron James 2024 Panini Prizm Basketball",
"player": "LeBron James",
"set": "2024 Panini Prizm Basketball",
"number": "130",
"variant": "Base",
"card_id": "1740403688997x505339465151470000",
"image": "//942284f33c575895b4be9de571ca6e40.cdn.bubble.io/d112/f1757384268822x692013733346557700/resize",…