I want to obtain some information of stock markets from TradingView website.

For instance, let us access to S&P index chart through the URL, https://www.tradingview.com/chart/?symbol=SP%3ASPX

Now, one can find Stock Screener tab in the lower left in the website: enter image description here

Clicking the tab and then the total amount of the screening result appears (The result is for Most Capitalized stocks in this example): enter image description here

Now, you can see the total amount is 5483. My question is: Is it possible to get this number from Mathematica?

Although I think my question is related to so called ``scraping’’, I am not familiar with web things (HTML, http, developer tools, api keys, etc.) at all, so I have no clue for this issue.

I tried Import which did not work:


Any comment is welcome. Thank you.

  • $\begingroup$ To get information on a particular stock e.g., do this. The way you enter the spikey is = =. $\endgroup$
    – Syed
    Sep 20, 2022 at 8:30
  • $\begingroup$ Thank you. I do not want to get a particular stock information, but to get total information in a single market as breadth indicators. Mathematica does not seem to provide breadth indicators. $\endgroup$ Sep 20, 2022 at 14:12
  • 1
    $\begingroup$ May I suggest you inquire about Wolfram Finance Platform. $\endgroup$
    – Syed
    Sep 20, 2022 at 14:15

1 Answer 1

  1. I do not think it is possible as it looks like TradingView has blocked scraping so Import does not work.

You can try the inbuilt function FinancialData to get lots of market data to see if that helps. The documentation is quite good here, but an example would be

properties = FinancialData["Apple", "Properties"];
data = FinancialData["Apple", #] & /@ properties;
Dataset[AssociationThread[properties, data]]
  1. The general approach I use to scraping is to import the page and store the raw data. I then use F12 to inspect the webpage to figure out where in the raw data the element I want is. Sometimes using Ctrl+F to find where it is.

For example

(*look on the website for the position of the data*)

Some useful resources.



  1. You might have more luck scraping TradingView using Python modules selenium or beautifulsoup. A Google search will return more information about this.
  • $\begingroup$ Thank you for your kind explanation. I know how to get information of individual stocks. What I want to get is TOTAL amount of all stock information in a single stock market (U.S. market in this case) to see the market conditions in a quantitative manner (e.g., Newhigh-newlow-index). Meanwhile, the website, scrapethissite, would be very helpful for me! $\endgroup$ Sep 20, 2022 at 14:08
  • 1
    $\begingroup$ rawData = Import["en.wikipedia.org/wiki/List_of_S%26P_500_companies", "Data"] rawComponents = rawData[[1]][[1]][[2]];(* from manually inspecting rawData*) symbols = StringTrim /@ rawComponents[[2 ;;, 1]]; (* clean data*) FinancialData[symbols[[1]]] (* you can do something less trivial here such as marketCaps=FinancialData[symbols, "MarketCap"]*) $\endgroup$ Sep 20, 2022 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.