UNPKG

@i077/tda-api-nodejs-unofficial

Version:

TD Ameritrade API node.js wrapper for front-end integration

29 lines (23 loc) 629 B
import getPriceHistory from './getPriceHistory'; const parseDates = (res) => { res.forEach((candle) => { candle.datetime = new Date(candle.datetime); }); return res; }; export default ({ authentication, config }) => { const { getAccessToken } = authentication; const get = async (params) => { return parseDates( await getPriceHistory({ ...params, ...config, getAccessToken }) ); }; const unAuthGet = async (params) => parseDates(await getPriceHistory({ ...params, ...config })); return { getPriceHistory: get, unauthenticated: { getPriceHistory: unAuthGet, }, }; };