当前位置: 首页 > news >正文

沈阳网站定制广告软文是什么意思

沈阳网站定制,广告软文是什么意思,企业建设网站哪里好,网站源码库对AI炒股感兴趣的小伙伴可加WX:caihaihua057200(备注:学校/公司名字方向) 另外我还有些AI的应用可以一起研究(我一直开源代码) 1、引言 在这期内容中,我们回到AI预测股票,转而探索…

 对AI炒股感兴趣的小伙伴可加WX:caihaihua057200(备注:学校/公司+名字+方向)

另外我还有些AI的应用可以一起研究(我一直开源代码)

1、引言

在这期内容中,我们回到AI预测股票,转而探索人工智能技术如何应用于另一个有趣的领域:预测A股大盘。

2、AI与股票的关系

在股票预测中,AI充当着数据分析和模式识别的角色。虽然无法确保百分之百准确的结果,但它为增加预测的洞察力和理解提供了全新的途径。

3、数据收集与处理(akshare爬实时上证指数)

import akshare as ak
import numpy as np
import pandas as pd
from pandas.tseries.offsets import CustomBusinessDay
from datetime import datetime
import xgboost as xgbdf = ak.stock_zh_index_daily_em(symbol='sh000001')  

数据预处理:时间特征转换及时间特征结合K线特征


today = datetime.today()
date_str = today.strftime("%Y%m%d")
base = int(datetime.strptime(date_str, "%Y%m%d").timestamp())
change1 = lambda x: (int(datetime.strptime(x, "%Y%m%d").timestamp()) - base) / 86400
change2 = lambda x: (datetime.strptime(str(x), "%Y%m%d")).day
change3 = lambda x: datetime.strptime(str(x), "%Y%m%d").weekday()df['date'] = df['date'].str.replace('-', '')
X = df['date'].apply(lambda x: change1(x)).values.reshape(-1, 1)
X_month_day = df['date'].apply(lambda x: change2(x)).values.reshape(-1, 1)
X_week_day = df['date'].apply(lambda x: change3(x)).values.reshape(-1, 1)
XX = np.concatenate((X, X_week_day, X_month_day), axis=1)[29:]
FT = np.array(df.drop(columns=['date']))
min_vals = np.min(FT, axis=0)
max_vals = np.max(FT, axis=0)
FT = (FT - min_vals) / (max_vals - min_vals)window_size = 30
num_rows, num_columns = FT.shape
new_num_rows = num_rows - window_size + 1
result1 = np.empty((new_num_rows, num_columns))
for i in range(new_num_rows):window = FT[i: i + window_size]window_mean = np.mean(window, axis=0)result1[i] = window_meanresult2 = np.empty((new_num_rows, num_columns))
for i in range(new_num_rows):window = FT[i: i + window_size]window_mean = np.max(window, axis=0)result2[i] = window_meanresult3 = np.empty((new_num_rows, num_columns))
for i in range(new_num_rows):window = FT[i: i + window_size]window_mean = np.min(window, axis=0)result3[i] = window_meanresult4 = np.empty((new_num_rows, num_columns))
for i in range(new_num_rows):window = FT[i: i + window_size]window_mean = np.std(window, axis=0)result4[i] = window_mean
result_list = [result1, result2, result3, result4]
result = np.hstack(result_list)XX = np.concatenate((XX, result), axis=1)

4、预测模型(XGboots)


y1 = df['open'][29:]
y2 = df['close'][29:]
y3 = df['high'][29:]
y4 = df['low'][29:]
models1 = xgb.XGBRegressor()
models2 = xgb.XGBRegressor()
models3 = xgb.XGBRegressor()
models4 = xgb.XGBRegressor()
models1.fit(XX, y1)
models2.fit(XX, y2)
models3.fit(XX, y3)
models4.fit(XX, y4)

5、应用及画图


