Browse Source

完善动2.1数据表

master
shanji 3 years ago
parent
commit
8c6ae51c9a
  1. 26
      Binance.TradeRobot.Model/Base/Enums.cs
  2. 24
      Binance.TradeRobot.Model/Db/Order/ExecutionLog.cs
  3. 54
      Binance.TradeRobot.Model/Db/Order/LoanOrder.cs
  4. 99
      Binance.TradeRobot.Model/Db/Order/SpotOrder.cs
  5. 63
      Binance.TradeRobot.Model/Db/Policy/Spot/D21Policy.cs
  6. 2
      Binance.TradeRobot.Model/Db/Robot/Robot.cs
  7. 2
      Binance.TradeRobot.Model/Db/代码生成/__重新生成.bat

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

@ -58,7 +58,7 @@ namespace Binance.TradeRobot.Model.Base
/// <summary> /// <summary>
/// 机器人状态 Stop=0,Runing=1 /// 机器人状态 Stop=0,Runing=1
/// </summary> /// </summary>
public enum RobotStatus public enum RobotState
{ {
Stop = 0, Stop = 0,
Runing = 1 Runing = 1
@ -114,6 +114,30 @@ namespace Binance.TradeRobot.Model.Base
/// </summary> /// </summary>
Gate_IO = 1 Gate_IO = 1
} }
/// <summary>
/// 借币状态 Loading=0 returned=1
/// </summary>
public enum LoanState
{
Loaning, retured
}
/// <summary>
/// 订单状态
/// </summary>
public enum OrderState
{
Created
}
/// <summary>
/// 交易方向 Buy=0,Sell=1
/// </summary>
public enum TradeDirection
{
Buy, Sell
}
#endregion #endregion
} }
} }

24
Binance.TradeRobot.Model/Db/Order/ExecutionLog.cs

@ -0,0 +1,24 @@
using FreeSql.DataAnnotations;
using System;
namespace Binance.TradeRobot.Model.Db
{
[Table(DisableSyncStructure = true)]
public partial class ExecutionLog {
[ Column(IsPrimary = true)]
public long Id { get; set; }
[Column(StringLength = 250, IsNullable = false)]
public string Content { get; set; }
[Column(InsertValueSql = "getdate()")]
public DateTime CreateTime { get; set; }
public long RobotId { get; set; }
}
}

54
Binance.TradeRobot.Model/Db/Order/LoanOrder.cs

@ -0,0 +1,54 @@
using Binance.TradeRobot.Model.Base;
using FreeSql.DataAnnotations;
using System;
namespace Binance.TradeRobot.Model.Db
{
[Table(DisableSyncStructure = true)]
public partial class LoanOrder
{
[Column(IsPrimary = true)]
public long Id { get; set; }
[Column(InsertValueSql = "getdate()")]
public DateTime CreateTime { get; set; }
/// <summary>
/// 交易所Id
/// </summary>
public int ExchangeId { get; set; }
[Column(MapType = typeof(int))]
public Enums.LoanState LoadState { get; set; } = Enums.LoanState.Loaning;
/// <summary>
/// 借币金额
/// </summary>
[Column(DbType = "decimal(18,8)")]
public decimal LoanAmount { get; set; } = 0.0M;
/// <summary>
/// 借币利息
/// </summary>
[Column(DbType = "decimal(18,8)")]
public decimal LoanFee { get; set; } = 0.0M;
[Column(StringLength = 50, IsNullable = false)]
public string LoanOrderId { get; set; }
public DateTime ReturnTime { get; set; }
public long RobotId { get; set; }
public long SpotOrderId { get; set; }
}
}

99
Binance.TradeRobot.Model/Db/Order/SpotOrder.cs

