Browse Source

增加交易所Id

master
shanji 3 years ago
parent
commit
0b95b4bf32
  1. 3
      Binance.TradeRobot.API/Binance.TradeRobot.API.xml
  2. 5
      Binance.TradeRobot.API/Controllers/ExchangeAccountController.cs
  3. 3
      Binance.TradeRobot.Business/Binance.TradeRobot.Business.xml
  4. 6
      Binance.TradeRobot.Business/Business/ExchangeBusiness.cs
  5. 3
      Binance.TradeRobot.Business/Business/RobotBusiness.cs
  6. 18
      Binance.TradeRobot.Model/Base/Enums.cs
  7. 20
      Binance.TradeRobot.Model/Binance.TradeRobot.Model.xml
  8. 3
      Binance.TradeRobot.Model/Db/Exchange/ExchangeAccount.cs
  9. 2
      Binance.TradeRobot.Model/Db/Robot/Robot.cs
  10. 5
      Binance.TradeRobot.Model/Db/Robot/RobotAccount.cs
  11. 3
      Binance.TradeRobot.Model/Db/User/UserAccountProfitLossRecord.cs
  12. 2
      Binance.TradeRobot.Model/Dto/Request/Exchange/AddExchangeAccountRequest.cs
  13. 2
      Binance.TradeRobot.Model/Dto/Request/Robot/AddRobotRequest.cs

3
Binance.TradeRobot.API/Binance.TradeRobot.API.xml

@ -23,11 +23,12 @@
<param name="tradePolicy">交易策略</param>
<returns></returns>
</member>
<member name="M:Binance.TradeRobot.API.Controllers.ExchangeAccountController.GetNoUsedExchangeAccountList(Binance.TradeRobot.Model.Base.Enums.TradePolicy)">
<member name="M:Binance.TradeRobot.API.Controllers.ExchangeAccountController.GetNoUsedExchangeAccountList(Binance.TradeRobot.Model.Base.Enums.TradePolicy,Binance.TradeRobot.Model.Base.Enums.Exchange)">
<summary>
获取APIKey未使用的交易所账户列表
</summary>
<param name="tradePolicy"></param>
<param name="exchangeId"></param>
<returns></returns>
</member>
<member name="M:Binance.TradeRobot.API.Controllers.RobotController.AddPyramidPolicyRobot(Binance.TradeRobot.Model.Dto.AddPyramidPolicyRobotRequest)">

5
Binance.TradeRobot.API/Controllers/ExchangeAccountController.cs

@ -53,11 +53,12 @@ namespace Binance.TradeRobot.API.Controllers
/// 获取APIKey未使用的交易所账户列表
/// </summary>
/// <param name="tradePolicy"></param>
/// <param name="exchangeId"></param>
/// <returns></returns>
[HttpGet("{tradePolicy}")]
public IList<ExchangeAccountResponse> GetNoUsedExchangeAccountList([FromRoute]Enums.TradePolicy tradePolicy)
public IList<ExchangeAccountResponse> GetNoUsedExchangeAccountList([FromRoute] Enums.TradePolicy tradePolicy, [FromRoute] Enums.Exchange exchangeId)
{
return exchangeBusiness.GetNoUsedExchangeAccountList(tradePolicy);
return exchangeBusiness.GetNoUsedExchangeAccountList(tradePolicy, exchangeId);
}
}
}

3
Binance.TradeRobot.Business/Binance.TradeRobot.Business.xml

@ -4,11 +4,12 @@
<name>Binance.TradeRobot.Business</name>
</assembly>
<members>
<member name="M:Binance.TradeRobot.Business.Exchange.ExchangeBusiness.GetNoUsedExchangeAccountList(Binance.TradeRobot.Model.Base.Enums.TradePolicy)">
<member name="M:Binance.TradeRobot.Business.Exchange.ExchangeBusiness.GetNoUsedExchangeAccountList(Binance.TradeRobot.Model.Base.Enums.TradePolicy,Binance.TradeRobot.Model.Base.Enums.Exchange)">
<summary>
获取APIKey未使用交易所账户列表
</summary>
<param name="tradePolicy"></param>
<param name="exchangeId"></param>
<returns></returns>
</member>
<member name="M:Binance.TradeRobot.Business.RobotBusiness.CheckRobotRegister(Binance.TradeRobot.Model.Dto.AddRobotRequest,Binance.TradeRobot.Model.Db.ExchangeAPIKey@)">

6
Binance.TradeRobot.Business/Business/ExchangeBusiness.cs

