siat 2.0.1__py3-none-any.whl → 2.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- siat/future_china.py +13 -7
- siat/option_china.py +10 -5
- siat/security_prices.py +2 -2
- {siat-2.0.1.dist-info → siat-2.0.2.dist-info}/METADATA +1 -1
- {siat-2.0.1.dist-info → siat-2.0.2.dist-info}/RECORD +7 -7
- {siat-2.0.1.dist-info → siat-2.0.2.dist-info}/WHEEL +0 -0
- {siat-2.0.1.dist-info → siat-2.0.2.dist-info}/top_level.txt +0 -0
siat/future_china.py
CHANGED
@@ -19,7 +19,7 @@ from siat.common import *
|
|
19
19
|
from siat.grafix import *
|
20
20
|
#==========================================================================================
|
21
21
|
if __name__=='__main__':
|
22
|
-
trade_date='2023-
|
22
|
+
trade_date='2023-5-18'
|
23
23
|
|
24
24
|
def future_type_china_0(trade_date):
|
25
25
|
"""
|
@@ -196,9 +196,9 @@ if __name__=='__main__':
|
|
196
196
|
|
197
197
|
#======================================================================================
|
198
198
|
if __name__=='__main__':
|
199
|
-
code='
|
200
|
-
start='2023-
|
201
|
-
end='2023-
|
199
|
+
code='PG'
|
200
|
+
start='2023-5-1'
|
201
|
+
end='2023-5-18'
|
202
202
|
power=0
|
203
203
|
|
204
204
|
def future_price_china(code,start,end,power=0):
|
@@ -212,9 +212,15 @@ def future_price_china(code,start,end,power=0):
|
|
212
212
|
end1=convert_date_ts(end)
|
213
213
|
|
214
214
|
#获得中国内盘期货品种代码
|
215
|
-
|
215
|
+
try:
|
216
|
+
varietydf=future_type_china_0(end1)
|
217
|
+
except:
|
218
|
+
print(" #Error(future_price_china): no info for the end date", end, "\b, try an earlier date")
|
219
|
+
return None
|
220
|
+
|
216
221
|
#获得期货合约code的品种代码
|
217
222
|
variety=get_future_symbol(code)
|
223
|
+
#variety=get_future_symbol(code).lower()
|
218
224
|
|
219
225
|
try:
|
220
226
|
vdf=varietydf[varietydf['代码']==variety]
|
@@ -243,9 +249,9 @@ def future_price_china(code,start,end,power=0):
|
|
243
249
|
print(" Try earlier start date")
|
244
250
|
return None
|
245
251
|
|
246
|
-
p1=p[p['symbol']==code]
|
252
|
+
p1=p[p['symbol']==code.lower()]
|
247
253
|
if len(p1)==0:
|
248
|
-
print(" #
|
254
|
+
print(" #Warning(future_price_china): future contract",code,'not found in market',market)
|
249
255
|
contracts=set(list(p[p['variety']==variety]['symbol']))
|
250
256
|
contracts1=sorted(contracts)
|
251
257
|
print("\n提示:当前可用的"+varietyname+variety+'期货合约:'+mktnamefull+', '+str(end))
|
siat/option_china.py
CHANGED
@@ -1708,9 +1708,11 @@ if __name__=='__main__':
|
|
1708
1708
|
#==============================================================================
|
1709
1709
|
if __name__=='__main__':
|
1710
1710
|
option='50ETF'
|
1711
|
-
|
1711
|
+
option='300ETF'
|
1712
|
+
maturity='2306'
|
1712
1713
|
exercise=3000
|
1713
|
-
|
1714
|
+
exercise=3500
|
1715
|
+
trade_date='2023-5-17'
|
1714
1716
|
printout=True
|
1715
1717
|
|
1716
1718
|
def fin_option_risk_sse2(option,maturity,exercise,trade_date, \
|
@@ -1801,11 +1803,14 @@ def fin_option_risk_sse2(option,maturity,exercise,trade_date, \
|
|
1801
1803
|
print(" #Error(fin_option_risk_sse): options not available fulfilling",option,maturity,exercise)
|
1802
1804
|
return None
|
1803
1805
|
|
1806
|
+
#去重
|
1807
|
+
df9a=df9.drop_duplicates(subset=['date','option','underlying','direction','maturity','exercise'],keep='first')
|
1808
|
+
|
1804
1809
|
#绘制看涨看跌期权风险对比柱状图
|
1805
1810
|
#排序,保证看涨期权排在前面
|
1806
|
-
|
1807
|
-
#df9b=
|
1808
|
-
df9b=
|
1811
|
+
df9a.sort_values(by='direction',ascending=True,inplace=True)
|
1812
|
+
#df9b=df9a[['delta','theta','gamma','vega','rho','implied volatility']]
|
1813
|
+
df9b=df9a[['Delta','Gamma','Theta','Vega','Rho']]
|
1809
1814
|
dfg=df9b.T
|
1810
1815
|
dfg.columns=['看涨期权','看跌期权']
|
1811
1816
|
|
siat/security_prices.py
CHANGED
@@ -1005,8 +1005,8 @@ def get_prices_yf(ticker,start,end,threads=False):
|
|
1005
1005
|
#下载单一股票的股价
|
1006
1006
|
stock=yf.Ticker(ticker1)
|
1007
1007
|
try:
|
1008
|
-
p=stock.history(start=start,end=end,threads=threads)
|
1009
|
-
|
1008
|
+
#p=stock.history(start=start,end=end,threads=threads)
|
1009
|
+
p=stock.history(start=start,end=end)
|
1010
1010
|
except Exception as e:
|
1011
1011
|
emsg=str(e)
|
1012
1012
|
#print(emsg)
|
@@ -48,7 +48,7 @@ siat/fund.py,sha256=wMDORsCBV8ZXfgwbtq-0bu3qqWY66dHnbqgllW0gWCo,24637
|
|
48
48
|
siat/fund_china.py,sha256=KBVTvzgkjzD_AhxrZntx0p5muPQTL5oXT10_ed6fXnU,66934
|
49
49
|
siat/fund_china_test.py,sha256=-Bh6m0J0GPpIbYXx-H2vpzJoNFI6pE2C2jVPa8DazgE,6649
|
50
50
|
siat/fund_test.py,sha256=V4ADb8Gsp8gyeFTwcgRsJBpnUih_O-Q2V1ILc5oKjK8,1116
|
51
|
-
siat/future_china.py,sha256=
|
51
|
+
siat/future_china.py,sha256=5fTJCQ0AnZcHUY47TIaRXrASndzMTttAWPe2_QkhGk4,16657
|
52
52
|
siat/future_china_test.py,sha256=BrSzmDVaOHki6rntOtosmRn-6dkfOBuLulJNqh7MOpc,1163
|
53
53
|
siat/global_index_test.py,sha256=hnFp3wqqzzL-kAP8mgxDZ54Bd5Ijf6ENi5YJlGBgcXw,2402
|
54
54
|
siat/grafix.py,sha256=P9juLNhqs1TkmKz9oPZxlra2obVGcTVN1QdsJ4fZJn4,63498
|
@@ -65,7 +65,7 @@ siat/markowitz_test.py,sha256=fDXoPp6DrKeneYjd0lbb0KfYUJj-VcOvVaPlfsIOstw,5818
|
|
65
65
|
siat/markowitz_test2.py,sha256=FcVZqYU5va4567WGUVUJ7cMQdVbBGxeBAz82Y3BhCTI,2193
|
66
66
|
siat/ml_cases.py,sha256=FYDk0O7l9hhHlbrlOVGgbH-h2DA503lhKFi9XugH1f0,86874
|
67
67
|
siat/ml_cases_example1.py,sha256=xRGb3YTQEDTOnaWNzZN_myU5umQnA2RdMNiPrxTmn9c,1673
|
68
|
-
siat/option_china.py,sha256=
|
68
|
+
siat/option_china.py,sha256=mId-poVS-0acyxaoSUl6Bz1N05nb1zhAWjv_i5TLGzk,92571
|
69
69
|
siat/option_china_test.py,sha256=UQ-YUHUjoGBQyanLcM-yzqeEIUQP_gCQIeT0W6rnUnA,16355
|
70
70
|
siat/option_pricing.py,sha256=ZvOziCkXODUjqSw2Q7Ux_gepw9UQaGMgvbI_YuceyX8,69625
|
71
71
|
siat/option_pricing_test.py,sha256=eeorV5Ja5vjlRXnP6fWJHetGU5Vb8SnLopkC6RV3GfA,2203
|
@@ -81,7 +81,7 @@ siat/risk_free_rate_test.py,sha256=CpmhUf8aEAEZeNu4gvWP2Mz2dLoIgBX5bI41vfUBEr8,4
|
|
81
81
|
siat/sector_china.py,sha256=0JFs5wXZXOu5tuGnFXKBuR4TVIGqvP_W4psQAAAjW-M,100084
|
82
82
|
siat/sector_china_test.py,sha256=1wq7ef8Bb_L8F0h0W6FvyBrIcBTEbrTV7hljtpj49U4,5843
|
83
83
|
siat/security_price.py,sha256=ibrdUJyt_n0c8oKRbVStE1_ptmWkzy4YIHjpc_fGiPQ,29148
|
84
|
-
siat/security_prices.py,sha256=
|
84
|
+
siat/security_prices.py,sha256=vmN39llWbm-B1awfuZzR14UlEca6Tm3KOvBQUYZJzXw,71984
|
85
85
|
siat/security_prices_test.py,sha256=OEphoJ87NPKoNow1QA8EU_5MUYrJF-qKoWKNapVfZNI,10779
|
86
86
|
siat/setup.py,sha256=up65rQGLmTBkhtaMLowjoQXYmIsnycnm4g1SYmeQS6o,1335
|
87
87
|
siat/shenwan index history test.py,sha256=JCVAzOSEldHalhSFa3pqD8JI_8_djPMQOxpkuYU-Esg,1418
|
@@ -111,7 +111,7 @@ siat/universal_test.py,sha256=CDAOffW1Rvs-TcNN5giWVvHMlch1w4dp-w5SIV9jXL0,3936
|
|
111
111
|
siat/valuation_china.py,sha256=gYYXeT9bBPyQ251TCsYlibWcu6JA8x-YOKqLUEeLE7U,51342
|
112
112
|
siat/valuation_market_china_test.py,sha256=gbJ0ioauuo4koTPH6WKUkqcXiQPafnbhU5eKJ6lpdLA,1571
|
113
113
|
siat/var_model_validation.py,sha256=zB_Skk_tmzIR15l6oAW3am4HBGVIG-eZ8gJhCdXZ8Qw,14859
|
114
|
-
siat-2.0.
|
115
|
-
siat-2.0.
|
116
|
-
siat-2.0.
|
117
|
-
siat-2.0.
|
114
|
+
siat-2.0.2.dist-info/METADATA,sha256=6-5C24wMSK8bNP0-91ngCJh9UixYHv9u8m37OsNaKUE,1399
|
115
|
+
siat-2.0.2.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
|
116
|
+
siat-2.0.2.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
|
117
|
+
siat-2.0.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|