Esempio n. 1
0
 public Task <IEnumerable <PairConfig> > GetAssigned(long id)
 {
     return(WithConnection((connection, transaction) =>
     {
         return _pairConfigManager.GetAssignedPairs(id, connection, transaction);
     }));
 }
Esempio n. 2
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;
            }));
        }
Esempio n. 3
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));
        }