@ -135,10 +135,12 @@ namespace Binance.TradeRobot.Business.Exchange
/// 获取APIKey未使用交易所账户列表
/// </summary>
/// <param name="tradePolicy"></param>
/// <param name="exchangeId"></param>
/// <returns></returns>
public IList<ExchangeAccountResponse> GetNoUsedExchangeAccountList(Enums.TradePolicy tradePolicy)
public IList<ExchangeAccountResponse> GetNoUsedExchangeAccountList(Enums.TradePolicy tradePolicy, Enums.Exchange exchangeId)
{
var exchangeAccountList = fsql.Select<ExchangeAccount>().Where(ea => ea.TradePolicy == tradePolicy).ToList().Map<IList<ExchangeAccountResponse>>();
var exchangeAccountList = fsql.Select<ExchangeAccount>().Where(ea => ea.TradePolicy == tradePolicy && ea.ExchangeId == exchangeId)
.ToList().Map<IList<ExchangeAccountResponse>>();
var accountIdList = exchangeAccountList.Select(ea => ea.Id);
var exchangeAPIKeyList = fsql.Select<ExchangeAPIKey>().Where(k => k.RobotId == null && accountIdList.Contains(k.AccountId))
.ToList()

3
Binance.TradeRobot.Business/Business/RobotBusiness.cs

@ -51,7 +51,8 @@ namespace Binance.TradeRobot.Business
Id = idGenerator.NewLong(),
Symbol = addRobotRequest.Symbol,
TradePolicy = addRobotRequest.TradePolicy,
BusinessType = addRobotRequest.TradePolicy.GetBusinessType()
BusinessType = addRobotRequest.TradePolicy.GetBusinessType(),
ExchangeId = addRobotRequest.ExchangeId,
};
}

18
Binance.TradeRobot.Model/Base/Enums.cs

@ -97,5 +97,23 @@ namespace Binance.TradeRobot.Model.Base
_1M
}
#endregion
#region 交易所
/// <summary>
/// Binance=0, Gate.io=1
/// </summary>
public enum Exchange
{
/// <summary>
/// 币安
/// </summary>
Binance = 0,
/// <summary>
/// 芝麻开门
/// </summary>
Gate_IO = 1
}
#endregion
}
}

20
Binance.TradeRobot.Model/Binance.TradeRobot.Model.xml

@ -74,6 +74,21 @@
信号周期 1m=0,3m=1,5m=2,15m=3,30m=4,1h=5,2h=6,4h=7,6h=8,8h=9,12h=10,1d=11,3d=12,1w=13,1M=14
</summary>
</member>
<member name="T:Binance.TradeRobot.Model.Base.Enums.Exchange">
<summary>
Binance=0, Gate.io=1
</summary>
</member>
<member name="F:Binance.TradeRobot.Model.Base.Enums.Exchange.Binance">
<summary>
币安
</summary>
</member>
<member name="F:Binance.TradeRobot.Model.Base.Enums.Exchange.Gate_IO">
<summary>
芝麻开门
</summary>
</member>
<member name="P:Binance.TradeRobot.Model.Db.ExchangeAccount.BusinessType">
<summary>
业务类型
@ -139,6 +154,11 @@
盈利次数
</summary>
</member>
<member name="P:Binance.TradeRobot.Model.Db.RobotAccount.LoanAmount">
<summary>
总借币金额
</summary>
</member>
<member name="P:Binance.TradeRobot.Model.Db.User.CostAmount">
<summary>
投资本金

3
Binance.TradeRobot.Model/Db/Exchange/ExchangeAccount.cs

@ -33,6 +33,9 @@ namespace Binance.TradeRobot.Model.Db
[Column(MapType = typeof(int))]
public Enums.TradePolicy TradePolicy { get; set; }
[Column(MapType = typeof(int))]
public Enums.Exchange ExchangeId { get; set; }
}
}

2
Binance.TradeRobot.Model/Db/Robot/Robot.cs

@ -32,6 +32,8 @@ namespace Binance.TradeRobot.Model.Db
[Column(MapType = (typeof(int)))]
public Enums.BusinessType BusinessType { get; set; }
[Column(MapType = (typeof(int)))]
public Enums.Exchange ExchangeId { get; set; }
}
}

5
Binance.TradeRobot.Model/Db/Robot/RobotAccount.cs

@ -41,6 +41,11 @@ namespace Binance.TradeRobot.Model.Db
/// </summary>
public long WinCount { get; set; } = 0;
/// <summary>
/// 总借币金额
/// </summary>
[Column(DbType = "decimal(18,8)")]
public decimal LoanAmount { get; set; } = 0.0M;
}
}

3
Binance.TradeRobot.Model/Db/User/UserAccountProfitLossRecord.cs

@ -54,6 +54,9 @@ namespace Binance.TradeRobot.Model.Db
[Column(DbType = "decimal(18,8)")]
public decimal UserProfit { get; set; } = 0.0M;
[Column(MapType = (typeof(int)))]
public Enums.Exchange ExchangeId { get; set; }
}
}

2
Binance.TradeRobot.Model/Dto/Request/Exchange/AddExchangeAccountRequest.cs

@ -8,6 +8,8 @@ namespace Binance.TradeRobot.Model.Dto
public string LoginName { get; set; }
public Enums.Exchange ExchangeId { get; set; }
/// <summary>
/// 交易策略
/// </summary>

2
Binance.TradeRobot.Model/Dto/Request/Robot/AddRobotRequest.cs

@ -13,5 +13,7 @@ namespace Binance.TradeRobot.Model.Dto
/// 交易所APIKeyId
/// </summary>
public long ExchangeAPIKeyId { get; set; }
public Enums.Exchange ExchangeId { get; set; }
}
}

Loading…
Cancel
Save