当前位置:首页 » 科技股票 » python股票历史最低点

python股票历史最低点

发布时间: 2025-03-26 18:29:59

1. 如何用python代码判断一段范围内股票最高点

Copyright © 1999-2020, CSDN.NET, All Rights Reserved




登录

python+聚宽 统计A股市场个股在某时间段的最高价、最低价及其时间 原创
2019-10-12 09:20:50

开拖拉机的大宝

码龄4年

关注
使用工具pycharm + 聚宽数据源,统计A股市场个股在某时间段的最高价、最低价及其时间,并打印excel表格输出

from jqdatasdk import *
import pandas as pd
import logging
import sys
logger = logging.getLogger("logger")
logger.setLevel(logging.INFO)

# 聚宽数据账户名和密码设置
auth('username','password')

#获取A股列表,包括代号,名称,上市退市时间等。
security = get_all_securities(types=[], date=None)
pd2 = get_all_securities(['stock'])

# 获取股票代号
stocks = list(get_all_securities(['stock']).index)

# 获取股票名称
stocknames = pd2['display_name']

start_date = '2015-01-01'
end_date = '2018-12-31'
def get_stocks_high_low(start_date,end_date):
# 新建表,表头列
# 为:"idx","stockcode","stockname","maxvalue","maxtime","lowvalue","lowtime"
result = pd.DataFrame(columns=["idx", "stockcode", "stockname", "maxvalue", "maxtime", "lowvalue", "lowtime"])
for i in range(0,stocks.__len__()-1):
pd01 = get_price(stocks[i], start_date, end_date, frequency='daily',
fields=None, skip_paused=False,fq='pre', count=None)
result=result.append(pd.DataFrame({'idx':[i],'stockcode':[stocks[i]],'stockname':
[stocknames[i]],'maxvalue':[pd01['high'].max()],'maxtime':
[pd01['high'].idxmax()],'lowvalue': [pd01['low'].min()], 'lowtime':
[pd01['low'].idxmin()]}),ignore_index=True)

result.to_csv("stock_max_min.csv",encoding = 'utf-8', index = True)
logger.warning("执行完毕!

热点内容
一亿元买理财一年收益多少 发布:2025-04-27 20:37:01 浏览:756
固收基金产品和债券哪个好 发布:2025-04-27 20:31:57 浏览:461
现代金融产业有哪些 发布:2025-04-27 20:25:27 浏览:32
投资哪些指数基金好 发布:2025-04-27 20:04:36 浏览:249
期货小资金怎么长期存活 发布:2025-04-27 19:49:30 浏览:370
期货的额仓是什么意思 发布:2025-04-27 19:44:36 浏览:160
捷足先登科技教育公司市值多少 发布:2025-04-27 19:32:11 浏览:943
招联期货可以做什么 发布:2025-04-27 19:29:37 浏览:535
投资去理财怎么样 发布:2025-04-27 19:29:30 浏览:21
市值1亿一个股多少钱 发布:2025-04-27 19:29:27 浏览:486