public static MeMarketOrderFeeModel Create( FeeType type, double size, string sourceClientId, string targetClientid, FeeSizeType sizeType, string[] assetIds) { return(new MeMarketOrderFeeModel { Type = (int)type, Size = size, SourceClientId = sourceClientId, TargetClientId = targetClientid, SizeType = (int)sizeType, AssetId = assetIds, }); }
internal static FeeModel GenerateCashInOutFee( double amount, int accuracy, string clientId, double feeSize = 0d, FeeSizeType feeSizeType = FeeSizeType.ABSOLUTE) { var feeAbsolute = 0d; if (feeSize > 0) { switch (feeSizeType) { case FeeSizeType.ABSOLUTE: feeAbsolute = feeSize; break; case FeeSizeType.PERCENTAGE: feeAbsolute = Math.Round(Math.Abs(amount) * feeSize, 15); break; } feeAbsolute = feeAbsolute.TruncateDecimalPlaces(accuracy, true); } if (Math.Abs(feeAbsolute) > 0) { return new FeeModel { Type = feeSize.GetFeeType(), Size = feeAbsolute, SourceClientId = null, TargetClientId = clientId, SizeType = FeeSizeType.ABSOLUTE, } } ; return(null); }
///<inheritdoc cref="IMatchingEngineClient"/> public Task <MeResponseModel> CashInOutAsync( string id, string clientId, string assetId, int accuracy, double amount, string feeClientId, double feeSize, FeeSizeType feeSizeType, CancellationToken cancellationToken = default) { var fee = FeeExtensions.GenerateCashInOutFee( amount, accuracy, feeClientId, feeSize, feeSizeType); var amountWithFee = fee?.CalculateAmountWithFee(amount, accuracy) ?? amount.TruncateDecimalPlaces(accuracy, true); var model = MeNewCashInOutModel.Create( id, clientId, assetId, amountWithFee, fee?.ToMeModel()); return(SendData( model, _newTasksManager, x => x.ToDomainModel(), _meResponsePolicy, cancellationToken, id, $"{assetId} with acc {accuracy} and fee type {feeSizeType}" )); }
public static MeLimitOrderFeeModel Create( FeeType type, double makerSize, double takerSize, string sourceClientId, string targetClientId, FeeSizeType makerSizeType, FeeSizeType takerSizeType, string[] assetId, double makerFeeModificator) { return(new MeLimitOrderFeeModel { Type = (int)type, MakerSize = makerSize, TakerSize = takerSize, SourceClientId = sourceClientId, TargetClientId = targetClientId, MakerSizeType = (int)makerSizeType, TakerSizeType = (int)takerSizeType, AssetId = assetId, MakerFeeModificator = makerFeeModificator }); }