This repository contains comprehensive example code for using the Siebly.io Crypto API SDKs with various cryptocurrency exchanges. All examples are written in TypeScript and demonstrate REST API, WebSocket, and authentication patterns.
- Binance - Spot, Futures, Portfolio Margin, WebSockets
- Bitget - V2 Classic & V3 UTA, Spot, Futures, WebSockets
- Bitmart - Spot, Futures, WebSockets
- Bybit - V5 API, Spot, Futures, WebSockets
- Coinbase - Advanced Trade, Coinbase App, Institutional APIs
- Gate.io - Spot, Futures, WebSockets
- Kraken - Spot, Derivatives, WebSockets
- Kucoin - Spot, Futures, WebSockets (V1 & Pro V2)
- OKX - Spot, Futures, WebSockets, Multiple Markets (Global/EEA/US)
examples/
├── Binance/
│ ├── Auth/ # Authentication examples (RSA, Ed25519)
│ ├── Rest/ # REST API examples
│ │ ├── Spot/
│ │ ├── Futures/
│ │ ├── Portfolio Margin/
│ │ └── misc/
│ └── WebSockets/ # WebSocket examples
│ ├── Public/
│ ├── Private(userdata)/
│ ├── WS-API/
│ ├── Demo/
│ └── Misc/
├── Bitget/
│ ├── Auth/
│ ├── V2 - Classic/ # V2 Classic API examples
│ │ ├── Rest/
│ │ └── Websocket/
│ └── V3 - UTA/ # V3 Unified Trading Account examples
│ ├── Rest/
│ ├── Websocket/
│ └── WS-API/
├── Bitmart/
│ ├── Auth/
│ ├── Rest/
│ │ ├── Spot/
│ │ └── Futures/
│ └── Websocket/
├── Bybit/
│ ├── Auth/
│ ├── Rest/ # V5 REST API examples
│ └── Websocket/
│ ├── Public/
│ ├── Private/
│ └── WS-API/
├── Coinbase/
│ ├── AdvancedTrade/ # Advanced Trade API
│ ├── CoinbaseApp/ # Coinbase App API
│ └── Institutional/ # Institutional APIs
│ ├── CBExchange/
│ └── CBInternationalExchange/
├── Gate/
│ ├── Rest/
│ │ ├── spot/
│ │ └── futures/
│ └── Websocket/
│ └── WS-API/
├── Kraken/
│ ├── Spot/
│ │ ├── Public/
│ │ ├── Private/
│ │ └── WebSockets/
│ └── Derivatives/
│ ├── Public/
│ ├── Private/
│ └── WebSockets/
├── Kucoin/
│ ├── Auth/
│ ├── Rest/
│ └── WebSockets/ # V1 & Pro V2 examples
│ └── WS-API/
└── OKX/
├── Auth/
├── Rest/
└── Websocket/
└── WS-API/
- Clone this repository:
git clone <repository-url>
cd crypto-api-examples- Install dependencies:
npm installThis will install all required SDK packages:
binancebitget-apibitmart-apibybit-apicoinbase-apigateio-api@siebly/kraken-apikucoin-apiokx-api
Each example file is a standalone TypeScript file that can be executed directly. Examples use environment variables for API credentials.
Set up environment variables:
export API_KEY="your-api-key"
export API_SECRET="your-api-secret"
export API_PASS="your-api-passphrase" # If required by exchangeRun an example:
npx ts-node examples/Binance/Rest/Spot/rest-spot-public.ts- Public APIs: Examples that don't require authentication (market data, tickers, etc.)
- Private APIs: Examples requiring API keys (trading, account management, etc.)
- WebSockets: Real-time data streaming examples
- Auth: Authentication method examples (HMAC, RSA, Ed25519)
- WS-API: WebSocket API client examples for advanced use cases
All examples follow a consistent pattern:
- Import the SDK client from the npm package
- Initialize the client with credentials (if needed)
- Make API calls or set up WebSocket connections
- Handle responses and errors
Example:
import { RestClient } from 'binance';
const client = new RestClient({
apiKey: process.env.API_KEY,
apiSecret: process.env.API_SECRET,
});
// Make API calls
const result = await client.getAccountInfo();
console.log(result);npm run lint- Run ESLint on all example filesnpm run lint:fix- Fix ESLint issues automaticallynpm run format- Format code with Prettiernpm run build- Update latest SDK versions and build examplesnpm run buildfast- Build examples without updating SDKs
When adding new examples:
- Follow the existing directory structure
- Use environment variables for credentials
- Include clear comments explaining the example
- Ensure code passes linting:
npm run lint - Format code:
npm run format
For detailed SDK documentation and API reference, visit:
ISC