A node module for interfacing with the TradeKing REST API.
Alpha at best and in flux.
Pull requests and issues are encouraged!
Chris Dituri - [email protected]
npm install --production --save node-tradeking
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 a new Tradeking object.
const config = require('./config')
const Tradeking = require('tradeking');
const tk = new Tradeking(config);
tk.accountSummary((error, data) => console.log(data));
tk.accountBalances((error, data) => console.log(data));
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);