# [ 50ETF 期權] 1. 歷史成交持倉和 PCR 數據
> 來源:https://uqer.io/community/share/5604937ff9f06c597665ef34
在本文中,我們將通過量化實驗室提供的數據,計算上證50ETF期權的歷史成交持倉和PCR數據,并在最后利用PCR建立一個簡單的擇時策略
```py
from CAL.PyCAL import *
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
rc('mathtext', default='regular')
import seaborn as sns
sns.set_style('white')
from matplotlib import dates
```
## 1. 期權數據接口
有關上證50ETF期權數據,量化實驗室有三個接口,分別對應于不同的功能
+ `DataAPI.OptGet`: 可以獲取已退市和上市的所有期權的基本信息
+ `DataAPI.MktOptdGet`: 拿到歷史上某一天或某段時間的期權成交行情信息
+ `DataAPI.MktTickRTSnapshotGet`: 此為高頻數據,獲取期權最新市場信息快照
在接下來對于期權的數據分析中,我們將使用這三個API提供的數據,以下為API使用示例,具體API的詳情可以查看幫助文檔
```py
# 使用DataAPI.OptGet,拿到已退市和上市的所有期權的基本信息
opt_info = DataAPI.OptGet(optID='', contractStatus=[u"DE", u"L"], field='', pandas="1")
opt_info.head(3)
```
| | secID | optID | secShortName | tickerSymbol | exchangeCD | currencyCD | varSecID | varShortName | varTicker | varExchangeCD | ... | contMultNum | contractStatus | listDate | expYear | expMonth | expDate | lastTradeDate | exerDate | deliDate | delistDate |
| --- | --- |
| 0 | 510050C1503M02200.XSHG | 10000001 | 50ETF購3月2200 | 510050C1503M02200 | XSHG | CNY | 510050.XSHG | 華夏上證50ETF | 510050 | XSHG | ... | 10000 | DE | 2015-02-09 | 2015 | 3 | 2015-03-25 | 2015-03-25 | 2015-03-25 | 2015-03-26 | 2015-03-25 |
| 1 | 510050C1503M02250.XSHG | 10000002 | 50ETF購3月2250 | 510050C1503M02250 | XSHG | CNY | 510050.XSHG | 華夏上證50ETF | 510050 | XSHG | ... | 10000 | DE | 2015-02-09 | 2015 | 3 | 2015-03-25 | 2015-03-25 | 2015-03-25 | 2015-03-26 | 2015-03-25 |
| 2 | 510050C1503M02300.XSHG | 10000003 | 50ETF購3月2300 | 510050C1503M02300 | XSHG | CNY | 510050.XSHG | 華夏上證50ETF | 510050 | XSHG | ... | 10000 | DE | 2015-02-09 | 2015 | 3 | 2015-03-25 | 2015-03-25 | 2015-03-25 | 2015-03-26 | 2015-03-25 |
```
3 rows × 23 columns
```
```py
#使用DataAPI.MktOptdGet,拿到歷史上某一天的期權成交信息
opt_mkt = DataAPI.MktOptdGet(tradeDate='20150921', field='', pandas="1")
opt_mkt.head(2)
```
| | secID | optID | ticker | secShortName | exchangeCD | tradeDate | preSettlePrice | preClosePrice | openPrice | highestPrice | lowestPrice | closePrice | settlPrice | turnoverVol | turnoverValue | openInt |
| --- | --- |
| 0 | 510050C1512M02100.XSHG | 10000368 | 510050C1512M02100 | 50ETF購12月2100 | XSHG | 2015-09-21 | 0.2069 | 0.1994 | 0.1955 | 0.2087 | 0.1955 | 0.2062 | 0.2062 | 21 | 43115 | 457 |
| 1 | 510050P1512M01950.XSHG | 10000369 | 510050P1512M01950 | 50ETF沽12月1950 | XSHG | 2015-09-21 | 0.1037 | 0.0999 | 0.1000 | 0.1073 | 0.0905 | 0.0905 | 0.0927 | 272 | 261112 | 868 |
```py
# 獲取期權最新市場信息快照
opt_mkt_snapshot = DataAPI.MktOptionTickRTSnapshotGet(optionId=u"",field=u"",pandas="1")
opt_mkt_snapshot[opt_mkt_snapshot.dataDate=='2015-09-22'].head(2)
```
| | optionId | timestamp | auctionPrice | auctionQty | dataDate | dataTime | highPrice | instrumentID | lastPrice | lowPrice | ... | askBook_price1 | askBook_volume1 | askBook_price2 | askBook_volume2 | askBook_price3 | askBook_volume3 | askBook_price4 | askBook_volume4 | askBook_price5 | askBook_volume5 |
| --- | --- |
```
0 rows × 37 columns
```
## 2. 期權歷史成交持倉數據圖
```py
# 華夏上證50ETF收盤價數據
secID = '510050.XSHG'
begin = Date(2015, 2, 9)
end = Date.todaysDate()
fields = ['tradeDate', 'closePrice']
etf = DataAPI.MktFunddGet(secID, beginDate=begin.toISO().replace('-', ''), endDate=end.toISO().replace('-', ''), field=fields)
etf['tradeDate'] = pd.to_datetime(etf['tradeDate'])
etf = etf.set_index('tradeDate')
etf.tail(2)
```
| | closePrice |
| --- | --- |
| tradeDate | |
| 2015-09-23 | 2.180 |
| 2015-09-24 | 2.187 |
統計50ETF期權歷史成交量和持倉量信息
```py
# 計算歷史一段時間內的50ETF期權持倉量交易量數據
def getOptHistVol(beginDate, endDate):
optionVarSecID = u"510050.XSHG"
cal = Calendar('China.SSE')
cal.addHoliday(Date(2015,9,3))
cal.addHoliday(Date(2015,9,4))
dates = cal.bizDatesList(beginDate, endDate)
dates = map(Date.toDateTime, dates)
columns = ['callVol', 'putVol', 'callValue',
'putValue', 'callOpenInt', 'putOpenInt',
'nearCallVol', 'nearPutVol', 'nearCallValue',
'nearPutValue', 'nearCallOpenInt', 'nearPutOpenInt',
'netVol', 'netValue', 'netOpenInt',
'volPCR', 'valuePCR', 'openIntPCR',
'nearVolPCR', 'nearValuePCR', 'nearOpenIntPCR']
hist_opt = pd.DataFrame(0.0, index=dates, columns=columns)
hist_opt.index.name = 'date'
# 每一個交易日數據單獨計算
for date in hist_opt.index:
date_str = Date.fromDateTime(date).toISO().replace('-', '')
try:
opt_data = DataAPI.MktOptdGet(secID=u"", tradeDate=date_str, field=u"", pandas="1")
except:
hist_opt = hist_opt.drop(date)
continue
opt_type = []
exp_date = []
for ticker in opt_data.secID.values:
opt_type.append(ticker[6])
exp_date.append(ticker[7:11])
opt_data['optType'] = opt_type
opt_data['expDate'] = exp_date
near_exp = np.sort(opt_data.expDate.unique())[0]
data = opt_data.groupby('optType')
# 計算所有上市期權:看漲看跌交易量、看漲看跌交易額、看漲看跌持倉量
hist_opt['callVol'][date] = data.turnoverVol.sum()['C']
hist_opt['putVol'][date] = data.turnoverVol.sum()['P']
hist_opt['callValue'][date] = data.turnoverValue.sum()['C']
hist_opt['putValue'][date] = data.turnoverValue.sum()['P']
hist_opt['callOpenInt'][date] = data.openInt.sum()['C']
hist_opt['putOpenInt'][date] = data.openInt.sum()['P']
near_data = opt_data[opt_data.expDate == near_exp]
near_data = near_data.groupby('optType')
# 計算近月期權(主力合約): 看漲看跌交易量、看漲看跌交易額、看漲看跌持倉量
hist_opt['nearCallVol'][date] = near_data.turnoverVol.sum()['C']
hist_opt['nearPutVol'][date] = near_data.turnoverVol.sum()['P']
hist_opt['nearCallValue'][date] = near_data.turnoverValue.sum()['C']
hist_opt['nearPutValue'][date] = near_data.turnoverValue.sum()['P']
hist_opt['nearCallOpenInt'][date] = near_data.openInt.sum()['C']
hist_opt['nearPutOpenInt'][date] = near_data.openInt.sum()['P']
# 計算所有上市期權: 總交易量、總交易額、總持倉量
hist_opt['netVol'][date] = hist_opt['callVol'][date] + hist_opt['putVol'][date]
hist_opt['netValue'][date] = hist_opt['callValue'][date] + hist_opt['putValue'][date]
hist_opt['netOpenInt'][date] = hist_opt['callOpenInt'][date] + hist_opt['putOpenInt'][date]
# 計算期權看跌看漲期權交易量(持倉量)的比率:
# 交易量看跌看漲比率,交易額看跌看漲比率, 持倉量看跌看漲比率
# 近月期權交易量看跌看漲比率,近月期權交易額看跌看漲比率, 近月期權持倉量看跌看漲比率
# PCR = Put Call Ratio
hist_opt['volPCR'][date] = round(hist_opt['putVol'][date]*1.0/hist_opt['callVol'][date], 4)
hist_opt['valuePCR'][date] = round(hist_opt['putValue'][date]*1.0/hist_opt['callValue'][date], 4)
hist_opt['openIntPCR'][date] = round(hist_opt['putOpenInt'][date]*1.0/hist_opt['callOpenInt'][date], 4)
hist_opt['nearVolPCR'][date] = round(hist_opt['nearPutVol'][date]*1.0/hist_opt['nearCallVol'][date], 4)
hist_opt['nearValuePCR'][date] = round(hist_opt['nearPutValue'][date]*1.0/hist_opt['nearCallValue'][date], 4)
hist_opt['nearOpenIntPCR'][date] = round(hist_opt['nearPutOpenInt'][date]*1.0/hist_opt['nearCallOpenInt'][date], 4)
return hist_opt
```
```py
begin = Date(2015, 2, 9)
end = Date.todaysDate()
opt_hist = getOptHistVol(begin, end)
opt_hist.tail(2)
```
| | callVol | putVol | callValue | putValue | callOpenInt | putOpenInt | nearCallVol | nearPutVol | nearCallValue | nearPutValue | ... | nearPutOpenInt | netVol | netValue | netOpenInt | volPCR | valuePCR | openIntPCR | nearVolPCR | nearValuePCR | nearOpenIntPCR |
| --- | --- |
| date | | | | | | | | | | | | | | | | | | | | | |
| 2015-09-23 | 50093 | 42910 | 37809117 | 41517121 | 269395 | 144256 | 16603 | 11494 | 6217923 | 10409963 | ... | 50576 | 93003 | 79326238 | 413651 | 0.8566 | 1.0981 | 0.5355 | 0.6923 | 1.6742 | 0.3738 |
| 2015-09-24 | 29352 | 23474 | 21696859 | 22161955 | 146224 | 98350 | 19785 | 19339 | 15693989 | 14549046 | ... | 55217 | 52826 | 43858814 | 244574 | 0.7997 | 1.0214 | 0.6726 | 0.9775 | 0.9270 | 0.8012 |
```
2 rows × 21 columns
```
```py
## ----- 50ETF期權成交持倉數據圖 -----
fig = plt.figure(figsize=(10,5))
fig.set_tight_layout(True)
ax = fig.add_subplot(111)
font.set_size(16)
lns1 = ax.plot(opt_hist.index, opt_hist.netOpenInt, 'grey', label = u'OpenInt')
lns2 = ax.plot(opt_hist.index, opt_hist.netVol, '-r', label = 'TurnoverVolume')
ax2 = ax.twinx()
lns3 = ax2.plot(etf.index, etf.closePrice, '-', label = 'ETF closePrice')
lns = lns1+lns2+lns3
labs = [l.get_label() for l in lns]
ax.legend(lns, labs, loc=2)
ax.grid()
ax.set_xlabel(u"tradeDate")
ax.set_ylabel(r"TurnoverVolume / OpenInt")
ax2.set_ylabel(r"ETF closePrice")
plt.title('50ETF Option TurnoverVolume / OpenInt')
plt.show()
```

