Commit c51500f4 authored by wuyuming's avatar wuyuming

20231108

parent ae4ccb9b
This source diff could not be displayed because it is too large. You can view the blob instead.
import csv
import math
import os
import time
import numpy as np
import pandas as pd
# root='D:/Administrator/Desktop/Stk_Day/'
root='/Users/yumingwu/Downloads/Stk_Day/'
path =os.listdir(root)
path.sort()
num =10
guben1 = pd.read_excel('./流通股本.xlsx')
guben1['变更日期']=pd.to_datetime(guben1['变更日期'])
with open('./2023深圳开盘涨停股本'+'.csv','w',encoding='gbk',newline='') as csfile:
writer =csv.writer(csfile)
writer.writerow(['代码','日期','昨日收盘价','开盘价','最低价','最高价涨幅','成交量','成交额','换手率','买入价格','卖出价格','盈利','涨幅','10日涨幅','流通市值'])
for spath in path:
# 过滤000
if spath.find("SZ0") == -1 and spath.find("S30") == -1:
continue
percent =1.098
if spath.find("S30") != -1:
percent = 1.198
print(spath)
dataS = pd.read_csv(root + spath, encoding='gbk')
dataS['时间'] = pd.to_datetime(dataS['时间'])
data1=dataS[dataS['时间']>=pd.to_datetime('20220101')]
data1 = data1[data1['时间'] < pd.to_datetime('20230907')]
code = spath[2:8] + "." + spath[0:2]
guben = guben1[guben1['代码']==code]
guben =guben.sort_values('变更日期',ascending=False)
for indexitemn in np.arange(len(data1)):
if indexitemn==len(data1)-1:
continue
itemn=data1.iloc[indexitemn]
itemn1 = data1.iloc[indexitemn+1]
data=dataS[dataS['时间']<itemn['时间']]
if (len(data) <5):
continue
item = data.iloc[-1]
if itemn['开盘价'] / item['收盘价'] <= percent:
continue
zhangting = 0
if zhangting == 0:
data10 = data.iloc[len(data) - 10 - 1:len(data)]
minprice = data10['开盘价'].min()
zhangfu = item['收盘价'] / minprice
# if zhangfu >= 1.15:
# continue
if len(guben)==0:
continue
gubenitem = guben.iloc[0]
gubenitem1 = guben[guben['变更日期']<=item['时间']]
if len(gubenitem1)==0:
gubenitem1 = guben.iloc[-1]
else:
gubenitem1=gubenitem1.iloc[0]
huanshou=item['成交量(股)'] / gubenitem1['流通A股']
shizhi = gubenitem['流通A股'] * item['收盘价'] / 100000000.0
# if shizhi > 200:
# continue
num1 = math.floor(2000000 / itemn['最高价'] / 100) * 100
writer.writerow([itemn['代码'],
itemn['时间'],
item['收盘价'],
itemn['开盘价'],
itemn['最低价'],
itemn['最高价']/item['收盘价']-1,
item['成交量(股)'],
item['成交额(元)'],
huanshou,
itemn['最高价'],
itemn1['开盘价'],
num1 * (itemn1['开盘价'] -itemn['最高价']) - itemn['最高价'] * num1 * 0.0002 -
itemn1['开盘价'] * num1 * 0.0012,
itemn1['开盘价'] / itemn['最高价']-1-0.0014,
zhangfu,
shizhi,
])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment