siat 2.12.4__py3-none-any.whl → 2.12.6__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/allin.py +2 -2
- siat/financial_statements.py +4 -1
- siat/financials.py +2 -1
- siat/financials2.py +33 -3
- siat/google_authenticator.py +47 -0
- siat/translate.py +8 -6
- {siat-2.12.4.dist-info → siat-2.12.6.dist-info}/METADATA +1 -1
- {siat-2.12.4.dist-info → siat-2.12.6.dist-info}/RECORD +10 -9
- {siat-2.12.4.dist-info → siat-2.12.6.dist-info}/WHEEL +0 -0
- {siat-2.12.4.dist-info → siat-2.12.6.dist-info}/top_level.txt +0 -0
siat/allin.py
CHANGED
siat/financial_statements.py
CHANGED
@@ -259,7 +259,10 @@ def get_income_statements(symbol):
|
|
259
259
|
# 服务型企业无此项
|
260
260
|
if 'CostOfRevenue' not in list(stmt):
|
261
261
|
stmt['CostOfRevenue']=0
|
262
|
-
|
262
|
+
|
263
|
+
if 'OperatingExpense' not in list(stmt):
|
264
|
+
stmt['OperatingExpense']=stmt['CostOfRevenue']
|
265
|
+
|
263
266
|
# 服务型企业
|
264
267
|
if 'OperatingIncome' not in list(stmt):
|
265
268
|
stmt['OperatingIncome']=stmt['OperatingRevenue']-stmt['OperatingExpense']
|
siat/financials.py
CHANGED
@@ -970,7 +970,8 @@ def calc_fin_rates(fsdf):
|
|
970
970
|
fs['Total Asset Growth']=fs['TotalAssets'].pct_change()
|
971
971
|
#固定资产成新率:平均固定资产净值 / 平均固定资产原值。又称“固定资产净值率”或“有用系数”
|
972
972
|
#fs['PPE Residual']=fs['avgNetPPE']/fs['avgGrossPPE']
|
973
|
-
|
973
|
+
if ('NetPPE' in list(fs)) and ('GrossPPE' in list(fs)):
|
974
|
+
fs['PPE Residual']=fs['NetPPE']/fs['GrossPPE']
|
974
975
|
|
975
976
|
#其他指标
|
976
977
|
#盈利能力指标
|
siat/financials2.py
CHANGED
@@ -506,10 +506,23 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
506
506
|
dftmp2=dftmp[dftmp['periodType']=='3M'].tail(1)
|
507
507
|
else:
|
508
508
|
dftmp2=dftmp.tail(1)
|
509
|
-
|
509
|
+
|
510
|
+
"""
|
510
511
|
dftmp2=pd.DataFrame(dftmp2)
|
511
512
|
fsdf=pd.concat([fsdf,dftmp2])
|
512
|
-
|
513
|
+
"""
|
514
|
+
#删除重复的列名,若存在重复列会出现错误InvalidIndexError: Reindexing
|
515
|
+
dftmp2t=dftmp2.T
|
516
|
+
dftmp2t['item']=dftmp2t.index
|
517
|
+
dftmp2t.drop_duplicates(keep='first',inplace=True)
|
518
|
+
dftmp2t.drop(columns=['item'],inplace=True)
|
519
|
+
dftmp3=dftmp2t.T
|
520
|
+
|
521
|
+
if fsdf is None:
|
522
|
+
fsdf=dftmp3
|
523
|
+
else:
|
524
|
+
fsdf=pd.concat([fsdf,dftmp3],ignore_index=True)
|
525
|
+
|
513
526
|
# 变换年报/季报
|
514
527
|
fsdf['periodType']=fsdf['periodType'].apply(lambda x: 'Annual' if x=='12M' else 'Quarterly')
|
515
528
|
fsdf['reportDate']=fsdf['asOfDate'].apply(lambda x: x.strftime('%y-%m-%d'))
|
@@ -695,7 +708,9 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
695
708
|
|
696
709
|
#删除重复的列名,若存在重复列会出现错误InvalidIndexError: Reindexing only valid with uniquely valued Index objects
|
697
710
|
dftmp2t=dftmp2.T
|
711
|
+
dftmp2t['item']=dftmp2t.index
|
698
712
|
dftmp2t.drop_duplicates(keep='first',inplace=True)
|
713
|
+
dftmp2t.drop(columns=['item'],inplace=True)
|
699
714
|
dftmp3=dftmp2t.T
|
700
715
|
|
701
716
|
if fsdf is None:
|
@@ -780,12 +795,27 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
780
795
|
else:
|
781
796
|
dftmp2=dftmp.tail(1)
|
782
797
|
|
798
|
+
"""
|
783
799
|
dftmp2=pd.DataFrame(dftmp2)
|
784
800
|
fsdf=pd.concat([fsdf,dftmp2])
|
785
|
-
|
801
|
+
"""
|
802
|
+
#删除重复的列名,若存在重复列会出现错误InvalidIndexError: Reindexing
|
803
|
+
dftmp2t=dftmp2.T
|
804
|
+
dftmp2t['item']=dftmp2t.index
|
805
|
+
dftmp2t.drop_duplicates(keep='first',inplace=True)
|
806
|
+
dftmp2t.drop(columns=['item'],inplace=True)
|
807
|
+
dftmp3=dftmp2t.T
|
808
|
+
|
809
|
+
if fsdf is None:
|
810
|
+
fsdf=dftmp3
|
811
|
+
else:
|
812
|
+
fsdf=pd.concat([fsdf,dftmp3],ignore_index=True)
|
813
|
+
|
786
814
|
# 多只股票的杜邦分析对比
|
787
815
|
fsdf['periodType']=fsdf['periodType'].apply(lambda x: 'Annual' if x=='12M' else 'Quarterly')
|
788
816
|
fsdf['Company']=fsdf['ticker'].apply(lambda x: codetranslate(x))
|
817
|
+
|
818
|
+
|
789
819
|
collist=['Company','periodType','endDate','Profit Margin','Total Asset Turnover','Equity Multiplier','Return on Equity']
|
790
820
|
df=fsdf[collist]
|
791
821
|
ticker='Company'
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""
|
3
|
+
本模块功能:模拟谷歌验证器,Google Authenticator
|
4
|
+
基于电脑时间,以密钥为基准,生成6位数字动态口令
|
5
|
+
"""
|
6
|
+
|
7
|
+
import hmac, base64, struct, hashlib, time
|
8
|
+
|
9
|
+
class CalGoogleCode():
|
10
|
+
"""计算谷歌验证码(秘钥,生成6位验证码)"""
|
11
|
+
|
12
|
+
# 使用静态方法,调用这个方法时,不必对类进行实例化
|
13
|
+
@staticmethod
|
14
|
+
def cal_google_code(secret, current_time=int(time.time()) // 30):
|
15
|
+
"""
|
16
|
+
:param secret: 16位谷歌秘钥
|
17
|
+
:param current_time: 时间(谷歌验证码是30s更新一次)
|
18
|
+
:return: 返回6位谷歌验证码
|
19
|
+
"""
|
20
|
+
key = base64.b32decode(secret)
|
21
|
+
msg = struct.pack(">Q", current_time)
|
22
|
+
google_code = hmac.new(key, msg, hashlib.sha1).digest()
|
23
|
+
o = ord(chr(google_code[19])) & 15 # python3时,ord的参数必须为chr类型
|
24
|
+
google_code = (struct.unpack(">I", google_code[o:o + 4])[0] & 0x7fffffff) % 1000000
|
25
|
+
|
26
|
+
return '%06d' % google_code # 不足6位时,在前面补0
|
27
|
+
|
28
|
+
def signin_binance():
|
29
|
+
secret_key = "HLAT4FZ6IDW53AYD"
|
30
|
+
print(CalGoogleCode.cal_google_code(secret_key))
|
31
|
+
|
32
|
+
return
|
33
|
+
|
34
|
+
def signin_pypi():
|
35
|
+
secret_key = "CYKOJC2LMKOKPD6VGI7CAHDWBP2AVB23"
|
36
|
+
print(CalGoogleCode.cal_google_code(secret_key))
|
37
|
+
|
38
|
+
return
|
39
|
+
|
40
|
+
if __name__ == '__main__':
|
41
|
+
# For Binance
|
42
|
+
secret_key = "HLAT4FZ6IDW53AYD"
|
43
|
+
print(CalGoogleCode.cal_google_code(secret_key))
|
44
|
+
|
45
|
+
# for PyPi
|
46
|
+
secret_key = "CYKOJC2LMKOKPD6VGI7CAHDWBP2AVB23"
|
47
|
+
print(CalGoogleCode.cal_google_code(secret_key))
|
siat/translate.py
CHANGED
@@ -678,7 +678,8 @@ def codetranslate_c(codelist):
|
|
678
678
|
name1=name
|
679
679
|
elif suffix in ['HK']:
|
680
680
|
if not ('港股' in name):
|
681
|
-
name1=name+'(港股)'
|
681
|
+
#name1=name+'(港股)'
|
682
|
+
name1=name+'(港)'
|
682
683
|
else:
|
683
684
|
name1=name
|
684
685
|
namelist=namelist+[name1]
|
@@ -695,7 +696,8 @@ def codetranslate_c(codelist):
|
|
695
696
|
name1=name
|
696
697
|
if suffix in ['HK']:
|
697
698
|
if not ('港股' in name):
|
698
|
-
name1=name+'(港股)'
|
699
|
+
#name1=name+'(港股)'
|
700
|
+
name1=name+'(港)'
|
699
701
|
return name1
|
700
702
|
else:
|
701
703
|
return codelist
|
@@ -748,9 +750,9 @@ def codetranslate0(code):
|
|
748
750
|
['00005.HK','港股汇丰控股'],['02888.HK','港股渣打银行'],
|
749
751
|
['03988.HK','中国银行港股'],['BANK OF CHINA','中国银行'],
|
750
752
|
|
751
|
-
['CICHY','
|
752
|
-
['ACGBY','
|
753
|
-
['IDCBY','
|
753
|
+
['CICHY','建设银行美股'],['CICHF','建设银行美股'],
|
754
|
+
['ACGBY','农业银行美股'],['ACGBF','农业银行美股'],
|
755
|
+
['IDCBY','工商银行美股'],['IDCBF','工商银行美股'],
|
754
756
|
['BCMXY','交通银行美股'],
|
755
757
|
|
756
758
|
['BAC','美国银行'],['Bank of America Corporation','美国银行'],
|
@@ -775,7 +777,7 @@ def codetranslate0(code):
|
|
775
777
|
['00005.HK','港股汇丰控股'],['HSBC HOLDINGS','汇丰控股'],
|
776
778
|
['02888.HK','港股渣打银行'],['STANCHART','渣打银行'],
|
777
779
|
|
778
|
-
['UBSG.SW','瑞士瑞银'],
|
780
|
+
['UBSG.SW','瑞士瑞银'], ['IBN','印度IBN银行'], ['SCGLY','法国兴业银行'],
|
779
781
|
|
780
782
|
#股票:高科技
|
781
783
|
['AAPL','苹果'],['Apple','苹果'],['DELL','戴尔'],['IBM','国际商用机器'],
|
@@ -1,5 +1,5 @@
|
|
1
1
|
siat/__init__.py,sha256=2c0GKq4KaxA0vfdvMeyCPiNR6wODmH6CGj8n5UDOywY,2182
|
2
|
-
siat/allin.py,sha256=
|
2
|
+
siat/allin.py,sha256=IJeK_vZkiobVj2ukxRxADNrGXOu1B3TtAuMhqg1JGZ4,2564
|
3
3
|
siat/alpha_vantage_test.py,sha256=tKr-vmuFH3CZAqwmISz6jzjPHzV1JJl3sPfZdz8aTfM,747
|
4
4
|
siat/assets_liquidity.py,sha256=WEdxeENumZZZ7sFmwjDeX9rClHXGGHbnlrL2NMkgqnw,28808
|
5
5
|
siat/assets_liquidity_test.py,sha256=UWk6HIUlizU7LQZ890fGx8LwU1jMMrIZswg8cFUJWZ8,1285
|
@@ -33,11 +33,11 @@ siat/exchange_bond_china.pickle,sha256=78r6E3vPFZlCYPcmS1asgVbe0FGAxsCWaw8ek42Sd
|
|
33
33
|
siat/fama_french.py,sha256=tNtr0WRyPxDbgN6Nu_ZnDtVC-RIiQfh6w0JiPjevWa0,47538
|
34
34
|
siat/fama_french_test.py,sha256=M4O23lBKsJxhWHRluwCb3l7HSEn3OFTjzGMpehcevRg,4678
|
35
35
|
siat/financial_base.py,sha256=j961-1YS9qBl6LmOzI4gCOpdTmk0d1JgNXMzLmV-lrs,41062
|
36
|
-
siat/financial_statements.py,sha256=
|
36
|
+
siat/financial_statements.py,sha256=mdUk5nAoAgQuguPxqHay1xsEgXFi2HfPqJezAc4eet0,24045
|
37
37
|
siat/financial_statements_test.py,sha256=FLhx8JD-tVVWSBGux6AMz1jioXX4U4bp9DmgFHYXb_w,716
|
38
|
-
siat/financials.py,sha256=
|
38
|
+
siat/financials.py,sha256=TyKthn5S1UC1QL01RkDvecc9PHAkp_P-mTJL1bzARhE,78860
|
39
39
|
siat/financials2 - 副本.py,sha256=dKlNjIfKeoSy055fQ6E6TUj9HEoO5Ney9grD84J5kfk,14389
|
40
|
-
siat/financials2.py,sha256=
|
40
|
+
siat/financials2.py,sha256=ReiQL7MLj68lNg6NMvKzUDl8NatSL_9ianFcbvZNX1Q,38012
|
41
41
|
siat/financials_china.py,sha256=nUSPS4SDLP1RaOZF6uIvel8pFl3X_aBO_I0Opl1O8RI,177685
|
42
42
|
siat/financials_china2.py,sha256=12wgmTz1iV7N3IKm6Z0b6_punUzlkBMQ8I8yqvBsScU,73675
|
43
43
|
siat/financials_china2_test.py,sha256=Erz5k4LyOplBBvYls2MypuqHpVNJ3daiLdyeJezNPu0,2722
|
@@ -56,6 +56,7 @@ siat/fund_test.py,sha256=V4ADb8Gsp8gyeFTwcgRsJBpnUih_O-Q2V1ILc5oKjK8,1116
|
|
56
56
|
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
|
+
siat/google_authenticator.py,sha256=ZUbZR8OW0IAKDbcYtlqGqIpZdERpFor9NccFELxg9yI,1637
|
59
60
|
siat/grafix.py,sha256=ZeyZHtimAMTYoHlNoWvCi3vEvEzcARUsRg7a9LPfAXw,67596
|
60
61
|
siat/grafix_test.py,sha256=kXvcpLgQNO7wd30g_bWljLj5UH7bIVI0_dUtXbfiKR0,3150
|
61
62
|
siat/holding_risk.py,sha256=Dh4zXEw-0hnbMNorbsRS142C8mUzq4NhFjYnauWu5tc,30548
|
@@ -118,13 +119,13 @@ siat/transaction_test.py,sha256=Z8g1LJCN4-mnUByXMUMoFmN0t105cbmsz2QmvSuIkbU,1858
|
|
118
119
|
siat/translate-20230125.py,sha256=NPPSXhT38s5t9fzMvl_fvi4ckSB73ThLmZetVI-xGdU,117953
|
119
120
|
siat/translate-20230206.py,sha256=-vtI125WyaJhmPotOpDAmclt_XnYVaWU9ByLWZ6FyYE,118133
|
120
121
|
siat/translate-20230215.py,sha256=TJgtPE3n8IjljmZ4Pefy8dmHoNdFF-1zpML6BhA9FKE,121657
|
121
|
-
siat/translate.py,sha256=
|
122
|
+
siat/translate.py,sha256=EbMGZ7V9YZLPy3WKxMgQeemqw-liUBSp7GSv4oyW5bY,143164
|
122
123
|
siat/universal_test.py,sha256=CDAOffW1Rvs-TcNN5giWVvHMlch1w4dp-w5SIV9jXL0,3936
|
123
124
|
siat/valuation.py,sha256=3VKrO9b9xY9dOJGGuF0ZhytzB5d2pCx3kO3TtMml7mo,44025
|
124
125
|
siat/valuation_china.py,sha256=oEQRrktJNHiOG1mJSQN1aSSQAQrwrg-ppIHyNVjMjNg,67603
|
125
126
|
siat/valuation_market_china_test.py,sha256=gbJ0ioauuo4koTPH6WKUkqcXiQPafnbhU5eKJ6lpdLA,1571
|
126
127
|
siat/var_model_validation.py,sha256=zB_Skk_tmzIR15l6oAW3am4HBGVIG-eZ8gJhCdXZ8Qw,14859
|
127
|
-
siat-2.12.
|
128
|
-
siat-2.12.
|
129
|
-
siat-2.12.
|
130
|
-
siat-2.12.
|
128
|
+
siat-2.12.6.dist-info/METADATA,sha256=hS1b0748mitbfvJBmBgQdIPv17hrVZc9bBfHCVBt-rY,1378
|
129
|
+
siat-2.12.6.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
130
|
+
siat-2.12.6.dist-info/top_level.txt,sha256=r1cVyL7AIKqeAmEJjNR8FMT20OmEzufDstC2gv3NvEY,5
|
131
|
+
siat-2.12.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|