private static bool BuildAccountPortfolios() { try { // make sure we have no legacies foreach (AccountPortfolio account in s_accountList.Values) { account.Stop(); } s_accountList.Clear(); // build a portfolio for each account in AccountData table foreach (HugoDataSet.AccountDataRow row in s_accountData) { AccountPortfolio account = new AccountPortfolio(row.AcctName); s_accountList.Add(row.AcctName, account); } } catch (Exception ex) { Error("Error building account portfolios", ex); return(false); } return(true); }
internal AccountSummary(AccountPortfolio portfolio) { if (portfolio != null) { AccountName = portfolio.AccountName; Portfolio = portfolio.Portfolio; Trades = portfolio.Trades; AccountData = portfolio.AccountData; } }
//public AccountSummary[] GetAllAccountSummaries() //{ // AccountPortfolio[] portfolios = PositionMonitorUtilities.GetAllAccountPortfolios(); // if (portfolios == null) // { // return null; // } // else // { // List<AccountSummary> summaries = new List<AccountSummary>(); // foreach (AccountPortfolio portfolio in portfolios) // { // summaries.Add(new AccountSummary(portfolio)); // } // return summaries.ToArray(); // } //} public AccountSummary GetAccountSummary(string acctName) { AccountPortfolio portfolio = PositionMonitorUtilities.GetAccountPortfolio(acctName); if (portfolio != null) { return(new AccountSummary(portfolio)); } else { return(null); } }
public static AccountPortfolio GetAccountPortfolio(string acctName) { AccountPortfolio account = null; if (IsMonitoring) { if (!s_accountList.TryGetValue(acctName, out account)) { Info(String.Format("Account {0] not found", acctName)); } } else { Info("Error - monitor not started"); } return(account); }