Skip to content

Commit

Permalink
#402 Commit : bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
yutiansut committed Apr 3, 2017
1 parent 2ee1baa commit d129cf3
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 16 deletions.
25 changes: 16 additions & 9 deletions QUANTAXIS/QAFetch/QAWind.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
import datetime,re
import pymongo
from WindPy import w
w.start()
#w.start()


#Stock
def getStock_Info(startDate,endDate,name):
def get_stock_info(name,startDate,endDate):
w.start()
#get the all stock list on the endDate
# judge the vaild date
if(is_valid_date(endDate)==False):
Expand All @@ -21,7 +22,8 @@ def getStock_Info(startDate,endDate,name):
if (data.ErrorCode!=0):
print ("Connent to Wind successfully")
return data.Data
def getStock_Day(startDate,endDate,name):
def get_stock_day(name,startDate,endDate):
w.start()
if(is_valid_date(endDate)==False):
print ("wrong date")
else :
Expand All @@ -31,7 +33,8 @@ def getStock_Day(startDate,endDate,name):
if (data.ErrorCode==0):
print ("Connent to Wind successfully")
return data.Data
def getStock_Indicator(startDate,endDate,name):
def get_stock_indicator(name,startDate,endDate):
w.start()
if(is_valid_date(endDate)==False):
print ("wrong date")
else :
Expand All @@ -40,7 +43,8 @@ def getStock_Indicator(startDate,endDate,name):
if (data.ErrorCode==0):
print ("Connent to Wind successfully")
return data.Data
def getStock_Shape(startDate,endDate,name):
def get_stock_shape(name,startDate,endDate):
w.start()
if(is_valid_date(endDate)==False):
print ("wrong date")
else :
Expand All @@ -49,23 +53,26 @@ def getStock_Shape(startDate,endDate,name):
if (data.ErrorCode==0):
print ("Connent to Wind successfully")
return data.Data
def getStock_Risk(startDate,endDate,name):
def get_stock_risk(name,startDate,endDate):
w.start()
if(is_valid_date(endDate)==False):
print ("wrong date")
else :
data=w.wsd(name, "annualyeild_100w,annualyeild_24m,annualyeild_60m,annualstdevr_100w,annualstdevr_24m,annualstdevr_60m,beta_100w,beta_24m,beta_60m,avgreturn,avgreturny,stdevry,stdcof,risk_nonsysrisk1,r2,alpha2,beta,sharpe,treynor,jensen,jenseny,betadf", startDate, endDate, "period=2;returnType=1;index=000001.SH;yield=1")
if (data.ErrorCode==0):
print ("Connent to Wind successfully")
return data.Data
def getStock_Xueqiu(startDate,endDate,name):
def get_stock_xueqiu(name,startDate,endDate):
w.start()
if(is_valid_date(endDate)==False):
print ("wrong date")
else :
data=w.wsd(name, "xq_accmfocus,xq_accmcomments,xq_accmshares,xq_focusadded,xq_commentsadded,xq_sharesadded,xq_WOW_focus,xq_WOW_comments,xq_WOW_shares", startDate, endDate, "")
if (data.ErrorCode==0):
print ("Connent to Wind successfully")
return data.Data
def getStock_Financial(startDate,endDate,name):
def get_stock_financial(name,startDate,endDate):
w.start()
pass
def is_valid_date(str):
try:
Expand All @@ -75,7 +82,7 @@ def is_valid_date(str):
return False

def get_trade_date(endDate,exchange):

w.start()
supportExchanges=["SSE","SZSE","CFFEX","SHFE","DCE","CZCE"]
if (exchange in supportExchanges):
#"SSE","SZSE","CFFEX","SHFE","DCE","CZCE"
Expand Down
1 change: 0 additions & 1 deletion QUANTAXIS/QAMarket/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#coding : utf-8

import pymongo
import QAFetch
7 changes: 3 additions & 4 deletions QUANTAXIS/QATasks/tasks.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from celery import Celery
import sys
sys.path.append('c:\\quantaxis')
import QAFetch
import QUANTAXIS

quantaxis = Celery('tasks', backend='amqp://guest@localhost//', broker='amqp://guest@localhost//')

@quantaxis.task

def save_data(all):
return QAFetch.QAWind()
pass
def update_data():
pass
def update_spider(name):
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,10 @@ mkdir web && cd web
npm install quantaxiswebkit
cd node_modules/quantaxiswebkit
npm run all
```
## 使用示例
```python
import QUANTAXIS as QA
print(QA.get_stock_day("ts","000001.SZ","2000-01-01","2017-04-01"))
print(QA.get_stock_day("wind","000001.SZ","2000-01-01","2017-04-01"))
```
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def read(fname):
名字,一般放你包的名字即可
"""

PACKAGES = ["QUANTAXIS", "QUANTAXIS.QAFetch", "QUANTAXIS.QAMarket", "QUANTAXIS.QAStrategy", "QUANTAXIS.QATasks", "QUANTAXIS.QAFetch.QAWind", "QUANTAXIS.QAFetch.QATushare", "QUANTAXIS.QAFetch.QASpider"]
PACKAGES = ["QUANTAXIS", "QUANTAXIS.QAFetch", "QUANTAXIS.QAMarket", "QUANTAXIS.QAStrategy", "QUANTAXIS.QATasks", "QUANTAXIS.QASpider"]
"""
包含的包,可以多个,这是一个列表
"""
Expand All @@ -46,7 +46,7 @@ def read(fname):

URL = "http://www.yutiansut.com"

VERSION = "0.3.8"
VERSION = "0.3.8-beta"


LICENSE = "MIT"
Expand Down

0 comments on commit d129cf3

Please sign in to comment.