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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@reycodev/tradier-client

v0.2.0

Published

Node.js Tradier Brokerage API written in typescript.

Downloads

22

Readme

Tradier Client

Node.js Tradier Brokerage API written in typescript.

Current Functionality

  • Market Data
  • Fundamentals (Beta use at own risk)

Future Planned Functionality

  • Stream Endpoint
  • OAuth Authentication
  • Account
  • Trading
  • Watchlist

Tradier

Brokerage Reinvented.

Tradier is a REST-based, open, and secure API for investors, advisors, and traders.

Tradier Documentation

Access Token

You will receive your Tradier API Access Token after you create an account.

Depending on what type of account you create will determine the type of access token you will receive.

Note: Sandbox does not work with every endpoint and may contain delayed information.

Installation

npm i --save @reycodev/tradier-client

Usage

Initialize the client.

import { TradierAccountType, TradierClient, TradierClientOptions } from '@reycodev/tradier-client';

const options: TradierClientOptions = {
  accessToken: '##########' // Token receieved after creating tradier account
  accountType: TradierAccountType.SANDBOX // Depends on type of account created.
}

const tradier: TradierClient = new TradierClient(options);

Market

Implemented Endpoints:

Examples:

// Get Quotes
tradier.market.getQuotes(['spy', 'amd'])
  .then((response) => console.log('response', response))
  .catch((error) => console.error(error));
// Get Option Questions
tradier.market.getOptionChains('spy', '2019-05-17')
  .then((response) => console.log('response', response))
  .catch((error) => console.error(error));

Fundamentals

Implemented Endpoints:

Examples:

// Get Company Information
tradier.fundamentals.getCompany(['spy', 'amd'])
  .then((response) => console.log('response', response))
  .catch((error) => console.error(error));
  // Get Corporate Calendars
tradier.fundamentals.getCorporateCalendars(['spy', 'amd'])
  .then((response) => console.log('response', response))
  .catch((error) => console.error(error));

Development

Decisions:

  • Trying to follow Inversion of Control with Dependency Injection (Needs some more refactoring)
  • Went with promises but thought about observables (rxjs) but didn't want to have that dependency.
    • Observables seem like a viable option because it could help with real time updates.

Improvements:

  • Add Linting
  • Add Unit Tests
  • Add Typings for responses
  • Add more endpoints for tradier
  • Add bundling process to allow for use on different environments such as browser.

Miscellaneous

NestJs

Planned on creating a Nestjs library using this package. In the mean time, you can follow this to create your own.

tradier.service.ts

import { Injectable } from '@nestjs/common';
import { TradierClient } from '@reycodev/tradier-client';

@Injectable()
export class TradierService extends TradierClient {}

tradier.module.ts

import { Module, Provider } from '@nestjs/common';
import { TradierClient, TradierAccountType, TradierClientOptions } from '@reycodev/tradier-client';

import { TradierService } from './services';

// Recomend not commiting access token
const tradierToken: string = '######' 

// Probably should be its own file.
const tradierServiceFactory: Provider = {
  provide: TradierService,
  useFactory: () => {
    return new TradierClient({
      accessToken: tradierToken,
      accountType: TradierAccountType.SANDBOX,
    });
  }
}

@Module({
  imports: [],
  providers: [
    tradierServiceFactory,
  ],
  exports: [
    TradierService,
  ],
})
export class TradierModule {}