DavideViolante / investing-com-api

Unofficial APIs for Investing.com website.
MIT License
78 stars 26 forks source link

Please make an API guide doc #60

Open ibrayandiyev opened 1 year ago

ibrayandiyev commented 1 year ago

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!

DavideViolante commented 1 year ago

There is no guide at the moment since I didn't investigate enough on how the API works. The only things we know is on the readme in the inputs paragraph where there are all the available inputs for the APIs.

yortug commented 1 year ago

I'm completely new to Javascript, APIs, and all the rest of it, so please forgive me if this is a bit of a dumb question!

I'm curious to know how you figured out that this particular API URL was even queryable to begin with? How did you figure out that the pairId was required for a query? How did you find out where to find the different pairId's on the website?

I'm guessing there's no documentation available to the public for this API, so I'm assuming you would have had to sort of "work backwards" to figure it all out? I'm curious about how you went about this process.

For example, I haven't investigated it at all, but it doesn't stand out to me as particularly obvious what the pointscount parameter in the API is doing? It's documented as being the total number of results returned, but what happens if you set the period=P1M, interval=P1D and pointscount=120?

To me, with those parameters, it seems like the period is set to a month, and the interval is set to daily, so then the results returned should be max 31 (i.e. a single result for every day of the month)?

I'll have to test some different parameters out to try and build my understanding, but I'm overall curious how you went about figuring all of this information out in the beginning?

DavideViolante commented 1 year ago

Hi @yortug thanks for the question. I just used the Google Chrome Console, Network tab. In that tab you can find all the requests the browser send to a server (website) and the responses. I found out that to load the charts they are using an internal API that does not require any auth. See gif below:

investinghowto

About the parameters, I'm also not sure what they exactly do, but I discovered them clicking the chart and watching the request parameters change.