Coinbase WebSocket API

· 컴포넌트

sgcWebSockets 4.4.7부터 Coinbase WebSocket API를 지원해요. Coinbase는 Ethereum, Bitcoin 같은 암호화폐를 사고팔고 저장할 수 있는 플랫폼이에요.

WebSocket API를 사용하면 시세 업데이트, 상태, 티커, 주문서 깊이 등을 실시간으로 받을 수 있어요.


Coinbase 연결 방법

oClient := TsgcWebSocketClient.Create(nil);
oCoinbase := TsgcWSAPI_Coinbase.Create(nil);
oCoinbase.Client := oClient;
oClient.Active := True; 

티커 구독 방법 

oClient := TsgcWebSocketClient.Create(nil);
oCoinbase := TsgcWSAPI_Coinbase.Create(nil);
oCoinbase.Client := oClient;
oCoinbase.SubscribeTicker('ETH-USD']);
procedure OnCoinbaseMessage(Sender: TObject; aType, aRawMessage: string);
begin
// here you will receive the ticker updates
end;