UNPKG

@gitchrisqueen/tdameritrade-api-js-client

Version:
54 lines (48 loc) 2.06 kB
'use strict'; /** * Get Instrument * Get an instrument by CUSIP * * cusip String * apikey String Pass your OAuth User ID to make an unauthenticated request for delayed data. (optional) * returns SearchInstrumentResponse **/ exports.instrumentsCusipGET = function(cusip,apikey) { return new Promise(function(resolve, reject) { var examples = {}; examples['application/json'] = { "key" : { "$ref" : "#/components/examples/instrumentExample" } }; if (Object.keys(examples).length > 0) { resolve(examples[Object.keys(examples)[0]]); } else { resolve(); } }); } /** * Search Instruments * Search or retrieve instrument data, including fundamental data * * symbol String Value to pass to the search. See projection description for more information. * projection String The type of request: symbol-search: Retrieve instrument data of a specific symbol or cusip symbol-regex: Retrieve instrument data for all symbols matching regex. Example: symbol=XYZ.* will return all symbols beginning with XYZ desc-search: Retrieve instrument data for instruments whose description contains the word supplied. Example: symbol=FakeCompany will return all instruments with FakeCompany in the description. desc-regex: Search description with full regex support. Example: symbol=XYZ.[A-C] returns all instruments whose descriptions contain a word beginning with XYZ followed by a character A through C. fundamental: Returns fundamental data for a single instrument specified by exact symbol. * apikey String Pass your OAuth User ID to make an unauthenticated request for delayed data. (optional) * returns SearchInstrumentResponse **/ exports.instrumentsGET = function(symbol,projection,apikey) { return new Promise(function(resolve, reject) { var examples = {}; examples['application/json'] = { "key" : { "$ref" : "#/components/examples/instrumentExample" } }; if (Object.keys(examples).length > 0) { resolve(examples[Object.keys(examples)[0]]); } else { resolve(); } }); }