從上圖可以看出:
+ 期權的交易量基本上是50ETF的反向指標
+ 五月之前的瘋牛中,期權日交易量處于低位
+ 六月中下旬之后的暴跌時間段,期權日交易量高位運行,是不是創個新高
+ 8月17日開始的這一周中,大盤風雨飄搖,50ETF探底時,期權交易量創了新高
+ 目前來看,期權交易仍然活躍,但是交易量較之前數據有所回落,應該是大盤企穩的節奏
## 3. 期權的PCR比例
期權分看跌和看漲兩種,買入兩種不同的期權,代表著對于后市的不同看法,因此可以引進一個量化指標,來表示對后市看衰與看漲的力量的強弱:
+ PCR = Put Call Ratio
+ PCR可以是關于成交量的PCR,可以是持倉量的PCR,也可以是成交額的PCR
```py
begin = Date(2015, 2, 9)
end = Date.todaysDate()
opt_hist = getOptHistVol(begin, end)
opt_hist.tail(2)
```
| | callVol | putVol | callValue | putValue | callOpenInt | putOpenInt | nearCallVol | nearPutVol | nearCallValue | nearPutValue | ... | nearPutOpenInt | netVol | netValue | netOpenInt | volPCR | valuePCR | openIntPCR | nearVolPCR | nearValuePCR | nearOpenIntPCR |
| --- | --- |
| date | | | | | | | | | | | | | | | | | | | | | |
| 2015-09-23 | 50093 | 42910 | 37809117 | 41517121 | 269395 | 144256 | 16603 | 11494 | 6217923 | 10409963 | ... | 50576 | 93003 | 79326238 | 413651 | 0.8566 | 1.0981 | 0.5355 | 0.6923 | 1.6742 | 0.3738 |
| 2015-09-24 | 29352 | 23474 | 21696859 | 22161955 | 146224 | 98350 | 19785 | 19339 | 15693989 | 14549046 | ... | 55217 | 52826 | 43858814 | 244574 | 0.7997 | 1.0214 | 0.6726 | 0.9775 | 0.9270 | 0.8012 |
```
2 rows × 21 columns
```
首先,我們來看看成交量PCR和ETF價格走勢的關系
```py
## ----------------------------------------------
## 50ETF期權PC比例數據圖
fig = plt.figure(figsize=(10,8))
fig.set_tight_layout(True)
# ------ 成交量PC比例 ------
ax = fig.add_subplot(211)
lns1 = ax.plot(opt_hist.index, opt_hist.volPCR, color='r', label = u'volPCR')
ax2 = ax.twinx()
lns2 = ax2.plot(etf.index, etf.closePrice, '-', label = 'closePrice')
lns = lns1+lns2
labs = [l.get_label() for l in lns]
ax.legend(lns, labs, loc=3)
ax.set_ylim(0, 2)
hfmt = dates.DateFormatter('%m')
ax.xaxis.set_major_formatter(hfmt)
ax.grid()
ax.set_xlabel(u"tradeDate(Month)")
ax.set_ylabel(r"PCR")
ax2.set_ylabel(r"ETF ClosePrice")
plt.title('Volume PCR')
# ------ 近月主力期權成交量PC比例 ------
ax = fig.add_subplot(212)
lns1 = ax.plot(opt_hist.index, opt_hist.nearVolPCR, color='r', label = u'nearVolPCR')
ax2 = ax.twinx()
lns2 = ax2.plot(etf.index, etf.closePrice, '-', label = 'closePrice')
lns = lns1+lns2
labs = [l.get_label() for l in lns]
ax.legend(lns, labs, loc=3)
ax.set_ylim(0, 2)
hfmt = dates.DateFormatter('%m')
ax.xaxis.set_major_formatter(hfmt)
ax.grid()
ax.set_xlabel(u"tradeDate(Month)")
ax.set_ylabel(r"PCR")
ax2.set_ylabel(r"ETF ClosePrice")
plt.title('Dominant Contract Volume PCR')
<matplotlib.text.Text at 0x6470990>
```

