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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@crl-technologies/sdk

v2.0.1

Published

CRL White Label API - TypeScript SDK with HMAC authentication

Readme

@crl-technologies/sdk

Official TypeScript/JavaScript SDK for CRL White Label API with production-ready HMAC authentication.

npm version License

Installation

npm install @crl-technologies/sdk

Quick Start

import { CRLApiClient } from '@crl-technologies/sdk';

// Initialize client (uses production endpoint by default)
const client = new CRLApiClient({
  keyId: process.env.CRL_KEY_ID!,
  secretKey: process.env.CRL_SECRET_KEY!
});

// Calculate Long CRL position
const result = await client.calculateLong(
  100.0,  // S0 - Entry price
  110.0,  // ST - Current price
  105.0,  // K - Strike price
  5.0,    // L - Leverage multiplier
  2.5     // Premium paid
);

console.log(`P&L: ${result.pnl}`);
console.log(`State: ${result.state}`);
console.log(`Retro Jump: ${result.retroJump}`);

Configuration

Default Configuration (v2.0.0+)

The SDK uses the production endpoint by default:

const client = new CRLApiClient({
  keyId: "your-api-key",
  secretKey: "your-secret-key"
  // baseUrl defaults to: https://crl-api.crl-technologies.com
});

Custom Base URL

Override for testing or custom deployments:

const client = new CRLApiClient({
  keyId: "your-api-key",
  secretKey: "your-secret-key",
  baseUrl: "https://staging.crl-technologies.com"  // Custom endpoint
});

API Reference

calculateLong(S0, ST, K, L, premium): Promise<CalcResponse>

Calculate P&L for a LONG position with Conditional Retro-Leverage.

Parameters:

  • S0 (number): Entry price
  • ST (number): Current/Exit price
  • K (number): Strike price (trigger level)
  • L (number): Leverage multiplier (applied retroactively if triggered)
  • premium (number): Premium paid for the CRL feature

Returns: Promise<CalcResponse>

interface CalcResponse {
  pnl: number;           // Profit & Loss
  state: string;         // 'INITIAL' | 'LEVERAGED'
  retroJump: number;     // Additional P&L from retro-leverage
  calcId: string;        // Unique calculation ID
}

Example:

const result = await client.calculateLong(100, 110, 105, 5, 2.5);
// Entry at 100, current price 110, strike at 105
// If ST > K: retroactive 5x leverage applied from S0 to K

calculateShort(S0, ST, K, L, premium): Promise<CalcResponse>

Calculate P&L for a SHORT position with Conditional Retro-Leverage.

Parameters: Same as calculateLong()

Example:

const result = await client.calculateShort(100, 90, 95, 5, 2.5);
// Entry at 100, current price 90, strike at 95
// If ST < K: retroactive 5x leverage applied from S0 to K

Authentication

The SDK uses HMAC-SHA256 authentication with automatic request signing.

Required Headers (handled automatically):

  • X-API-Key: Your tenant API key
  • X-CRL-Timestamp: Unix timestamp
  • X-CRL-Signature: HMAC signature of the request

Signature Construction:

HMAC-SHA256(secret, "METHOD|PATH|TIMESTAMP|BODY")

Error Handling

try {
  const result = await client.calculateLong(100, 110, 105, 5, 2.5);
  console.log(result);
} catch (error) {
  if (error.response?.status === 401) {
    console.error('Authentication failed - check your credentials');
  } else if (error.response?.status === 429) {
    console.error('Rate limit exceeded');
  } else {
    console.error('API error:', error.message);
  }
}

Environment Variables

Recommended setup:

# .env file
CRL_KEY_ID=your-tenant-key-id
CRL_SECRET_KEY=your-secret-key
CRL_BASE_URL=https://crl-api.crl-technologies.com  # Optional (default)
import { CRLApiClient } from '@crl-technologies/sdk';

const client = new CRLApiClient({
  keyId: process.env.CRL_KEY_ID!,
  secretKey: process.env.CRL_SECRET_KEY!,
  baseUrl: process.env.CRL_BASE_URL  // Optional override
});

TypeScript Support

Full TypeScript support with type definitions included:

import { CRLApiClient, CalcRequest, CalcResponse } from '@crl-technologies/sdk';

const request: CalcRequest = {
  mode: 'long',
  S0: 100,
  ST: 110,
  K: 105,
  L: 5,
  premium: 2.5,
  side: 'buy'
};

Production Endpoints

| Endpoint | Method | Description | |----------|--------|-------------| | /v1/calc | POST | Calculate CRL position P&L | | /health | GET | Health check (no auth required) |

Base URL: https://crl-api.crl-technologies.com

Migration from v1.x

See CHANGELOG.md for detailed migration guide.

Summary:

  • v2.0.0 uses production URL by default (https://crl-api.crl-technologies.com)
  • Removed non-existent best-execution endpoints
  • Fixed endpoint path (/v1/calc instead of /api/v1/calc)

If you're using custom baseUrl, no changes required.

Support

License

PROPRIETARY - CRL Technologies Inc.


Version: 2.0.0
Last Updated: 2025-11-15