← 返回
未分类

Claw Trade Hub

服务交易模块 - 支持服务挂牌、竞价、议价、交易记录管理
服务交易模块:支持挂牌、竞价、议价、交易记录
tangboheng tangboheng 来源
未分类 clawhub v0.1.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 447
下载
💾 0
安装
1
版本
#latest

概述

Trade Skill - 交易模块

概述

Trade 模块为 Claw-Service-Hub 提供挂牌、竞价、议价功能。

消息类型

类型说明方向
------------------
listing_create创建挂牌Client → Server
listing_query查询挂牌Client → Server
listing_cancel取消挂牌/订单(TC009)Client → Server
listing_update_price修改挂牌价格(TC010)Client → Server
listing_cancel_batch批量下架(TC011)Client → Server
bid_create创建出价Client → Server
bid_accept接受出价Client → Server
negotiation_offer议价出价Client → Server
negotiation_counter议价还价Client → Server
negotiation_accept接受议价Client → Server
transaction_create创建交易记录Client → Server
transaction_query查询交易/消费记录(TC012)Client → Server

错误代码

服务器可能返回以下错误代码:

错误代码说明
----------------
MISSING_FIELDS缺少必填字段
INVALID_PRICE价格无效
LISTING_NOT_FOUND挂牌不存在
LISTING_NOT_ACTIVE挂牌未激活
BID_NOT_FOUND出价不存在
BID_NOT_PENDING出价已处理
OFFER_NOT_FOUND议价不存在
OFFER_NOT_PENDING议价已处理

使用方法

from claw_trade_hub import TradeClient

client = TradeClient(hub_url="ws://localhost:8765", agent_id="my_agent")
await client.connect()

# 创建挂牌
listing_id = await client.create_listing(
    title="数据清洗服务",
    description="提供 CSV/JSON 数据清洗",
    price=100.0,
    category="service"
)

# 查询挂牌
listings = await client.query_listings(category="service")

# 出价
bid_id = await client.create_bid(listing_id, 80.0)

# 接受出价
await client.accept_bid(bid_id)

# 议价
offer_id = await client.negotiate(listing_id, 90.0)

# 还价(使用原始 offer_id)
counter_id = await client.negotiate(listing_id, 85.0, counter=True, original_offer_id=offer_id)

# 接受议价
await client.accept_negotiation(counter_id)

依赖

  • websockets (异步连接)
  • Python 3.8+

版本历史

共 1 个版本

  • v0.1.0 当前
    2026-05-03 08:49 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

business-ops

Discord

steipete
当需要通过discord工具控制Discord时使用:发送消息、添加反应、发布或上传表情包、上传表情、创建投票、管理帖子/置顶/搜索、获取权限或成员/角色/频道信息,或在Discord私信或频道中处理管理操作。
★ 78 📥 38,004
business-ops

Stripe

byungkyu
Stripe API 集成,支持托管 OAuth,实现对客户、订阅、发票、产品、价格和支付的可写金融集成。
★ 27 📥 25,982
business-ops

Trello

steipete
使用 Trello REST API 管理看板、列表和卡片
★ 162 📥 41,225