Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
FactorCalculate
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李煜
FactorCalculate
Commits
2353e349
Commit
2353e349
authored
Jul 04, 2019
by
李煜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify per share
parent
757bc40e
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
149 additions
and
151 deletions
+149
-151
client.py
client.py
+24
-22
factor_per_share_indicators.py
factor/factor_per_share_indicators.py
+125
-129
No files found.
client.py
View file @
2353e349
...
...
@@ -504,7 +504,7 @@ def get_basic_earning(trade_date):
if
__name__
==
'__main__'
:
session1
=
str
(
'156099868869460811'
)
session2
=
str
(
'156099868869460812'
)
#
session3 = str('156099868869460813')
session3
=
str
(
'156099868869460813'
)
session4
=
str
(
'156099868869460814'
)
session5
=
str
(
'156099868869460815'
)
session6
=
str
(
'156099868869460816'
)
...
...
@@ -525,9 +525,9 @@ if __name__ == '__main__':
history_value
=
historical_value
.
HistoricalValue
(
'factor_historical_value'
)
history_value
.
create_dest_tables
()
#
scal
e
# scale = factor_per_share_indicators.PerShareIndicators('factor_scal
e')
# scal
e.create_dest_tables()
#
per shapr
e
per_share
=
factor_per_share_indicators
.
PerShareIndicators
(
'factor_per_shar
e'
)
per_shar
e
.
create_dest_tables
()
# cash flow
cash_flow
=
factor_cash_flow
.
FactorCashFlow
(
'factor_cash_flow'
)
...
...
@@ -538,8 +538,8 @@ if __name__ == '__main__':
constrain
.
create_dest_tables
()
# earning
earning
=
factor_earning
.
FactorEarning
(
'factor_earning'
)
earning
.
create_dest_tables
()
#
earning = factor_earning.FactorEarning('factor_earning')
#
earning.create_dest_tables()
for
date_index
in
trade_date_sets
:
# factor_growth
...
...
@@ -561,14 +561,16 @@ if __name__ == '__main__':
time2
=
time
.
time
()
print
(
'history_cal_time:{}'
.
format
(
time2
-
time1
))
# # scale
# valuation_sets, ttm_factor_sets, cash_flow_sets, income_sets, balance_sets = get_basic_scale_data(date_index)
# valuation_sets = pd.merge(valuation_sets, income_sets, on='symbol')
# valuation_sets = pd.merge(valuation_sets, ttm_factor_sets, on='symbol')
# valuation_sets = pd.merge(valuation_sets, cash_flow_sets, on='symbol')
# valuation_sets = pd.merge(valuation_sets, balance_sets, on='symbol')
# cache_data.set_cache(session3, date_index, valuation_sets.to_json(orient='records'))
# factor_per_share_indicators.factor_calculate(date_index=date_index, session=session3)
# per share indicators
valuation_sets
,
ttm_factor_sets
,
cash_flow_sets
,
income_sets
,
balance_sets
=
get_basic_scale_data
(
date_index
)
valuation_sets
=
pd
.
merge
(
valuation_sets
,
income_sets
,
on
=
'symbol'
)
valuation_sets
=
pd
.
merge
(
valuation_sets
,
ttm_factor_sets
,
on
=
'symbol'
)
valuation_sets
=
pd
.
merge
(
valuation_sets
,
cash_flow_sets
,
on
=
'symbol'
)
valuation_sets
=
pd
.
merge
(
valuation_sets
,
balance_sets
,
on
=
'symbol'
)
cache_data
.
set_cache
(
session3
,
date_index
,
valuation_sets
.
to_json
(
orient
=
'records'
))
factor_per_share_indicators
.
factor_calculate
(
date_index
=
date_index
,
session
=
session3
)
time3
=
time
.
time
()
print
(
'per_share_cal_time:{}'
.
format
(
time3
-
time2
))
# cash flow
tp_cash_flow
,
ttm_factor_sets
=
get_basic_cash_flow
(
date_index
)
...
...
@@ -576,7 +578,7 @@ if __name__ == '__main__':
cache_data
.
set_cache
(
session4
+
"2"
,
date_index
,
ttm_factor_sets
.
to_json
(
orient
=
'records'
))
factor_cash_flow
.
factor_calculate
(
date_index
=
date_index
,
session
=
session4
)
time4
=
time
.
time
()
print
(
'cash_flow_cal_time:{}'
.
format
(
time4
-
time
2
))
print
(
'cash_flow_cal_time:{}'
.
format
(
time4
-
time
3
))
# constrain
balance_sets
,
ttm_factors_sets
=
get_basic_constrain
(
date_index
)
...
...
@@ -587,11 +589,11 @@ if __name__ == '__main__':
print
(
'constrain_cal_time:{}'
.
format
(
time5
-
time4
))
# earning
tp_earning
,
ttm_earning_5y
,
ttm_earning
=
get_basic_earning
(
date_index
)
cache_data
.
set_cache
(
session6
+
"1"
,
date_index
,
tp_earning
.
to_json
(
orient
=
'records'
))
cache_data
.
set_cache
(
session6
+
"2"
,
date_index
,
ttm_earning_5y
.
to_json
(
orient
=
'records'
))
cache_data
.
set_cache
(
session6
+
"3"
,
date_index
,
ttm_earning
.
to_json
(
orient
=
'records'
))
factor_earning
.
factor_calculate
(
date_index
=
date_index
,
session
=
session6
)
time6
=
time
.
time
()
print
(
'earning_cal_time:{}'
.
format
(
time6
-
time5
))
#
tp_earning, ttm_earning_5y, ttm_earning = get_basic_earning(date_index)
#
cache_data.set_cache(session6 + "1", date_index, tp_earning.to_json(orient='records'))
#
cache_data.set_cache(session6 + "2", date_index, ttm_earning_5y.to_json(orient='records'))
#
cache_data.set_cache(session6 + "3", date_index, ttm_earning.to_json(orient='records'))
#
factor_earning.factor_calculate(date_index=date_index, session=session6)
#
time6 = time.time()
#
print('earning_cal_time:{}'.format(time6 - time5))
print
(
'---------------------->'
)
factor/factor_per_share_indicators.py
View file @
2353e349
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment