What are the steps to streamline the process of obtaining historical NASDAQ stock prices automatically?

Currently, I am manually obtaining raw data for 10-year historical daily prices for over 200 different tickers from . This process involves searching for each ticker, selecting '10 years' from the Timeframe drop-down menu, waiting for the response, and then clicking 'Download this file in Excel Format' at the bottom corner.

Due to the tedious and time-consuming nature of this task, I am exploring ways to automate it.

I have observed that the 'Download this file in Excel Format' button triggers a JavaScript function:

function getQuotes(download) {
        if (!download)
            showLoadingSpinner();

        var data = $("[id$='ddlTimeFrame']").val();
        var submitString = data + '|' + download + "|" + quoteBoxSelectedSymbol; if (!download) {
            $.ajax({
                type: "POST",
                url: baseUrl,
                data: submitString,
                contentType: "application/json",
                success: function (response) {
                    $("[id$='historicalContainer']").html(response);
                    $(".genTable tbody tr:odd").addClass("genTablealt");
                    hideLoadingSpinner();
                }
            });
        }
        else {
            $("[id$='submitString']").val(submitString);
            $("#getFile").submit();
        }
    }

It appears that the download variable serves as a boolean input when the button is clicked. Is there a possible way to intercept and inspect the endpoint generated by this function using a tool like Postman? My knowledge of JavaScript is limited.

Answer №1

To complete the task, a minimum of 2 requests are necessary.

<pre><code><pre><code><pre><code><pre><code><pre>
<!-- Relevant HTML fragment containing timeframes -->
<select id="ddlTimeFrame" name="ddlTimeFrame" onchange="getQuotes(false)">
    <!-- Options listing various timeframe selections -->
</select>

<!-- A specific symbol identified -->
var quoteBoxSelectedSymbol="AAPL";
</pre>
  1. data = 10y
  2. download = true
  3. quoteBoxSelectedSymbol = AAPL
  4. submitString = 10y|true|AAPL
    POST /symbol/aapl/historical HTTP/1.1
    Host: www.nasdaq.com
    x-requested-with: XMLHttpRequest
    Content-Type: application/x-www-form-urlencoded
    accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
    cache-control: no-cache

    __VIEWSTATE:{{__VIEWSTATE}}
    __VIEWSTATEGENERATOR:{{__VIEWSTATEGENERATOR}}
    __VIEWSTATEENCRYPTED:{{__VIEWSTATEENCRYPTED}}
    __EVENTVALIDATION:{{__EVENTVALIDATION}}
    ctl00$quotes_content_left$submitString:{{submitToDownload}}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best approach to have a method in the parent class identify the type based on a method in the child class using TypeScript?

I'm faced with a code snippet that looks like this. class Base{ private getData(): Data | undefined{ return undefined } public get output(): Data | undefined { return { data: this.getData() } } } class ...

Creating an array by combining two queries using loops: What's the best approach?

I am trying to set the primary array to have the property of a foreign key I have two tables, tipe_akademik and jam_akademik_a The jam_akademik table has a foreign key pointing to tipe_akademik My goal is to display tipe_akademik as having a list of jam ...

Refreshing the child route page does not display the specific data assigned to that particular route

I have everything set up on codesandbox. Any assistance would be highly appreciated. // Here is the link to my Axios Getter in /year methods: { async fetchData() { const self = this; const response = await axios.get( "https://e ...

Automatically reset the form after submission in CakePHP 1.3

I've encountered an issue with my report form that is linked multiple times on a page to a jQuery dialog box. To prevent cross-posting, I added a random string to the submission process. After successfully submitting the form on a single page access, ...

Including metadata in CSS

