@icgio/icg-exchanges-wrapper
v1.17.18
Published
High-level wrapper functions for the ICG exchanges package, providing simplified interfaces for common trading operations across multiple exchanges.
Readme
ICG Exchanges Wrapper
High-level wrapper functions for the ICG exchanges package, providing simplified interfaces for common trading operations across multiple exchanges.
Features
- Multi-Exchange Operations: Execute operations across multiple exchanges in parallel
- Unified Data Format: Consistent response format regardless of exchange
- Order Management Middleware: Advanced order placement with retries and validation
- WebSocket Data Client: Real-time log streaming support
- Rate Data Aggregation: Combine orderbook data from multiple sources
Installation
npm install @icgio/icg-exchanges-wrapperUsage
Functions Module
const { functions } = require('@icgio/icg-exchanges-wrapper')
// Get rates (orderbook) from multiple exchanges
const rates = await functions.get_exchanges_rates(exchanges, pairs)
// Get balances from multiple exchanges
const balances = await functions.get_exchanges_balance(exchanges)
// Get trade history
const trades = await functions.get_exchanges_trades(exchanges, pairs)
// Get open orders
const open_orders = await functions.get_exchanges_open_orders(exchanges, pairs)
// Get deposit history
const deposits = await functions.get_exchanges_deposits(exchanges)
// Get withdrawal history
const withdrawals = await functions.get_exchanges_withdrawals(exchanges)
// Get OHLCV data
const ohlcv = await functions.get_exchanges_ohlcv(exchanges, pairs, interval)
// Get market history
const market_history = await functions.get_exchanges_market_history(exchanges, pairs)Orders Middleware
const Orders = require('@icgio/icg-exchanges-wrapper').orders
// Create an order manager instance
const orders = new Orders(exchanges_config)
// Place orders with advanced features
await orders.place_order(exchange, pair, side, amount, price, options)
// Cancel orders
await orders.cancel_order(exchange, pair, order_id)
// Get order status
const status = await orders.get_order_status(exchange, pair, order_id)Project Structure
icg-exchanges-wrapper/
├── index.js # Main entry point
├── functions/
│ ├── get-exchanges-balance.js # Balance fetching
│ ├── get-exchanges-deposits.js # Deposit history
│ ├── get-exchanges-open-orders.js # Open orders
│ ├── get-exchanges-rates-market-history-ohlcv.js # Market data
│ ├── get-exchanges-trades.js # Trade history
│ └── get-exchanges-withdrawals.js # Withdrawal history
├── middleware/
│ ├── account.js # Account middleware
│ └── orders.js # Order management middleware
└── package.jsonAvailable Functions
| Function | Description |
|----------|-------------|
| get_exchanges_rates | Fetch orderbook/rates from exchanges |
| get_exchanges_market_history | Fetch recent trade history |
| get_exchanges_ohlcv | Fetch OHLCV candlestick data |
| get_exchanges_balance | Fetch account balances |
| get_exchanges_trades | Fetch user trade history |
| get_exchanges_open_orders | Fetch open orders |
| get_exchanges_deposits | Fetch deposit history |
| get_exchanges_withdrawals | Fetch withdrawal history |
Dependencies
| Package | Purpose |
|---------|---------|
| @icgio/icg-exchanges | Exchange implementations |
| @icgio/icg-utils | Utility functions |
| lodash | Utility library |
| pg | PostgreSQL client |
Code Style
- CommonJS modules (
require()/module.exports) - Variable naming:
snake_case - Function naming:
snake_case
License
ISC License
