sgcWebSockets Bitstamp API 更新

· 功能

sgcWebSockets 库对 Bitstamp REST API 组件进行了重大改进。此次更新新增了多个此前缺失的端点类别,使集成更加全面,并与最新的 Bitstamp API v2 保持一致。

新增内容

以下新 REST API 端点类别已添加到 TsgcHTTP_API_Bitstamp_Rest 组件:

目录

  1. 用户交易记录
  2. 手续费
  3. 充值地址
  4. 子账户转账
  5. 理财/质押
  6. 旅行规则与市场
  7. WebSocket API
  8. 配置

1. 用户交易记录

两个新方法允许您检索交易历史:

方法 描述
GetUserTransactions 返回所有用户交易记录,支持分页(limit、offset)和排序。
GetUserTransactionsForCurrencyPair 返回按特定货币对过滤的用户交易记录。

示例

// Get the last 50 user transactions, sorted descending
vJSON := Bitstamp1.REST_API.GetUserTransactions(50, 0, 'desc');
// Get user transactions for BTC/USD pair
vJSON := Bitstamp1.REST_API.GetUserTransactionsForCurrencyPair('btcusd');

2. 手续费

三个新方法提供手续费信息访问:

方法 描述
GetTradingFees 返回所有货币对的交易手续费。
GetTradingFeesForCurrencyPair 返回特定货币对的交易手续费。
GetWithdrawalFees 返回所有支持币种的提现手续费。

示例

// Get all trading fees
vJSON := Bitstamp1.REST_API.GetTradingFees;
// Get trading fee for ETH/USD
vJSON := Bitstamp1.REST_API.GetTradingFeesForCurrencyPair('ethusd');
// Get withdrawal fees
vJSON := Bitstamp1.REST_API.GetWithdrawalFees;

3. 充值地址

新增方法允许您获取任意支持的加密货币充值地址:

方法 描述
GetCryptoDepositAddress 返回指定币种的充值地址。

示例

// Get Bitcoin deposit address
vJSON := Bitstamp1.REST_API.GetCryptoDepositAddress('btc');
// Get Ethereum deposit address
vJSON := Bitstamp1.REST_API.GetCryptoDepositAddress('eth');

4. 子账户转账

两个新方法支持主账户与子账户之间的资金转账:

方法 描述
TransferToMain 将资金从子账户转入主账户。
TransferFromMain 将资金从主账户转入子账户。

示例

// Transfer 0.5 BTC from sub-account to main
vJSON := Bitstamp1.REST_API.TransferToMain('btc', '0.5');
// Transfer 100 USD from main to a specific sub-account
vJSON := Bitstamp1.REST_API.TransferFromMain('usd', '100', 'sub_account_id');

5. 理财/质押

四个新方法提供对 Bitstamp Earn 质押计划的完整访问:

方法 描述
EarnSubscribe 订阅指定币种和数量的收益奖励。
EarnUnsubscribe 取消订阅收益计划。
GetEarnSubscriptions 返回当前收益订阅列表。
GetEarnTransactions 返回包含奖励在内的收益交易历史。

示例

// Subscribe 1 ETH to the Earn program
vJSON := Bitstamp1.REST_API.EarnSubscribe('eth', '1.0');
// Check current subscriptions
vJSON := Bitstamp1.REST_API.GetEarnSubscriptions;
// Get earn transaction history (rewards, etc.)
vJSON := Bitstamp1.REST_API.GetEarnTransactions;
// Unsubscribe 0.5 ETH from Earn
vJSON := Bitstamp1.REST_API.EarnUnsubscribe('eth', '0.5');

6. 旅行规则与市场

新增了两个公共端点:

方法 描述
GetTravelRuleVASPs 返回欧盟旅行规则合规所需的虚拟资产服务提供商(VASP)列表。在执行需要受益人 VASP 信息的加密货币提现时非常有用。
GetMarkets 返回包含基本数据的所有可用市场列表,补充现有的 GetTradingPairsInfo 方法。

示例

// Get list of Travel Rule VASPs
vJSON := Bitstamp1.REST_API.GetTravelRuleVASPs;
// Get all available markets
vJSON := Bitstamp1.REST_API.GetMarkets;

7. WebSocket API

WebSocket API V2 保持完全最新。所有公共频道(Live Ticker、Live Orders、Order Book、Detail Order Book、Full Order Book)和私有频道(My Orders、My Trades)继续与 wss://ws.bitstamp.net 端点配合使用。


8. 配置

要使用私有 REST API 端点,您需要配置 Bitstamp API 凭据:

Bitstamp1.Bitstamp.ApiKey := 'your_api_key';
Bitstamp1.Bitstamp.ApiSecret := 'your_api_secret';
注意:所有新端点使用与现有私有端点相同的基于 HMAC-SHA256 头部的身份验证(X-Auth 头部),无需额外配置。