<a id="skfolio-descriptor-marketleverage"></a>

# skfolio.descriptor.MarketLeverage

<a id="skfolio.descriptor.MarketLeverage"></a>

### *class* skfolio.descriptor.MarketLeverage

Market leverage descriptor.

Computes the proportion of total capital (at market value) financed by debt:

$$
\text{market\_leverage}(t) =
\frac{\text{total\_debt}(t)}
     {\text{total\_debt}(t) + \text{market\_cap}(t)}
$$

Market leverage blends accounting data (total debt) with market data (market
capitalization). Unlike [`BookLeverage`](https://skfolio.org/generated/skfolio.descriptor.BookLeverage.html.md#skfolio.descriptor.BookLeverage), the denominator updates daily with
the stock price, making it more responsive to changes in the firm’s risk profile.
When a stock drops sharply, market leverage rises immediately, capturing the
increased financial risk before any accounting restatement [[1]](#r96fb91817dfe-1).

NaNs are allowed as missing observations and propagate to the output. Non-missing
`total_debt` values must be finite. Non-missing `market_cap` values must be finite
and strictly positive.

When `total_debt` is non-negative and given that `market_cap` is non-negative by
construction, the ratio is bounded in $[0, 1)$. This makes it the most
numerically well-behaved of the leverage descriptors, requiring no special
treatment for negative-equity firms.

* **Parameters:**
  **None**
* **Attributes:**
  **n_assets_** *int*
  : Number of assets seen during fitting.

  **asset_names_** *ndarray of shape (n_assets,)*
  : Asset names seen during fitting.

### Methods

| [`fit_transform`](#skfolio.descriptor.MarketLeverage.fit_transform)(X[, y])         | Compute market leverage ratios.                |
|--------------------------------------------------------------------------------|------------------------------------------------|
| [`get_metadata_routing`](#skfolio.descriptor.MarketLeverage.get_metadata_routing)()        | Get metadata routing of this object.           |
| [`get_params`](#skfolio.descriptor.MarketLeverage.get_params)([deep])            | Get parameters for this estimator.             |
| [`partial_fit_transform`](#skfolio.descriptor.MarketLeverage.partial_fit_transform)(X[, y]) | Stateless class delegation to `fit_transform`. |
| [`set_params`](#skfolio.descriptor.MarketLeverage.set_params)(\*\*params)        | Set the parameters of this estimator.          |

#### SEE ALSO
[`DebtToAssets`](https://skfolio.org/generated/skfolio.descriptor.DebtToAssets.html.md#skfolio.descriptor.DebtToAssets)
: Leverage relative to total assets.

[`BookLeverage`](https://skfolio.org/generated/skfolio.descriptor.BookLeverage.html.md#skfolio.descriptor.BookLeverage)
: Leverage as a fraction of total book capital.

### References

* <a id='r96fb91817dfe-1'>**[1]**</a> “Capital structure decisions: which factors are reliably important?” Financial Management. Frank, M. Z., & Goyal, V. K. (2009).

### Examples

```pycon
>>> from skfolio.datasets import make_synthetic_characteristics
>>> from skfolio.descriptor import MarketLeverage
>>>
>>> X = make_synthetic_characteristics()
>>>
>>> descriptor = MarketLeverage()
>>> market_leverage = descriptor.fit_transform(X)
```

<a id="skfolio.descriptor.MarketLeverage.fit_transform"></a>

#### fit_transform(X, y=None, \*\*fit_params)

Compute market leverage ratios.

* **Parameters:**
  **X** *AssetPanel*
  : Input panel containing `total_debt` and `market_cap`.

  **y** *None*
  : Ignored. Present for compatibility with scikit-learn’s API.

  **\*\*fit_params** *dict*
  : Additional fit parameters. Ignored.
* **Returns:**
  **market_leverage** *ndarray of shape (n_observations, n_assets)*
  : Market leverage ratio for each observation and asset.

<a id="skfolio.descriptor.MarketLeverage.get_metadata_routing"></a>

#### get_metadata_routing()

Get metadata routing of this object.

Please check [User Guide](https://skfolio.org/user_guide/metadata_routing.html.md#metadata-routing) on how the routing
mechanism works.

* **Returns:**
  **routing** *MetadataRequest*
  : A `MetadataRequest` encapsulating
    routing information.

<a id="skfolio.descriptor.MarketLeverage.get_params"></a>

#### get_params(deep=True)

Get parameters for this estimator.

* **Parameters:**
  **deep** *bool, default=True*
  : If True, will return the parameters for this estimator and
    contained subobjects that are estimators.
* **Returns:**
  **params** *dict*
  : Parameter names mapped to their values.

<a id="skfolio.descriptor.MarketLeverage.partial_fit_transform"></a>

#### partial_fit_transform(X, y=None, \*\*fit_params)

Stateless class delegation to `fit_transform`.

<a id="skfolio.descriptor.MarketLeverage.set_params"></a>

#### set_params(\*\*params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects
(such as `Pipeline`). The latter have
parameters of the form `<component>__<parameter>` so that it’s
possible to update each component of a nested object.

* **Parameters:**
  **\*\*params** *dict*
  : Estimator parameters.
* **Returns:**
  **self** *estimator instance*
  : Estimator instance.