成交量數據圖中,上圖為全體期權的成交量PCR,下圖為近月期權的成交量PCR:
+ 上下兩圖中,PCR的曲線走勢基本相似,因為期權交易中,近月期權最為活躍
+ ETF價格走勢,和PCR走勢有比較明顯的負相關性
其次,我們來看看持倉量PCR和ETF價格走勢的關系
```py
## ----------------------------------------------
## 50ETF期權PC比例數據圖
fig = plt.figure(figsize=(10,8))
fig.set_tight_layout(True)
# ------ 持倉量PC比例 ------
ax = fig.add_subplot(211)
lns1 = ax.plot(opt_hist.index, opt_hist.openIntPCR, color='r', label = u'volPCR')
ax2 = ax.twinx()
lns2 = ax2.plot(etf.index, etf.closePrice, '-', label = 'closePrice')
lns = lns1+lns2
labs = [l.get_label() for l in lns]
ax.legend(lns, labs, loc=3)
ax.set_ylim(0, 2)
hfmt = dates.DateFormatter('%m')
ax.xaxis.set_major_formatter(hfmt)
ax.grid()
ax.set_xlabel(u"tradeDate(Month)")
ax.set_ylabel(r"PCR")
ax2.set_ylabel(r"ETF ClosePrice")
plt.title('OpenInt PCR')
# ------ 近月主力期權持倉量PC比例 ------
ax = fig.add_subplot(212)
lns1 = ax.plot(opt_hist.index, opt_hist.nearOpenIntPCR, color='r', label = u'nearVolPCR')
ax2 = ax.twinx()
lns2 = ax2.plot(etf.index, etf.closePrice, '-', label = 'closePrice')
lns = lns1+lns2
labs = [l.get_label() for l in lns]
ax.legend(lns, labs, loc=3)
ax.set_ylim(0, 2)
hfmt = dates.DateFormatter('%m')
ax.xaxis.set_major_formatter(hfmt)
ax.grid()
ax.set_xlabel(u"tradeDate(Month)")
ax.set_ylabel(r"PCR")
ax2.set_ylabel(r"ETF ClosePrice")
plt.title('Dominant Contract OpenInt PCR')
<matplotlib.text.Text at 0x69e5990>
```

