コード例 #1
0
        public async Task <ExchangeConfig> GetExchangeConfig(int exchangeCode)
        {
            return(await WithConnection(async (connection, transaction) =>
            {
                ExchangeConfig exchangeConfig = await _exchangeConfigManager.Get(exchangeCode, connection, transaction);
                if (exchangeConfig != null)
                {
                    exchangeConfig.Pairs = (List <PairConfig>) await _pairConfigManager.GetAssignedPairs(exchangeCode, connection, transaction);
                }

                return exchangeConfig;
            }));
        }
コード例 #2
0
        /// <summary>
        /// Send order to Exchange
        /// </summary>
        /// <param name="orderId"></param>
        public async Task <ExchangeOrder> List(long orderId)
        {
            Order order = null;

            ExchangeConfig config = await WithConnection(async (connection, transaction) =>
            {
                order = await _orderManager.Get(orderId, connection);
                ExchangeConfig config = await _exchangeConfigManager.Get(order.ExchangeCode, connection, transaction);
                config.Pairs          = (List <PairConfig>) await _pairConfigManager.GetAssignedPairs(config.ExchangeCode, connection, transaction);
                return(config);
            });

            Func <Order, ExchangeConfig, Task <ExchangeOrder> > sender = orderSenders[config.ExchangeCode];

            return(await sender?.Invoke(order, config));
        }