This blog is used to put Mac On the platform python Access to Oriental Wealth Choice The process of interface is refined and rewritten , Some parts of the official documents are too vague , In some places, bloggers try a variety of methods before trying out , Here is the standard answer to everyone , Try to avoid the pit ~
Make complaints : Flush has a strong sense of Technology , Fabulous , But no Mac Version of , And the data of securities companies is too little , Hope to make persistent efforts
First, when using this interface , You need to have a purchase account , Please refer to the price :https://choice.eastmoney.com/buyingcenter, It should be every year 3w
Generally, someone will call you after you register your account , Or take the initiative to call customer service , Can the .
Then bind a mobile number to the account , You need this mobile number later
Choice The official documentation of the interface is as follows :http://quantapi.eastmoney.com/Manual/Index?from=web&loc=%E6%8E%A5%E5%8F%A3%E9%85%8D%E7%BD%AE&ploc=%E6%8E%A5%E5%8F%A3%E9%85%8D%E7%BD%AE
First go to the website :http://quantapi.eastmoney.com/Download?from=web, download python Version of :
The download link is :http://updates.jg.eastmoney.com/Choice/EMQuantAPI/EMQuantAPI_Python.zip
After downloading the compressed package , Use :
unzip EMQuantAPI_Python.zip
cd EMQuantAPI_Python
cd python3
python installEmQuantAPI.py
This adds dependencies to the current environment
Run the command :
brew install gtk+3
cd libs/mac
chmod +x loginactivator_mac
./loginactivator_mac
Then open an interface :
Click to activate , Here you need the mobile number that the account was bound to , After configuration OK La
There will be a file under the current folder userInfo
, In the file is a string
You can try to run the following example code :
The data pulled by the code is 000001.SZ,000002.SZ
The stock names of these two securities are similar to IPO Time
from EmQuantAPI import c
import pandas as pd
# Sign in
loginresult = c.start()
print(loginresult)
# data
choice_data = c.css("000001.SZ,000002.SZ", "NAME,LISTDATE", "")
if choice_data.ErrorMsg == "success":
data_df = pd.DataFrame(choice_data.Data).T
data_df.columns = choice_data.Indicators
print(data_df)
# Log out
logoutresult = c.stop()
result :
[EmQuantAPI Python] [Em_Info][2022-07-01 11:24:10]:The current version is EmQuantAPI(V2.5.3.4).
[EmQuantAPI Python] [Em_Info][2022-07-01 11:24:10]:verifying your token...
[EmQuantAPI Python] [Em_Info][2022-07-01 11:24:10]:connect server...
[EmQuantAPI Python] [Em_Info][2022-07-01 11:24:11]:start success!
ErrorCode=0, ErrorMsg=success, Data={}
[EmQuantAPI Python] [Em_Info][2022-07-01 11:24:11]:percentflag(for csd/css/cses) update success.
NAME LISTDATE
000001.SZ Ping An Bank 1991/4/3
000002.SZ vanke A 1991/1/29
[EmQuantAPI Python] [Em_Info][2022-07-01 11:24:12]:heartbeatthread end.
among , Ahead [EmQuantAPI Python]
Log in and log out , Middle correspondence data_df
The data are as follows :
NAME LISTDATE
000001.SZ Ping An Bank 1991/4/3
000002.SZ vanke A 1991/1/29
Please refer to the code generation tool :http://quantapi.eastmoney.com/Cmd/ChoiceSerialSection?from=web
There is a weekly call limit for quantifying interface data :