万得-python接口获取股票数据

# -*- coding: utf-8 -*-
"""
Created on Thu May  4 16:31:20 2017

@author: yunjinqi 
 
E-mail:yunjinqi@qq.com 
 
Differentiate yourself in the world from anyone else.
"""
from WindPy import*
import pandas as pd
import numpy as np
import datetime
import time
###################
w.start()
symbol="000001.SZ"
start_date="2017-01-01"

end_date="2017-05-02"

stock=w.wsd(symbol, "trade_code,open,high,low,close,pre_close,\
                  volume,amt,dealnum,chg,pct_chg,vwap, adjfactor,\
                  close2,turn,free_turn,oi,oi_chg,pre_settle,settle,\
                  chg_settlement,pct_chg_settlement, lastradeday_s,\
                  last_trade_day,rel_ipo_chg,rel_ipo_pct_chg,susp_reason,\
                  close3, pe_ttm,val_pe_deducted_ttm,pe_lyr,pb_lf,\
                  ps_ttm,ps_lyr,dividendyield2,ev,mkt_cap_ard,\
                  pb_mrq,pcf_ocf_ttm,pcf_ncf_ttm,pcf_ocflyr,\
                  pcf_nflyr,trade_status", start_date,end_date)
i=1
while i==1:
                 index_data = pd.DataFrame()
                 index_data['trade_date']=stock.Times
                 stock.Data[0]=symbol
                 index_data['stock_code']=stock.Data[0]
                 #index_data['stock_code'] =symbol
                 index_data['open'] =stock.Data[1]
                 index_data['high'] =stock.Data[2]
                 index_data['low']  =stock.Data[3]
                 index_data['close']=stock.Data[4]
                 index_data['pre_close']=stock.Data[5]
                 index_data['volume']=stock.Data[6]
                 index_data['amt']=stock.Data[7]
                 index_data['dealnum']=stock.Data[8]
                 index_data['chg']=stock.Data[9]
                 index_data['pct_chg']=stock.Data[10]
                 #index_data['pct_chg']=index_data['pct_chg']/100
                 index_data['vwap']=stock.Data[11]
                 index_data['adj_factor']=stock.Data[12]
                 index_data['close2']=stock.Data[13]
                 index_data['turn']=stock.Data[14]
                 index_data['free_turn']=stock.Data[15]
                 index_data['oi']=stock.Data[16]
                 index_data['oi_chg']=stock.Data[17]
                 index_data['pre_settle']=stock.Data[18]
                 index_data['settle']=stock.Data[19]
                 index_data['chg_settlement']=stock.Data[20]
                 index_data['pct_chg_settlement']=stock.Data[21]
                 index_data['lastradeday_s']=stock.Data[22]
                 index_data['last_trade_day']=stock.Data[23]
                 index_data['rel_ipo_chg']=stock.Data[24]
                 index_data['rel_ipo_pct_chg']=stock.Data[25]
                 index_data['susp_reason']=stock.Data[26]
                 index_data['close3']=stock.Data[27]
                 index_data['pe_ttm']=stock.Data[28]
                 index_data['val_pe_deducted_ttm']=stock.Data[29]
                 index_data['pe_lyr']=stock.Data[30]
                 index_data['pb_lf']=stock.Data[31]
                 index_data['ps_ttm']=stock.Data[32]
                 index_data['ps_lyr']=stock.Data[33]
                 index_data['dividendyield2']=stock.Data[34]
                 index_data['ev']=stock.Data[35]
                 index_data['mkt_cap_ard']=stock.Data[36]
                 index_data['pb_mrq']=stock.Data[37]
                 index_data['pcf_ocf_ttm']=stock.Data[38]
                 index_data['pcf_ncf_ttm']=stock.Data[39]
                 index_data['pcf_ocflyr']=stock.Data[40]
                 index_data['pcf_ncflyr']=stock.Data[41]
                 index_data['trade_status']=stock.Data[42]
                 index_data['data_source']='Wind'
                 index_data = index_data[index_data['open'] > 0]
                 i=0
index_data

已标记关键词 清除标记
相关推荐
1 WINDPY接口说明 ................................................................................................. 1 1.1 WINDPY接口概述 ............................................................................................... 1 1.2 WINDPY接口安装 ............................................................................................... 2 1.2.1 WindPy对系统环境要求 ............................................................... 2 1.2.2 Python环境安装 .......................................................................... 2 1.2.3 正常WindPy接口安装 .................................................................. 3 1.2.4 特殊安装WindPy方式 .................................................................. 6 1.3 接口向导界面 ..................................................................................................... 6 1.4 WINDPY获取帮助途径 ....................................................................................... 7 1.4.1 本用户手册 .................................................................................... 7 1.4.2 量化交易群和R语言交流群 ........................................................... 7 1.5 WINDPY接口相关规范 ....................................................................................... 1 1.5.1 以下所有命令都有如下假设 ........................................................... 1 1.5.2 命令区分大小写,且“w.”不能省略 ............................................... 1 1.5.3 中文以及单字节码和双字节码的问题 ............................................. 1 1.5.4 品种、指标、参数等引号内的部分不区分大小写 ........................... 1 1.5.5 参数支持list输入 ...................................................................... 1 1.5.6 时间、日期支持Python语言的时间、日期格式 ........................... 2 1.5.7 参数中有缺省值的可以不用输入 .................................................... 2 1.5.8 可以带参数名输入 ......................................................................... 2 精于数据,一直进步 IV 1.5.9 Showblank参数 ........................................................................... 3 1.5.10 交易接口中Showfields参数................................................ 3 1.5.11 Erro
©️2020 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页
实付 299.00元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值