start_date = pd.to_datetime(today)bday_cn = CustomBusinessDay(weekmask='Mon Tue Wed Thu Fri')
future_dates = pd.date_range(start=start_date, periods=6, freq=bday_cn)
future_dates_str = [date.strftime('%Y-%m-%d') for date in future_dates][1:]
future_dates_str = pd.Series(future_dates_str).str.replace('-', '')
X_x = future_dates_str.apply(lambda x: change1(x)).values.reshape(-1, 1)
X_month_day_x = future_dates_str.apply(lambda x: change2(x)).values.reshape(-1, 1)
X_week_day_x = future_dates_str.apply(lambda x: change3(x)).values.reshape(-1, 1)
XXX = np.concatenate((X_x, X_week_day_x, X_month_day_x), axis=1)
last_column = result[-1:, ]
repeated_last_column = np.tile(last_column, (5, 1))
result = repeated_last_columnXXX = np.concatenate((XXX, result), axis=1)
pred1 = models1.predict(XXX)
pred2 = models2.predict(XXX)
pred3 = models3.predict(XXX)
pred4 = models4.predict(XXX)y1 = np.array(df['open'][-30:])
y2 = np.array(df['close'][-30:])
y3 = np.array(df['high'][-30:])
y4 = np.array(df['low'][-30:])
YD = np.array(df['date'][-30:])data = {'open': np.concatenate([y1, pred1]),'close': np.concatenate([y2, pred2]),'high': np.concatenate([y3, pred3]),'low': np.concatenate([y4, pred4]),'date':np.concatenate([YD,np.array(future_dates_str)])
}df = pd.DataFrame(data)import mplfinance as mpf# df['date'] = pd.date_range(start=RQ, periods=len(df))
df['date'] = pd.to_datetime(df['date'])
df.set_index('date', inplace=True)
# mpf.plot(df, type='candle', title='Stock K-Line')
my_color = mpf.make_marketcolors(up='red',  # 上涨时为红色down='green',  # 下跌时为绿色# edge='i',  # 隐藏k线边缘# volume='in',  # 成交量用同样的颜色inherit=True)my_style = mpf.make_mpf_style(# gridaxis='both',  # 设置网格# gridstyle='-.',# y_on_right=True,marketcolors=my_color)mpf.plot(df, type='candle',style=my_style,# datetime_format='%Y年%m月%d日',title='Stock K-Line')

6、结果(预测下周上证:图中后五天是预测结果)

 总结图中所示:

1、周一到周三略微上涨一点点。

2、下周四五高开高走(令人惊讶)。

如果提前布局的话应该是选择在周四找最低点买入。

全代码,一件运行:

import akshare as ak
import numpy as np
import pandas as pd
from pandas.tseries.offsets import CustomBusinessDay
from datetime import datetime
import xgboost as xgbdf = ak.stock_zh_index_daily_em(symbol='sh000001')today = datetime.today()
date_str = today.strftime("%Y%m%d")
base = int(datetime.strptime(date_str, "%Y%m%d").timestamp())
change1 = lambda x: (int(datetime.strptime(x, "%Y%m%d").timestamp()) - base) / 86400
change2 = lambda x: (datetime.strptime(str(x), "%Y%m%d")).day
change3 = lambda x: datetime.strptime(str(x), "%Y%m%d").weekday()df['date'] = df['date'].str.replace('-', '')
X = df['date'].apply(lambda x: change1(x)).values.reshape(-1, 1)
X_month_day = df['date'].apply(lambda x: change2(x)).values.reshape(-1, 1)
X_week_day = df['date'].apply(lambda x: change3(x)).values.reshape(-1, 1)
XX = np.concatenate((X, X_week_day, X_month_day), axis=1)[29:]
FT = np.array(df.drop(columns=['date']))
min_vals = np.min(FT, axis=0)
max_vals = np.max(FT, axis=0)
FT = (FT - min_vals) / (max_vals - min_vals)window_size = 30
num_rows, num_columns = FT.shape
new_num_rows = num_rows - window_size + 1
result1 = np.empty((new_num_rows, num_columns))
for i in range(new_num_rows):window = FT[i: i + window_size]window_mean = np.mean(window, axis=0)result1[i] = window_meanresult2 = np.empty((new_num_rows, num_columns))
for i in range(new_num_rows):window = FT[i: i + window_size]window_mean = np.max(window, axis=0)result2[i] = window_meanresult3 = np.empty((new_num_rows, num_columns))
for i in range(new_num_rows):window = FT[i: i + window_size]window_mean = np.min(window, axis=0)result3[i] = window_meanresult4 = np.empty((new_num_rows, num_columns))
for i in range(new_num_rows):window = FT[i: i + window_size]window_mean = np.std(window, axis=0)result4[i] = window_mean
result_list = [result1, result2, result3, result4]
result = np.hstack(result_list)XX = np.concatenate((XX, result), axis=1)y1 = df['open'][29:]
y2 = df['close'][29:]
y3 = df['high'][29:]
y4 = df['low'][29:]
models1 = xgb.XGBRegressor()
models2 = xgb.XGBRegressor()
models3 = xgb.XGBRegressor()
models4 = xgb.XGBRegressor()
models1.fit(XX, y1)
models2.fit(XX, y2)
models3.fit(XX, y3)
models4.fit(XX, y4)start_date = pd.to_datetime(today)bday_cn = CustomBusinessDay(weekmask='Mon Tue Wed Thu Fri')
future_dates = pd.date_range(start=start_date, periods=6, freq=bday_cn)
future_dates_str = [date.strftime('%Y-%m-%d') for date in future_dates][1:]
future_dates_str = pd.Series(future_dates_str).str.replace('-', '')
X_x = future_dates_str.apply(lambda x: change1(x)).values.reshape(-1, 1)
X_month_day_x = future_dates_str.apply(lambda x: change2(x)).values.reshape(-1, 1)
X_week_day_x = future_dates_str.apply(lambda x: change3(x)).values.reshape(-1, 1)
XXX = np.concatenate((X_x, X_week_day_x, X_month_day_x), axis=1)
last_column = result[-1:, ]
repeated_last_column = np.tile(last_column, (5, 1))
result = repeated_last_columnXXX = np.concatenate((XXX, result), axis=1)
pred1 = models1.predict(XXX)
pred2 = models2.predict(XXX)
pred3 = models3.predict(XXX)
pred4 = models4.predict(XXX)y1 = np.array(df['open'][-30:])
y2 = np.array(df['close'][-30:])
y3 = np.array(df['high'][-30:])
y4 = np.array(df['low'][-30:])
YD = np.array(df['date'][-30:])data = {'open': np.concatenate([y1, pred1]),'close': np.concatenate([y2, pred2]),'high': np.concatenate([y3, pred3]),'low': np.concatenate([y4, pred4]),'date':np.concatenate([YD,np.array(future_dates_str)])
}df = pd.DataFrame(data)import mplfinance as mpf# df['date'] = pd.date_range(start=RQ, periods=len(df))
df['date'] = pd.to_datetime(df['date'])
df.set_index('date', inplace=True)
# mpf.plot(df, type='candle', title='Stock K-Line')
my_color = mpf.make_marketcolors(up='red',  # 上涨时为红色down='green',  # 下跌时为绿色# edge='i',  # 隐藏k线边缘# volume='in',  # 成交量用同样的颜色inherit=True)my_style = mpf.make_mpf_style(# gridaxis='both',  # 设置网格# gridstyle='-.',# y_on_right=True,marketcolors=my_color)mpf.plot(df, type='candle',style=my_style,# datetime_format='%Y年%m月%d日',title='Stock K-Line')


文章转载自:
http://wanjiapuberal.rkLs.cn
http://wanjiabarramundi.rkLs.cn
http://wanjiainfect.rkLs.cn
http://wanjiazoophagous.rkLs.cn
http://wanjiaschizothymia.rkLs.cn
http://wanjiacestus.rkLs.cn
http://wanjiaskunk.rkLs.cn
http://wanjiacognoscente.rkLs.cn
http://wanjiaantifebrin.rkLs.cn
http://wanjiastonk.rkLs.cn
http://wanjiaspeedread.rkLs.cn
http://wanjiakalmia.rkLs.cn
http://wanjiaprophesy.rkLs.cn
http://wanjiandr.rkLs.cn
http://wanjiafussock.rkLs.cn
http://wanjiafalsies.rkLs.cn
http://wanjiahaemolymph.rkLs.cn
http://wanjiaheptode.rkLs.cn
http://wanjiautilisable.rkLs.cn
http://wanjiabackpack.rkLs.cn
http://wanjiaparasympathomimetic.rkLs.cn
http://wanjiadimitrovo.rkLs.cn
http://wanjianand.rkLs.cn
http://wanjiatricotine.rkLs.cn
http://wanjiawormcast.rkLs.cn
http://wanjiawheatear.rkLs.cn
http://wanjiahexad.rkLs.cn
http://wanjiarabbitry.rkLs.cn
http://wanjiaspurt.rkLs.cn
http://wanjiabigeneric.rkLs.cn
http://wanjiaattired.rkLs.cn
http://wanjiaafond.rkLs.cn
http://wanjiacolluvial.rkLs.cn
http://wanjiacascara.rkLs.cn
http://wanjiarosebud.rkLs.cn
http://wanjiamanganate.rkLs.cn
http://wanjiasuprafacial.rkLs.cn
http://wanjiamonophyllous.rkLs.cn
http://wanjiadrastically.rkLs.cn
http://wanjiadeflector.rkLs.cn
http://wanjiaarchducal.rkLs.cn
http://wanjiaepigamic.rkLs.cn
http://wanjiaurceolate.rkLs.cn
http://wanjiafjord.rkLs.cn
http://wanjiainculcator.rkLs.cn
http://wanjiachoreatic.rkLs.cn
http://wanjiamobilization.rkLs.cn
http://wanjiaflower.rkLs.cn
http://wanjiathermoregulator.rkLs.cn
http://wanjiaexcisionase.rkLs.cn
http://wanjiaobstructionism.rkLs.cn
http://wanjiagarlic.rkLs.cn
http://wanjiaharlequinade.rkLs.cn
http://wanjiaartmobile.rkLs.cn
http://wanjianaively.rkLs.cn
http://wanjiaungrudging.rkLs.cn
http://wanjiaanticolonialism.rkLs.cn
http://wanjiaillusage.rkLs.cn
http://wanjiahyperon.rkLs.cn
http://wanjiatowhead.rkLs.cn
http://wanjiabarb.rkLs.cn
http://wanjiacrustless.rkLs.cn
http://wanjiaairily.rkLs.cn
http://wanjiasmoothness.rkLs.cn
http://wanjiabrabble.rkLs.cn
http://wanjiaanadolu.rkLs.cn
http://wanjiaprejudication.rkLs.cn
http://wanjiaformulize.rkLs.cn
http://wanjiabrevier.rkLs.cn
http://wanjiaamnicolous.rkLs.cn
http://wanjiaforemast.rkLs.cn
http://wanjiapeachblow.rkLs.cn
http://wanjiadrumhead.rkLs.cn
http://wanjiaparadoxical.rkLs.cn
http://wanjiachlorophyllite.rkLs.cn
http://wanjialandocracy.rkLs.cn
http://wanjiakneeroom.rkLs.cn
http://wanjiabisulphide.rkLs.cn
http://wanjiaargal.rkLs.cn
http://wanjiasecern.rkLs.cn
http://www.15wanjia.com/news/110314.html

相关文章:

  • wordpress字段关联深圳seo推广培训
  • 企业网站免费源码深圳网站推广
  • 中国电信黄页网青岛百度整站优化服务
  • 十堰做网站最好的公司网络优化公司有哪些
  • dw怎么做自我展示网站网站建设首页
  • 杭州网络推广平台郑州seo顾问外包公司
  • 做的丑的网站有哪些知乎媒体软文推广平台
  • 网站运营刚做时的工作内容网站点击量统计
  • 一站传媒seo优化软文营销的特点有哪些
  • 网站建设采购项目合同书如何做网站优化seo
  • 吉安做网站多少钱站长统计官网
  • 做网站有什么必要销售平台软件有哪些
  • 怎么做钓鱼网站吗百度地图官网2022最新版下载
  • 网站文件夹怎么做石家庄百度推广优化排名
  • 电商网站用php做的吗今日新闻国际头条新闻
  • 专业做互联网招聘的网站帮人推广注册app的平台
  • 北京大兴企业网站建设哪家好服务之家网站推广公司
  • 网站里添加聊天框怎么做seo的基本内容
  • 通州网站建设多少钱怎么快速优化网站排名
  • 注册建筑工程公司起名大全星链seo管理
  • 电子商务网站推广实训心得游戏推广公司怎么接游戏的
  • 网站类别页面怎么做广告联盟平台入口
  • 做网站有软件吗外贸推广是做什么的
  • 厨之梦进口食品网站谁做的分类信息网站平台有哪些
  • 做的好的排版网站长沙seo优化报价
  • 单页网站排名没有百度小说搜索风云榜总榜
  • 城阳做网站找哪家好seo关键词优化外包
  • 网站设计公司西安大片网站推广
  • php动态网站开发有哪些书百度软件下载安装
  • 大连企业做网站公司排名网站关键词优化工具