davideviolante / investing-com-api Goto Github PK
View Code? Open in Web Editor NEWUnofficial APIs for Investing.com website.
License: MIT License
Unofficial APIs for Investing.com website.
License: MIT License
Hallo, I appreciate your work and I really would like to be able to use for retieving data, but unfortunately in my case I can't.
What I did so far:
npm i investing-com-api
(warn on finishing about puppeteer version deprecated...)
Created a myfile.js file with content as for your example.
Launched myfile.js with:
node myfile.js
The script runs with no errors, but nothing appears as result on the terminal.
Am I missing something?
Thank you.
APIs used from investing.com website changed. This lib needs an update.
Example:
https://www.investing.com/currencies/gbp-usd
2 is id
P3M is period
P1D is interval
120 is candle count
curl 'https://api.investing.com/api/financialdata/2/historical/chart/?period=P3M&interval=P1D&pointscount=120' \
-H 'authority: api.investing.com' \
-H 'accept: application/json, text/plain, */*' \
-H 'domain-id: www' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Linux"' \
-H 'origin: https://www.investing.com' \
-H 'sec-fetch-site: same-site' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-dest: empty' \
-H 'referer: https://www.investing.com/' \
--compressed
item[5] and item[6] probably (help wanted) represents the volume, add them into the APIs.
Eg for dow jones:
[
1645660800000,
32830.33,
33269.34,
32272.64,
33223.83,
593186432, // volume?
0 // volume?
],
Hi Davide,
I use python to get data from the same url: https://api.investing.com/api/financialdata/8830/historical/chart/? as yours. Where can I find your API header? I am wondering if the api still work, because my crawler returns " Enable JavaScript and cookies to continue".
THX!
When running in a Docker container we need to specify Puppeteer launch options in order to make Puppeteer work:
const browser = await puppeteer.launch({
executablePath: '/usr/bin/google-chrome',
args: [
'--disable-gpu',
'--disable-dev-shm-usage',
'--disable-setuid-sandbox',
'--no-sandbox',
],
})
See https://pptr.dev/api/puppeteer.launchoptions for all options.
Currently there is no way to specify these launch options.
Hi, I write a demo from the README file
const { investing } = require("investing-com-api");
async function main() {
console.log("begin");
const response = await investing("currencies/eur-usd");
console.log(`response is ${response}`);
// response = [ { date: Timestamp, value: Number }, {...}, ... ]
}
main();
and I get the result from the terminal. I don't know what's wrong. Thank you!
node ./main.js
begin
No response.data.candles found
response is undefined
Hi Davide, thanks for your code. Actually I think the investing.com API package is a creative solution. But seems that the API guide doc is not ready yet. Or can I find it somewhere? I hope you could give me a hint. Thanks!
hi,
i am using Playwright for Java(https://playwright.dev/).
and Playwright supports NodeJS primarily.
if you can do, it will be a big help for me.
thanks.
Since v4 uses Puppeteer, mocha tests fails. Fix them somehow.
Current;y, I need run my system as root user, so I need made hardcode add "--no-sandbox" in index.js for puppeteer, Could we have solution let user easy add the parameters when launch time.
Example code:
const browser = await puppeteer.launch({args: ["--no-sandbox"]});
Seems like this project has all possible inputs for investing.com:
https://github.com/alvarobartt/investpy/tree/master/investpy/resources
Expand mapping.js with all these csv, then add info about source in readme.
Hello I am currently having some major problems using it
After starting the system for about 1 hour - 2 hours, RAM usage suddenly increases to 90% and restarts the server
Currently, I have used PM2 and rebooted every hour but the RAM is still at 90%.
My device configuration:
Windows server 2016
RAM: 16GB
CPU: 8 cores
400GB SSD
my source:
async investing(body = {
type: 'klines/realtime',
name: '', //https://github.com/DavideViolante/investing-com-api/blob/master/mapping.js
period: 'P1D, P1W, P1M, P3M, P6M, P1Y, P5Y, MAX',
interval: 'PT1M, PT5M, PT15M, PT30M, PT1H, PT5H, P1D, P1W, P1M',
pointcount: '60, 70, 120',
pptrLaunchOptions: undefined,
}) {
let response = await investing(body.name, body.period, body.interval, Number(body.pointcount), body.pptrLaunchOptions);
return ....
},
Looking forward to receiving comments.
OS: Windows 10 Pro 21H1
Node.js: node-v14.20.0-win-x64
==================================================================
Welcome to Node.js v14.20.0.
Type ".help" for more information.
.load ../test.js
const { investing } = require('investing-com-api');
async function main() {
try {
const response1 = await investing('currencies/eur-usd');
const response2 = await investing('currencies/eur-usd', 'P1M', 'P1D'); // With optional params
} catch (err) {
console.error(err);
}
}
main();
Promise {
,
[Symbol(async_id_symbol)]: 95,
[Symbol(trigger_async_id_symbol)]: 5,
[Symbol(destroyed)]: { destroyed: false }
}
> Request failed with status code 403
Request failed with status code 403
Pretty much the title. They do have a web widget for the market calendar.
See discussion in #61
After the mentioned PR this package is returning also some other values, see readme.
I would fetch "38017" from intesting, but the code not exists in mapping.js
We can't put whole codes into mapping.js, so I will prefer have a solution let user input a object instead of name
By Example:
Copy "input" into "endpoint" if "input" parameter is object type.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.