持倉量數據圖中,上圖為全體期權的持倉量PCR,下圖為近月期權的持倉量PCR:
+ 上下兩圖中,PCR的曲線走勢基本相似,因為期權交易中,近月期權最為活躍
+ 實際上,近月期權十分活躍,使得近月期權的PCR系數變動往往比整體期權PCR變化更劇烈
+ ETF價格走勢,和PCR走勢并無明顯的負相關性
+ 相反,ETF價格的低點,往往PCR也處于低點,這其實說明:股價大跌之后大家會選擇平倉看跌期權
最后,我們來看看成交額PCR和ETF價格走勢的關系
```py
## ----------------------------------------------
## 50ETF期權PC比例數據圖
fig = plt.figure(figsize=(10,8))
fig.set_tight_layout(True)
# ------ 成交額PC比例 ------
ax = fig.add_subplot(211)
lns1 = ax.plot(opt_hist.index, opt_hist.valuePCR, color='r', label = u'turnoverValuePCR')
ax2 = ax.twinx()
lns2 = ax2.plot(etf.index, etf.closePrice, '-', label = 'closePrice')
lns = lns1+lns2
labs = [l.get_label() for l in lns]
ax.legend(lns, labs, loc=3)
#ax.set_ylim(0, 2)
ax.set_yscale('log')
hfmt = dates.DateFormatter('%m')
ax.xaxis.set_major_formatter(hfmt)
ax.grid()
ax.set_xlabel(u"tradeDate(Month)")
ax.set_ylabel(r"PCR")
ax2.set_ylabel(r"ETF ClosePrice")
plt.title('Turnover Value PCR')
# ------ 近月主力期權成交額PC比例 ------
ax = fig.add_subplot(212)
lns1 = ax.plot(opt_hist.index, opt_hist.nearValuePCR, color='r', label = u'turnoverValuePCR')
ax2 = ax.twinx()
lns2 = ax2.plot(etf.index, etf.closePrice, '-', label = 'closePrice')
lns = lns1+lns2
labs = [l.get_label() for l in lns]
ax.legend(lns, labs, loc=3)
#ax.set_ylim(0, 2)
ax.set_yscale('log')
hfmt = dates.DateFormatter('%m')
ax.xaxis.set_major_formatter(hfmt)
ax.grid()
ax.set_xlabel(u"tradeDate(Month)")
ax.set_ylabel(r"PCR")
ax2.set_ylabel(r"ETF ClosePrice")
plt.title('Dominant Contract Turnover Value PCR')
<matplotlib.text.Text at 0x70ce890>
```

