awesomebot-fmp
Advanced tools
Comparing version 1.2.9 to 1.2.10
'use strict' | ||
module.exports = { | ||
key: null | ||
key: "4a91990c4c8048a68765976f3d1e6d9a" | ||
}; |
@@ -14,4 +14,4 @@ 'use strict' | ||
company_value: (period = 'annual') => makeRequest('enterprise-value', generateJson(stock, { period: period })), | ||
ratios: () => makeRequest('financial-ratios', generateJson(stock)) | ||
ratios: () => makeRequest('ratios', generateJson(stock)) | ||
} | ||
}; |
{ | ||
"name": "awesomebot-fmp", | ||
"version": "1.2.9", | ||
"version": "1.2.10", | ||
"description": "", | ||
@@ -33,2 +33,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"async": "^3.2.0", | ||
"axios": ">=0.19.2" | ||
@@ -35,0 +36,0 @@ }, |
@@ -351,6 +351,7 @@ 'use strict' | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/financial-ratios/AAPL') | ||
.get('/ratios/AAPL') | ||
.end((err, res) => { | ||
financial('AAPL').ratios() | ||
.then((response) => { | ||
console.log(res.body) | ||
expect(res.body).to.eql(response); | ||
@@ -357,0 +358,0 @@ done(); |
'use strict' | ||
var companies = require('./companies.json'); | ||
const chai = require('chai'); | ||
@@ -4,0 +5,0 @@ const chaiHttp = require('chai-http'); |
@@ -5,630 +5,90 @@ 'use strict' | ||
const chaiHttp = require('chai-http'); | ||
const financial = require('../lib/financial'); | ||
const expect = chai.expect; | ||
chai.use(chaiHttp); | ||
const news = require('../lib/news'); | ||
const stock = require('../lib/stock'); | ||
describe('.stock', () => { | ||
describe('.profile', () => { | ||
it('AAPL stock should return valid data', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/company/profile/AAPL') | ||
.end((err, res) => { | ||
stock('AAPL').profile() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
var companies = require('./companies.json'); | ||
}); | ||
const stock = require('../lib/stock'); | ||
it('should return stock screener for NASDAQ', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/stock-screener?limit=20&exchange=NASDAQ&apikey=742caf19f789f502d3e5194544bf9243') | ||
.end((err, res) => { | ||
stock().stock_screener({limit:20,exchange:'NASDAQ'}) | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
companies.forEach(itemNumber => { | ||
describe(`${itemNumber.symbol} ${itemNumber.name} test `, () => { | ||
}); | ||
it('[\'AAPL,MSFT\'] stock should return valid data', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/company/profile/AAPL,MSFT') | ||
.end((err, res) => { | ||
stock(['AAPL', 'MSFT']).profile() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
it(`${itemNumber.symbol} news should return valid data`, (done) => { | ||
news(itemNumber.symbol).stock_news().then((response) => { | ||
if (response[0].symbol === itemNumber.symbol) | ||
done(); | ||
}) | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('Apple stock should return valid data in past 10 minutes', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/historical-chart/15min/AAPL?&apikey=d4266e03ec14c5ad6c6d8886d2956980') | ||
.end((err, res) => { | ||
stock('AAPL').recent_history({'time_range':'15min'}) | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
it(`${itemNumber.symbol} stock should return valid profile`, (done) => { | ||
stock(itemNumber.symbol).profile().then((response) => { | ||
if (response.symbol === itemNumber.symbol) done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('\'aapl\' in lowercase should return valid data', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/company/profile/AAPL') | ||
.end((err, res) => { | ||
stock('aapl').profile() | ||
it(`${itemNumber.symbol} stock should return valid data in past 10 minutes`, (done) => { | ||
stock(itemNumber.symbol).recent_history({'time_range': '15min'}) | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
if (response[Object.keys(response)[0]]['date']) | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
}) | ||
it('\'AAPL,MSFT\' should return valid data', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/company/profile/AAPL,MSFT') | ||
.end((err, res) => { | ||
stock('AAPL,MSFT').profile() | ||
it(`${itemNumber.symbol} stock should return valid data`, (done) => { | ||
stock(itemNumber.symbol).quote() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
console.log(response) | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('undefined stock value should return 404 error', (done) => { | ||
stock().profile() | ||
.then((response) => { | ||
expect(response).to.have.status(404); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
it('empty stock value should return 404 error', (done) => { | ||
stock('').profile() | ||
.then((response) => { | ||
expect(response).to.have.status(404); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
}); | ||
describe('.quote', () => { | ||
it('AAPL stock should return valid data', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/quote/AAPL') | ||
.end((err, res) => { | ||
stock('AAPL').quote() | ||
it(`${itemNumber.symbol} in lowercase should return valid data`, (done) => { | ||
stock(itemNumber.symbol).current_price() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
if (response.symbol === itemNumber.symbol) done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('[\'AAPL,MSFT\'] stock should return valid data', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/quote/AAPL,MSFT') | ||
.end((err, res) => { | ||
stock(['AAPL', 'MSFT']).quote() | ||
it(`${itemNumber.symbol} should return financial ratio`, (done) => { | ||
financial(itemNumber.symbol).ratios() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
if (response.symbol === itemNumber.symbol) done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('\'aapl\' in lowercase should return valid data', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/quote/AAPL') | ||
.end((err, res) => { | ||
stock('aapl').quote() | ||
it(`${itemNumber.symbol} should return valid of history of a stock`, (done) => { | ||
stock(itemNumber.symbol).history() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
if (response.symbol === itemNumber.symbol) done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
}) | ||
it('[\'aapl\', \'msft\'] in lowercase should return valid data', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/quote/AAPL,MSFT') | ||
.end((err, res) => { | ||
stock(['aapl', 'msft']).quote() | ||
it(`${itemNumber.symbol} should return data points between a time interval`, (done) => { | ||
stock(itemNumber.symbol).history({start_date: '2021-03-12', end_date: '2021-03-12'}) | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
if (response.symbol === itemNumber.symbol) done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('\'AAPL,MSFT\' should return valid data', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/quote/AAPL,MSFT') | ||
.end((err, res) => { | ||
stock('AAPL,MSFT').quote() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('undefined stock value should return 404 error', (done) => { | ||
stock().quote() | ||
.then((response) => { | ||
expect(response).to.have.status(404); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
it('empty stock value should return 404 error', (done) => { | ||
stock('').quote() | ||
.then((response) => { | ||
expect(response).to.have.status(404); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
}); | ||
describe('.rating', () => { | ||
it('AAPL stock should return valid data', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/company/rating/AAPL') | ||
.end((err, res) => { | ||
stock('AAPL').rating() | ||
it(`${itemNumber.symbol} should return valid of split history of a stock`, (done) => { | ||
stock(itemNumber.symbol).split_history() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
console.log(response) | ||
if (response.symbol === itemNumber.symbol) done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('[\'AAPL,MSFT\'] stock should return valid data', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/company/rating/AAPL,MSFT') | ||
.end((err, res) => { | ||
stock(['AAPL', 'MSFT']).rating() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('\'aapl\' in lowercase should return valid data', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/company/rating/AAPL') | ||
.end((err, res) => { | ||
stock('aapl').rating() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('[\'aapl\', \'msft\'] in lowercase should return valid data', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/company/rating/AAPL,MSFT') | ||
.end((err, res) => { | ||
stock(['aapl', 'msft']).rating() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('\'AAPL,MSFT\' should return valid data', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/company/rating/AAPL,MSFT') | ||
.end((err, res) => { | ||
stock('AAPL,MSFT').rating() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('undefined stock value should return 404 error', (done) => { | ||
stock().rating() | ||
.then((response) => { | ||
expect(response).to.have.status(404); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
it('empty stock value should return 404 error', (done) => { | ||
stock('').rating() | ||
.then((response) => { | ||
expect(response).to.have.status(404); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
}); | ||
describe('.current_price', () => { | ||
it('AAPL stock should return valid data', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/stock/real-time-price/AAPL') | ||
.end((err, res) => { | ||
stock('AAPL').current_price() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('[\'AAPL,MSFT\'] stock should return valid data', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/stock/real-time-price/AAPL,MSFT') | ||
.end((err, res) => { | ||
stock(['AAPL', 'MSFT']).current_price() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('\'aapl\' in lowercase should return valid data', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/stock/real-time-price/AAPL') | ||
.end((err, res) => { | ||
stock('aapl').current_price() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('[\'aapl\', \'msft\'] in lowercase should return valid data', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/stock/real-time-price/AAPL,MSFT') | ||
.end((err, res) => { | ||
stock(['aapl', 'msft']).current_price() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('\'AAPL,MSFT\' should return valid data', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/stock/real-time-price/AAPL,MSFT') | ||
.end((err, res) => { | ||
stock('AAPL,MSFT').current_price() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('undefined stock value should return all price values', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/stock/real-time-price') | ||
.end((err, res) => { | ||
stock().current_price() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('empty stock value should return all price values', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/stock/real-time-price/') | ||
.end((err, res) => { | ||
stock('').current_price() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
}); | ||
describe('.history', () => { | ||
it('should return valid of history of a stock', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/historical-price-full/AAPL') | ||
.end((err, res) => { | ||
stock('AAPL').history() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('should return valid of history of a stock for lowercase values', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/historical-price-full/AAPL') | ||
.end((err, res) => { | ||
stock('aapl').history() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('should return only data points until limit', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/historical-price-full/AAPL?timeseries=5') | ||
.end((err, res) => { | ||
stock('AAPL').history({ limit: 5 }) | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('should return only data points until limit in linear graph format', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/historical-price-full/AAPL?timeseries=5&serietype=line') | ||
.end((err, res) => { | ||
stock('AAPL').history({ data_type: 'line', limit: 5 }) | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('should return data points between a time interval', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/historical-price-full/AAPL?from=2018-03-12&to=2019-03-12') | ||
.end((err, res) => { | ||
stock('AAPL').history({ start_date: '2018-03-12', end_date: '2019-03-12' }) | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('should return 500 server error between a time interval with a data limit', (done) => { | ||
stock('AAPL').history({ start_date: '2018-03-12', end_date: '2019-03-12', limit: 5 }) | ||
.then((response) => { | ||
expect(response).to.have.status(500); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
it('should return 500 server error between a time interval with a data limit for a line graph', (done) => { | ||
stock('AAPL').history({ start_date: '2018-03-12', end_date: '2019-03-12', limit: 5, data_type: 'line' }) | ||
.then((response) => { | ||
expect(response).to.have.status(500); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
}); | ||
describe('.dividend_history', () => { | ||
it('should return valid of history of a stock', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/historical-price-full/stock_dividend/AAPL') | ||
.end((err, res) => { | ||
stock('AAPL').dividend_history() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('should return valid of history of a stock for lowercase values', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/historical-price-full/stock_dividend/AAPL') | ||
.end((err, res) => { | ||
stock('aapl').dividend_history() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('should return only data points until limit', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/historical-price-full/stock_dividend/AAPL?timeseries=5') | ||
.end((err, res) => { | ||
stock('AAPL').dividend_history({ limit: 5 }) | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('should return only data points until limit in linear graph format', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/historical-price-full/stock_dividend/AAPL?timeseries=5&serietype=line') | ||
.end((err, res) => { | ||
stock('AAPL').dividend_history({ data_type: 'line', limit: 5 }) | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('should return data points between a time interval', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/historical-price-full/stock_dividend/AAPL?from=2018-03-12&to=2019-03-12') | ||
.end((err, res) => { | ||
stock('AAPL').dividend_history({ start_date: '2018-03-12', end_date: '2019-03-12' }) | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('should return 500 server error between a time interval with a data limit', (done) => { | ||
stock('AAPL').dividend_history({ start_date: '2018-03-12', end_date: '2019-03-12', limit: 5 }) | ||
.then((response) => { | ||
expect(response).to.have.status(500); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
it('should return 500 server error between a time interval with a data limit for a line graph', (done) => { | ||
stock('AAPL').dividend_history({ start_date: '2018-03-12', end_date: '2019-03-12', limit: 5, data_type: 'line' }) | ||
.then((response) => { | ||
expect(response).to.have.status(500); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
}); | ||
describe('.split_history', () => { | ||
it('should return valid of history of a stock', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/historical-price-full/stock_split/AAPL') | ||
.end((err, res) => { | ||
stock('AAPL').split_history() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('should return valid of history of a stock for lowercase values', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/historical-price-full/stock_split/AAPL') | ||
.end((err, res) => { | ||
stock('aapl').split_history() | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('should return only data points until limit', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/historical-price-full/stock_split/AAPL?timeseries=5') | ||
.end((err, res) => { | ||
stock('AAPL').split_history({ limit: 5 }) | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('should return only data points until limit in linear graph format', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/historical-price-full/stock_split/AAPL?timeseries=5&serietype=line') | ||
.end((err, res) => { | ||
stock('AAPL').split_history({ data_type: 'line', limit: 5 }) | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('should return data points between a time interval', (done) => { | ||
chai.request('https://financialmodelingprep.com/api/v3') | ||
.get('/historical-price-full/stock_split/AAPL?from=2018-03-12&to=2019-03-12') | ||
.end((err, res) => { | ||
stock('AAPL').split_history({ start_date: '2018-03-12', end_date: '2019-03-12' }) | ||
.then((response) => { | ||
expect(res.body).to.eql(response); | ||
done(); | ||
}) | ||
.catch(done); | ||
}) | ||
}); | ||
it('should return 500 server error between a time interval with a data limit', (done) => { | ||
stock('AAPL').split_history({ start_date: '2018-03-12', end_date: '2019-03-12', limit: 5 }) | ||
.then((response) => { | ||
expect(response).to.have.status(500); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
it('should return 500 server error between a time interval with a data limit for a line graph', (done) => { | ||
stock('AAPL').split_history({ start_date: '2018-03-12', end_date: '2019-03-12', limit: 5, data_type: 'line' }) | ||
.then((response) => { | ||
expect(response).to.have.status(500); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
}); | ||
}); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
5919198
40
262892
2
1
+ Addedasync@^3.2.0
+ Addedasync@3.2.6(transitive)