> For the complete documentation index, see [llms.txt](https://help.deepsearch.com/dp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.deepsearch.com/dp/api/func/event/portfolio/computeportfolioreturns.md).

# ComputePortfolioReturns

### Function specification

```
ComputePortfolioReturns(entities, date_from, date_to, weight,
                rebalancing_freq="daily", rebalancing_date=0, transaction_cost=0)
```

### Parameters

| Parameter           | Type            | Description                                                                                                                                                                                                                                                                                                                                                                                                   |
| ------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| entities            | list of strings | 종목명 리스                                                                                                                                                                                                                                                                                                                                                                                                        |
| date\_from/date\_to | date            | 수익률 계산 기간                                                                                                                                                                                                                                                                                                                                                                                                     |
| weight              | string          | 비중 결정 방식 ( "equal", "value", "relevance" )                                                                                                                                                                                                                                                                                                                                                                    |
| rebalancing\_freq   | string          | 리밸런싱 주기 ( "daily","monthly", "quarterly", "semi-annual", "annual", "no" )                                                                                                                                                                                                                                                                                                                                     |
| rebalancing\_date   | int             | the i-th date of portfolio rebalancing within the given frequency. For example, if (quarterly, 2) is given, it means the portfolio is to be rebalanced at the end of 2nd month in a quarter, e.g., Feb 28, May 31, Aug 31, and Nov 30. Similarly, if (monthly, 25) is given, the portfolio will be rebalaned at the 25th of every month. The default value is zero, which indicates the last date of a cycle. |
| transaction\_cost   | float           | 거래 비용 (%) ex) 1.0 -> 1.0%                                                                                                                                                                                                                                                                                                                                                                                     |

### Result

{% content-ref url="/pages/-MX0u3YRe2FnOzWXDDvW" %}
[Result:PortfolioReturns](/dp/api/result_layout/result-portfolioreturns.md)
{% endcontent-ref %}

### Examples

```
> ComputePortfolioReturns([삼성전자, LG전자, 네이버], 2013-01-01, 2018-12-31, "equal")
> ComputePortfolioReturns(상위(인공지능 관련 기업,10), 2013-01-01, 2018-12-31, "equal")
> ComputePortfolioReturns(시가총액 > 1000000000000, 2013-01-01, 2018-12-31, "equal")
> ComputePortfolioReturns([삼성전자, LG전자, 네이버], 2013-01-01, 2018-12-31, "equal", "daily")
> ComputePortfolioReturns([삼성전자, LG전자, 네이버], 2013-01-01, 2018-12-31, "equal", "no")
> ComputePortfolioReturns([삼성전자, LG전자, 네이버], 2013-01-01, 2018-12-31, "equal", "monthly")
```

###
