已经开发好的例子
https://github.com/jiuyuesanqiu/dingtouhuice.git
参考:
https://jingyan.baidu.com/article/a17d5285a347128098c8f201.html
系统选择 centos 最新版系统即可
yum install epel-release
yum install python36
python3 -m pip install gunicorn
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Python3 get-pip.py
pip install Django
yum install git
git clone https://github.com/jiuyuesanqiu/dingtouhuice.git
cd dingtouhuice
pip install xalpha
pip install pandas
配置setting.py 的ALLOWED_HOSTS字段
ALLOWED_HOSTS=['19.239.22.11'] 这里填你自己的服务器IP地址
python3 manage.py migrate
gunicorn dingTouHuiCheDjango.wsgi -b 0.0.0.0:8989
http://19.239.22.11:8989/calculate/?code=110022&start=2017-05-06&end=2020-05-06&amount=1000&period=M&nsukey=NR3jlatzQW0wGla96dZxdrmd5shD90vAn%2Fcxy299eIsXfzEbOjDaaYfIur5Y7yMYW97Dr0cpsOW5F0DnVH10%2FdRm%2FJVBw8WsVxxDhrdG4yiDRlZNGdlin5No0VbIVjelzq4zsTtc70v6GkbkNUs3TSpy3iENDmxh0gX51WQJjuCapToOjA7P5kyW1mpAusp5dn3deGCThkSZ8N0xHOUtAg%3D%3D
记得替换你的 IP地址
然后会返回如下JSON数据就成功了!
{
"基金名称": {
"0": "易方达消费行业股票"
},
"基金代码": {
"0": "110022"
},
"当日净值": {
"0": 3.002
},
"单位成本": {
"0": 2.3057
},
"持有份额": {
"0": 65924.86
},
"基金现值": {
"0": 197906.43
},
"基金总申购": {
"0": 152000
},
"历史最大占用": {
"0": 152000
},
"基金持有成本": {
"0": 152000
},
"基金分红与赎回": {
"0": 0
},
"换手率": {
"0": 0.1668190128
},
"基金收益总额": {
"0": 45906.43
},
"投资收益率": {
"0": 30.2016
}
}