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.
43 lines
1.7 KiB
43 lines
1.7 KiB
3 years ago
|
using Binance.TradeRobot.Model.Base;
|
||
|
using Binance.TradeRobot.Model.Db;
|
||
|
using Microsoft.Extensions.Caching.Memory;
|
||
|
using SDKAdapter.Model;
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using Yitter.IdGenerator;
|
||
|
|
||
|
namespace Binance.TradeRobot.Business
|
||
|
{
|
||
|
public class BaseSpotOrderPublishBusiness : BaseBusiness
|
||
|
{
|
||
|
protected DingBusiness dingBusiness { get; private set; }
|
||
|
|
||
|
public BaseSpotOrderPublishBusiness(IFreeSql fsql,
|
||
|
NLogManager logManager,
|
||
|
IIdGenerator idGenerator,
|
||
|
IMemoryCache memoryCache,
|
||
|
DingBusiness dingBusiness) : base(fsql, logManager, idGenerator, memoryCache) { this.dingBusiness = dingBusiness; }
|
||
|
|
||
|
public void HandleError(Exception ex,
|
||
|
List<ExecutionLog> logList,
|
||
|
string loggerName,
|
||
|
long robotId,
|
||
|
long orderId,
|
||
|
string step)
|
||
|
{
|
||
|
logList.Add(new ExecutionLog()
|
||
|
{
|
||
|
Id = idGenerator.NewLong(),
|
||
|
SourceSingal = Enums.SingalType.订单回调,
|
||
|
RobotId = robotId,
|
||
|
CreateTime = DateTime.Now,
|
||
|
Content = ex.Message
|
||
|
});
|
||
|
try { fsql.Insert(logList).ExecuteAffrows(); } catch { }
|
||
|
var errorMsg = $"交易警报,{Enums.SingalType.订单回调},{loggerName},robot {robotId},order {orderId},{step}";
|
||
|
logManager.GetLogger(loggerName).Error(ex, errorMsg);
|
||
|
dingBusiness.Send($"{errorMsg} {ex.Message}");
|
||
|
}
|
||
|
}
|
||
|
}
|