investing-com-api-v2
v5.0.5
Published
Unofficial APIs for Investing.com website.
Downloads
32
Maintainers
Readme
Investing.com Unofficial APIs V2
Introduction
Unofficial APIs for Investing.com website.
Upgraded from investing-com-api, fixes RAM overflow error when hanging for a long time on windows server.
Install
npm i investing-com-api-v2
Example
const InVestingApiV2 = require('investing-com-api-v2/api/InvestingApiV2');
//default using console, can use winston...
InVestingApiV2.logger(console);
//enable debugger
InVestingApiV2.setDebugger(false);
//startup browser
//function init(pptrLaunchOptions:LaunchOptions):Promise<void>;
await InVestingApiV2.init({});
//get data
/*
function investing(
input: string,
period?: 'P1D' | 'P1W' | 'P1M' | 'P3M' | 'P6M' | 'P1Y' | 'P5Y' | 'MAX',
interval?: 'PT1M' | 'PT5M' | 'PT15M' | 'PT30M' | 'PT1H' | 'PT5H' | 'P1D' | 'P1W' | 'P1M',
pointscount?: 60 | 70 | 120
): Promise<{
date: number,
value: number,
price_open: number,
price_high: number,
price_low: number,
price_close: number,
}[]>
*/
let data = await InVestingApiV2.investing(
'currencies/eur-usd',
'P1D',
'PT1M',
60);
console.log(data);
//close browser
//function close():Promise<void>;
await InVestingApiV2.close();
Inputs
Only input is required, other params are optional.
- input String: input string, see mapping.js keys, or provide a valid investing.com pairId. (Required)
- period String: Period of time, window size. Default P1M (1 month). Valid values: P1D, P1W, P1M, P3M, P6M, P1Y, P5Y, MAX.
- interval Number: Interval between results. Default P1D (1 day). Valid values: PT1M, PT5M, PT15M, PT30M, PT1H, PT5H, P1D, P1W, P1M.
- pointsCount Number: number of total results. Valid values seems to be 60, 70 or 120.
- puppeteerLaunchOptions Any: Puppeteer launch options, see official website.