siat 2.13.18__py3-none-any.whl → 2.13.21__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/common.py +4 -3
- siat/grafix.py +31 -8
- siat/security_prices.py +4 -1
- siat/security_trend.py +2 -0
- siat/stock.py +8 -3
- siat/translate.py +4 -0
- {siat-2.13.18.dist-info → siat-2.13.21.dist-info}/METADATA +1 -1
- {siat-2.13.18.dist-info → siat-2.13.21.dist-info}/RECORD +10 -10
- {siat-2.13.18.dist-info → siat-2.13.21.dist-info}/WHEEL +0 -0
- {siat-2.13.18.dist-info → siat-2.13.21.dist-info}/top_level.txt +0 -0
siat/common.py
CHANGED
@@ -2294,6 +2294,7 @@ def sround(a,decimal=4):
|
|
2294
2294
|
#==============================================================================
|
2295
2295
|
if __name__=='__main__':
|
2296
2296
|
file='stooq.py'
|
2297
|
+
package='pandas_datareader'
|
2297
2298
|
|
2298
2299
|
def fix_package(file='stooq.py',package='pandas_datareader'):
|
2299
2300
|
"""
|
@@ -2319,7 +2320,7 @@ def fix_package(file='stooq.py',package='pandas_datareader'):
|
|
2319
2320
|
srcfile=srcpath1+'/'+file
|
2320
2321
|
else:
|
2321
2322
|
srcpath1=srcpath
|
2322
|
-
srcfile=srcpath1+'
|
2323
|
+
srcfile=srcpath1+'/'+file
|
2323
2324
|
|
2324
2325
|
#目标地址
|
2325
2326
|
cmdstr1='import '+package
|
@@ -2334,7 +2335,7 @@ def fix_package(file='stooq.py',package='pandas_datareader'):
|
|
2334
2335
|
objfile=objpath1+'/'+file
|
2335
2336
|
else:
|
2336
2337
|
objpath1=objpath
|
2337
|
-
objfile=objpath1+'
|
2338
|
+
objfile=objpath1+'/'+file
|
2338
2339
|
|
2339
2340
|
#复制文件
|
2340
2341
|
from shutil import copyfile
|
@@ -2345,7 +2346,7 @@ def fix_package(file='stooq.py',package='pandas_datareader'):
|
|
2345
2346
|
result=copyfile(srcfile,objfile)
|
2346
2347
|
except IOError as e:
|
2347
2348
|
print(" #Error(fix_package): Unable to copy file. %s" % e)
|
2348
|
-
print(" Program failed becos of
|
2349
|
+
print(" Program failed most likely becos of incorrect source/target directories.")
|
2349
2350
|
print(" Solution: manually copy the file",srcfile,"to the folder",objpath1)
|
2350
2351
|
#exit(1)
|
2351
2352
|
except:
|
siat/grafix.py
CHANGED
@@ -67,7 +67,8 @@ if czxt in ['linux']: #website Jupyter
|
|
67
67
|
plt.rcParams['axes.unicode_minus'] = False
|
68
68
|
#==============================================================================
|
69
69
|
def plot_line(df0,colname,collabel,ylabeltxt,titletxt,footnote,datatag=False, \
|
70
|
-
power=0,zeroline=False,
|
70
|
+
power=0,zeroline=False,average_value=False, \
|
71
|
+
resample_freq='H',loc='best', \
|
71
72
|
date_range=False,date_freq=False,date_fmt='%Y-%m-%d'):
|
72
73
|
"""
|
73
74
|
功能:绘制折线图。如果power=0不绘制趋势图,否则绘制多项式趋势图
|
@@ -112,8 +113,18 @@ def plot_line(df0,colname,collabel,ylabeltxt,titletxt,footnote,datatag=False, \
|
|
112
113
|
ax.xaxis.set_major_formatter(mdate.DateFormatter(date_fmt))
|
113
114
|
plt.xticks(pd.date_range(date_start,date_end,freq=date_freq))
|
114
115
|
|
116
|
+
if ylabeltxt != '' or ylabeltxt == "stooq_MB":
|
117
|
+
collabel=''
|
118
|
+
if ylabeltxt == "stooq_MB":
|
119
|
+
ylabeltxt=''
|
120
|
+
|
115
121
|
plt.plot(df.index,df[colname],'-',label=collabel, \
|
116
122
|
linestyle='-',color='blue', linewidth=2)
|
123
|
+
|
124
|
+
haveLegend=True
|
125
|
+
if collabel == '':
|
126
|
+
haveLegend=False
|
127
|
+
|
117
128
|
#绘制数据标签
|
118
129
|
if datatag:
|
119
130
|
for x, y in zip(df.index, df[colname]):
|
@@ -136,18 +147,27 @@ def plot_line(df0,colname,collabel,ylabeltxt,titletxt,footnote,datatag=False, \
|
|
136
147
|
if isinstance(zeroline,bool):#若zeroline为True
|
137
148
|
if zeroline:
|
138
149
|
hline=0
|
139
|
-
plt.axhline(y=hline,ls=":",c="
|
150
|
+
plt.axhline(y=hline,ls=":",c="green",linewidth=2,label="零线")
|
151
|
+
haveLegend=True
|
140
152
|
else:
|
141
153
|
if isinstance(zeroline,float) or isinstance(zeroline,int):
|
142
154
|
hline=zeroline
|
143
|
-
plt.axhline(y=hline,ls=":",c="
|
155
|
+
plt.axhline(y=hline,ls=":",c="darkorange",linewidth=3,label="关注值")
|
156
|
+
haveLegend=True
|
157
|
+
footnote=footnote + ",关注值"+str(hline)
|
158
|
+
|
159
|
+
if average_value:
|
160
|
+
av=df[colname].mean()
|
161
|
+
plt.axhline(y=av,ls="dashed",c="blueviolet",linewidth=2,label="均值")
|
162
|
+
haveLegend=True
|
163
|
+
footnote=footnote + ",均值"+str(round(av,2))
|
144
164
|
|
145
165
|
#绘制趋势线
|
146
166
|
#print("--Debug(plot_line): power=",power)
|
147
167
|
if power > 0:
|
148
168
|
lang=check_language()
|
149
|
-
|
150
|
-
trend_txt=''
|
169
|
+
trend_txt='趋势线'
|
170
|
+
#trend_txt=''
|
151
171
|
if lang == 'English':
|
152
172
|
trend_txt='Trend line'
|
153
173
|
|
@@ -160,13 +180,16 @@ def plot_line(df0,colname,collabel,ylabeltxt,titletxt,footnote,datatag=False, \
|
|
160
180
|
parameter = np.polyfit(df.id, df[colname], power)
|
161
181
|
f = np.poly1d(parameter)
|
162
182
|
plt.plot(df.index, f(df.id),"r--", label=trend_txt,linewidth=1)
|
183
|
+
haveLegend=True
|
163
184
|
except:
|
164
185
|
print(" Warning(plot_line): failed to converge trend line, try a smaller power.")
|
165
186
|
|
166
|
-
if ylabeltxt != '':
|
167
|
-
|
187
|
+
if ylabeltxt != '' or average_value or isinstance(zeroline,bool):
|
188
|
+
if haveLegend:
|
189
|
+
plt.legend(loc=loc,fontsize=legend_txt_size)
|
190
|
+
|
168
191
|
plt.gcf().autofmt_xdate() # 优化标注(自动倾斜)
|
169
|
-
|
192
|
+
|
170
193
|
plt.ylabel(ylabeltxt,fontsize=ylabel_txt_size)
|
171
194
|
plt.xlabel(footnote,fontsize=xlabel_txt_size)
|
172
195
|
plt.title(titletxt,fontweight='bold',fontsize=title_txt_size)
|
siat/security_prices.py
CHANGED
@@ -490,9 +490,12 @@ if __name__=='__main__':
|
|
490
490
|
ticker='CPIYCN.M'
|
491
491
|
ticker='INPYCN.M'
|
492
492
|
ticker='TRBNCN.M'
|
493
|
+
ticker='RSAYCN.M'
|
493
494
|
|
494
495
|
start='2023-1-1'
|
495
|
-
end='2024-
|
496
|
+
end='2024-2-19'
|
497
|
+
|
498
|
+
p=get_price_stooq(ticker,start,end)
|
496
499
|
|
497
500
|
def get_price_stooq(ticker,start,end):
|
498
501
|
"""
|
siat/security_trend.py
CHANGED
@@ -81,6 +81,7 @@ if __name__=='__main__':
|
|
81
81
|
def security_trend(ticker,indicator='Close', \
|
82
82
|
start='default',end='default', \
|
83
83
|
critical_value='', \
|
84
|
+
average_value=False, \
|
84
85
|
kline=False,kline_demo=False,mav=[5,10,20], \
|
85
86
|
stock_dividend=False,stock_split=False, \
|
86
87
|
market="China",market_index="000300.SS",RF=False,window=252, \
|
@@ -266,6 +267,7 @@ def security_trend(ticker,indicator='Close', \
|
|
266
267
|
df=security_indicator(ticker=tickers[0],indicator=measures[0], \
|
267
268
|
fromdate=fromdate,todate=todate, \
|
268
269
|
zeroline=zeroline, \
|
270
|
+
average_value=average_value, \
|
269
271
|
datatag=datatag,power=power,graph=graph, \
|
270
272
|
source=source)
|
271
273
|
return df
|
siat/stock.py
CHANGED
@@ -590,6 +590,7 @@ if __name__ =="__main__":
|
|
590
590
|
|
591
591
|
def security_indicator(ticker,indicator,fromdate,todate, \
|
592
592
|
zeroline=False, \
|
593
|
+
average_value=False, \
|
593
594
|
datatag=False,power=0,graph=True,source='auto'):
|
594
595
|
"""
|
595
596
|
功能:单只证券的全部指标
|
@@ -642,13 +643,13 @@ def security_indicator(ticker,indicator,fromdate,todate, \
|
|
642
643
|
tickersplit=ticker.split('.')
|
643
644
|
if (len(tickersplit) > 1) and (indicator == 'Close'):
|
644
645
|
if tickersplit[1].upper() in ['M','B']:
|
645
|
-
ylabeltxt=""
|
646
|
+
ylabeltxt="stooq_MB" #特殊标志,告知绘图函数不显示某些标记
|
646
647
|
|
647
648
|
if 'Ret%' in indicator:
|
648
649
|
zeroline=True
|
649
650
|
|
650
651
|
plot_line(erdf3,indicator,collabel,ylabeltxt,titletxt,footnote,datatag=datatag, \
|
651
|
-
power=power,zeroline=zeroline)
|
652
|
+
power=power,zeroline=zeroline,average_value=average_value)
|
652
653
|
|
653
654
|
return erdf3
|
654
655
|
|
@@ -2035,7 +2036,11 @@ def candlestick(stkcd,fromdate,todate,volume=True,style='China',mav=[5,10]):
|
|
2035
2036
|
if daily is None:
|
2036
2037
|
print(" #Error(candlestick): failed to get price info of",stkcd,fromdate,todate)
|
2037
2038
|
return
|
2038
|
-
|
2039
|
+
|
2040
|
+
#如果抓取到的数据没有Volume字段,创造一个但填充为零
|
2041
|
+
if 'Volume' not in list(daily):
|
2042
|
+
daily['Volume']=0
|
2043
|
+
|
2039
2044
|
#绘制蜡烛图
|
2040
2045
|
lang=check_language()
|
2041
2046
|
if lang == 'English':
|
siat/translate.py
CHANGED
@@ -1362,7 +1362,11 @@ def codetranslate0(code):
|
|
1362
1362
|
['RSAYPL.M','波兰零售业增长率%(同比)'],['RSAYRO.M','罗马尼亚零售业增长率%(同比)'],
|
1363
1363
|
['RSAYTR.M','土耳其零售业增长率%(同比)'],['RSAYUS.M','美国零售业增长率%(同比)'],
|
1364
1364
|
['RSAYUK.M','英国零售业增长率%(同比)'],['RSAYZA.M','南非零售业增长率%(同比)'],
|
1365
|
+
['RSAYSE.M','瑞典零售业增长率%(同比)'],['RSAYSG.M','新加坡零售业增长率%(同比)'],
|
1366
|
+
['RSAYLT.M','立陶宛零售业增长率%(同比)'],
|
1365
1367
|
|
1368
|
+
['RTTYGR.M','希腊零售业增长率%(同比)'],['RTTYJP.M','日本零售业增长率%(同比)'],
|
1369
|
+
['RTTYSK.M','斯洛伐克零售业增长率%(同比)'],
|
1366
1370
|
|
1367
1371
|
#======================================================================
|
1368
1372
|
# 白酒行业
|
@@ -15,7 +15,7 @@ siat/bond_test.py,sha256=yUOFw7ddGU-kb1rJdnsjkJWziDNgUR7OLDA7F7Ub91A,5246
|
|
15
15
|
siat/capm_beta.py,sha256=cqbmfM4mrq73Ub0bq5QjWJjmJHj9x7-dSqbmNxnEj7k,28946
|
16
16
|
siat/capm_beta_test.py,sha256=ImR0c5mc4hIl714XmHztdl7qg8v1E2lycKyiqnFj6qs,1745
|
17
17
|
siat/cmat_commons.py,sha256=Nj9Kf0alywaztVoMVeVVL_EZk5jRERJy8R8kBw88_Tg,38116
|
18
|
-
siat/common.py,sha256=
|
18
|
+
siat/common.py,sha256=QOKGCaxREeCtHjvQZPNIFmBRgMyBeUA4A-gUJSYFHi0,81947
|
19
19
|
siat/compare_cross.py,sha256=-MZzxmX8_9oFZ7X0IcR51w87EWwssbitiw-BcmHMFzQ,26228
|
20
20
|
siat/compare_cross_test.py,sha256=xra5XYmQGEtfIZL2h-GssdH2hLdFIhG3eoCrkDrL3gY,3473
|
21
21
|
siat/concepts_iwencai.py,sha256=m1YEDtECRT6FqtzlKm91pt2I9d3Z_XoP59BtWdRdu8I,3061
|
@@ -57,7 +57,7 @@ siat/future_china.py,sha256=F-HsIf2Op8Z22RzTjet1g8COzldgnMjFNSXsAkeGyWo,17595
|
|
57
57
|
siat/future_china_test.py,sha256=BrSzmDVaOHki6rntOtosmRn-6dkfOBuLulJNqh7MOpc,1163
|
58
58
|
siat/global_index_test.py,sha256=hnFp3wqqzzL-kAP8mgxDZ54Bd5Ijf6ENi5YJlGBgcXw,2402
|
59
59
|
siat/google_authenticator.py,sha256=ZUbZR8OW0IAKDbcYtlqGqIpZdERpFor9NccFELxg9yI,1637
|
60
|
-
siat/grafix.py,sha256=
|
60
|
+
siat/grafix.py,sha256=NAw6VzTuxg0LIAyzJ8_lmT4X8-TNPJ8v2vAyat-y_o4,69287
|
61
61
|
siat/grafix_test.py,sha256=kXvcpLgQNO7wd30g_bWljLj5UH7bIVI0_dUtXbfiKR0,3150
|
62
62
|
siat/holding_risk.py,sha256=Dh4zXEw-0hnbMNorbsRS142C8mUzq4NhFjYnauWu5tc,30548
|
63
63
|
siat/holding_risk_test.py,sha256=FRlw_9wFG98BYcg_cSj95HX5WZ1TvkGaOUdXD7-V86s,474
|
@@ -90,12 +90,12 @@ siat/risk_free_rate_test.py,sha256=CpmhUf8aEAEZeNu4gvWP2Mz2dLoIgBX5bI41vfUBEr8,4
|
|
90
90
|
siat/sector_china.py,sha256=jflt5whcS65cRh37gj25cDU2U3cdW5L5Hx-gQaU79nc,120800
|
91
91
|
siat/sector_china_test.py,sha256=1wq7ef8Bb_L8F0h0W6FvyBrIcBTEbrTV7hljtpj49U4,5843
|
92
92
|
siat/security_price.py,sha256=2oHskgiw41KMGfqtnA0i2YjNNV6cYgtlUK0j3YeuXWs,29185
|
93
|
-
siat/security_prices.py,sha256=
|
93
|
+
siat/security_prices.py,sha256=kGBAqHwmN_iupBZ6v3AUrRHjCSNxP09sz2nlBSVyaHs,76950
|
94
94
|
siat/security_prices_test.py,sha256=OEphoJ87NPKoNow1QA8EU_5MUYrJF-qKoWKNapVfZNI,10779
|
95
|
-
siat/security_trend.py,sha256=
|
95
|
+
siat/security_trend.py,sha256=rWYjeR-KONBdJB7Va96gVieci2bOIxkc87rvqxZ80P4,15367
|
96
96
|
siat/setup.py,sha256=up65rQGLmTBkhtaMLowjoQXYmIsnycnm4g1SYmeQS6o,1335
|
97
97
|
siat/shenwan index history test.py,sha256=JCVAzOSEldHalhSFa3pqD8JI_8_djPMQOxpkuYU-Esg,1418
|
98
|
-
siat/stock.py,sha256=
|
98
|
+
siat/stock.py,sha256=aK9yVfb6367v7OXT81WoumMhvNksROa51mC3Taw-AC4,140334
|
99
99
|
siat/stock_advice_linear.py,sha256=-twT7IGP-NEplkL1WPSACcNJjggRB2j4mlAQCkzOAuo,31655
|
100
100
|
siat/stock_base.py,sha256=uISvbRyOGy8p9QREA96CVydgflBkn5L3OXOGKl8oanc,1312
|
101
101
|
siat/stock_china.py,sha256=B1hbZCxJuE5GVvGGmf_rSmQodYHmEFuyiDrUvxHhg4w,83969
|
@@ -120,13 +120,13 @@ siat/transaction_test.py,sha256=Z8g1LJCN4-mnUByXMUMoFmN0t105cbmsz2QmvSuIkbU,1858
|
|
120
120
|
siat/translate-20230125.py,sha256=NPPSXhT38s5t9fzMvl_fvi4ckSB73ThLmZetVI-xGdU,117953
|
121
121
|
siat/translate-20230206.py,sha256=-vtI125WyaJhmPotOpDAmclt_XnYVaWU9ByLWZ6FyYE,118133
|
122
122
|
siat/translate-20230215.py,sha256=TJgtPE3n8IjljmZ4Pefy8dmHoNdFF-1zpML6BhA9FKE,121657
|
123
|
-
siat/translate.py,sha256=
|
123
|
+
siat/translate.py,sha256=rLEk2PMwkQ9cLrzsjGh46ol3trx5JKYl3cupqZY7zYo,166832
|
124
124
|
siat/universal_test.py,sha256=CDAOffW1Rvs-TcNN5giWVvHMlch1w4dp-w5SIV9jXL0,3936
|
125
125
|
siat/valuation.py,sha256=3VKrO9b9xY9dOJGGuF0ZhytzB5d2pCx3kO3TtMml7mo,44025
|
126
126
|
siat/valuation_china.py,sha256=oEQRrktJNHiOG1mJSQN1aSSQAQrwrg-ppIHyNVjMjNg,67603
|
127
127
|
siat/valuation_market_china_test.py,sha256=gbJ0ioauuo4koTPH6WKUkqcXiQPafnbhU5eKJ6lpdLA,1571
|
128
128
|
siat/var_model_validation.py,sha256=zB_Skk_tmzIR15l6oAW3am4HBGVIG-eZ8gJhCdXZ8Qw,14859
|
129
|
-
siat-2.13.
|
130
|
-
siat-2.13.
|
131
|
-
siat-2.13.
|
132
|
-
siat-2.13.
|
129
|
+
siat-2.13.21.dist-info/METADATA,sha256=o2xK5jJvotka-h75LzHUJmVCmkAxJATgohFYPgXn988,1449
|
130
|
+
siat-2.13.21.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
131
|
+
siat-2.13.21.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
|
132
|
+
siat-2.13.21.dist-info/RECORD,,
|
File without changes
|
File without changes
|