成交額數據圖中,上圖為全體期權的成交額PCR,下圖為近月期權的成交額PCR:
+ 上下兩圖中,PCR的曲線走勢基本相似,因為期權交易中,近月期權最為活躍
+ 實際上,近月期權PCR指數十分活躍,使得近月期權的PCR系數變動往往比整體期權PCR變化更劇烈
+ 相對于成交量和持倉量PCR指標,此處的成交額PCR指標峰值往往很高,上圖中近月期權的成交額PCR最大值甚至接近30,這是由于市場恐慌時候,看跌期權成交量本身就大,而交易量大往往將看跌期權的價格大幅抬高
+ ETF價格走勢,和PCR走勢具有明顯的負相關性
4. 基于期權成交額PCR的擇時策略
根據成交額PCR和ETF價格走勢明顯的負相關性,我們建立一個非常簡單的擇時策略:
+ PCR下降時,市場情緒趨穩定,全倉買入50ETF
+ PCR上升時,恐慌情緒蔓延,清倉觀望
```py
start = datetime(2015, 2, 9) # 回測起始時間
end = datetime(2015, 9, 21) # 回測結束時間
hist_pcr = getOptHistVol(start, end)
start = datetime(2015, 2, 9) # 回測起始時間
end = datetime(2015, 9, 21) # 回測結束時間
benchmark = '510050.XSHG' # 策略參考標準
universe = ['510050.XSHG'] # 股票池
capital_base = 100000 # 起始資金
commission = Commission(0.0,0.0)
refresh_rate = 1
def initialize(account): # 初始化虛擬賬戶狀態
account.fund = universe[0]
def handle_data(account): # 每個交易日的買入賣出指令
fund = account.fund
# 獲取回測當日的前一天日期
dt = Date.fromDateTime(account.current_date)
cal = Calendar('China.IB')
cal.addHoliday(Date(2015,9,3))
cal.addHoliday(Date(2015,9,4))
last_day = cal.advanceDate(dt,'-1B',BizDayConvention.Preceding) #計算出倒數第一個交易日
last_last_day = cal.advanceDate(last_day,'-1B',BizDayConvention.Preceding) #計算出倒數第二個交易日
last_day_str = last_day.strftime("%Y-%m-%d")
last_last_day_str = last_last_day.strftime("%Y-%m-%d")
# 計算買入賣出信號
try:
# 拿取PCR數據
pcr_last = hist_pcr['valuePCR'].loc[last_day_str]
pcr_last_last = hist_pcr['valuePCR'].loc[last_last_day_str]
long_flag = True if (pcr_last - pcr_last_last) < 0 else False
except:
long_flag = True
if long_flag:
approximationAmount = int(account.cash / account.referencePrice[fund] / 100.0) * 100
order(fund, approximationAmount)
else:
# 賣出時,全倉清空
order_to(fund, 0)
```

