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

@kofeinstyle/tradernet-sdk

v0.0.2

Published

Tradernet API typescript client

Downloads

119

Readme

alt text

Tradernet SDK

A TypeScript/JavaScript client library for the Tradernet trading platform API.

Publish Package to npmjs npm version

Tradernet Docs - https://tradernet.com/tradernet-api/instruments

Features

  • 💼 Broker Reports - Trades, corporate actions, cash flows, commissions, and related report data
  • 📝 User Cash Flows - Cash flow data with filters and pagination
  • 📝 TypeScript - Typed public methods and response shapes for supported endpoints
  • 🧪 Tested - Jest coverage for current client behavior
  • 🔄 Retry Logic - Retry support for network errors, timeouts, HTTP 429, and HTTP 5xx responses
  • 📦 Lightweight - No runtime dependencies

Installation

npm install @kofeinstyle/tradernet-sdk

Quick Start

import { TradernetApiClient } from '@kofeinstyle/tradernet-sdk'

// Initialize client
const client = new TradernetApiClient({
  apiKey: 'testApiKey',
  apiSecret: 'testApiSecret',
})

Get a dividends report

import { CorporateActionTypes } from '@kofeinstyle/tradernet-sdk'

const apiResult = await client.getBrokerReport({ dateFrom: '2025-01-01', dateTo: '2025-12-31' }, 'corporate_actions')

if (apiResult.success) {
  const dividends = apiResult.data.report.detailed.filter(item => item.type_id === CorporateActionTypes.DIVIDEND)
  console.log('Dividends:', dividends)
} else {
  console.error('Error:', apiResult.error, apiResult.message)
}

Get user cash flow data

const filters = [{ field: 'type_code', operator: 'eq', value: 'dividend' }]
const result = await client.getUserCashFlows({ take: 100, skip: 0, filters })

if (result.success) {
  console.log('Cashflow data:', result.data.cashflow)
} else {
  console.error('Error:', result.error, result.message)
}

API Methods

Reports

  • getBrokerReport(dateRange, type) - Gets a broker report by date range and report type, such as trades or corporate_actions.
  • getUserCashFlows(params) - Gets user cash flow records with optional pagination, sorting, and filters.

Error Handling

All API methods return an ApiResponse object with success/error information:

const result = await client.getBrokerReport({ dateFrom: '2025-01-01', dateTo: '2025-12-31' }, 'trades')

if (result.success) {
  console.log('Report data:', result.data)
} else {
  console.error('Error:', result.error, result.message)
}

Configuration

TradernetConfig

  • apiKey - Tradernet public API key.
  • apiSecret - Tradernet API secret used to sign requests.
  • baseUrl - API base URL (default: 'https://tradernet.com/api')
  • timeout - Request timeout in milliseconds (default: 60000)
  • retries - Number of retry attempts (default: 3)
  • verbose - Enables SDK debug logs when set to true

Roadmap

Market data, portfolio, and WebSocket APIs are planned for future versions. They are not part of the current public API.

Development

# Install dependencies
npm install

# Run tests
npm test

# Run tests in watch mode
npm run test:watch

# Run tests with coverage
npm run test:coverage

# Build TypeScript
npm run build

# Build in watch mode
npm run build:watch

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

License

This project is licensed under the MIT License.

Support

For support, please open an issue on GitHub or contact the maintainers.


Note: This SDK is designed to work with the Tradernet trading platform. Make sure you have valid API credentials and understand the risks involved in automated trading.