币安量化交易
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.

58 lines
5.0 KiB

3 years ago
using AutoMapper;
using Binance.TradeRobot.Model.Db;
using Binance.TradeRobot.Model.Dto;
3 years ago
namespace Binance.TradeRobot.Model.Base
{
public class MappingProfiles : Profile
{
public MappingProfiles()
{
CreateMap<User, UserResponse>();
CreateMap<UserAccountFundChangeRecord, UserAccountFundChangeRecordResponse>();
CreateMap<AddExchangeAccountRequest, ExchangeAccount>();
CreateMap<AddExchangeAPIKeyRequest, ExchangeAPIKey>();
CreateMap<ExchangeAPIKey, ExchangeAPIKeyResponse>();
CreateMap<ExchangeAccount, ExchangeAccountResponse>();
CreateMap<Robot, RobotResponse>().ForPath(t => t.RobotAccount.Id, opt => opt.MapFrom(f => f.RobotAccountId))
.ForPath(t => t.RobotAccount.RobotId, opt => opt.MapFrom(f => f.Id))
.ForPath(t => t.RobotAccount.SoptCurrentcyAmount, opt => opt.MapFrom(f => f.SoptCurrentcyAmount))
.ForPath(t => t.RobotAccount.SpotCurrencyQuantity, opt => opt.MapFrom(f => f.SpotCurrencyQuantity))
.ForPath(t => t.RobotAccount.ClosePositionCount, opt => opt.MapFrom(f => f.ClosePositionCount))
.ForPath(t => t.RobotAccount.LoanAmount, opt => opt.MapFrom(f => f.LoanAmount))
.ForPath(t => t.RobotAccount.TotalProfit, opt => opt.MapFrom(f => f.TotalProfit))
.ForPath(t => t.RobotAccount.WinCount, opt => opt.MapFrom(f => f.WinCount))
.ForPath(t => t.ExchangeAPIKey.AccountId, opt => opt.MapFrom(f => f.ExchangeAccountId))
.ForPath(t => t.ExchangeAPIKey.APIKey, opt => opt.MapFrom(f => f.ExchangeAPIKey))
3 years ago
.ForPath(t => t.ExchangeAPIKey.SecretKey, opt => opt.MapFrom(f => f.ExchangeSecretKey));
//.ForPath(t => t.SymbolInfo.Id, opt => opt.MapFrom(f => f.SymbolId))
//.ForPath(t => t.SymbolInfo.Symbol, opt => opt.MapFrom(f => f.Symbol))
//.ForPath(t => t.SymbolInfo.SaleQuantityAccuracy, opt => opt.MapFrom(f => f.SymbolSaleQuantityAccuracy))
//.ForPath(t => t.SymbolInfo.ExchangeId, opt => opt.MapFrom(f => f.ExchangeId));
CreateMap<Robot, D21PolicyRobotResponse>().IncludeBase<Robot, RobotResponse>()
.ForPath(t => t.D21Policy.Id, opt => opt.MapFrom(f => f.D21PolicyId))
.ForPath(t => t.D21Policy.RobotId, opt => opt.MapFrom(f => f.Id))
.ForPath(t => t.D21Policy.Position, opt => opt.MapFrom(f => f.D21Position))
.ForPath(t => t.D21Policy.IsEnabledIncreasePurchase, opt => opt.MapFrom(f => f.D21IsEnabledIncreasePurchase))
.ForPath(t => t.D21Policy.IsEnableRemedyForErrorCrossSignal, opt => opt.MapFrom(f => f.D21IsEnableRemedyForErrorCrossSignal))
.ForPath(t => t.D21Policy.PeriodicSignal, opt => opt.MapFrom(f => f.D21PeriodicSignal))
.ForPath(t => t.D21Policy.MaxFollowPurchaseRatio, opt => opt.MapFrom(f => f.D21MaxFollowPurchaseRatio))
.ForPath(t => t.D21Policy.CreateTime, opt => opt.MapFrom(f => f.D21CreateTime))
.ForPath(t => t.D21Policy.ExecutionMode, opt => opt.MapFrom(f => f.D21ExecutionMode))
.ForPath(t => t.D21Policy.Assets, opt => opt.MapFrom(f => f.D21Assets))
.ForPath(t => t.D21Policy.MaxExchangeLoanRatio, opt => opt.MapFrom(f => f.D21MaxExchangeLoanRatio))
.ForPath(t => t.D21Policy.MaxSystemLoanRatio, opt => opt.MapFrom(f => f.D21MaxSystemLoanRatio))
.ForPath(t => t.D21Policy.Level1PositionStopLossRatio, opt => opt.MapFrom(f => f.D21Level1PositionStopLossRatio))
.ForPath(t => t.D21Policy.Level1PriceStopLossRatio, opt => opt.MapFrom(f => f.D21Level1PriceStopLossRatio))
.ForPath(t => t.D21Policy.Level2PositionStopLossRatio, opt => opt.MapFrom(f => f.D21Level2PositionStopLossRatio))
.ForPath(t => t.D21Policy.Level2PriceStopLossRatio, opt => opt.MapFrom(f => f.D21Level2PriceStopLossRatio));
CreateMap<EditD21PolicyRequest, D21Policy>();
CreateMap<EditPyramidPolicyRequest, PyramidPolicy>();
//CreateMap<SpotOrder, SpotOrderResponse>();
}
3 years ago
}
}