Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
financialmodelingprep-node
Advanced tools
A Node.js client for interacting with the FinancialModelingPrep API, providing a wide range of financial data, including market, company, and economic data. This library is designed to make it easy to fetch financial information with simple method calls.
This project is an independent initiative and has no affiliation with FinancialModelingPrep or its web API development. It is provided as a convenient way to interact with the API at financialmodelingprep.com. The library is provided "as is," without warranty of any kind, express or implied. Use this library at your own risk. The author assumes no responsibility for any issues or damages that may arise from using this library.
You can install this package using npm:
npm install financialmodelingprep-node
Or using yarn:
yarn add financialmodelingprep-node
This client uses the FinancialModelingPrep API key for accessing data. You can provide the API key directly or use an environment variable.
Create a .env
file in the root of your project:
touch .env
Add your FinancialModelingPrep API key to the .env
file:
FMP_API_KEY=your_api_key_here
Alternatively, you can directly set the API key when creating an instance of the client:
const FinancialModelingPrepClient = require('financialmodelingprep-node');
const fmpClient = new FinancialModelingPrepClient('your_api_key_here');
import FinancialModelingPrepClient from 'financialmodelingprep-node';
// Using environment variables for API key
const fmpClient = new FinancialModelingPrepClient(process.env.FMP_API_KEY);
Fetch the company profile for the given symbol.
// Fetch the company profile for a given symbol
fmpClient.companyProfile({ symbol: 'TICKER' })
// Success!
.then(data => {
// Use the data as needed
console.log(data);
})
// Failure!
.catch(error => {
// Handle any errors
console.error(error);
});
any
Method for Dynamic EndpointsThe any
method allows you to call any endpoint by specifying the version and path. This is especially useful if new endpoints are added to the API, or if this library is not updated frequently to include those new endpoints.
// Use the `any` method to dynamically call any endpoint
fmpClient.any('v4', 'treasury', { from: '2024-09-13', to: '2024-09-13' })
// Success!
.then(data => {
// Use the data as needed
console.log('Treasury Data (via any method):', data);
})
// Failure!
.catch(error => {
// Handle any errors
console.error('Error:', error);
});
Specify a timeout (in milliseconds) for API requests. By default, the timeout is set to 3000 milliseconds (3 seconds).
const fmpClient = new FinancialModelingPrepClient(process.env.FMP_API_KEY, { timeout: 3000 });
This client supports a wide range of endpoints, categorized as follows:
quote
, quotes
, stockMarketGainers
, etc.companyProfile
, stockPeers
, companyOutlook
, etc.incomeStatement
, balanceSheetStatement
, etc.treasury
, economicCalendar
, etc.stockNews
, pressReleases
, etc.search
, searchTicker
, searchIsin
, etc.For detailed information on all available endpoints, refer to the official FinancialModelingPrep API Documentation.
If a new endpoint is introduced, you can use the flexible any
method to call it without waiting for an update to this library. Alternatively, you can modify or add to the config files in the src/config directory to include new endpoints.
Note: The methods in this client generally follow the naming style of the FinancialModelingPrep API with camelCase conventions. Check the examples directory for the full list of available endpoints and their parameters.
To get a complete list of all available methods (i.e., API Endpoints), you can use the getAllEndpoints
function.
This function returns an array of all the method names supported by this client:
// Get all the API Endpoints
const endpoints = fmpClient.getAllEndpoints();
// Display the list
console.log(endpoints);
Here are some quick examples of how to use the client. For more examples, explore the full list.
fmpClient.treasury({ from: '2024-01-01', to: '2024-12-31' })
.then(data => console.log(data))
.catch(error => console.error(error));
fmpClient.search({ query: 'text' })
.then(data => console.log(data))
.catch(error => console.error(error));
fmpClient.stockMarketGainers()
.then(data => console.log(data))
.catch(error => console.error(error));
The source code in this package is written in ES modules (ESM) and is compiled into both ESM and CommonJS (CJS) formats for distribution. The compiled files are located in the dist
directory. To build the package, run:
npm run build
Note: The dist
directory is included in the npm package but excluded from the GitHub repository.
This project includes a comprehensive test suite. To run the tests, use:
npm test
Contributions are welcome! Please fork this repository and open a pull request to propose changes.
git checkout -b feature-branch
)git commit -am 'Add new feature'
)git push origin feature-branch
)This project is licensed under the MIT License - see the LICENSE.md file for details.
FAQs
A Node.js client for the FinancialModelingPrep API
We found that financialmodelingprep-node demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.