Datasets
FactSet
Introduction
Instead of using the data from QuantConnect or your brokerage, you can use data from FactSet if you have the authetication JSON file.
To view the implementation of the FactSet integration, see the Lean.DataSource.FactSet repository.
Authetication
To access FactSet data, ask FactSet Support 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:
{ "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
Our FactSet integration supports US Index Options securities.
Download
To download FactSet data, open a terminal in your organization workspace 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 saves them.
Research
To access FactSet data from the local Research Environment, open a terminal in your organization workspace 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 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 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 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:
- Add some parameters to your project.
- Open a terminal in your organization workspace.
- Run
lean optimize <projectName> --data-provider-historical FactSet --factset-auth-config-file <auth.json>
. - Follow the steps in the interactive wizard to configure your optimization job settings.
$ lean optimize "My Project" --data-provider-historical FactSet --factset-auth-config-file auth.json
The lean optimize
command also accepts additional 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 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 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 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 page on the FactSet website.