回測結果如上,需要注意的是:
+ 期權掛牌時間較短,回測時間短,加上期權市場參與人數少,故而回測結果可能然并卵
+ 但是嚴格根據PCR走勢買賣50ETF,還是可以比較好的避開市場大跌的風險
+ 不管怎樣,PCR可以作為一個擇時指標來討論
+ 除了成交額PCR,還可以通過成交量、持倉量、近月成交額等等PCR建立擇時策略
- Python 量化交易教程
- 第一部分 新手入門
- 一 量化投資視頻學習課程
- 二 Python 手把手教學
- 量化分析師的Python日記【第1天:誰來給我講講Python?】
- 量化分析師的Python日記【第2天:再接著介紹一下Python唄】
- 量化分析師的Python日記【第3天:一大波金融Library來襲之numpy篇】
- 量化分析師的Python日記【第4天:一大波金融Library來襲之scipy篇】
- 量化分析師的Python日記【第5天:數據處理的瑞士軍刀pandas】
- 量化分析師的Python日記【第6天:數據處理的瑞士軍刀pandas下篇
- 量化分析師的Python日記【第7天:Q Quant 之初出江湖】
- 量化分析師的Python日記【第8天 Q Quant兵器譜之函數插值】
- 量化分析師的Python日記【第9天 Q Quant兵器譜之二叉樹】
- 量化分析師的Python日記【第10天 Q Quant兵器譜 -之偏微分方程1】
- 量化分析師的Python日記【第11天 Q Quant兵器譜之偏微分方程2】
- 量化分析師的Python日記【第12天:量化入門進階之葵花寶典:因子如何產生和回測】
- 量化分析師的Python日記【第13天 Q Quant兵器譜之偏微分方程3】
- 量化分析師的Python日記【第14天:如何在優礦上做Alpha對沖模型】
- 量化分析師的Python日記【第15天:如何在優礦上搞一個wealthfront出來】
- 第二部分 股票量化相關
- 一 基本面分析
- 1.1 alpha 多因子模型
- 破解Alpha對沖策略——觀《量化分析師Python日記第14天》有感
- 熔斷不要怕, alpha model 為你保駕護航!
- 尋找 alpha 之: alpha 設計
- 1.2 基本面因子選股
- Porfolio(現金比率+負債現金+現金保障倍數)+市盈率
- ROE選股指標
- 成交量因子
- ROIC&cashROIC
- 【國信金工】資產周轉率選股模型
- 【基本面指標】Cash Cow
- 量化因子選股——凈利潤/營業總收入
- 營業收入增長率+市盈率
- 1.3 財報閱讀 ? [米缸量化讀財報] 資產負債表-投資相關資產
- 1.4 股東分析
- 技術分析入門 【2】 —— 大家搶籌碼(06年至12年版)
- 技術分析入門 【2】 —— 大家搶籌碼(06年至12年版)— 更新版
- 誰是中國A股最有錢的自然人
- 1.5 宏觀研究
- 【干貨包郵】手把手教你做宏觀擇時
- 宏觀研究:從估值角度看當前市場
- 追尋“國家隊”的足跡
- 二 套利
- 2.1 配對交易
- HS300ETF套利(上)
- 【統計套利】配對交易
- 相似公司股票搬磚
- Paired trading
- 2.2 期現套利 ? 通過股指期貨的期現差與 ETF 對沖套利
- 三 事件驅動
- 3.1 盈利預增
- 盈利預增事件
- 事件驅動策略示例——盈利預增
- 3.2 分析師推薦 ? 分析師的金手指?
- 3.3 牛熊轉換
- 歷史總是相似 牛市還在延續
- 歷史總是相似 牛市已經見頂?
- 3.4 熔斷機制 ? 股海拾貝之 [熔斷錯殺股]
- 3.5 暴漲暴跌 ? [實盤感悟] 遇上暴跌我該怎么做?
- 3.6 兼并重組、舉牌收購 ? 寶萬戰-大戲開幕
- 四 技術分析
- 4.1 布林帶
- 布林帶交易策略
- 布林帶回調系統-日內
- Conservative Bollinger Bands
- Even More Conservative Bollinger Bands
- Simple Bollinger Bands
- 4.2 均線系統
- 技術分析入門 —— 雙均線策略
- 5日線10日線交易策略
- 用5日均線和10日均線進行判斷 --- 改進版
- macross
- 4.3 MACD
- Simple MACD
- MACD quantization trade
- MACD平滑異同移動平均線方法
- 4.4 阿隆指標 ? 技術指標阿隆( Aroon )全解析
- 4.5 CCI ? CCI 順勢指標探索
- 4.6 RSI
- 重寫 rsi
- RSI指標策略
- 4.7 DMI ? DMI 指標體系的構建及簡單應用
- 4.8 EMV ? EMV 技術指標的構建及應用
- 4.9 KDJ ? KDJ 策略
- 4.10 CMO
- CMO 策略模仿練習 1
- CMO策略模仿練習2
- [技術指標] CMO
- 4.11 FPC ? FPC 指標選股
- 4.12 Chaikin Volatility
- 嘉慶離散指標測試
- 4.13 委比 ? 實時計算委比
- 4.14 封單量
- 按照封單跟流通股本比例排序,剔除6月上市新股,前50
- 漲停股票封單統計
- 實時計算漲停板股票的封單資金與總流通市值的比例
- 4.15 成交量 ? 決戰之地, IF1507 !
- 4.16 K 線分析 ? 尋找夜空中最亮的星
- 五 量化模型
- 5.1 動量模型
- Momentum策略
- 【小散學量化】-2-動量模型的簡單實踐
- 一個追漲的策略(修正版)
- 動量策略(momentum driven)
- 動量策略(momentum driven)——修正版
- 最經典的Momentum和Contrarian在中國市場的測試
- 最經典的Momentum和Contrarian在中國市場的測試-yanheven改進
- [策略]基于勝率的趨勢交易策略
- 策略探討(更新):價量結合+動量反轉
- 反向動量策略(reverse momentum driven)
- 輕松跑贏大盤 - 主題Momentum策略
- Contrarian strategy
- 5.2 Joseph Piotroski 9 F-Score Value Investing Model · 基本面選股系統:Piotroski F-Score ranking system
- 5.3 SVR · 使用SVR預測股票開盤價 v1.0
- 5.4 決策樹、隨機樹
- 決策樹模型(固定模型)
- 基于Random Forest的決策策略
- 5.5 鐘擺理論 · 鐘擺理論的簡單實現——完美躲過股災和精準抄底
- 5.6 海龜模型
- simple turtle
- 俠之大者 一起賺錢
- 5.7 5217 策略 · 白龍馬的新手策略
- 5.8 SMIA · 基于歷史狀態空間相似性匹配的行業配置 SMIA 模型—取交集
- 5.9 神經網絡
- 神經網絡交易的訓練部分
- 通過神經網絡進行交易
- 5.10 PAMR · PAMR : 基于均值反轉的投資組合選擇策略 - 修改版
- 5.11 Fisher Transform · Using Fisher Transform Indicator
- 5.12 分型假說, Hurst 指數 · 分形市場假說,一個聽起來很美的假說
- 5.13 變點理論 · 變點策略初步
- 5.14 Z-score Model
- Zscore Model Tutorial
- 信用債風險模型初探之:Z-Score Model
- user-defined package
- 5.15 機器學習 · Machine Learning 學習筆記(一) by OTreeWEN
- 5.16 DualTrust 策略和布林強盜策略
- 5.17 卡爾曼濾波
- 5.18 LPPL anti-bubble model
- 今天大盤熔斷大跌,后市如何—— based on LPPL anti-bubble model
- 破解股市泡沫之謎——對數周期冪率(LPPL)模型
- 六 大數據模型
- 6.1 市場情緒分析
- 通聯情緒指標策略
- 互聯網+量化投資 大數據指數手把手
- 6.2 新聞熱點
- 如何使用優礦之“新聞熱點”?
- 技術分析【3】—— 眾星拱月,眾口鑠金?
- 七 排名選股系統
- 7.1 小市值投資法
- 學習筆記:可模擬(小市值+便宜 的修改版)
- 市值最小300指數
- 流通市值最小股票(新篩選器版)
- 持有市值最小的10只股票
- 10% smallest cap stock
- 7.2 羊駝策略
- 羊駝策略
- 羊駝反轉策略(修改版)
- 羊駝反轉策略
- 我的羊駝策略,選5只股無腦輪替
- 7.3 低價策略
- 專撿便宜貨(新版quartz)
- 策略原理
- 便宜就是 alpha
- 八 輪動模型
- 8.1 大小盤輪動 · 新手上路 -- 二八ETF擇時輪動策略2.0
- 8.2 季節性策略
- Halloween Cycle
- Halloween cycle 2
- 夏買電,東買煤?
- 歷史的十一月板塊漲幅
- 8.3 行業輪動
- 銀行股輪動
- 申萬二級行業在最近1年、3個月、5個交易日的漲幅統計
- 8.4 主題輪動
- 快速研究主題神器
- recommendation based on subject
- strategy7: recommendation based on theme
- 板塊異動類
- 風險因子(離散類)
- 8.5 龍頭輪動
- Competitive Securities
- Market Competitiveness
- 主題龍頭類
- 九 組合投資
- 9.1 指數跟蹤 · [策略] 指數跟蹤低成本建倉策略
- 9.2 GMVP · Global Minimum Variance Portfolio (GMVP)
- 9.3 凸優化 · 如何在 Python 中利用 CVXOPT 求解二次規劃問題
- 十 波動率
- 10.1 波動率選股 · 風平浪靜 風起豬飛
- 10.2 波動率擇時
- 基于 VIX 指數的擇時策略
- 簡單低波動率指數
- 10.3 Arch/Garch 模型 · 如何使用優礦進行 GARCH 模型分析
- 十一 算法交易
- 11.1 VWAP · Value-Weighted Average Price (VWAP)
- 十二 中高頻交易
- 12.1 order book 分析 · 基于高頻 limit order book 數據的短程價格方向預測—— via multi-class SVM
- 12.2 日內交易 · 大盤日內走勢 (for 擇時)
- 十三 Alternative Strategy
- 13.1 易經、傳統文化 · 老黃歷診股
- 第三部分 基金、利率互換、固定收益類
- 一 分級基金
- “優礦”集思錄——分級基金專題
- 基于期權定價的分級基金交易策略
- 基于期權定價的興全合潤基金交易策略
- 二 基金分析
- Alpha 基金“黑天鵝事件” -- 思考以及原因
- 三 債券
- 債券報價中的小陷阱
- 四 利率互換
- Swap Curve Construction
- 中國 Repo 7D 互換的例子
- 第四部分 衍生品相關
- 一 期權數據
- 如何獲取期權市場數據快照
- 期權高頻數據準備
- 二 期權系列
- [ 50ETF 期權] 1. 歷史成交持倉和 PCR 數據
- 【50ETF期權】 2. 歷史波動率
- 【50ETF期權】 3. 中國波指 iVIX
- 【50ETF期權】 4. Greeks 和隱含波動率微笑
- 【50ETF期權】 5. 日內即時監控 Greeks 和隱含波動率微笑
- 【50ETF期權】 5. 日內即時監控 Greeks 和隱含波動率微笑
- 三 期權分析
- 【50ETF期權】 期權擇時指數 1.0
- 每日期權風險數據整理
- 期權頭寸計算
- 期權探秘1
- 期權探秘2
- 期權市場一周縱覽
- 基于期權PCR指數的擇時策略
- 期權每日成交額PC比例計算
- 四 期貨分析
- 【前方高能!】Gifts from Santa Claus——股指期貨趨勢交易研究