コード例 #1
0
        public ServiceResponse <ExchangeModel> GetExchangeByName(ExchangeType exchangeType)
        {
            var response = new ServiceResponse <ExchangeModel>(null);

            //Check Redis
            var cacheKey = "Exchange:" + (int)exchangeType;
            var result   = _redisCacheManager.Get <ExchangeModel>(cacheKey);

            //-------------------------------
            if (result != null)
            {
                response.Entity = result;
                return(response);
            }
            else
            {
                var exchangeResult = _context.Exchange.Where(ex => ex.Name == exchangeType.ToString()).FirstOrDefault();
                if (exchangeResult != null)
                {
                    var model = _mapper.Map <ExchangeModel>(exchangeResult);
                    response.Entity       = model;
                    response.IsSuccessful = true;
                    _redisCacheManager.Set(cacheKey, response.Entity, DateTime.Now.AddMinutes(1));
                }
            }
            return(response);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: wzugang/XAPI2
        static bool OnFilterSubscribe(object sender, ExchangeType exchange, int instrument_part1, int instrument_part2, int instrument_part3, IntPtr pInstrument)
        {
            // 当数字为0时,只判断交易所
            // 当交易所为
            if (instrument_part1 == 0)
            {
                // 只要上海与深圳,不处理三板
                return(exchange != ExchangeType.NEEQ);
            }

            //type = ExchangeType::SZE;
            //double1 = 399300;

            int prefix1 = instrument_part1 / 100000;
            int prefix3 = instrument_part1 / 1000;

            switch (exchange)
            {
            case ExchangeType.SSE:
                return(prefix1 == 6);

            case ExchangeType.SZSE:
                return((prefix1 == 0) || (prefix3 == 300));

            default:
                break;
            }

            return(true);
        }
コード例 #3
0
 public ExchangeAttribute(string name, ExchangeType type, bool durable = true, bool autoDelete = false)
 {
     Name       = name;
     Type       = type;
     Durable    = durable;
     AutoDelete = autoDelete;
 }
コード例 #4
0
        /// <summary>
        /// 更新24小时市场价,废弃
        /// </summary>
        /// <param name="platformId"></param>
        /// <param name="coinId"></param>
        /// <param name="exchangeId"></param>
        /// <param name="exName"></param>
        /// <param name="platformCode"></param>
        /// <param name="coinCode"></param>
        public void TaskExecution(int platformId, int coinId, int exchangeId, string exName, string platformCode, string coinCode)
        {
            Log.Info("执行TaskExecution:" + platformCode + "_" + coinCode + "_" + exName);
            try
            {
                ExchangeType   eType      = (ExchangeType)Enum.Parse(typeof(ExchangeType), platformCode);
                ExChangeBase   eb         = ExchangeFactory.InstanExchange(eType);
                BasePriceModel priceModel = eb.GetNowPrice(coinCode, exName);
                if (priceModel == null)
                {
                    return;
                }
                //得到1970年的时间戳
                DateTime timeStamp = new DateTime(1970, 1, 1);
                //注意这里有时区问题,用now就要减掉8个小时
                string timestamps = Convert.ToString((DateTime.UtcNow.Ticks - timeStamp.Ticks) / 10000);
                InsertQuotes(platformId, coinId, exchangeId, platformCode, coinCode, timestamps, priceModel);

                GC.Collect();
            }
            catch (Exception ex)
            {
                Log.Error("执行查询插入数据出错" + ex);
            }
        }
コード例 #5
0
 private SuspectedClientInfo(ExchangeType exchangeType, string currency, decimal amount, long identifier)
 {
     ExchangeType = exchangeType;
     Currency     = currency ?? throw new ArgumentNullException(nameof(amount));
     Amount       = amount;
     Identifier   = identifier;
 }
コード例 #6
0
ファイル: ExchangeFactory.cs プロジェクト: llenroc/BEx
        public static Exchange GetAuthenticatedExchange(ExchangeType toGet)
        {
            if (_tokens == null)
            {
                LoadApiKeys();
            }

            AuthToken token;

            _tokens.TryGetValue(toGet, out token);

            switch (toGet)
            {
            case ExchangeType.BitStamp:
                return(new BitStamp(
                           token.ApiKey,
                           token.Secret,
                           token.ClientId));

            case ExchangeType.Bitfinex:
                return(new Bitfinex(
                           token.ApiKey,
                           token.Secret));

            case ExchangeType.Gdax:
                return(new Gdax(
                           token.ApiKey,
                           token.Secret,
                           token.ClientId
                           ));

            default:
                return(null);
            }
        }
コード例 #7
0
ファイル: RedisRepository.cs プロジェクト: galyamichevp/pet
        public async Task <CacheExchangeInfo> GetExchangeInfo(ExchangeType @base, ExchangeType target)
        {
            try
            {
                var exchangeInfoCache = await _distributedCache.GetAsync(@base.ToString());

                if (exchangeInfoCache == null)
                {
                    return new CacheExchangeInfo
                           {
                               BaseType = @base,
                               Rates    = Enumerable.Empty <ExchangeRateInfo>().ToList()
                           }
                }
                ;

                var exchangeInfoList = ZeroFormatterSerializer.Deserialize <CacheExchangeInfo>(exchangeInfoCache);

                return(target == ExchangeType.NONE
                    ? exchangeInfoList
                    : exchangeInfoList.FilterRatesByType(target));
            }
            catch (InvalidOperationException ex)
            {
                _logger.LogError(ex, ex.Message);
                throw ex;
            }
        }
コード例 #8
0
 public BusOptions()
 {
     Hostname     = "localhost";
     VirtualHost  = "/";
     ExchangeName = "DefaultExchange";
     ExchangeType = ExchangeType.Topic;
 }
コード例 #9
0
 public static string GetCandlestickCachedDataFileName(ExchangeType e, string baseCurrency, string marketCurrency, int intervalMin, DateTime start, DateTime end)
 {
     return(e.ToString() + "_" + baseCurrency + "_" + marketCurrency + "_" + intervalMin + "_" +
            DateTime2String(start) + "_" +
            DateTime2String(end) + "_" +
            "CandlestickData.xml");
 }
コード例 #10
0
 public static string GetTradeHistoryCachedDataFileName(ExchangeType e, string baseCurrency, string marketCurrency, DateTime start, DateTime end)
 {
     return(e.ToString() + "_" + baseCurrency + "_" + marketCurrency + "_" +
            DateTime2String(start) + "_" +
            DateTime2String(end) + "_" +
            "TradeHistory.xml");
 }
        protected override Expression <Func <RabbitMqExchangeOptions, bool> > ToExpression()
        {
            var allowedExchangeTypes = ExchangeType.All() !;

            // Do not validate dead letter exchange type if actual DeadLetterExchange is empty.
            return(options => string.IsNullOrEmpty(options.DeadLetterExchange) || allowedExchangeTypes.Contains(options.DeadLetterExchangeType));
        }
コード例 #12
0
ファイル: ResponseVerification.cs プロジェクト: llenroc/BEx
        public static void VerifyOpenOrders(
            OpenOrders toVerify,
            ExchangeType source,
            TradingPair pair)
        {
            ResponseVerification.VerifyApiResult(toVerify, source);

            foreach (var openOrder in toVerify.BuyOrders)
            {
                var order = openOrder.Value;

                ResponseVerification.VerifyApiResult(order, source);

                Assert.That(order.IsBuyOrder);
                Assert.That(order.Amount > 0.0m);
                Assert.That(!string.IsNullOrEmpty(order.Id));
                Assert.That(openOrder.Key == order.Id);
                Assert.That(order.Price > 0.0m);
            }

            foreach (var openOrder in toVerify.SellOrders)
            {
                var order = openOrder.Value;

                ResponseVerification.VerifyApiResult(order, source);

                Assert.That(order.IsSellOrder);
                Assert.That(order.Amount > 0.0m);
                Assert.That(!string.IsNullOrEmpty(order.Id));
                Assert.That(openOrder.Key == order.Id);
                Assert.That(order.Price > 0.0m);
            }
        }
コード例 #13
0
ファイル: SimpleSwap.cs プロジェクト: michaelrapoport/DiceBot
        public SimpleSwap(ExchangeType Type, string LockedCurrency, string Deposit)
        {
            InitializeComponent();
            GetCurrencies();
            Client = new HttpClient { BaseAddress = baseAddress };
            if (Type == ExchangeType.deposit)
            {
                cbTo.Enabled = false;

                txtReceiving.Text = Deposit;
                txtReceiving.ReadOnly = true;
                cbTo.SelectedIndex = Array.IndexOf(Currencies, LockedCurrency);
                if (cbTo.SelectedIndex == -1)
                {
                    MessageBox.Show("Oops! It seems we can't swap to the currency you want!");
                    Type = ExchangeType.free;
                    cbTo.Enabled = true;
                    txtReceiving.ReadOnly = false;
                    txtReceiving.Text = "";
                }
            }
            else if (Type == ExchangeType.withdraw)
            {
                cbFrom.Enabled = false;
                cbFrom.SelectedIndex = Array.IndexOf(Currencies, LockedCurrency);
                if (cbFrom.SelectedIndex == -1)
                {
                    MessageBox.Show("Oops! It seems we can't swap from the currency you want!");
                    Type = ExchangeType.free;
                    cbFrom.Enabled = true;
                }
            }
        }
コード例 #14
0
        public override bool TryValidate(out string error)
        {
            error = "";

            if (string.IsNullOrWhiteSpace(Name))
            {
                error = "Please supply a name for the exchange";
                return(false);
            }

            if (string.IsNullOrWhiteSpace(ExchangeType))
            {
                error = "Please supply the type of exchange to create";
                return(false);
            }

            // Check that this is a valid exchange type
            if (!RabbitMQ.Client.ExchangeType.All().Contains(ExchangeType.ToLower()))
            {
                error = "Please supply a valid type of exchange to create";
                return(false);
            }

            return(true);
        }
コード例 #15
0
        public static ExChangeBase InstanExchange(ExchangeType exchange)
        {
            switch (exchange)
            {
                case ExchangeType.HuoBi:
                    return new HuoBiProduct(AppConfig.HuoBiApiAccessKey, AppConfig.HuoBiApiSeceretKey);
                   
                case ExchangeType.OKEX:

                    return new OkExProduct(AppConfig.OkExApiKey, AppConfig.OkExSecretKey);

                case ExchangeType.Gate:

                    return new GateProduct(AppConfig.GateApiKey, AppConfig.GateSecretKey);

                case ExchangeType.BiAn:

                    return new BiAnProduct(AppConfig.BiAnApiKey, AppConfig.BiAnSecretKey);

                case ExchangeType.ZB:

                    return new ZBProduct(AppConfig.ZBApiKey, AppConfig.ZBSecretKey);
                case ExchangeType.Coineal:

                    return new CoinealProduct(AppConfig.EalApiKey, AppConfig.EalSecretKey);
            }

            return null;

        }
コード例 #16
0
 public ExchangeDeclareParameters(string brokerName, ExchangeType exchangeType, bool exchangeDurable = false, bool exchangeAutoDelete = false)
 {
     BrokerName         = brokerName;
     ExchangeType       = exchangeType.ToString().ToLower();
     ExchangeDurable    = exchangeDurable;
     ExchangeAutoDelete = exchangeAutoDelete;
 }
コード例 #17
0
        public IBusSubscriber SubscribeEvent <TEvent>(string @namespace         = null, string queueName = null,
                                                      string prefixQueueName    = null,
                                                      ExchangeType exchangeType = ExchangeType.Unknown,
                                                      Func <TEvent, RabbitMqPubSubException, IRejectedEvent> onError = null)
            where TEvent : IEvent
        {
            _busClient.SubscribeAsync <TEvent, CorrelationContext>(async(@event, correlationContext) =>
            {
                var eventHandler = _serviceProvider.GetService <IEventHandler <TEvent> >();

                return(await TryHandleAsync(@event, correlationContext,
                                            () => eventHandler.HandleAsync(@event, correlationContext), onError));
            },
                                                                   ctx => ctx.UseSubscribeConfiguration((cfg) =>
            {
                cfg.FromDeclaredQueue(q => q.WithName(GetQueueName <TEvent>(@namespace, queueName, prefixQueueName)));
                if (exchangeType != ExchangeType.Unknown)
                {
                    cfg.OnDeclaredExchange(e => e.WithType(exchangeType).WithName(@namespace));
                }
            }
                                                                                                        ));

            return(this);
        }
コード例 #18
0
 private RabbitMqEndpoint(TransportUri uri, IRabbitMqProtocol protocol, ConnectionFactory factory, string exchangeName, ExchangeType exchangeType) : base(uri, protocol)
 {
     ConnectionFactory = factory;
     ExchangeName      = exchangeName;
     ExchangeType      = exchangeType;
     TransportUri      = uri;
 }
コード例 #19
0
    // returns if result clamped to 0
    public bool DoExchange(ExchangeType exchangeType, int diff)
    {
        if (data.ContainsKey(exchangeType))
        {
            data[exchangeType] += diff;
        }
        else
        {
            data[exchangeType] = diff;
        }

        if (data[exchangeType] < 0)
        {
            data[exchangeType] = 0;
            if (OnExchange != null)
            {
                OnExchange.Invoke();
            }
            return(false);
        }

        if (OnExchange != null)
        {
            OnExchange.Invoke();
        }

        return(true);
    }
コード例 #20
0
ファイル: AddLatePrice.cs プロジェクト: demon28/Remover
        /// <summary>
        /// 执行TASK更新市场深度
        /// </summary>
        /// <param name="model"></param>
        public void TaskExecution(VmpConfigModel model)
        {
            //Log.Info($"执行更新市场深度TaskExecution,platformCode={platformCode};coinCode={coinCode};currencyCode={currencyCode}");
            try
            {
                ExchangeType   eType      = (ExchangeType)Enum.Parse(typeof(ExchangeType), model.PlatformCode);
                ExChangeBase   eb         = ExchangeFactory.InstanExchange(eType);
                LatePriceModel priceModel = eb.GetLatestRecord(model.CurrencyCode, model.ExCurrencyCode);
                if (priceModel.Asks == null)
                {
                    Log.Error($"执行查询集合为空,platformCode={model.PlatformCode};coinCode={model.CurrencyCode};currencyCode={model.ExCurrencyCode}");
                    return;
                }

                //更新数据库市场深度
                //UpdateLatePriceFacade latePriceFacade =new UpdateLatePriceFacade();
                //latePriceFacade.InsertLatestRecord(model, priceModel);
                //更新缓存市场深度
                UpdateDepthFacade depthFacade = new UpdateDepthFacade();
                if (!depthFacade.UpdateLatePrice(model, priceModel))
                {
                    Log.Error($"Error,更新缓存市场深度失败,platformCode={model.PlatformCode};coinCode={model.CurrencyCode};currencyCode={model.ExCurrencyCode}");
                }

                GC.Collect();
            }
            catch (Exception ex)
            {
                Log.Error("执行查询插入数据出错" + ex);
            }
        }
コード例 #21
0
ファイル: RabbitMqProvider.cs プロジェクト: drtk712/Chegevala
        /// <summary>
        /// 为指定名称的channel创建Exchange
        /// </summary>
        /// <param name="channelName"></param>
        /// <param name="exchangeType"></param>
        /// <param name="exchangeName"></param>
        /// <returns></returns>
        public bool ConstructMqExchange(string channelName, ExchangeType exchangeType, string exchangeName)
        {
            if (string.IsNullOrEmpty(exchangeName))
            {
                LogHelper.LogError("Exchange Name Must Not Be NULL");
                return(false);
            }
            ConnectChannel channel = channelList.Find(n => n.ChannelName == channelName);

            if (channel == null)
            {
                LogHelper.LogError($"Channel {channelName} Not Exist.");
                return(false);
            }
            channel.ExchangeType = exchangeType;
            channel.ExchangeName = exchangeName;
            try
            {
                channel.ConsumerChannel.ExchangeDeclare(exchangeName, exchangeType.ToString(), true);
                return(true);
            }
            catch (Exception e)
            {
                LogHelper.LogError(e.Message);
                return(false);
            }
        }
コード例 #22
0
ファイル: Program.cs プロジェクト: handgod/QuantBox_XAPI
        static bool OnFilterSubscribe(object sender, ExchangeType exchange, int instrument_part1, int instrument_part2, int instrument_part3, IntPtr pInstrument)
        {
            // 当数字为0时,只判断交易所
            // 当交易所为
            if (instrument_part1 == 0)
                // 只要上海与深圳,不处理三板
                return exchange != ExchangeType.NEEQ;

            //type = ExchangeType::SZE;
            //double1 = 399300;

            int prefix1 = instrument_part1 / 100000;
            int prefix3 = instrument_part1 / 1000;
            switch (exchange)
            {
                case ExchangeType.SSE:
                    return (prefix1 == 6);
                case ExchangeType.SZE:
                    return (prefix1 == 0) || (prefix3 == 300);
                default:
                    break;
		    }

		    return true;
        }
コード例 #23
0
        private void Init()
        {
            double timerInterval = _exchangeType == ExchangeType.BinanceExchange ? RandomFast.Next(_settings.TimerInterval * 60, 2 * _settings.TimerInterval * 60) * 1000 : 1;

            switch (_settings.BotMode)
            {
            case BotMode.FixedProfit:
                _marketTimer.Interval = timerInterval;
                Strategy = new FixedProfitStrategy(_exchangeType, _settings);
                break;

            case BotMode.FixedPriceChange:
                _marketTimer.Interval = timerInterval;
                Strategy = new FixedPriceChangeStrategy(_exchangeType, _settings);
                break;

            case BotMode.TradingViewSignal:
                _marketTimer.Interval = 5000;     // Every 5 seconds
                Strategy = new TradingViewAlertStrategy(_exchangeType, _settings);
                break;

            case BotMode.Futures:
                _marketTimer.Interval = 10000;
                _exchangeType         = ExchangeType.BinanceFuturesExchange;
                Strategy = new FuturesStrategy(_exchangeType, _settings);
                break;

            default:
                Console.WriteLine("Unhandled Bot Mode.");
                Console.ReadLine();
                return;
            }
        }
コード例 #24
0
ファイル: SimpleSwap.cs プロジェクト: beducode/DiceBot-1
        public SimpleSwap(ExchangeType Type, string LockedCurrency, string Deposit)
        {
            InitializeComponent();
            GetCurrencies();
            Client = new HttpClient {
                BaseAddress = baseAddress
            };
            if (Type == ExchangeType.deposit)
            {
                cbTo.Enabled = false;

                txtReceiving.Text     = Deposit;
                txtReceiving.ReadOnly = true;
                cbTo.SelectedIndex    = Array.IndexOf(Currencies, LockedCurrency);
                if (cbTo.SelectedIndex == -1)
                {
                    MessageBox.Show("Oops! It seems we can't swap to the currency you want!");
                    Type                  = ExchangeType.free;
                    cbTo.Enabled          = true;
                    txtReceiving.ReadOnly = false;
                    txtReceiving.Text     = "";
                }
            }
            else if (Type == ExchangeType.withdraw)
            {
                cbFrom.Enabled       = false;
                cbFrom.SelectedIndex = Array.IndexOf(Currencies, LockedCurrency);
                if (cbFrom.SelectedIndex == -1)
                {
                    MessageBox.Show("Oops! It seems we can't swap from the currency you want!");
                    Type           = ExchangeType.free;
                    cbFrom.Enabled = true;
                }
            }
        }
コード例 #25
0
        public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
        .ConfigureServices((hostContext, services) =>
        {
            var argsList  = args.ToList();
            var queueName = argsList.FirstOrDefault(a => a.StartsWith("queue"))?.Split("=").ElementAtOrDefault(1);

            var exchangeName = argsList.FirstOrDefault(a => a.StartsWith("exchange"))?.Split("=").ElementAtOrDefault(1);
            var exchangeType = ExchangeType.Parse(argsList.FirstOrDefault(a => a.StartsWith("type"))?.Split("=").ElementAtOrDefault(1));
            var routingKey   = argsList.FirstOrDefault(a => a.StartsWith("routingKey"))?.Split("=").ElementAtOrDefault(1);

            var workerName = argsList.FirstOrDefault(a => a.StartsWith("worker"))?.Split("=").ElementAtOrDefault(1) ?? "Noname";

            var cfgProvider = string.IsNullOrEmpty(exchangeName) || string.IsNullOrEmpty(routingKey)
                        ? new ConsumerWorkerConfigProvider(queueName,
                                                           workerName)
                        : new ConsumerWorkerConfigProvider(exchangeName,
                                                           exchangeType,
                                                           routingKey,
                                                           workerName);

            services.AddSingleton <IConsumerWorkerConfigProvider>(cfgProvider);
            services.RegisterEventsSubscriber(hostContext.Configuration);
            services.AddHostedService <QueueConsumerService>();
        });
コード例 #26
0
ファイル: UserTransaction.cs プロジェクト: llenroc/BEx
 internal UserTransaction(
     decimal baseCurrencyAmount,
     decimal counterCurrencyAmount,
     long timeStamp,
     decimal exchangeRate,
     string orderId,
     decimal tradeFee,
     Currency tradeFeeCurrency,
     TradingPair pair,
     ExchangeType sourceExchange,
     OrderType orderType,
     int transactionId)
     : this()
 {
     BaseCurrencyAmount    = baseCurrencyAmount;
     CounterCurrencyAmount = counterCurrencyAmount;
     TransactionType       = orderType;
     UnixTimeStamp         = timeStamp;
     ExchangeRate          = exchangeRate;
     OrderId              = orderId;
     TradeFee             = tradeFee;
     TradeFeeCurrency     = tradeFeeCurrency;
     Pair                 = pair;
     SourceExchange       = sourceExchange;
     CompletedTime        = UnixTimeStamp.ToDateTimeUTC();
     ExchangeTimeStampUTC = CompletedTime;
     LocalTimeStampUTC    = DateTime.UtcNow;
     TransactionId        = transactionId;
 }
コード例 #27
0
ファイル: ExchangeTypeManager.cs プロジェクト: cafc79/SIA
        public ExchangeTypeCompositeType getExchangeTypeById(int iIdExchangeType)
        {
            ExchangeTypeCompositeType etct = new ExchangeTypeCompositeType();
            ExchangeType et = new ExchangeType();

            etct = et.GetExchangeTypeById(iIdExchangeType);
            return(etct);
        }
コード例 #28
0
ファイル: ExchangeTypeManager.cs プロジェクト: cafc79/SIA
        public List <ExchangeTypeCompositeType> getAllExchangeType()
        {
            List <ExchangeTypeCompositeType> lst = new List <ExchangeTypeCompositeType>();
            ExchangeType et = new ExchangeType();

            lst = et.getAll();
            return(lst);
        }
コード例 #29
0
ファイル: ExchangeNode.cs プロジェクト: iodes/PrestoClient
 public ExchangeNode(PlanNodeId id, ExchangeType type, ExchangeScope scope, PartitioningScheme partitioningScheme, IEnumerable <PlanNode> sources, IEnumerable <List <Symbol> > inputs) : base(id)
 {
     this.Type  = type;
     this.Scope = scope;
     this.PartitioningScheme = partitioningScheme ?? throw new ArgumentNullException("partitioningScheme");
     this.Sources            = sources ?? throw new ArgumentNullException("sources");
     this.Inputs             = inputs ?? throw new ArgumentNullException("inputs");
 }
コード例 #30
0
            protected ExchangeBuilderBase(ConnectionFactory connectionFactory, string exchangeName, ExchangeType exchangeType)
            {
                ConnectionFactory = connectionFactory;
                ExchangeName      = exchangeName;
                _exchangeType     = exchangeType;

                CreateExchange();
            }
コード例 #31
0
 /// <summary>
 /// Initializes a new instance of 'ExchangeInfo' without navigational filter.
 /// </summary>
 /// <param name="exchangeType">Exchange type.</param>
 /// <param name="className">Class name.</param>
 /// <param name="iuName">IU Name.</param>
 /// <param name="previousContext">Previous context.</param>
 public ExchangeInfo(
     ExchangeType exchangeType,
     string className,
     string iuName,
     IUContext previousContext)
     : this(exchangeType, className, iuName, false, previousContext)
 {
 }
コード例 #32
0
        public void ExchangeDeclared(NodeContext context, string name, ExchangeType exchangeType)
        {
            All(x =>
            {
                x.ExchangeDeclared(context, name, exchangeType);

                return(true);
            });
        }
コード例 #33
0
ファイル: TopologyBuilder.cs プロジェクト: Hibame/EasyNetQ
        public void CreateExchange(string exchangeName, ExchangeType exchangeType)
        {
            if(exchangeName == null)
            {
                throw new ArgumentNullException("exchangeName");
            }

            model.ExchangeDeclare(exchangeName, Enum.GetName(typeof(ExchangeType), exchangeType), true);
        }
コード例 #34
0
ファイル: Topology.cs プロジェクト: jonnii/chinchilla
        public IExchange DefineExchange(
            string name,
            ExchangeType exchangeType,
            Durability durablility = Durability.Durable,
            bool isAutoDelete = false)
        {
            var exchange = new Exchange(name, exchangeType)
            {
                IsAutoDelete = isAutoDelete,
                Durability = durablility
            };

            exchanges.Add(exchange);
            return exchange;
        }
コード例 #35
0
ファイル: Address.cs プロジェクト: moprise/spring-net-amqp
 /// <summary>
 /// Initializes a new instance of the <see cref="Address"/> class from an unstructured string
 /// </summary>
 /// <param name="address">The unstructured address.</param>
 public Address(string address)
 {
     if (address == null)
     {
         exchangeType = ExchangeType.Direct;
         exchangeName = "";
         routingKey = "";
     } else
     {
         Match match = PSEUDO_URI_PARSER.Match(address);
         if (match.Success)
         {
             string exchangeTypeAsString = match.Groups[1].Value;
             exchangeType = (ExchangeType)Enum.Parse(typeof(ExchangeType), exchangeTypeAsString, true);
             exchangeName = match.Groups[2].Value;
             routingKey = match.Groups[3].Value;
         } else
         {
             exchangeType = ExchangeType.Direct;
             exchangeName = "";
             routingKey = address;
         }
     }
 }
コード例 #36
0
ファイル: Currencies.cs プロジェクト: ryvers/CryptoDelivery
 public void SetCurrencyValue(CoinType coinType, ExchangeType exchangeType, Currency currency)
 {
     currenciesDictionary[coinType][exchangeType] = currency;
 }
コード例 #37
0
ファイル: Address.cs プロジェクト: moprise/spring-net-amqp
 /// <summary>
 /// Initializes a new instance of the <see cref="Address"/> class given the exchange type,
 ///  exchange name and routing key.
 /// </summary>
 /// <param name="exchangeType">Type of the exchange.</param>
 /// <param name="exchangeName">Name of the exchange.</param>
 /// <param name="routingKey">The routing key.</param>
 public Address(ExchangeType exchangeType, string exchangeName, string routingKey)
 {
     this.exchangeType = exchangeType;
     this.exchangeName = exchangeName;
     this.routingKey = routingKey;
 }
コード例 #38
0
 private static void TestExchange(Exchange exchange, string expectedName, ExchangeType expectedType, bool expectedDurable = true)
 {
     Assert.AreEqual(expectedName, exchange.Name, "Exchange Name");
     Assert.AreEqual(expectedType, exchange.ExchangeType, "Exchange Type");
     Assert.AreEqual(expectedDurable, exchange.Durable, "Exchange Durable");
 }
コード例 #39
0
 public Exchange(string name, ExchangeType type, bool isDurable)
 {
     this.Name = name;
     this.Type = type;
     this.IsDurable = isDurable;
 }
コード例 #40
0
ファイル: Exchange.cs プロジェクト: jamescrowley/chinchilla
 public Exchange(string name, ExchangeType exchangeType)
 {
     Name = name;
     Type = exchangeType;
 }
コード例 #41
0
		public IExchangeConfigurationBuilder WithType(ExchangeType exchangeType)
		{
			Configuration.ExchangeType = exchangeType.ToString().ToLower();
			return this;
		}
コード例 #42
0
ファイル: Currencies.cs プロジェクト: ryvers/CryptoDelivery
 public Currency GetCurrencyValue(CoinType coinType, ExchangeType exchangeType)
 {
     return currenciesDictionary[coinType][exchangeType];
 }
コード例 #43
0
 public RoutingInfo(string exchangeName, ExchangeType exchangeType, bool isDurable, string routingKey)
     : this(new Exchange(exchangeName, exchangeType, isDurable), routingKey)
 {
 }
コード例 #44
0
        /// <summary>
        /// Initializes a new instance of 'ExchangeInfo' without navigational filter.
        /// </summary>
        /// <param name="exchangeType">Exchange type.</param>
        /// <param name="className">Class name.</param>
        /// <param name="iuName">IU Name.</param>
        /// <param name="previousContext">Previous context.</param>
        public ExchangeInfo(
			ExchangeType exchangeType,
			string className,
			string iuName,
			IUContext previousContext)
            : this(exchangeType,className,iuName,false,previousContext)
        {
        }
コード例 #45
0
        /// <summary>
        /// Initializes a new instance of 'ExchangeInfo'.
        /// </summary>
        /// <param name="exchangeType">Exchange type.</param>
        /// <param name="className">Class name.</param>
        /// <param name="iuName">IU Name.</param>
        /// <param name="isNavigationalFilter">Navigational filter.</param>
        /// <param name="previousContext">Previous context.</param>
        public ExchangeInfo(
			ExchangeType exchangeType,
			string className,
			string iuName,
			bool isNavigationalFilter,
			IUContext previousContext)
        {
            ExchangeType = exchangeType;
            ClassName = className;
            IUName = iuName;
            NavigationalFilter = isNavigationalFilter;
            Previous = previousContext;
            // Initialize
            CustomData = null;
        }