Esempio n. 1
0
        private OrderAction ToMeOrderAction(Models.Orders.OrderAction action)
        {
            OrderAction orderAction;

            switch (action)
            {
            case Models.Orders.OrderAction.Buy:
                orderAction = OrderAction.Buy;
                break;

            case Models.Orders.OrderAction.Sell:
                orderAction = OrderAction.Sell;
                break;

            default:
                throw new Exception("Unknown order action");
            }

            return(orderAction);
        }
Esempio n. 2
0
        private async Task <LimitOrderFeeModel> GetLimitOrderFee(string clientId, AssetPair assetPair, Models.Orders.OrderAction orderAction)
        {
            var fee = await _feeCalculatorClient.GetLimitOrderFees(clientId, assetPair.Id, assetPair.BaseAssetId, ToFeeOrderAction(orderAction));

            return(new LimitOrderFeeModel
            {
                MakerSize = (double)fee.MakerFeeSize,
                TakerSize = (double)fee.TakerFeeSize,
                SourceClientId = clientId,
                TargetClientId = _feeSettings.TargetClientId.WalletApi,
                Type = fee.MakerFeeSize == 0m && fee.TakerFeeSize == 0m ? (int)LimitOrderFeeType.NO_FEE : (int)LimitOrderFeeType.CLIENT_FEE
            });
        }
Esempio n. 3
0
        private async Task <MarketOrderFeeModel> GetMarketOrderFee(string clientId, string assetPairId, string assetId, Models.Orders.OrderAction orderAction)
        {
            var fee = await _feeCalculatorClient.GetMarketOrderAssetFee(clientId, assetPairId, assetId, ToFeeOrderAction(orderAction));

            return(new MarketOrderFeeModel
            {
                Size = (double)fee.Amount,
                SizeType = fee.Type == FeeType.Absolute
                    ? (int)FeeSizeType.ABSOLUTE
                    : (int)FeeSizeType.PERCENTAGE,
                SourceClientId = clientId,
                TargetClientId = fee.TargetWalletId ?? _feeSettings.TargetClientId.WalletApi,
                Type = fee.Amount == 0m
                    ? (int)MarketOrderFeeType.NO_FEE
                    : (int)MarketOrderFeeType.CLIENT_FEE,
                AssetId = string.IsNullOrEmpty(fee.TargetAssetId)
                    ? Array.Empty <string>()
                    : new [] { fee.TargetAssetId }
            });
        }
Esempio n. 4
0
        private Lykke.Service.FeeCalculator.AutorestClient.Models.OrderAction ToFeeOrderAction(Models.Orders.OrderAction action)
        {
            Lykke.Service.FeeCalculator.AutorestClient.Models.OrderAction orderAction;
            switch (action)
            {
            case Models.Orders.OrderAction.Buy:
                orderAction = Lykke.Service.FeeCalculator.AutorestClient.Models.OrderAction.Buy;
                break;

            case Models.Orders.OrderAction.Sell:
                orderAction = Lykke.Service.FeeCalculator.AutorestClient.Models.OrderAction.Sell;
                break;

            default:
                throw new Exception("Unknown order action");
            }

            return(orderAction);
        }