@ -0,0 +1,99 @@
using Binance.TradeRobot.Model.Base;
using FreeSql.DataAnnotations;
using System;
namespace Binance.TradeRobot.Model.Db
{
[Table(DisableSyncStructure = true)]
public partial class SpotOrder
{
[Column(IsPrimary = true)]
public long Id { get; set; }
[Column(InsertValueSql = "getdate()")]
public DateTime CreateTime { get; set; }
/// <summary>
/// 交易所Id
/// </summary>
public int ExchangeId { get; set; }
/// <summary>
/// 历史利润
/// </summary>
[Column(DbType = "decimal(18,8)")]
public decimal HistoryTotalProfit { get; set; } = 0.0M;
/// <summary>
/// 最后交易时间
/// </summary>
public DateTime? LastTradeTime { get; set; }
/// <summary>
/// 交易策略
/// </summary>
public int PolicyType { get; set; }
/// <summary>
/// 订单利润
/// </summary>
[Column(DbType = "decimal(18,8)")]
public decimal Profit { get; set; } = 0.0M;
public long RobotId { get; set; }
[Column(MapType = typeof(int))]
public Enums.OrderState States { get; set; }
[Column(MapType = typeof(int))]
public Enums.TradeDirection TradeDirection { get; set; }
[Column(StringLength = 50, IsNullable = false)]
public string Symbol { get; set; }
/// <summary>
/// 成交总额
/// </summary>
[Column(DbType = "decimal(18,8)")]
public decimal TradeAmount { get; set; } = 0.0M;
/// <summary>
/// 交易次数
/// </summary>
public int TradeCount { get; set; } = 0;
/// <summary>
/// 手续费
/// </summary>
[Column(DbType = "decimal(18,8)")]
public decimal TradeFee { get; set; } = 0.0M;
/// <summary>
/// 交易手续费单位
/// </summary>
[Column(StringLength = 15, IsNullable = false)]
public string TradeFeeUnit { get; set; }
/// <summary>
/// 成交均价
/// </summary>
[Column(DbType = "decimal(18,8)")]
public decimal TradePrice { get; set; } = 0.0M;
/// <summary>
/// 交易量
/// </summary>
[Column(DbType = "decimal(18,8)")]
public decimal TradeQuantity { get; set; }
}
}

63
Binance.TradeRobot.Model/Db/Policy/Spot/D21Policy.cs

@ -0,0 +1,63 @@
using Binance.TradeRobot.Model.Base;
using FreeSql.DataAnnotations;
using System;
namespace Binance.TradeRobot.Model.Db
{
[Table(DisableSyncStructure = true)]
public partial class D21Policy
{
[Column(IsPrimary = true)]
public long Id { get; set; }
[Column(InsertValueSql = "getdate()")]
public DateTime CreateTime { get; set; }
/// <summary>
/// 执行模式
/// </summary>
public int ExecutionMode { get; set; } = 0;
/// <summary>
/// 是否开启增购
/// </summary>
public bool IsEnabledIncreasePurchase { get; set; } = true;
/// <summary>
/// 是否开启错误信号补救
/// </summary>
public bool IsEnableRemedyForErrorCrossSignal { get; set; } = true;
/// <summary>
/// 最大追高比例
/// </summary>
[Column(DbType = "decimal(18,2)")]
public decimal MaxFollowPurchaseRatio { get; set; } = 0.0M;
/// <summary>
/// 信号周期
/// </summary>
public Enums.SignalPeriod PeriodicSignal { get; set; }
/// <summary>
/// 仓位
/// </summary>
[Column(DbType = "decimal(18,8)")]
public decimal Position { get; set; } = 0.0M;
public long RobotId { get; set; }
/// <summary>
/// 止损比例
/// </summary>
public decimal StopLossRatio { get; set; }
}
}

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

@ -24,7 +24,7 @@ namespace Binance.TradeRobot.Model.Db
public long RunningTime { get; set; } = 0; public long RunningTime { get; set; } = 0;
[Column(MapType = (typeof(int)))] [Column(MapType = (typeof(int)))]
public Enums.RobotStatus State { get; set; } public Enums.RobotState State { get; set; }
[Column(StringLength = 50, IsNullable = false)] [Column(StringLength = 50, IsNullable = false)]
public string Symbol { get; set; } public string Symbol { get; set; }

2
Binance.TradeRobot.Model/Db/代码生成/__重新生成.bat

@ -1 +1 @@
FreeSql.Generator -Razor 1 -NameOptions 1,0,0,0 -NameSpace Binance.TradeRobot.Model.Db -DB "SqlServer,data source=18.179.56.42;initial catalog=Binance.TradeRobot.DB;User Id=sa;Password=kaicn1132+-;TrustServerCertificate=true;pooling=true;max pool size=2" -FileName "{name}.cs" FreeSql.Generator -Razor 1 -NameOptions 1,0,0,0 -NameSpace Binance.TradeRobot.Model.Db -DB "SqlServer,data source=.;initial catalog=Binance.TradeRobot.DB;User Id=sa;Password=pc911103;TrustServerCertificate=true;pooling=true;max pool size=2" -FileName "{name}.cs"

Loading…
Cancel
Save