|
|
@ -42,6 +42,7 @@ namespace Binance.TradeRobot.Business |
|
|
|
IUpdate<RobotAccount> updateRobotAccount = null; |
|
|
|
IList<IUpdate<User>> updateUserList = null; |
|
|
|
List<UserAccountProfitLossRecord> insertUserAccountProfitLossRecordList = null; |
|
|
|
IUpdate<D21Policy> updateD21Policy = null; |
|
|
|
|
|
|
|
|
|
|
|
if (spotOrderPublishInfo.SpotOrderState == Enums.SpotOrderState.Rejected || |
|
|
@ -111,6 +112,7 @@ namespace Binance.TradeRobot.Business |
|
|
|
//还币
|
|
|
|
var apiClient = GetBaseAPIClient(robot.ExchangeId, robot.ExchangeAPIKey.AccountId, robot.ExchangeAPIKey.APIKey, robot.ExchangeAPIKey.SecretKey); |
|
|
|
interest = apiClient.IsolatedMarginRepay(robot.Symbol, loanAmount); |
|
|
|
logList[0].Content = $"{logList[0].Content},借币金额:{loanAmount},还币利息:{interest}"; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -129,6 +131,9 @@ namespace Binance.TradeRobot.Business |
|
|
|
.SetIf(profit > 0M, ra => ra.WinCount + 1) |
|
|
|
.SetIf(interest > 0M, ra => ra.LoanAmount - loanAmount); |
|
|
|
|
|
|
|
if (profit > 0) //盈利复投
|
|
|
|
updateD21Policy = fsql.Update<D21Policy>(robot.D21Policy.Id).Set(p => p.Position + profit); |
|
|
|
|
|
|
|
var capitalChangeType = profit > 0M ? Enums.CapitalChangeType.Add : Enums.CapitalChangeType.Reduce; |
|
|
|
var userList = userBusiness.GetUserList(multiplyBy100: false); |
|
|
|
foreach (var user in userList) |
|
|
@ -164,6 +169,7 @@ namespace Binance.TradeRobot.Business |
|
|
|
fsql.Insert(logList).ExecuteAffrows(); |
|
|
|
updateSpotOrder.ExecuteAffrows(); |
|
|
|
updateRobotAccount?.ExecuteAffrows(); |
|
|
|
updateD21Policy?.ExecuteAffrows(); |
|
|
|
if (insertUserAccountProfitLossRecordList != null && insertUserAccountProfitLossRecordList.Count() > 0) |
|
|
|
fsql.Insert(insertUserAccountProfitLossRecordList).ExecuteAffrows(); |
|
|
|
if (updateUserList != null && updateUserList.Count() > 0) |
|
|
|