2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > 港股打新之卖出策略(暗盘和首日)

港股打新之卖出策略(暗盘和首日)

时间:2019-08-23 10:20:54

相关推荐

港股打新之卖出策略(暗盘和首日)

港股新股的,暗盘收盘价,首日开盘价,首日收盘价平均盈利率。

参考:集思录新股暗盘数据

新股:0501上市以来的新股。

结论:

暗盘盘尾卖出预期收益18.3515584416

开盘价卖出预期收益 13.4619749834

收盘价卖出预期收益 11.7666170539

最高价卖出预期收益(不可行) 33.6542119814

最低价卖出预期收益(不可行) -0.714902449712

可见暗盘卖出最合适。

代码

# 近期上市新股stockDf=DataAPI.HKEquGet(secID=u"",ticker=u"",listStatusCD=u"L",field=u"",pandas="1")stockDf=stockDf[stockDf['listDate']>'-05-01']stockDf=stockDf[stockDf['ListSector']=='主板']print(stockDf.shape)tickers=stockDf['ticker'].values.tolist()print(tickers[:5])import numpy as npimport pandas as pd#新股上市首日价格信息,开盘价,收盘,最高,最低stockPriceDf=DataAPI.MktHKEqudGet(secID='',ticker=tickers,tradeDate=u"",beginDate=u"0101",endDate=u"",field=u"",pandas="1")stockPriceDf=stockPriceDf.groupby('secShortName').first()# stockPriceDfstockPriceDf['openRate']=(stockPriceDf['openPrice']/stockPriceDf['preClosePrice']-1)*100stockPriceDf['closeRate']=(stockPriceDf['closePrice']/stockPriceDf['preClosePrice']-1)*100stockPriceDf['highRate']=(stockPriceDf['highestPrice']/stockPriceDf['preClosePrice']-1)*100stockPriceDf['lowRate']=(stockPriceDf['lowestPrice']/stockPriceDf['preClosePrice']-1)*100stockPriceDf=stockPriceDf.replace([np.inf, -np.inf], np.nan)stockPriceDf=stockPriceDf.dropna(subset=['openRate','closeRate'],axis=0)stockPriceDf=stockPriceDf[['ticker','openRate','closeRate','highRate','lowRate']]stockPriceDfhkAnpanDf=pd.read_csv('hk_newstock_anpan.csv')hkAnpanDf['ticker']=hkAnpanDf['ticker'].apply(lambda x:str(x).rjust(5,'0'))hkAnpanDf['anpanRate']=hkAnpanDf['anpanRate'].apply(lambda x:float(x.replace('%','').replace('-','0')))stockPriceDf=stockPriceDf.merge(hkAnpanDf,on='ticker',how='inner')stockPriceDfprint('暗盘盘尾卖出预期收益 ')print(stockPriceDf['anpanRate'].mean())print('开盘价卖出预期收益 ')print(stockPriceDf['openRate'].mean())print('收盘价卖出预期收益 ')print(stockPriceDf['closeRate'].mean())print('最高价卖出预期收益(不可行) ')print(stockPriceDf['highRate'].mean())print('最低价卖出预期收益(不可行) ')print(stockPriceDf['lowRate'].mean())#可见,暗盘收盘价卖出最佳stockPriceDf# 第二,暗盘收盘买入,次日最高价涨跌率差异#收益模拟: 暗盘正收益,则暗盘尾部买入,次日卖出价格暗盘+5%,否则持有到尾盘def score(x):if x['anpanRate']<0:return 0else:if x['highRate']-x['anpanRate']>5.0:return 5.0else:return x['closeRate']-x['anpanRate']stockPriceDf['predictRate']=stockPriceDf.apply(lambda x:score(x),axis=1)print(stockPriceDf['predictRate'].mean())#收益模拟: 暗盘正收益,次日止损价格暗盘5%,否则持有到尾盘def score(x):if x['anpanRate']<0:return 0else:if x['lowRate']-x['anpanRate']>5.0:return -5.0else:return x['closeRate']-x['anpanRate']stockPriceDf['predictRate']=stockPriceDf.apply(lambda x:score(x),axis=1)print(stockPriceDf['predictRate'].mean())

代码依赖外部数据hk_newstock_anpan.csv

内容如下,从集思录中取得,新股暗盘收盘涨跌百分率。(copy到excel,删除多余列,保存到csv即可)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。