---
title: "FactSet"
description: "Learn how use historical data from FactSet for research and backtest in Lean CLI."
canonical: https://www.quantconnect.com/docs/v2/lean-cli/datasets/factset
markdown: https://www.quantconnect.com/docs/v2/lean-cli/datasets/factset.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/05%20Lean%20CLI/05%20Datasets/09%20FactSet
modified: 2026-10-29
index: https://www.quantconnect.com/llms.txt
---

# FactSet

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Lean CLI](https://www.quantconnect.com/docs/v2/lean-cli.md) > Datasets > FactSet

> Code examples are shown in Python. Append `?lang=csharp` to this URL for the C# version of this page.

## Introduction

Instead of using the data from QuantConnect or your brokerage, you can use data from [FactSet](https://www.factset.com/) if you have the authetication `JSON` file. This page explains our integration with their API and its functionality.

To view the implementation of the FactSet integration, see the [Lean.DataSource.FactSet repository](https://github.com/QuantConnect/Lean.DataSource.FactSet).

To use the CLI, you must be a member in an [organization](https://www.quantconnect.com/docs/v2/cloud-platform/organizations/tier-features.md) on a paid tier.

## Authetication

To access FactSet data, ask [FactSet Support](https://www.factset.com/contact-us) for your authetication `JSON` file and then save it to your local machine. When you run any of the following commands, you'll provide the path to its location using the `--factset-auth-config-file` option. This file has the following [format](https://github.com/factset/oauth2-guidelines):

```
{
    "clientId": "abcde123",
    "clientAuthType": "Confidential",
    "jwk": {
        "kty": "RSA",
        "use": "sig",
        "alg": "RS256",
        "kid": "34n2j4n23j42m34kn234",
        "d": "42r34t345k3m45-34t3k45k-345v",
        "n": "42r34t345k3m45-34t3k45k-345v",
        "e": "42r34t345k3m45-34t3k45k-345v",
        "p": "42r34t345k3m45-34t3k45k-345v",
        "q": "42r34t345k3m45-34t3k45k-345v",
        "dp": "42r34t345k3m45-34t3k45k-345v",
        "dq": "42r34t345k3m45-34t3k45k-345v",
        "qi": "42r34t345k3m45-34t3k45k-345v"
    },
    "wellKnownUri": "https://auth.factset.com/.well-known/openid-configuration"
}
```

## Supported Datasets

The FactSet data provider serves asset price data directly from [FactSet's Options API](https://www.alphavantage.co/documentation/#time-series-data). Our integration supports [US Index Options](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/index-options.md) securities.

## Alternative Data

If you have licensed alternative data with QuantConnect, it works as expected with the FactSet data provider for research and backtesting.

## Download

To download FactSet data, open a terminal in your [organization workspace](https://www.quantconnect.com/docs/v2/lean-cli/initialization/organization-workspaces.md) and then run `lean data download --data-provider-historical FactSet --data-type <data-type> --resolution Daily --security-type IndexOption --ticker <tickers> --start <YYYYMMDD> --end <YYYYMMDD> --factset-auth-config-file=<auth.json>`.

```
$ lean data download --data-provider-historical FactSet --data-type Trade --resolution Daily --security-type IndexOption --ticker SPX --start 20240422 --end 20240423 --factset-auth-config-file=auth.json
```

If you provide your credentials, your [Lean configuration file](https://www.quantconnect.com/docs/v2/lean-cli/initialization/configuration.md#03-Lean-Configuration) saves them.

## Research

To access FactSet data from the local Research Environment, open a terminal in your [organization workspace](https://www.quantconnect.com/docs/v2/lean-cli/initialization/organization-workspaces.md) and then run `lean research <projectName> --data-provider-historical FactSet --factset-auth-config-file <auth.json>`.

```
$ lean research "My Project" --data-provider-historical FactSet --factset-auth-config-file auth.json
```

If you provide any of the preceding options, your [Lean configuration file](https://www.quantconnect.com/docs/v2/lean-cli/initialization/configuration.md#03-Lean-Configuration) saves them so that you only need to run `lean research <projectName>` to open the Research Environment with the same options.

## Backtesting

To run a local backtest with FactSet data, open a terminal in your [organization workspace](https://www.quantconnect.com/docs/v2/lean-cli/initialization/organization-workspaces.md) and then run `lean backtest <projectName> --data-provider-historical FactSet --factset-auth-config-file <auth.json>`.

```
$ lean backtest "My Project" --data-provider-historical FactSet --factset-auth-config-file auth.json
```

If you provide any of the preceding options, your [Lean configuration file](https://www.quantconnect.com/docs/v2/lean-cli/initialization/configuration.md#03-Lean-Configuration) saves them so that you only need to run `lean backtest <projectName>` to run another backtest with the same options.

## Optimization

Follow these steps to run a local optimization job with FactSet data:

1. Add some [parameters](https://www.quantconnect.com/docs/v2/lean-cli/optimization/parameters.md) to your project.
2. Open a terminal in your [organization workspace](https://www.quantconnect.com/docs/v2/lean-cli/initialization/organization-workspaces.md).
3. Run `lean optimize <projectName> --data-provider-historical FactSet --factset-auth-config-file <auth.json>`.
   ```
   $ lean optimize "My Project" --data-provider-historical FactSet --factset-auth-config-file auth.json
   ```
4. Follow [the steps in the interactive wizard](https://www.quantconnect.com/docs/v2/lean-cli/optimization/deployment.md#02-Run-Local-Optimizations) to configure your optimization job settings.

The `lean optimize` command also accepts additional [options](https://www.quantconnect.com/docs/v2/lean-cli/api-reference/lean-backtest.md#04-Options) so that you can select Polgyon and run the command in non-interactive mode. If you provide any of the preceding options, your [Lean configuration file](https://www.quantconnect.com/docs/v2/lean-cli/initialization/configuration.md#03-Lean-Configuration) saves them so that you only need to run `lean optimize <projectName>` to run another optimization job with the same options.

## Live Trading

To deploy a local live algorithm that uses FactSet as the historical data provider, open a terminal in your [organization workspace](https://www.quantconnect.com/docs/v2/lean-cli/initialization/organization-workspaces.md) and then run `lean live deploy <projectName> --data-provider-historical FactSet --factset-auth-config-file <auth.json> --brokerage <brokerageName> <requiredBrokerageOptions>`. FactSet doesn't support streaming live data. The paper trading brokerage also doesn't provide live data, so if you select it, you need to include `--data-provider-live <liveDataProviderName> <requiredLivedataProviderOptions>`.

```
$ lean live deploy "My Project" --data-provider-historical FactSet --factset-auth-config-file auth.json --brokerage "Paper Trading" --data-provider-live "Custom data only"
```

If you provide any of the preceding options, your [Lean configuration file](https://www.quantconnect.com/docs/v2/lean-cli/initialization/configuration.md#03-Lean-Configuration) saves them so that you only need to run `lean live deploy <projectName> --brokerage <brokerageName>` to deploy another live algorithm with the same options.

## Pricing

To learn more about FactSet data solutions and pricing, see the [Data Solutions](https://www.factset.com/solutions/data-solutions) page on the FactSet website.
