Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
R
robo-dividend
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
wenwen.tang
robo-dividend
Commits
79c8ea63
Commit
79c8ea63
authored
Aug 30, 2024
by
吕先亚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update config
parent
2f187d6c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
22 deletions
+37
-22
config-mdis_prr3.yml
config-mdis_prr3.yml
+5
-3
config-stable_prr3.yml
config-stable_prr3.yml
+6
-3
config-usmarket_prr4.yml
config-usmarket_prr4.yml
+7
-4
base_signal.py
rebalance/base_signal.py
+2
-1
robo_executor.py
robo_executor.py
+1
-1
robo_controller.py
web/robo_controller.py
+16
-10
No files found.
config-mdis_prr3.yml
View file @
79c8ea63
...
...
@@ -217,9 +217,11 @@ reports: # 报告模块相关
-
daily-signal-report
email
:
receives
:
-
jlin@ftfintech.com.tw
-
YYang1@ftsice.com.tw
copies
:
-
brody_wu@chifufund.com
-
wenwen.tang@thizgroup.com
copies
:
${DAILY_EMAIL_COPIES}
subject
:
# default: "MdisFoF_prr3(實盤)-每日投組推薦_{today}"
rebalance
:
"
MdisFoF_prr3(實盤)-每月投組推薦_{today}"
...
...
@@ -237,8 +239,8 @@ reports: # 报告模块相关
min-date
:
{
days
:
30
}
-
name
:
asset-pool-report
# 基金池
min-date
:
{
days
:
30
}
#
- name: combo-report # 持仓报告
#
min-date: {days: 40}
-
name
:
combo-report
# 持仓报告
min-date
:
{
days
:
40
}
-
name
:
mpt-report
min-date
:
{
days
:
30
}
-
name
:
signal-report
...
...
config-stable_prr3.yml
View file @
79c8ea63
...
...
@@ -221,8 +221,11 @@ reports: # 报告模块相关
-
daily-signal-report
email
:
receives
:
-
jlin@ftfintech.com.tw
-
YYang1@ftsice.com.tw
copies
:
-
brody_wu@chifufund.com
copies
:
${DAILY_EMAIL_COPIES}
-
wenwen.tang@thizgroup.com
subject
:
# default: "SteadyFoF_prr3(實盤)-每日投組推薦_{today}"
rebalance
:
"
SteadyFoF_prr3(實盤)-每月投組推薦_{today}"
...
...
@@ -261,7 +264,7 @@ reports: # 报告模块相关
subject
:
"
SVROBO6-实盘版-每日监测_{today}"
content
:
"
Dear
All:
附件是今天生成的监测数据,請驗收,謝謝!
注>:該郵件為自動發送,如有問題請聯繫矽谷團隊
telan_qian@chifufund.com"
robo-executor
:
# 执行器相关
use
:
${ROBO_EXECUTOR:
backtest
}
# 执行哪个执行器,优先取系统环境变量ROBO_EXECUTOR的值,默认backtest
use
:
${ROBO_EXECUTOR:
real
}
# 执行哪个执行器,优先取系统环境变量ROBO_EXECUTOR的值,默认backtest
sync-data
:
${SYNC_DATA:on}
# 是否开启同步资料数据
backtest
:
# 回测执行器相关
start-date
:
2013-01-02
# 回测起始日期
...
...
@@ -271,7 +274,7 @@ robo-executor: # 执行器相关
end-step
:
${BACKTEST_END_STEP:3}
# 回测从哪一步执行完成后结束执行 1:计算资产池;2:计算最优投组:3:计算再平衡信号以及持仓投组
clean-up
:
on
real
:
# 实盘执行器
export
:
${EXPORT_ENABLE:o
n
}
# 是否开启报告
export
:
${EXPORT_ENABLE:o
ff
}
# 是否开启报告
start-date
:
2023-05-08
# 实盘开始时间
include-date
:
[]
web
:
...
...
config-usmarket_prr4.yml
View file @
79c8ea63
...
...
@@ -206,8 +206,11 @@ reports: # 报告模块相关
-
daily-signal-report
email
:
receives
:
-
jlin@ftfintech.com.tw
-
YYang1@ftsice.com.tw
copies
:
-
brody_wu@chifufund.com
copies
:
${DAILY_EMAIL_COPIES}
-
wenwen.tang@thizgroup.com
subject
:
# default: "USFoF_prr4(實盤)-每日投組推薦_{today}"
rebalance
:
"
USFoF_prr4(實盤)-每月投組推薦_{today}"
...
...
@@ -246,7 +249,7 @@ reports: # 报告模块相关
subject
:
"
SVROBO6-实盘版-每日监测_{today}"
content
:
"
Dear
All:
附件是今天生成的监测数据,請驗收,謝謝!
注>:該郵件為自動發送,如有問題請聯繫矽谷團隊
telan_qian@chifufund.com"
robo-executor
:
# 执行器相关
use
:
${ROBO_EXECUTOR:
backtest
}
# 执行哪个执行器,优先取系统环境变量ROBO_EXECUTOR的值,默认backtest
use
:
${ROBO_EXECUTOR:
real
}
# 执行哪个执行器,优先取系统环境变量ROBO_EXECUTOR的值,默认backtest
sync-data
:
${SYNC_DATA:on}
# 是否开启同步资料数据
backtest
:
# 回测执行器相关
start-date
:
2013-01-02
# 回测起始日期
...
...
@@ -254,9 +257,9 @@ robo-executor: # 执行器相关
sealing-period
:
10
#调仓封闭期
start-step
:
${BACKTEST_START_STEP:1}
# 回测从哪一步开始执行 1:计算资产池;2:计算最优投组:3:计算再平衡信号以及持仓投组
end-step
:
${BACKTEST_END_STEP:3}
# 回测从哪一步执行完成后结束执行 1:计算资产池;2:计算最优投组:3:计算再平衡信号以及持仓投组
clean-up
:
o
n
clean-up
:
o
ff
real
:
# 实盘执行器
export
:
${EXPORT_ENABLE:o
n
}
# 是否开启报告
export
:
${EXPORT_ENABLE:o
ff
}
# 是否开启报告
start-date
:
2023-05-08
# 实盘开始时间
include-date
:
[]
web
:
...
...
rebalance/base_signal.py
View file @
79c8ea63
...
...
@@ -130,7 +130,8 @@ class DailySignalReportor(RoboReportor):
def
load_report
(
self
,
max_date
=
prev_workday
(
dt
.
today
()),
min_date
=
None
)
->
List
[
dict
]:
signals
=
pd
.
DataFrame
(
rrs
.
get_list
(
max_date
=
max_date
,
min_date
=
min_date
))
signals
=
signals
[(
signals
[
'date'
]
.
dt
.
date
==
max_date
.
date
())]
# signals = signals[(signals['date'].dt.date == max_date.date())]
signals
=
signals
.
tail
(
1
)
if
not
signals
.
empty
:
datum_ids
=
reduce
(
lambda
x
,
y
:
x
|
y
,
signals
[
'portfolio'
]
.
apply
(
lambda
x
:
set
(
json
.
loads
(
x
)
.
keys
())))
datums
=
pd
.
DataFrame
(
self
.
_datum
.
get_datums
(
type
=
DatumType
.
FUND
,
datum_ids
=
datum_ids
))
...
...
robo_executor.py
View file @
79c8ea63
...
...
@@ -136,7 +136,7 @@ class BacktestExecutor(RoboExecutor):
@
component
(
bean_name
=
'real'
)
class
RealExecutor
(
RoboExecutor
):
@
autowired
(
names
=
{
'daily_export'
:
'daily-real-export'
,
'monitor_export'
:
'daily-monitor-export'
})
@
autowired
(
names
=
{
'daily_export'
:
'daily-real-export'
})
def
__init__
(
self
,
builder
:
PortfoliosBuilder
=
None
,
hold
:
PortfoliosHolder
=
None
,
syncs
:
List
[
DataSync
]
=
None
,
daily_export
:
RoboExportor
=
None
,
monitor_export
:
RoboExportor
=
None
,
pool
:
AssetPool
=
None
,
signal
:
RebalanceSignal
=
None
):
...
...
web/robo_controller.py
View file @
79c8ea63
import
datetime
as
dt
import
json
import
logging
import
os
from
statistics
import
pstdev
from
tempfile
import
TemporaryDirectory
import
pandas
as
pd
import
uvicorn
...
...
@@ -24,13 +26,17 @@ fund_infos, cp, roi, risk = None, None, None, None
async
def
send_email
():
email
=
get_config
(
'reports.exports.real-daily.email'
)
receives
=
email
[
'receives'
]
copies
=
email
[
'copies'
]
if
'copies'
in
email
and
email
[
'copies'
]
is
not
None
else
[]
recommends
=
await
recommend
()
subject
=
email
[
'subject'
][
'rebalance'
]
.
format
(
today
=
format_date
(
dt
.
date
.
today
()))
content
=
json
.
dumps
(
recommends
)
sendmail
(
receives
=
receives
,
copies
=
copies
,
subject
=
subject
,
content
=
content
,
attach_paths
=
None
)
with
TemporaryDirectory
()
as
tmpdir
:
filepath
=
os
.
path
.
join
(
tmpdir
,
"portfolio.json"
)
with
open
(
filepath
,
"w"
,
encoding
=
'utf-8'
)
as
file
:
recommends
=
await
recommend
()
json
.
dump
(
recommends
,
file
,
indent
=
4
,
ensure_ascii
=
False
)
email
=
get_config
(
'reports.exports.real-daily.email'
)
receives
=
email
[
'receives'
]
copies
=
email
[
'copies'
]
if
'copies'
in
email
and
email
[
'copies'
]
is
not
None
else
[]
subject
=
email
[
'subject'
][
'rebalance'
]
.
format
(
today
=
format_date
(
dt
.
date
.
today
()))
content
=
email
[
'content'
][
'rebalance'
]
sendmail
(
receives
=
receives
,
copies
=
copies
,
subject
=
subject
,
content
=
content
,
attach_paths
=
[
filepath
])
def
get_today_rec
():
...
...
@@ -85,7 +91,7 @@ async def recommend():
'risk'
:
risk
,
'rr'
:
round
(
sum
([
id_ticker_map
[
key
][
'risk'
]
*
weight
for
key
,
weight
in
funds
.
items
()]),
2
),
'cp'
:
cp
,
'roi'
:
roi
}
note
=
{
'recomman_reason'
:
"推荐理由是:"
}
note
=
{
'recomman_reason'
:
"推荐理由是:
...
"
}
data
[
'note'
]
=
json
.
dumps
(
note
)
# 计算股债比
stock_weight
=
int
(
...
...
@@ -116,8 +122,8 @@ async def startup_event():
current_time
=
dt
.
datetime
.
now
()
target_time
=
dt
.
time
(
10
,
20
)
if
current_time
.
time
()
>
target_time
:
# await send_email()
scheduler
.
add_job
(
main
.
start
,
trigger
=
DateTrigger
(
run_date
=
current_time
))
await
send_email
()
# 开启定时任务,执行实盘
scheduler
.
add_job
(
main
.
start
,
'cron'
,
day_of_week
=
'0-4'
,
hour
=
10
,
minute
=
20
)
scheduler
.
add_job
(
send_email
,
'cron'
,
day_of_week
=
'0-4'
,
hour
=
10
,
minute
=
25
)
...
...
@@ -125,4 +131,4 @@ async def startup_event():
if
__name__
==
"__main__"
:
uvicorn
.
run
(
"robo_controller:app"
,
host
=
"0.0.0.0"
,
port
=
get_config
(
'web.port'
))
uvicorn
.
run
(
"robo_controller:app"
,
host
=
"0.0.0.0"
,
port
=
get_config
(
'web.port'
))
\ No newline at end of file
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