How to obtain the L2 stock quotation data interface to connect to quantitative transactions?


Shenzhen Stock Exchange Level-2 market, the market demand is indeed relatively large.

Many people need the real-time market of Shanghai and Shenzhen L2, but there are also many people who only need the L2 market of Shenzhen Stock Exchange, not the L2 market of Shanghai Stock Exchange. I have only been in contact with one market, only the Shenzhen Stock Exchange, and I did not say that as long as the Shanghai Stock Exchange is not the Shenzhen Stock Exchange. As for the real-time market program interface of Level 2 of the Shenzhen Stock Exchange, it is best to buy it directly from the Shenzhen Stock Exchange. Lowest latency, highest market quality, and best stability. Of course, the fee is also the most expensive, the procurement process is also very troublesome, and the technical ability requirements for program developers are also the highest. There are quite a few interface languages ​​that can be supported, including C++, C#, Java, Python, PHP, and both window and linux systems.

Level2 market interface link

1. Download the market tool

l2-push-python: python level2 market access example - Gitee.com


2. Directory description
Name description
conf Configuration directory
data Data directory
log Log directory
txttool Command line tool-Linux
txtool.exe Command line tool-Windows
3. Common commands of market tools
Command description
txttool -h View help
txttool version View tool version number
txttool proxy Start a local proxy server. The default command, Windows can directly double-click to execute


4. Access instructions


1. Download the market tool, modify conf/proxy.toml
1. Set the user name and password: User/Passwd
2. Set the push server address: RpcServer/TcpServer
2. Open the command window, switch to the cli directory, and execute the command to start the local proxy server
1 .Linux system execution: txttool proxy
2.Windows system execution: txttool.exe proxy
3. If it prompts that the local port is occupied, you can modify the configuration item Address (proxy server listening address)
3. Start successfully, call the GRPC interface provided by the proxy server
1. For the interface address, see the configuration item Address, the default is: localhost:8090
2. For the interface definition, see the directory proto


4. Proxy server configuration


1.proxy.toml configures the listening address of the proxy server, whether to write push messages to local files, etc.
2.log.toml configures the log format, whether to write to the console and files, etc.

Level2 market interface


Interface definition, see catalog proto
subscription event
get_subscription query subscription
add_subscription add
subscription del_subscription cancel subscription
data push event
tick_record_stream push tick-by-tick market data
order_record_stream push tick-by-tick market data
order_queue_record_stream push order queue
market data stock_quote_record_stream push stock market data

Code example
# -*- coding: utf-8 -*-
# This demo is just to demonstrate the access process
import grpc
import entity_pb2
import proxy_pb2_grpc
import threading
from multiprocessing import Process
# The address and port that the proxy server listens to
ServerConnect = grpc.insecure_channel('localhost :5000')
Stub = proxy_pb2_grpc.ProxyStub(ServerConnect)

# Query subscription
def get_subscription():

Guess you like

Origin blog.csdn.net/L2gogogo/article/details/130685140