Beispiel #1
0
        public string FilterTrades(string username, string clientid, string acctcode, string symbol, string sectype, string time, string exchange, string side)
        {
            try
            {
                TradeFilter filter = new TradeFilter();
                filter.AcctCode = acctcode;
                int iClientId = 0;
                if (int.TryParse(clientid, out iClientId))
                {
                    filter.ClientId = iClientId;
                }
                filter.Exchange = exchange;
                filter.SecType  = sectype;
                filter.Side     = side;
                filter.Symbol   = symbol;
                filter.Time     = time;
                Trade[] trades = new IBTradingService().FilterTrades(username, filter);
                if (trades != null)
                {
                    trades.ToCSV();
                }

                return(string.Empty);
            }
            catch (Exception ex)
            {
                _Logger.Error(ex);
                throw ex;
            }
        }
Beispiel #2
0
        public Trading.Trade[] FilterTrades(string userName, TradeFilter tradeFilter)
        {
            try
            {
                IBUser user = _userManager.GetUser(userName);
                if (user != null)
                {
                    ExecutionFilter             filter     = new ExecutionFilter(tradeFilter.ClientId, tradeFilter.AcctCode, tradeFilter.Time, tradeFilter.Symbol, tradeFilter.SecType, tradeFilter.Exchange, tradeFilter.Side);
                    Messages.ExecutionMessage[] executions = user.FilterExecutions(filter);
                    if (executions != null)
                    {
                        return(executions.Select(p => ConvertExecutionToTrade(p, user)).ToArray());
                    }
                }

                return(null);
            }
            catch (Exception ex)
            {
                _Logger.Error(ex);
                throw ex;
            }
        }