Investment Studio > Expressions > Functions > Lookup > PORTFOLIO_FLAGS
array[*][2] portfolio_flags(integer portfolio_index, date quote_date)
Returns a two-column array containing asset indices (first column) and corresponding transaction flags (second column) as of quote_date for all assets in the portfolio identified by portfolio_index.
A transaction flag is an arbitrary string field which can be set automatically by trading system rules or manually in the Transactions view, and read using the asset_flag and portfolio_flags functions. Its interpretation is up to you. For instance, it can be used to keep track of state changes in a trading system, or to give the Portfolios or Assets views advance warning about the trading system's intents for tomorrow, before the quotes needed to book actual transactions become available.
| Since
portfolio_flag returns a row for each asset in the
portfolio, you can count the number of assets in the
portfolio with the expression = rows(portfolio_flags(portfolio_index, quote_date)) |
Portfolio indices are references to entries in Investment Studio's internal table of loaded portfolios. The table is automatically created and maintained behind the scene, and may be rearranged at any time. Portfolio indices should therefore never be specified using constants, but rather obtained through the interface methods provided by the object hosting the expression. See e.g. the discussion of lookup cells in Grid objects.
Asset indices are references to entries in Investment Studio's internal table of assets in the selected portfolio.
See also asset_flag.