Atualização da API Bitstamp no sgcWebSockets

· Recursos

The biblioteca sgcWebSockets foi updated com significant improvements para o Bitstamp REST API component. This update adds support para several new endpoint categories that were previously missing, making o integration more comprehensive e aligned com o latest Bitstamp API v2 offerings.

What's New

The following new REST API endpoint categories foram added para o TsgcHTTP_API_Bitstamp_Rest component:

Sumário

  1. User Transactions
  2. Fees
  3. Deposit Addresses
  4. Sub-Account Transfers
  5. Earn / Staking
  6. Travel Rule e Markets
  7. WebSocket API
  8. Configuração

1. Transações do Usuário

Two new métodos permite que você retrieve your transaction history:

Method Description
GetUserTransactions Retorna all user transactions com support para pagination (limit, offset) e sorting.
GetUserTransactionsForCurrencyPair Retorna user transactions filtered por um specific currency pair.

Exemplo

// 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. Taxas

Three new métodos provide access para fee information:

Method Description
GetTradingFees Retorna trading fees para all currency pairs.
GetTradingFeesForCurrencyPair Retorna o trading fee para um specific currency pair.
GetWithdrawalFees Retorna withdrawal fees para all suportado currencies.

Exemplo

// 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. Endereços de Depósito

A new method permite que você retrieve o deposit address para any suportado cryptocurrency:

Method Description
GetCryptoDepositAddress Retorna o deposit address para o specified currency.

Exemplo

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

4. Transferências entre Sub-Contas

Two new métodos enable fund transfers entre main e sub-accounts:

Method Description
TransferToMain Transfers funds um partir de um sub-account para o main account.
TransferFromMain Transfers funds do main account para um sub-account.

Exemplo

// 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. Earn / Staking

Four new métodos provide full access para o Bitstamp Earn staking program:

Method Description
EarnSubscribe Inscreva-se em earn rewards para o specified currency e amount.
EarnUnsubscribe Unsubscribe do earn program.
GetEarnSubscriptions Retorna o list de current earn inscrições.
GetEarnTransactions Retorna o earn transaction history incluindo rewards.

Exemplo

// 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. Travel Rule e Mercados

Two additional public endpoints foram added:

Method Description
GetTravelRuleVASPs Retorna o list de Virtual Asset Service Providers (VASPs) para EU Travel Rule compliance. Useful when performing crypto withdrawals that require beneficiary VASP information.
GetMarkets Retorna o list de todos os disponíveis markets com basic data, complementing o existing GetTradingPairsInfo method.

Exemplo

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

7. WebSocket API

The WebSocket API V2 remains fully até date. All public channels (Live Ticker, Live Orders, Livro de Ordens, Detail Livro de Ordens, Full Livro de Ordens) and private channels (My Orders, My Trades) continue para work com o wss://ws.bitstamp.net endpoint.


8. Configuração

To use o private REST API endpoints, você precisa configure your Bitstamp API credentials:

Bitstamp1.Bitstamp.ApiKey := 'your_api_key';
Bitstamp1.Bitstamp.ApiSecret := 'your_api_secret';
Note: All novos endpoints use o same HMAC-SHA256 header-based autenticação (X-Auth headers) that is already in place para existing private endpoints. No additional configuração is needed.