程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Mac uses Python to access Dongfang fortune quantitative interface choice to debug and obtain data

編輯:Python

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

List of articles

  • Choice Account acquisition
  • Choice Interface activation
  • Python Interface pull data
  • More code

Choice Account acquisition

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 Interface activation

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

  1. 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

  2. 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

  1. Activate interface ( Here is the first kind of official website , You can also use the latter two methods that are very troublesome …)

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

Python Interface pull data

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

More code

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 :

  • Please check the callable interface and the number of times :http://quantapi.eastmoney.com/User/Authorization?from=web
  • The remaining call times can be referred to :http://quantapi.eastmoney.com/Flow?from=web

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved