You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
2.4 KiB
88 lines
2.4 KiB
using Binance.TradeRobot.Business;
|
|
using Binance.TradeRobot.Model.Dto;
|
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Binance.TradeRobot.API.Controllers
|
|
{
|
|
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
|
public class RobotController : BaseApiController
|
|
{
|
|
private RobotBusiness robotBusiness;
|
|
|
|
public RobotController(RobotBusiness robotBusiness)
|
|
{
|
|
this.robotBusiness = robotBusiness;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 开启机器人
|
|
/// </summary>
|
|
/// <param name="robotId"></param>
|
|
[HttpPost("{robotId}")]
|
|
public void StartRobot([FromRoute] long robotId)
|
|
{
|
|
robotBusiness.StartRobot(robotId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 停止机器人
|
|
/// </summary>
|
|
/// <param name="robotId"></param>
|
|
[HttpPost("{robotId}")]
|
|
public void StopRobot([FromRoute] long robotId)
|
|
{
|
|
robotBusiness.StopRobot(robotId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 刷新机器人运行时长
|
|
/// </summary>
|
|
[HttpPost]
|
|
public void RefreshRobotRuningTime()
|
|
{
|
|
robotBusiness.RefreshRobotRuningTime();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 创建金字塔策略机器人
|
|
/// </summary>
|
|
/// <param name="addRobotRequest"></param>
|
|
[HttpPost]
|
|
public void AddPyramidPolicyRobot([FromBody] AddRobotRequest addRobotRequest)
|
|
{
|
|
robotBusiness.AddPyramidPolicyRobot(addRobotRequest);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 创建动2.1策略机器人
|
|
/// </summary>
|
|
/// <param name="addRobotRequest"></param>
|
|
[HttpPost]
|
|
public void AddD21PolicyRobot([FromBody] AddRobotRequest addRobotRequest)
|
|
{
|
|
robotBusiness.AddD21PolicyRobot(addRobotRequest);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取动2.1机器人列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public IList<D21PolicyRobotResponse> GetD21PolicyRobotList()
|
|
{
|
|
return robotBusiness.GetD21PolicyRobotList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// D21补救检查
|
|
/// </summary>
|
|
[HttpPost]
|
|
public void D21Remedy()
|
|
{
|
|
robotBusiness.D21Remedy();
|
|
}
|
|
}
|
|
}
|
|
|