예제 #1
0
        private MessageSymbol CreateMessageSymbol(HitSymbol hitSymbol)
        {
            var message = new MessageSymbol(hitSymbol.Id)
            {
                Name                   = hitSymbol.Id,
                ProductAssetId         = hitSymbol.BaseCurrency,
                QuotingCurrencyAssetID = hitSymbol.QuoteCurrency,
                SymbolType             = SymbolType.Crypto,
                ExchangeId             = EXCHANGE_ID,
                HistoryType            = HistoryType.Last,
                VolumeType             = SymbolVolumeType.Volume,
                NettingType            = NettingType.Undefined,
                QuotingType            = SymbolQuotingType.LotSize,
                DeltaCalculationType   = DeltaCalculationType.TickDirection,
                VariableTickList       = new List <VariableTick>
                {
                    new VariableTick(double.NegativeInfinity, double.PositiveInfinity, true, (double)hitSymbol.TickSize, 1.0)
                },
                LotSize           = 1d,
                LotStep           = (double)hitSymbol.QuantityIncrement,
                NotionalValueStep = (double)hitSymbol.QuantityIncrement,
                MinLot            = (double)hitSymbol.QuantityIncrement,
                MaxLot            = int.MaxValue,

                AllowCalculateRealtimeChange = false,
                AllowCalculateRealtimeVolume = false,
                AllowCalculateRealtimeTicks  = false,
                AllowCalculateRealtimeTrades = false,

                AllowAbbreviatePriceByTickSize = true,

                SymbolAdditionalInfo = new List <AdditionalInfoItem>
                {
                    new AdditionalInfoItem
                    {
                        GroupInfo  = TRADING_INFO_GROUP,
                        SortIndex  = 100,
                        Id         = "Take liquidity rate",
                        NameKey    = loc.key("Take liquidity rate"),
                        ToolTipKey = loc.key("Take liquidity rate"),
                        DataType   = ComparingType.Double,
                        Value      = (double)hitSymbol.TakeLiquidityRate,
                        Hidden     = false
                    },
                    new AdditionalInfoItem
                    {
                        GroupInfo  = TRADING_INFO_GROUP,
                        SortIndex  = 110,
                        Id         = "Provide liquidity rate",
                        NameKey    = loc.key("Provide liquidity rate"),
                        ToolTipKey = loc.key("Provide liquidity rate"),
                        DataType   = ComparingType.Double,
                        Value      = (double)hitSymbol.ProvideLiquidityRate,
                        Hidden     = false
                    },
                    new AdditionalInfoItem
                    {
                        GroupInfo  = TRADING_INFO_GROUP,
                        SortIndex  = 120,
                        Id         = "Fee currency",
                        NameKey    = loc.key("Fee currency"),
                        ToolTipKey = loc.key("Fee currency"),
                        DataType   = ComparingType.String,
                        Value      = hitSymbol.FeeCurrency,
                        Hidden     = false
                    }
                }
            };

            if (this.currenciesCache.TryGetValue(hitSymbol.BaseCurrency, out HitCurrency baseCurrency) &&
                this.currenciesCache.TryGetValue(hitSymbol.QuoteCurrency, out HitCurrency quoteCurrency))
            {
                message.Description = $"{baseCurrency.FullName} vs {quoteCurrency.FullName}";
            }

            return(message);
        }
예제 #2
0
        private MessageSymbol CreateMessageSymbol(BitfinexSymbol bitfinexSymbol)
        {
            string baseAsset  = bitfinexSymbol.Pair.Substring(0, 3);
            string quoteAsset = bitfinexSymbol.Pair.Substring(3, 3);

            var message = new MessageSymbol(bitfinexSymbol.Pair)
            {
                AllowCalculateRealtimeChange   = false,
                AllowCalculateRealtimeVolume   = false,
                AllowCalculateRealtimeTrades   = false,
                AllowCalculateRealtimeTicks    = false,
                AllowAbbreviatePriceByTickSize = true,
                Description       = $"{baseAsset} vs {quoteAsset}",
                ExchangeId        = BitfinexConsts.EXCHANGE_ID,
                HistoryType       = HistoryType.Last,
                LotSize           = 1,
                LotStep           = Math.Pow(10, -8),
                NotionalValueStep = Math.Pow(10, -8),
                MinLot            = bitfinexSymbol.MinimumOrderSize,
                MaxLot            = bitfinexSymbol.MaximumOrderSize,
                Name                   = bitfinexSymbol.Pair,
                ProductAssetId         = baseAsset,
                QuotingCurrencyAssetID = quoteAsset,
                SymbolType             = SymbolType.Crypto,
                VolumeType             = SymbolVolumeType.Volume,
                QuotingType            = SymbolQuotingType.LotSize,
                DeltaCalculationType   = DeltaCalculationType.TickDirection,
                VariableTickList       = new List <VariableTick>
                {
                    new VariableTick(double.NegativeInfinity, double.PositiveInfinity, true, Math.Pow(10, -8), 1.0)
                }
            };

            message.SymbolAdditionalInfo = new List <AdditionalInfoItem>
            {
                new AdditionalInfoItem
                {
                    GroupInfo  = BitfinexConsts.TRADING_INFO_GROUP,
                    SortIndex  = 100,
                    Id         = "Allow margin trading",
                    NameKey    = loc.key("Allow margin trading"),
                    ToolTipKey = loc.key("Allow margin trading"),
                    DataType   = ComparingType.String,
                    Value      = bitfinexSymbol.AllowMargin,
                    Hidden     = false
                },
            };

            if (bitfinexSymbol.AllowMargin)
            {
                message.SymbolAdditionalInfo.Add(new AdditionalInfoItem
                {
                    GroupInfo  = BitfinexConsts.TRADING_INFO_GROUP,
                    SortIndex  = 110,
                    Id         = "Initial margin",
                    NameKey    = loc.key("Initial margin"),
                    ToolTipKey = loc.key("Initial margin"),
                    DataType   = ComparingType.Double,
                    Value      = bitfinexSymbol.InitialMargin,
                    Hidden     = false
                });

                message.SymbolAdditionalInfo.Add(new AdditionalInfoItem
                {
                    GroupInfo  = BitfinexConsts.TRADING_INFO_GROUP,
                    SortIndex  = 120,
                    Id         = "Minimum margin",
                    NameKey    = loc.key("Minimum margin"),
                    ToolTipKey = loc.key("Minimum margin"),
                    DataType   = ComparingType.Double,
                    Value      = bitfinexSymbol.MinimumMargin,
                    Hidden     = false
                });
            }

            return(message);
        }