请 [注册] 或 [登录]  | 返回主站

量化交易吧 /  数理科学 帖子:3364680 新帖:1

单只股票换手率信息获取

SCSDV_d发表于:5 月 9 日 19:36回复(1)

换手率获取代码封装函数

import numpy as np
import pandas as pd
import time 
from datetime import date
from jqdata import *
import statsmodels.api as sm
import seaborn as sns
import matplotlib.pyplot as plt
from numpy import nan

#换手率获取
def getIndexTurnoverByDate(index_code, date, cnt):
    q = query(valuation.turnover_ratio).filter(valuation.code == index_code)
    panel = get_fundamentals_continuously(q, end_date=date, count=cnt)
    print panel
    print panel.minor_xs('600519.XSHG')
    
getIndexTurnoverByDate('600519.XSHG', '2019-4-9', 20)
<class 'pandas.core.panel.Panel'>
Dimensions: 1 (items) x 20 (major_axis) x 1 (minor_axis)
Items axis: turnover_ratio to turnover_ratio
Major_axis axis: 2019-03-12 to 2019-04-09
Minor_axis axis: 600519.XSHG to 600519.XSHG
            turnover_ratio
day                       
2019-03-12          0.4180
2019-03-13          0.3229
2019-03-14          0.4949
2019-03-15          0.4171
2019-03-18          0.6473
2019-03-19          0.3235
2019-03-20          0.2477
2019-03-21          0.2593
2019-03-22          0.2429
2019-03-25          0.2967
2019-03-26          0.2993
2019-03-27          0.3408
2019-03-28          0.4583
2019-03-29          0.7239
2019-04-01          0.4851
2019-04-02          0.4237
2019-04-03          0.3428
2019-04-04          0.4440
2019-04-08          0.5274
2019-04-09          0.3820
 

全部回复

0/140

量化课程

    移动端课程