Is it possible to include metadata with a dynamically created CSS stylesheet that is returned via a <link> tag and read it with JavaScript? (In my scenario, the stylesheet I return consists of multiple smaller ones, and I want my JavaScript code to ...

Tips for transmitting multiple parameters using PHP via AJAX

Welcome to my page where I have a specific functionality that needs to be implemented. What I am looking for is, when the user clicks on the "accept" button, the "accept" function should be called with unique parameters attached to each row. Below is the ...

Ending a connection to MS SQL server in node.js with mssql library

In my journey to write a node.js script for querying an MSSQL database, I find myself navigating the realm of JavaScript, node.js, and VSCode with limited SQL knowledge. While I have managed to piece together working code, the issue lies in the connection ...

Function reference in JSDoc that is not within a class context

If I have two stand-alone functions in the structure outlined below: A/foo.ts B/bar.ts Where bar.ts contains export const happy()... And foo.ts contains /** @see happy /* How can I establish the correct linkage to bar#happy? I experimented with borr ...

Learning to implement $first in an Angular ng-repeat to dynamically add a new table row

I am currently facing an issue with displaying a Google map for addresses in my Angular application. The problem seems to be related to the asynchronous nature of HTML and JS, but I am struggling to find a solution. The issue is that even though the map vi ...

Does the parent container require a defined width?

I'm working with a parent div that contains three inner child divs. Here's the structure: <div style="width:900px;"> <div style="width:300px;">somedata</div> <div style="width:300px;">somedata</div> <div ...

Is there a way for me to input items into a database by sorting them according to their ranking and then clicking a

I have a website designed for my NASCAR-loving family. The page I focus on the most is the Roster page. In this page, I categorize drivers into five ranks (A, B, C, D, and E) based on data from a JSON file provided by NASCAR. Each driver is accompanied by ...

Is there a way to display multiple items at once in a bootstrap carousel?

I am currently working on implementing a carousel feature in my React project to display reviews. I have chosen to utilize the bootstrap carousel for this purpose. Here is the carousel that I am using However, I aim to achieve a design similar to this Wi ...

Froala - response in JSON format for uploading images

I have integrated the Froala editor into my website. The image upload feature of this editor is functioning properly, but I am facing issues with the response. As per the documentation provided: The server needs to process the HTTP request. The server mu ...

Performing an asynchronous AJAX request to a PHP script to compute the total sum and retrieve

I have created an HTML table and utilized AJAX to send a POST request with two arrays. The first array is named rowValues and contains three arrays, one for each row. The second array is called columnValues and also has three arrays, one for each column. ...

Oops! The Python TextBlob library couldn't locate the resource at 'tokenizers/punkt/english.pickle'

A similar issue was encountered by someone else, but they were able to solve it by downloading the necessary packages. I have already downloaded the packages, yet I am still experiencing the error. Oddly enough, I can run the code in the terminal without ...

Is it unnecessary to mention both JavaScript and AJAX together?

During a recent conversation I had, someone mentioned that it is inaccurate to state that since Ajax is JavaScript. The scenario was: "How can I perform an action on a webpage without requiring a page refresh?" My response: "Utilize JavaScript along wi ...

Issue with updating the vertices in three.js EdgesGeometry is causing the Line Segments to not be updated as expected

I have created multiple three.js objects. I have observed that the 'other' objects, designed as Mesh/Geometry/Material, update as expected after calling verticesNeedUpdate() Furthermore, I have two wireframe objects that were designed in this m ...

The functionality of the Youtube API is not compatible with a dynamically generated array of objects

Encountering an unusual problem with the Youtube API... I am in the process of developing a script that identifies all Youtube videos on a webpage and then replaces them using the Youtube API. This approach enables me to monitor API events like video compl ...

Encountered an error while trying to deploy Node.js on Heroku: TypeError - Unable to access property 'split' of null

Seeking insight into the following error message: My application is built on Node.js and uses Atlas as its database. However, when attempting to deploy it on Heroku, I encounter the following error in the logs: TypeError: Cannot read property 'spl ...

Is there a way to remove the initial number entered on a calculator's display in order to prevent the second number from being added onto the first one?

I am currently in the process of developing a calculator using HTML, CSS, and JavaScript. However, I have encountered an issue with my code. After a user inputs a number and then clicks on an operator, the operator remains highlighted until the user inputs ...