Webscraping 1 minute stock data from tradingview
@ rushi | Tuesday, Dec 22, 2020 | 1 minutes read | Update at Tuesday, Dec 22, 2020

How I webscraped 1 minute stock data from tradingview

After a long die-hard trying I managed to get 1 minute stock data for free. My previous tries were using selenium and beautifulsoup modules in python. But the data is highly obfuscated so I was not able to find the exact HTML element to scrape. If you manage to do this using selenium please comment below.

Probably the data is being loaded up as SVG which is why it isn’t being seen in html inspect element.

image-20200702112353396

But…

After a look into Network section I found something interesting.

image-20200702112605039

websockets !!!

After observing the Headers

image-20200702112714421

And Messages

image-20200702112933310

I tried to send the same messages using websockets in python and it worked :) .

Code at https://github.com/rushic24/tradingview-scraper.

Limitations

We can only get previous 5000 ticks of data.

关于我

g1eny0ung 的 ❤️ 博客

记录一些 🌈 生活上,技术上的事

一名大四学生

马上(已经)毕业于 🏫 大连东软信息学院

职业是前端工程师

业余时间会做开源和 Apple App (OSX & iOS)

主要的技术栈是:

  • JavaScript & TypeScript
  • React.js
  • Electron
  • Rust

写着玩(写过):

  • Java & Clojure & CLJS
  • OCaml & Reason & ReScript
  • Dart & Swift

目前在 PingCAP 工作

– 2020 年 09 月 09 日更新

其他

如果你喜欢我的开源项目或者它们可以给你带来帮助,可以赏一杯咖啡 ☕ 给我。~

If you like my open source projects or they can help you. You can buy me a coffee ☕.~

PayPal

https://paypal.me/g1eny0ung

Patreon:

Become a Patron!

微信赞赏码

wechat

最好附加一下信息或者留言,方便我可以将捐助记录 📝 下来,十分感谢 🙏。

It is better to attach some information or leave a message so that I can record the donation 📝, thank you very much 🙏.