How to use python to monitor stocks in real time and continuously scan the market?

Preface

tqsdk is a Python library for futures users, but it provides stock quotes and can be used to monitor stocks, select stocks, view quotes, make conditional orders and stock trading strategies.

It is a simple and powerful tool that can build various types of quantitative trading strategy programs with a small amount of code. Even a novice can learn to use this library to select stocks and check market trends in just ten minutes.

At the same time, it provides functions such as historical data, real-time data, strategy backtesting and simulated trading,

If you have a lot of ideas about trading, then you can even use tqsdk directly to write trading strategies.

Usage documentation can be found on the official website,

https://www.shinnytech.com/tianqin/

The installation method is very simple:

pip install tqsdk -U

Let’s give a simple example of checking market prices:

from tqsdk2 import TqApi, TqAuth

api = TqApi(web_gui=True, auth=TqAuth("username", "password"))
quote = api.get_quote("SZSE.159841") // 获得行情
print(quote.ask_volume1, quote.ask_price1) // 打印卖盘一档手数和价格
print(quote.instrument_name) // 打印股票名称(示例中是 证券ETF)
while True:
    api.wait_update() // 阻塞到行情更新
    print(quote.datetime, quote.last_price) // 行情每次跳动都打印时间和最新价

It should be noted that tqsdk only supports futures trading, not stock trading. It is very suitable for doing market-based calculations, such as calculating indicators, selecting stocks that meet conditions, etc. You can add your own email notifications to help you implement functions such as grid, conditional orders, and stop-profit and stop-loss.

In addition, I think it is very important that they have also built their own community. There is also a way to join the community on the official website, which is full of trading masters!

Insert image description here

About Python technical reserves

Learning Python well is good whether you are getting a job or doing a side job to make money, but you still need to have a learning plan to learn Python. Finally, we share a complete set of Python learning materials to give some help to those who want to learn Python!

1. Python learning route

Insert image description here

Insert image description here

2. Basic learning of Python

1. Development tools

We will prepare you with the necessary tools you need to use in the Python development process, including the latest version of PyCharm installation and permanent activation tool.
Insert image description here

2. Study notes

Insert image description here

3. Learning videos

Insert image description here

3. Essential manual for Python beginners

picture

4. Python practical cases

Insert image description here

5. Python crawler tips

picture

6. A complete set of resources for data analysis

Insert image description here

7. Python interview highlights

Insert image description here

Insert image description here

2. Resume template

Insert image description here
Insert image description here

Data collection

The complete set of Python learning materials mentioned above has been uploaded to CSDN official. If you need it, you can scan the CSDN official certification QR code below on WeChat and enter "receive materials" to get it.

Insert image description here

Guess you like

Origin blog.csdn.net/xiqng17111342931/article/details/133124706