Skip to content
This repository has been archived by the owner on Jul 11, 2021. It is now read-only.

cdituri/node-tradeking

Repository files navigation

node-tradeking

About

Build Status

Build Status

Build Status

Description

A node module for interfacing with the TradeKing REST API.

Disclaimer

Alpha at best and in flux.

Contributing

Pull requests and issues are encouraged!

Author

Chris Dituri - csdituri@gmail.com

Getting Started

Installation

npm install --production --save node-tradeking

Examples

See the examples directory for some ideas. You'll need to adjust examples/config.json with your relevant OAuth information:

node ./examples/accountSummary.js
node ./examples/streamingPortfolioTicker.js

Instantiate

Instantiate a new Tradeking object.

const config = require('./config')
const Tradeking = require('tradeking');
const tk = new Tradeking(config);

Account Summary

tk.accountSummary((error, data) => console.log(data));

Account Balances

tk.accountBalances((error, data) => console.log(data));

Streaming Quotes

const msecs = 10 * 1000;
const symbols = ['msft', 'twtr', 'jcp', 'kors', 'uvxy'];

const stream =
  tk.streamQuote(symbols,
      (error, data) => {
          if (error) {
              console.error(error);
          } else {
              const obj = JSON.parse(data);
              console.log(JSON.stringify(obj, null, 4));
          }
      }
  );

// stream for `msecs` milliseconds
setTimeout(c => c.abort(), msecs, stream);

About

A flexible module for interfacing with the TradeKing RESTful API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published