awesomebot-fmp
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -30,14 +30,19 @@ 'use strict' | ||
url += urlPath; | ||
if(pathParameters) { | ||
console.log(params) | ||
if (pathParameters) { | ||
if (pathParameters instanceof Array) | ||
pathParameters = pathParameters.join(','); | ||
pathParameters = pathParameters.toUpperCase(); | ||
url += '/' + pathParameters; | ||
if (params.urlPath === 'stock_news') { | ||
url += '?tickers=' + pathParameters | ||
} else { | ||
url += '/' + pathParameters; | ||
} | ||
} | ||
console.log(url) | ||
if (queryParameters) { | ||
for (const key in queryParameters) | ||
if(queryParameters[key] != undefined) | ||
if (queryParameters[key] != undefined) | ||
queryString += `${key}=${queryParameters[key]}&`; | ||
if (queryString) { | ||
@@ -48,9 +53,10 @@ queryString = queryString.slice(0, -1); | ||
} | ||
if (!queryString) { | ||
if (!queryString && params.urlPath !== 'stock_news') { | ||
url += '?' | ||
} else { | ||
url += '&' | ||
url += '&' | ||
} | ||
queryString += `&apikey=${apikey}`; | ||
url += queryString; | ||
console.log(url) | ||
@@ -74,4 +80,3 @@ return url; | ||
*/ | ||
function generateJson(pathParam, queryParam = undefined) | ||
{ | ||
function generateJson(pathParam, queryParam = undefined) { | ||
return { | ||
@@ -84,5 +89,5 @@ query: queryParam, | ||
module.exports = { | ||
makeRequest: (path, params = {}) => axios.get(url(Object.assign({}, params, { urlPath: path }))) | ||
.then(response => response.data).catch(err => err.response), | ||
makeRequest: (path, params = {}) => axios.get(url(Object.assign({}, params, {urlPath: path}))) | ||
.then(response => response.data).catch(err => err.response), | ||
generateJson: generateJson | ||
}; |
{ | ||
"name": "awesomebot-fmp", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -91,8 +91,9 @@ # Financial Modeling Prep | ||
Accessed through `fmp.etf.{method_name} | ||
```js | ||
list() // /symbol/available-etfs | ||
quote(stock = 'all')* // /quote | ||
history(stock, { start_date, end_date, data_type, limit } = {})* // /historical-price-full/etf/{ticker}?{opts} | ||
dividend_history(stock, { start_date, end_date, data_type, limit } = {})* // /historical-price-full/stock_dividend/{ticker}?{opts} | ||
split_history(stock, { start_date, end_date, data_type, limit } = {})* // /historical-price-full/stock_split/{ticker}?{opts} | ||
stocknews() // /symbol/available-etfs | ||
quote(stock = 'all') * // /quote | ||
history(stock, {start_date, end_date, data_type, limit} = {}) * // /historical-price-full/etf/{ticker}?{opts} | ||
dividend_history(stock, {start_date, end_date, data_type, limit} = {}) * // /historical-price-full/stock_dividend/{ticker}?{opts} | ||
split_history(stock, {start_date, end_date, data_type, limit} = {}) * // /historical-price-full/stock_split/{ticker}?{opts} | ||
``` | ||
@@ -103,8 +104,9 @@ \* The `stock` parameter can either be pased as a string or an array of market tickers. These tickers can be found either by running search based on corporation name or through the `list` function | ||
Accessed through `fmp.mutualfund.{method_name}` | ||
```js | ||
list() // /symbol/available-mutual-funds | ||
quote(stock = 'all')* // /quote | ||
history(stock, { start_date, end_date, data_type, limit } = {})* // /historical-price-full/mutual_fund/{ticker}?{opts} | ||
dividend_history(stock, { start_date, end_date, data_type, limit } = {})* // /historical-price-full/stock_dividend/{ticker}?{opts} | ||
split_history(stock, { start_date, end_date, data_type, limit } = {})* // /historical-price-full/stock_split/{ticker}?{opts} | ||
stocknews() // /symbol/available-mutual-funds | ||
quote(stock = 'all') * // /quote | ||
history(stock, {start_date, end_date, data_type, limit} = {}) * // /historical-price-full/mutual_fund/{ticker}?{opts} | ||
dividend_history(stock, {start_date, end_date, data_type, limit} = {}) * // /historical-price-full/stock_dividend/{ticker}?{opts} | ||
split_history(stock, {start_date, end_date, data_type, limit} = {}) * // /historical-price-full/stock_split/{ticker}?{opts} | ||
``` | ||
@@ -115,6 +117,7 @@ \* The `stock` parameter can either be pased as a string or an array of market tickers. These tickers can be found either by running search based on corporation name or through the `list` function | ||
Accessed through `fmp.crypto.{method_name}` | ||
```js | ||
list() // /symbol/available-cryptocurrencies | ||
quote(stock = 'all')* // /quote | ||
history(stock, { start_date, end_date, data_type, limit } = {})* // /historical-price-full/crypto/{ticker}?{opts} | ||
stocknews() // /symbol/available-cryptocurrencies | ||
quote(stock = 'all') * // /quote | ||
history(stock, {start_date, end_date, data_type, limit} = {}) * // /historical-price-full/crypto/{ticker}?{opts} | ||
``` | ||
@@ -125,6 +128,7 @@ \* The `stock` parameter can either be pased as a string or an array of market tickers. Also, the parameter appends `USD` to the crypto ticker passed to provide the value in US dollars so if you need to query data in a different currency I would suggest using the [forex](###Forex) command and manually convert it to the desired currency. | ||
Accessed through `fmp.commodities.{method_name}` | ||
```js | ||
list() // /symbol/available-commodities | ||
quote(stock = 'all')* // /quote | ||
history(stock, { start_date, end_date, data_type, limit } = {})* // /historical-price-full/commodity/{ticker}?{opts} | ||
stocknews() // /symbol/available-commodities | ||
quote(stock = 'all') * // /quote | ||
history(stock, {start_date, end_date, data_type, limit} = {}) * // /historical-price-full/commodity/{ticker}?{opts} | ||
``` | ||
@@ -131,0 +135,0 @@ \* The `stock` parameter can either be pased as a string or an array of market tickers. These tickers can be found either by running search based on corporation name or through the `list` function |
Sorry, the diff of this file is not supported yet
172812
37
3600
147