1111
1212from shipane_sdk import Client
1313from shipane_sdk .ap import APCronParser
14- from shipane_sdk .jobs .joinquant_following import JoinQuantFollowingJob
1514from shipane_sdk .jobs .new_stock_purchase import NewStockPurchaseJob
16- from shipane_sdk .jobs .ricequant_following import RiceQuantFollowingJob
15+ from shipane_sdk .jobs .online_quant_following import OnlineQuantFollowingJob
16+ from shipane_sdk .joinquant .client import JoinQuantClient
17+ from shipane_sdk .ricequant .client import RiceQuantClient
1718
1819if six .PY2 :
1920 ConfigParser = configparser .RawConfigParser
@@ -34,10 +35,16 @@ def __init__(self):
3435 self ._client = Client (host = self ._config .get ('ShiPanE' , 'host' ),
3536 port = self ._config .get ('ShiPanE' , 'port' ),
3637 key = self ._config .get ('ShiPanE' , 'key' ))
38+ self ._jq_client = JoinQuantClient (username = self ._config .get ('JoinQuant' , 'username' ),
39+ password = self ._config .get ('JoinQuant' , 'password' ),
40+ backtest_id = self ._config .get ('JoinQuant' , 'backtest_id' ))
41+ self ._rq_client = RiceQuantClient (username = self ._config .get ('RiceQuant' , 'username' ),
42+ password = self ._config .get ('RiceQuant' , 'password' ),
43+ run_id = self ._config .get ('RiceQuant' , 'run_id' ))
3744
3845 self ._new_stock_purchase_job = NewStockPurchaseJob (self ._config , self ._client )
39- self ._joinquant_following_job = JoinQuantFollowingJob (self ._config , self ._client )
40- self ._ricequant_following_job = RiceQuantFollowingJob (self ._config , self ._client )
46+ self ._jq_following_job = OnlineQuantFollowingJob (self ._client , self ._jq_client , 'JoinQuantFollowingJob' )
47+ self ._rq_following_job = OnlineQuantFollowingJob (self ._client , self ._rq_client , 'RiceQuantFollowingJob' )
4148
4249 def start (self ):
4350 scheduler = BackgroundScheduler ()
@@ -49,14 +56,16 @@ def start(self):
4956 self ._log .warning ('New stock purchase job is not enabled' )
5057
5158 if self ._config .getboolean ('JoinQuant' , 'enabled' ):
52- scheduler .add_job (self ._joinquant_following_job ,
53- APCronParser .parse (self ._config .get ('JoinQuant' , 'schedule' )))
59+ scheduler .add_job (self ._jq_following_job ,
60+ APCronParser .parse (self ._config .get ('JoinQuant' , 'schedule' )),
61+ None , None , None , self ._jq_following_job .name )
5462 else :
5563 self ._log .warning ('JoinQuant following job is not enabled' )
5664
5765 if self ._config .getboolean ('RiceQuant' , 'enabled' ):
58- scheduler .add_job (self ._ricequant_following_job ,
59- APCronParser .parse (self ._config .get ('RiceQuant' , 'schedule' )))
66+ scheduler .add_job (self ._rq_following_job ,
67+ APCronParser .parse (self ._config .get ('RiceQuant' , 'schedule' )),
68+ None , None , None , self ._rq_following_job .name )
6069 else :
6170 self ._log .warning ('RiceQuant following job is not enabled' )
6271
0 commit comments