|
@@ -36,20 +36,20 @@ function getApp(key) {
|
|
|
let app = {
|
|
|
id: -1,
|
|
|
port: -1,
|
|
|
- path:"",
|
|
|
- programName:"",
|
|
|
- strategyName:"",
|
|
|
+ path: "",
|
|
|
+ programName: "",
|
|
|
+ strategyName: "",
|
|
|
childProcess: undefined,
|
|
|
nowBalance: -1,
|
|
|
- posNum:-1,
|
|
|
+ posNum: -1,
|
|
|
messlist: [],
|
|
|
threadStatus: RobotStatus.STOPPED,
|
|
|
errorMessage: "成功",
|
|
|
threadStartTime: -1,
|
|
|
status: 0,
|
|
|
restartStatus: 0,
|
|
|
- closeTime:0,
|
|
|
- isClearance:false,
|
|
|
+ closeTime: 0,
|
|
|
+ isClearance: false,
|
|
|
|
|
|
}
|
|
|
// logger.info(appMap, appMap.has(key));
|
|
@@ -550,10 +550,30 @@ function delRobot(app) {
|
|
|
// delApp(app.id)
|
|
|
// }
|
|
|
}
|
|
|
-//----------------------------------------------
|
|
|
+
|
|
|
//----------------------------------------------
|
|
|
|
|
|
+// 新策略-获取状态
|
|
|
+function predictorState(app) {
|
|
|
+ var accUrl = "http://127.0.0.1:" + app.port
|
|
|
+ //拿到策略余额
|
|
|
+ try {
|
|
|
+ var config = getRustConfig()
|
|
|
+ http.request_get(`${accUrl}/predictor_state`, {...config.headers})
|
|
|
+ .then((data) => {
|
|
|
+ var d = JSON.parse(data)
|
|
|
+ return {'code': 200, 'data': d, "message": "SUCCESS"}
|
|
|
+ }).catch((error) => {
|
|
|
+ // 处理可能发生的错误
|
|
|
+ logger.error(`#####################汇报:获取状态请求失败: ${error.message}`)
|
|
|
+ return {'code': -1, 'data': null, "message": `获取状态请求失败${error.message}`}
|
|
|
+ });
|
|
|
+ } catch (e) {
|
|
|
+ logger.error('请求失败!:', e)
|
|
|
+ return {'code': -1, 'data': null, "message": "获取状态请求出错"}
|
|
|
+ }
|
|
|
|
|
|
+}
|
|
|
|
|
|
module.exports = {
|
|
|
run,
|
|
@@ -564,6 +584,7 @@ module.exports = {
|
|
|
robotAmount,
|
|
|
closeAppAll,
|
|
|
searchPositions,
|
|
|
+ predictorState,
|
|
|
appMap,
|
|
|
getApp,
|
|
|
getAppMap,
|