npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@chirag1702/algox-delta-exchange-plugin

v1.0.0

Published

Delta Exchange India broker plugin for AlgoX Trading Framework

Readme

AlgoX Delta Exchange India Broker Plugin

A broker plugin for Delta Exchange India that integrates with the AlgoX Trading Framework, enabling algorithmic trading strategies to connect and trade on the Delta Exchange platform.

Features

  • REST API Integration: Full support for order management, positions, and account information
  • WebSocket Streaming: Real-time market data (tickers, candles, orderbook)
  • Option Chain Support: Snapshot + live option chain updates via optionChain events
  • Options Trading: Place/modify/cancel option orders using option tradingSymbol
  • Private Channels: Order and position updates via authenticated WebSocket
  • Automatic Reconnection: Built-in reconnection logic with exponential backoff
  • TypeScript Support: Full TypeScript definitions included

Installation

npm install @chirag1702/algox @chirag1702/algox-delta-exchange-plugin

The plugin expects @chirag1702/algox to be installed alongside it as a peer dependency.

Quick Start

import { DeltaExchangePlugin, BrokerCredentials } from '@chirag1702/algox-delta-exchange-plugin';

// Create plugin instance
const deltaPlugin = new DeltaExchangePlugin({
  testnet: true,  // Use testnet for testing
  debug: true     // Enable debug logging
});

// Connect with credentials
await deltaPlugin.connect({
  apiKey: 'your-api-key',
  apiSecret: 'your-api-secret'
});

// Subscribe to market data
await deltaPlugin.subscribeTicks([{
  symbol: 'BTCUSD',
  exchange: 'DELTA',
  instrumentType: 'CRYPTO',
  tradingSymbol: 'BTCUSD',
  lotSize: 1,
  tickSize: 0.5
}]);

// Listen for ticks
deltaPlugin.on('tick', (tick) => {
  console.log('Tick received:', tick.ltp);
});

// Place an order
const orderResponse = await deltaPlugin.placeOrder({
  instrument: {
    symbol: 'BTCUSD',
    exchange: 'DELTA',
    instrumentType: 'CRYPTO',
    tradingSymbol: 'BTCUSD',
    lotSize: 1,
    tickSize: 0.5
  },
  orderType: 'LIMIT',
  transactionType: 'BUY',
  quantity: 10,
  price: 50000,
  productType: 'MARGIN',
  validity: 'GTC'
});

console.log('Order placed:', orderResponse);

Configuration

DeltaConfig

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | testnet | boolean | false | Use testnet environment | | apiKey | string | '' | API key for authentication | | apiSecret | string | '' | API secret for signature generation | | timeout | number | 10000 | Request timeout in milliseconds | | debug | boolean | false | Enable debug logging |

BrokerCredentials

interface BrokerCredentials {
  apiKey: string;
  apiSecret: string;
  // Optional:
  clientId?: string;
  userId?: string;
}

API Reference

Connection Management

connect(credentials: BrokerCredentials): Promise

Connects to Delta Exchange API using the provided credentials.

disconnect(): Promise

Disconnects from Delta Exchange API and cleans up resources.

isConnected(): boolean

Returns true if currently connected.

Data Subscriptions

subscribeTicks(instruments: Instrument[]): Promise

Subscribe to real-time tick data for specified instruments.

subscribeCandles(instruments: Instrument[], timeframes: Timeframe[]): Promise

Subscribe to candlestick data for specified instruments and timeframes.

subscribeOptionChain(symbol: string): Promise

Subscribe to option chain updates.

Input formats:

  • UNDERLYING|DD-MM-YYYY (recommended)
  • UNDERLYING (nearest live/upcoming expiry auto-selected)

unsubscribe(instruments: Instrument[]): Promise

Unsubscribe from data for specified instruments.

Order Management

placeOrder(order: OrderRequest): Promise

Place a new order.

modifyOrder(orderId: string, modifications: OrderModification): Promise

Modify an existing order.

cancelOrder(orderId: string): Promise

Cancel an order.

getOrderStatus(orderId: string): Promise

Get current order status.

getOrders(): Promise<Order[]>

Get all open orders.

Position Management

getPositions(): Promise<Position[]>

Get all open positions.

getPosition(instrument: Instrument): Promise<Position | null>

Get position for a specific instrument.

Account Information

getAccountInfo(): Promise

Get account information including balances.

getMargins(): Promise

Get margin details.

Historical Data

getHistoricalCandles(instrument, timeframe, from, to): Promise<Candle[]>

Fetch historical candle data.

Event Handling

on(event: BrokerEvent, handler: EventHandler): void

Register event handler.

off(event: BrokerEvent, handler: EventHandler): void

Unregister event handler.

Events

| Event | Description | |-------|-------------| | tick | Real-time tick data | | candle | Candlestick data updates | | orderUpdate | Order status changes | | positionUpdate | Position changes | | optionChain | Option chain snapshot/incremental updates | | connected | Connection established | | disconnected | Connection lost | | reconnected | Successfully reconnected | | error | Error occurred |

Supported Instruments

Delta Exchange India supports:

  • Crypto perpetual futures

  • Crypto options (call/put contracts)

  • BTCUSD (Bitcoin)

  • ETHUSD (Ethereum)

  • SOLUSD (Solana)

  • XRPUSD (Ripple)

  • ADAUSD (Cardano)

  • And more...

Error Handling

try {
  await deltaPlugin.placeOrder(order);
} catch (error) {
  if (error.message.includes('Insufficient margin')) {
    console.log('Not enough margin for this order');
  } else if (error.message.includes('Invalid API key')) {
    console.log('Check your API credentials');
  }
}

Testing

# Install dependencies
npm install

# Run tests
npm test

# Build
npm run build

# Lint
npm run lint

Delta Exchange API Documentation

For detailed API documentation, visit:

Integration with AlgoX Framework

This plugin implements the IBrokerPlugin interface, making it fully compatible with the AlgoX Trading Framework:

import { StrategyEngine, BrokerAdapter } from '@chirag1702/algox';
import { DeltaExchangePlugin } from '@chirag1702/algox-delta-exchange-plugin';

const brokerAdapter = new BrokerAdapter();
const deltaPlugin = new DeltaExchangePlugin({ testnet: true });

brokerAdapter.registerPlugin('delta', deltaPlugin);

// Connect all registered plugins
await brokerAdapter.connectAll();

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For issues and feature requests, please open an issue on GitHub.