5 changed files with 92 additions and 4 deletions
@ -0,0 +1,41 @@ |
|||||
|
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 OrderController : BaseApiController |
||||
|
{ |
||||
|
private OrderBusiness orderBusiness; |
||||
|
public OrderController(OrderBusiness orderBusiness) |
||||
|
{ |
||||
|
this.orderBusiness = orderBusiness; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取现货/逐仓杠杆订单记录
|
||||
|
/// </summary>
|
||||
|
/// <param name="robotId"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet("{robotId}")] |
||||
|
public IList<SpotOrderResponse> GetSpotOrderList([FromRoute] long robotId) |
||||
|
{ |
||||
|
return orderBusiness.GetSpotOrderList(robotId); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取执行日志记录
|
||||
|
/// </summary>
|
||||
|
/// <param name="robotId"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet("{robotId}")] |
||||
|
public IList<ExecutionLogResponse> GetExecutionLogList([FromRoute] long robotId) |
||||
|
{ |
||||
|
return orderBusiness.GetExecutionLogList(robotId); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
using Binance.TradeRobot.Common.DI; |
||||
|
using Binance.TradeRobot.Model.Db; |
||||
|
using Binance.TradeRobot.Model.Dto; |
||||
|
using Microsoft.Extensions.Caching.Memory; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using System.Collections.Generic; |
||||
|
using Yitter.IdGenerator; |
||||
|
|
||||
|
namespace Binance.TradeRobot.Business |
||||
|
{ |
||||
|
[BatchRegistration(ServiceLifetime.Singleton, RegistrationType.Self)] |
||||
|
public class OrderBusiness : BaseBusiness |
||||
|
{ |
||||
|
public OrderBusiness(IFreeSql fsql, NLogManager logManager, IIdGenerator idGenerator, IMemoryCache memoryCache) : base(fsql, logManager, idGenerator, memoryCache) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public IList<SpotOrderResponse> GetSpotOrderList(long robotId) |
||||
|
{ |
||||
|
return fsql.Select<SpotOrder>().Where(o => o.RobotId == robotId).OrderByDescending(o => o.CreateTime).Page(1, 20).ToList<SpotOrderResponse>(); |
||||
|
} |
||||
|
|
||||
|
public IList<ExecutionLogResponse> GetExecutionLogList(long robotId) |
||||
|
{ |
||||
|
return fsql.Select<ExecutionLog>().Where(l => l.RobotId == robotId).OrderByDescending(l => l.CreateTime).Page(1, 50).ToList<ExecutionLogResponse>(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
using Binance.TradeRobot.Model.Db; |
||||
|
|
||||
|
namespace Binance.TradeRobot.Model.Dto |
||||
|
{ |
||||
|
public class ExecutionLogResponse : ExecutionLog |
||||
|
{ |
||||
|
} |
||||
|
} |
@ -0,0 +1,9 @@ |
|||||
|
using Binance.TradeRobot.Model.Db; |
||||
|
|
||||
|
namespace Binance.TradeRobot.Model.Dto |
||||
|
{ |
||||
|
public class SpotOrderResponse : SpotOrder |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
Loading…
Reference in new issue