What is Boot Camp?
Boot Camp is a great way to improve your skills and learn the QuantConnect API in easily digestible portions.
Don't have an account? Join QuantConnect Today
We are dedicated to providing investors with a cutting-edge platform for rapidly creating quant investment strategies. Founded in 2012, we've empowered more than 250,000 quants and engineers to create and trade their ideas.
Quickly and easily started with our API to build your strategy. The learning center lessons are interactive, step-by-step guides to make you productive as fast as possible.
Focus your efforts on driving alpha, not parsing CSV files. Our cloud offers hundreds of terabytes of traditional and alternative data preformatted, cleaned, and instantly accessible by our API.
Coordinate teamwork, control access permissions, and your shared cloud resources. Grow your trading organization safely and efficiently on top of our cloud architecture.
A selection of streaming live-trading strategies written by QuantConnect, and top highlights from the community available to follow and clone. Peer into detailed real-time positions to gain insight for your own trading.
What is Boot Camp?
Boot Camp is a great way to improve your skills and learn the QuantConnect API in easily digestible portions.
A collection of courses from independent educators to improve your quant skill base and create better strategies.
Solidify and expand your quant skill base with courses at QuantConnect
Learn algorithmic trading with python for US Equities. Guided strategy development in easily digestible portions.
Author: QuantConnect
Free | 96,653 People Enrolled
Learn algorithmic trading with python for FX. Guided strategy development in easily digestible portions.
Author: QuantConnect
Free | 20,690 People Enrolled
Learn algorithmic trading with python for Futures. Guided strategy development in easily digestible portions.
Author: QuantConnect
Free | 7,525 People Enrolled
In this algorithmic trading tutorial series you will learn everything you need to know to start writing your own trading bots using Python and the QuantConnect quantitative trading platform.
Author: Louis
Free | 29,200 People Enrolled
Master algorithmic trading on QuantConnect; backtest and live trade Stocks, Options, Futures, Forex, and Crypto.
Author: Cheng Li
Paid | Enroll on Udemy
Learn to use Python, Pandas, Matplotlib, and the QuantConnect Lean Engine to perform financial analysis and trading.
Author: Jose Portilla, Pierian Training
Paid | Enroll on Udemy
Learn to write programs that algorithmically trade cryptocurrencies using QuantConnect (C#).
Author: Eric Summers
Paid | Enroll on Udemy
Organization Notes
Get Started with Algorithm Lab
New Research
Portfolio Construction Using Topological Data Analysis
Harnessing topological techniques to diversify SPY constituents by clustering top constituents to reduce correlation risk and drawdown....
ReadNew Announcement
Quant League Q1 2025 Results: Triton Quantitative Trading Takes the 1st Place!
ReadAlgorithm Lab is your playground for developing and refining trading algorithms with QuantConnect. Utilize advanced tools, historical data, and robust backtesting to enhance your trading strategies. Transform your ideas into actionable insights and optimize your trading approach with ease.
Sign Up for FreeAlready have an account Log In.
This account is protected by two-factor authentication.
Request Token Information Reset My TokenCreated | Last Time Used | Agent | |
---|---|---|---|
No entries found |
To continue please enter your email:
(No google account required)
To verify that everything goes well please enter the 6 digit verification code generated by the authenticator application
Algorithm Lab is your playground for developing and refining trading algorithms with QuantConnect. Utilize advanced tools, historical data, and robust backtesting to enhance your trading strategies. Transform your ideas into actionable insights and optimize your trading approach with ease.
Sign Up for FreeAlready have an account Log In.
Please stop one of the following coding sessions, or upgrade your account.
NAME | ORGANIZATION |
---|
QuantConnect Datasets
Explore free and paid datasets available on QuantConnect covering fundamentals, pricing, and alternative options.
Datasets >
Dashboard
A transparent, community reporting system. Report suspected issues with our cloud data to be investigated by the QuantConnect Team.
Issue List
Loading...
Data Explorer Issues are a way to report and track data problems. They give the QuantConnect community a way to discuss potential solutions and be notified when they are resolved. If you think you have found a data problem please check the existing open and closed issues first; often another user may have already reported your problem.
Does your issue match any of the already listed issues?
Thank you for your contribution! Our team is currently working on resolving these issues, please subscribe to them to receive updates.
Datasets >
US Government Contracts
Dataset by Quiver Quantitative
The US Government Contracts dataset by Quiver Quantitative tracks the transactions of government contracts with publicly traded companies. The data covers over 700 US Equities, starts in October 2019, and is delivered on a daily frequency. Quiver Quantitative creates this dataset by using the API for USASpending.gov, which has the official open data source of federal spending information. The rows in this dataset only show new contracts, not payments or modifications to existing contracts. The dollar amounts are based on the total dollars obligated from each contract.
This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.
Quiver Quantitative was founded by two college students in February 2020 with the goal of bridging the information gap between Wall Street and non-professional investors. Quiver allows retail investors to tap into the power of big data and have access to actionable, easy to interpret data that hasn’t already been dissected by Wall Street.
The following snippet demonstrates how to request data from the US Government Contracts dataset:
self.aapl = self.add_equity("AAPL", Resolution.DAILY).symbol
self.dataset_symbol = self.add_data(QuiverGovernmentContract, self.aapl).symbol
self._universe = self.add_universe(QuiverGovernmentContractUniverse, self.universe_selection)
_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_datasetSymbol = AddData<QuiverGovernmentContract>(_symbol).Symbol;
_universe = AddUniverse<QuiverGovernmentContractUniverse>(UniverseSelection);
The following table describes the dataset properties:
Property | Value |
---|---|
Start Date | October 15, 2019 |
Asset Coverage | 748 US Equities |
Data Density | Sparse |
Resolution | Daily |
Timezone | UTC |
The Quiver Quantitative US Government Contracts dataset enables you to create strategies using the latest information on government contracts activity. Examples include the following strategies:
For more example algorithms, see Examples.
The US Government Contracts dataset provides QuiverGovernmentContract and QuiverGovernmentContractUniverse objects.
QuiverGovernmentContract objects have the following attributes:
QuiverGovernmentContractUniverse objects have the following attributes:
To add US Government Contracts data to your algorithm, call the AddDataadd_data method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.
class QuiverGovernmentContractDataAlgorithm(QCAlgorithm):
def initialize(self) -> None:
self.set_start_date(2019, 1, 1)
self.set_end_date(2020, 6, 1)
self.set_cash(100000)
symbol = self.add_equity("AAPL", Resolution.DAILY).symbol
self.dataset_symbol = self.add_data(QuiverGovernmentContract, symbol).symbol
namespace QuantConnect.Algorithm.CSharp.AltData
{
public class QuiverGovernmentContractDataAlgorithm : QCAlgorithm
{
private Symbol _datasetSymbol;
public override void Initialize()
{
SetStartDate(2019, 1, 1);
SetEndDate(2020, 6, 1);
SetCash(100000);
var symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_datasetSymbol= AddData<QuiverGovernmentContract>(symbol).Symbol;
}
}
}
To get the current US Government Contract data, index the current Slice with the dataset Symbol. Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.
def on_data(self, slice: Slice) -> None:
if slice.contains_key(self.dataset_symbol):
data_points = slice[self.dataset_symbol]
for data_point in data_points:
self.log(f"{self.dataset_symbol} amount at {slice.time}: {data_point.amount}")
public override void OnData(Slice slice)
{
if (slice.ContainsKey(_datasetSymbol))
{
var dataPoints = slice[_datasetSymbol];
foreach (var dataPoint in dataPoints)
{
Log($"{_datasetSymbol} amount at {slice.Time}: {dataPoint.Amount}");
}
}
}
To iterate through all of the dataset objects in the current Slice, call the Getget method.
def on_data(self, slice: Slice) -> None:
for dataset_symbol, data_points in slice.get(QuiverGovernmentContract).items():
for data_point in data_points:
self.log(f"{dataset_symbol} amount at {slice.time}: {data_point.amount}")
public override void OnData(Slice slice)
{
foreach (var kvp in slice.Get<QuiverGovernmentContract>())
{
var datasetSymbol = kvp.Key;
var dataPoints = kvp.Value;
foreach(var dataPoint in dataPoints)
{
Log($"{datasetSymbol} amount at {slice.Time}: {dataPoint.Amount}");
}
}
}
To get historical US Government Contracts data, call the Historyhistory method with the dataset Symbol. If there is no data in the period you request, the history result is empty.
# DataFrame
history_df = self.history(self.dataset_symbol, 100, Resolution.DAILY)
# Dataset objects
history_bars = self.history[QuiverGovernmentContract](self.dataset_symbol, 100, Resolution.DAILY)
var history = History<QuiverGovernmentContract>(_datasetSymbol, 100, Resolution.Daily);
For more information about historical data, see History Requests.
To select a dynamic universe of US Equities based on US Government Contract data, call the AddUniverseadd_universe method with the QuiverGovernmentContractUniverse class and a selection function.
def initialize(self):
self._universe = self.add_universe(QuiverGovernmentContractUniverse, self.universe_selection)
def universe_selection(self, alt_coase: List[QuiverGovernmentContractUniverse]) -> List[Symbol]:
gov_contract_data_by_symbol = {}
for datum in alt_coarse:
symbol = datum.symbol
if symbol not in gov_contract_data_by_symbol:
gov_contract_data_by_symbol[symbol] = []
gov_contract_data_by_symbol[symbol].append(datum)
return [symbol for symbol, d in gov_contract_data_by_symbol.items()
if len(d) >= 3 and sum([x.amount for x in d]) > 50000]
private Universe _universe;
public override void Initialize()
{
_universe = AddUniverse<QuiverGovernmentContractUniverse>(altCoarse =>
{
var govContractDataBySymbol = new Dictionary<Symbol, List<QuiverGovernmentContractUniverse>>();
foreach (var datum in altCoarse.OfType<QuiverGovernmentContractUniverse>())
{
var symbol = datum.Symbol;
if (!govContractDataBySymbol.ContainsKey(symbol))
{
govContractDataBySymbol.Add(symbol, new List<QuiverGovernmentContractUniverse>());
}
govContractDataBySymbol[symbol].Add(datum);
}
return from kvp in govContractDataBySymbol
where kvp.Value.Count >= 3 && kvp.Value.Sum(x => x.Amount) > 50000m
select kvp.Key;
});
}
You can get historical universe data in an algorithm and in the Research Environment.
To get historical universe data in an algorithm, call the Historyhistory method with the Universe object and the lookback period. If there is no data in the period you request, the history result is empty.
var universeHistory = History(universe, 30, Resolution.Daily);
foreach (var contracts in universeHistory)
{
foreach (QuiverGovernmentContractUniverse contract in contracts)
{
Log($"{contract.Symbol} amount at {contract.EndTime}: {contract.Amount}");
}
}
# DataFrame example where the columns are the QuiverGovernmentContractUniverse attributes:
history_df = self.history(self._universe, 30, Resolution.DAILY, flatten=True)
# Series example where the values are lists of QuiverGovernmentContractUniverse objects:
universe_history = self.history(self._universe, 30, Resolution.DAILY)
for (_, time), contracts in universe_history.items():
for contract in contracts:
self.log(f"{contract.symbol} amount at {contract.end_time}: {contract.amount}")
To get historical universe data in research, call the UniverseHistoryuniverse_history method with the Universe object, a start date, and an end date. This method returns the filtered universe. If there is no data in the period you request, the history result is empty.
var universeHistory = qb.UniverseHistory(universe, qb.Time.AddDays(-30), qb.Time);
foreach (var contracts in universeHistory)
{
foreach (QuiverGovernmentContractUniverse contract in contracts)
{
Console.WriteLine($"{contract.Symbol} amount at {contract.EndTime}: {contract.Amount}");
}
}
# DataFrame example where the columns are the QuiverGovernmentContractUniverse attributes:
history_df = qb.universe_history(universe, qb.time-timedelta(30), qb.time, flatten=True)
# Series example where the values are lists of QuiverGovernmentContractUniverse objects:
universe_history = qb.universe_history(universe, qb.time-timedelta(30), qb.time)
for (_, time), contracts in universe_history.items():
for contract in contracts:
print(f"{contract.symbol} amount at {contract.end_time}: {contract.amount}")
You can call the Historyhistory method in Research.
To remove a subscription, call the RemoveSecurityremove_security method.
self.remove_security(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);
If you subscribe to US Government Contracts data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes.
The US Government Contracts dataset provides QuiverGovernmentContract and QuiverGovernmentContractUniverse objects.
QuiverGovernmentContract objects have the following attributes:
QuiverGovernmentContractUniverse objects have the following attributes:
The following example algorithm buys Apple stock when they receive a new government contract worth over $50K. If they receive a new contract worth under $10K, the algorithm short sells Apple.
from AlgorithmImports import *
from QuantConnect.DataSource import *
class QuiverGovernmentContractAlgorithm(QCAlgorithm):
def initialize(self) -> None:
self.set_start_date(2020, 10, 7) #Set Start Date
self.set_end_date(2021, 10, 11) #Set End Date
self.aapl = self.add_equity("AAPL", Resolution.DAILY).symbol
# Subscribe to government contract data for AAPL to generate trade signal
self.dataset_symbol = self.add_data(QuiverGovernmentContract, self.aapl).symbol
# history request
history = self.history(self.dataset_symbol, 10, Resolution.DAILY)
self.debug(f"We got {len(history)} items from historical data request of {self.dataset_symbol}.")
def on_data(self, slice: Slice) -> None:
# Trade only base on government contract data
for gov_contracts in slice.Get(QuiverGovernmentContract).values():
# Buy if over 50000 government contract amount, suggesting a large income
if any([gov_contract.amount > 50000 for gov_contract in gov_contracts]):
self.set_holdings(self.aapl, 1)
# Sell if below 10000 government contract amount, suggesting a smaller than usual income
elif any([gov_contract.amount < 10000 for gov_contract in gov_contracts]):
self.set_holdings(self.aapl, -1)
using QuantConnect.DataSource;
namespace QuantConnect
{
public class QuiverGovernmentContractAlgorithm : QCAlgorithm
{
private Symbol _symbol, _datasetSymbol;
public override void Initialize()
{
SetStartDate(2020, 10, 7); //Set Start Date
SetEndDate(2021, 10, 11); //Set End Date
_symbol = AddEquity("AAPL").Symbol;
// Subscribe to government contract data for AAPL to generate trade signal
_datasetSymbol = AddData<QuiverGovernmentContract>(_symbol).Symbol;
// history request
var history = History<QuiverGovernmentContract>(new[] {_datasetSymbol}, 10, Resolution.Daily);
Debug($"We got {history.Count()} items from historical data request of {_datasetSymbol}.");
}
public override void OnData(Slice slice)
{
// Trade only base on government contract data
foreach (var kvp in slice.Get<QuiverGovernmentContract>())
{
// Buy if over 50000 government contract amount, suggesting a large income
if (kvp.Value.Any(x => (int) (x as QuiverGovernmentContract).Amount > 50000m))
{
SetHoldings(_symbol, 1);
}
// Sell if below 10000 government contract amount, suggesting a smaller than usual income
else if (kvp.Value.Any(x => (int) (x as QuiverGovernmentContract).Amount < 10000m))
{
SetHoldings(_symbol, -1);
}
}
}
}
}
The following example algorithm creates a dynamic universe of US Equities that have just received a government contract worth at least $5K. Each day, it then forms an equal-weighted dollar-neutral portfolio with the 10 companies that received the largest contracts and the 10 companies that received the smallest contracts.
from AlgorithmImports import *
from QuantConnect.DataSource import *
class QuiverGovernmentContractDataAlgorithm(QCAlgorithm):
def initialize(self) -> None:
self.set_start_date(2019, 1, 1)
self.set_end_date(2020, 1, 1)
self.set_cash(100000)
self.universe_settings.resolution = Resolution.MINUTE
# Filter universe using government contract data
self.add_universe(QuiverGovernmentContractUniverse, self.universe_selection)
# Custom alpha model that emit insights based on updated government contract data
self.add_alpha(QuiverGovernmentContractAlphaModel())
# Invest equally to evenly dissipate the capital concentration risk
self.set_portfolio_construction(EqualWeightingPortfolioConstructionModel())
self.set_execution(ImmediateExecutionModel())
def universe_selection(self, data: List[QuiverGovernmentContractUniverse]) -> List[Symbol]:
gov_contract_data_by_symbol = {}
for datum in data:
symbol = datum.symbol
if symbol not in gov_contract_data_by_symbol:
gov_contract_data_by_symbol[symbol] = []
gov_contract_data_by_symbol[symbol].append(datum)
# Only select the stocks with over 5000 government contracts, which is considered material information
return [symbol for symbol, d in gov_contract_data_by_symbol.items()
if sum([x.amount for x in d]) > 5000]
class QuiverGovernmentContractAlphaModel(AlphaModel):
def __init__(self) -> None:
# A variable to control the rebalancing time
self.last_time = datetime.min
# To hold the government contract dataset symbol for managing subscription
self.dataset_symbol_by_symbol = {}
def update(self, algorithm: QCAlgorithm, slice: Slice) -> List[Insight]:
try:
if self.last_time > algorithm.time: return []
except:
self.Log("")
# Trade signal only based on government contract data
data_points = slice.Get(QuiverGovernmentContract)
if not data_points: return []
gov_contracts = {}
# To aggregate all data per symbol for analysis
for data_point in data_points:
if data_point.Key not in gov_contracts:
gov_contracts[data_point.Key] = 0
for gov_contract in data_point.Value:
gov_contracts[data_point.Key] += gov_contract.amount
# Long the top 10 highest government contract amount, predicting a higher expected income and return
# Short the lowest 10 government contract amount, predicting a lower expected income and return
sorted_by_gov_contracts = sorted(gov_contracts.items(), key=lambda x: x[1])
long_symbols = [x[0].underlying for x in sorted_by_gov_contracts[-10:]]
short_symbols = [x[0].underlying for x in sorted_by_gov_contracts[:10]]
insights = []
for symbol in long_symbols:
insights.append(Insight.price(symbol, Expiry.END_OF_DAY, InsightDirection.UP))
for symbol in short_symbols:
insights.append(Insight.price(symbol, Expiry.END_OF_DAY, InsightDirection.DOWN))
self.last_time = Expiry.END_OF_DAY(algorithm.Time)
return insights
def on_securities_changed(self, algorithm: QCAlgorithm, changes: SecurityChanges) -> None:
for security in changes.added_securities:
# Requesting government contract data for trade signal generation
symbol = security.symbol
dataset_symbol = algorithm.add_data(QuiverGovernmentContract, symbol).symbol
self.dataset_symbol_by_symbol[symbol] = dataset_symbol
# Historical Data
history = algorithm.history(dataset_symbol, 10, Resolution.DAILY)
algorithm.debug(f"We got {len(history)} items from our history request on {dataset_symbol}.")
for security in changes.removed_securities:
dataset_symbol = self.dataset_symbol_by_symbol.pop(security.symbol, None)
if dataset_symbol:
# Remove government contract data subscription to release computation resources
algorithm.remove_security(dataset_symbol)
using QuantConnect.DataSource;
namespace QuantConnect
{
public class QuiverGovernmentContractFrameworkAlgorithm : QCAlgorithm
{
public override void Initialize()
{
SetStartDate(2021, 1, 1);
SetEndDate(2021, 7, 1);
SetCash(100000);
UniverseSettings.Resolution = Resolution.Minute;
// Filter universe using government contract data
AddUniverse<QuiverGovernmentContractUniverse>(data =>
{
var govContractDataBySymbol = new Dictionary<Symbol, List<QuiverGovernmentContractUniverse>>();
foreach (var datum in data.OfType<QuiverGovernmentContractUniverse>())
{
var symbol = datum.Symbol;
if (!govContractDataBySymbol.ContainsKey(symbol))
{
govContractDataBySymbol.Add(symbol, new List<QuiverGovernmentContractUniverse>());
}
govContractDataBySymbol[symbol].Add(datum);
}
// Only select the stocks with over 5000 government contracts, which is considered material information
return from kvp in govContractDataBySymbol
where kvp.Value.Sum(x => x.Amount) > 5000m
select kvp.Key;
});
// Custom alpha model that emit insights based on updated government contract data
AddAlpha(new QuiverGovernmentContractAlphaModel());
// Invest equally to evenly dissipate the capital concentration risk
SetPortfolioConstruction(new EqualWeightingPortfolioConstructionModel());
SetExecution(new ImmediateExecutionModel());
}
}
public class QuiverGovernmentContractAlphaModel: AlphaModel
{
// A variable to control the rebalancing time
private DateTime _time;
// To hold the government contract dataset symbol for managing subscription
private Dictionary<Symbol, Symbol> _datasetSymbolBySymbol = new();
public QuiverGovernmentContractAlphaModel()
{
_time = DateTime.MinValue;
}
public override IEnumerable<Insight> Update(QCAlgorithm algorithm, Slice slice)
{
if (_time > algorithm.Time) return new List<Insight>();
// Trade signal only based on government contract data
var dataPoints = slice.Get<QuiverGovernmentContract>();
if (dataPoints.IsNullOrEmpty()) return new List<Insight>();
// To aggregate all data per symbol for analysis
var govContracts = dataPoints.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.Sum(x => ((QuiverGovernmentContract)x).Amount));
// Long the top 10 highest government contract amount, predicting a higher expected income and return
// Short the lowest 10 government contract amount, predicting a lower expected income and return
var sortedByGovContract = from kvp in govContracts
orderby kvp.Value descending
select kvp.Key.Underlying;
var longSymbols = sortedByGovContract.Take(10).ToList();
var shortSymbols = sortedByGovContract.TakeLast(10).ToList();
var insights = new List<Insight>();
insights.AddRange(longSymbols.Select(symbol =>
new Insight(symbol, Expiry.EndOfDay, InsightType.Price, InsightDirection.Up)));
insights.AddRange(shortSymbols.Select(symbol =>
new Insight(symbol, Expiry.EndOfDay, InsightType.Price, InsightDirection.Down)));
_time = Expiry.EndOfDay(algorithm.Time);
return insights;
}
public override void OnSecuritiesChanged(QCAlgorithm algorithm, SecurityChanges changes)
{
foreach (var security in changes.AddedSecurities)
{
// Requesting government contract data for trade signal generation
var symbol = security.Symbol;
var datasetSymbol = algorithm.AddData<QuiverGovernmentContract>(symbol).Symbol;
_datasetSymbolBySymbol.Add(symbol, datasetSymbol);
// History request
var history = algorithm.History<QuiverGovernmentContract>(datasetSymbol, 10, Resolution.Daily);
algorithm.Debug($"We get {history.Count()} items in historical data of {datasetSymbol}");
}
foreach (var security in changes.RemovedSecurities)
{
var symbol = security.Symbol;
if (_datasetSymbolBySymbol.ContainsKey(symbol))
{
// Remove government contract data subscription to release computation resources
_datasetSymbolBySymbol.Remove(symbol, out var datasetSymbol);
algorithm.RemoveSecurity(datasetSymbol);
}
}
}
}
}
The following example lists all US Equities with Government contracts in the past year.
#r "../QuantConnect.DataSource.QuiverGovernmentContracts.dll"
using QuantConnect.DataSource;
// Requesting data
var aapl = qb.AddEquity("AAPL", Resolution.Daily).Symbol;
var symbol = qb.AddData<QuiverGovernmentContract>(aapl).Symbol;
// Historical data
var history = qb.History<QuiverGovernmentContract>(symbol, 360, Resolution.Daily);
foreach (var contracts in history)
{
foreach (QuiverGovernmentContract contract in contracts)
{
Console.WriteLine($"{contract.Symbol} amount at {contract.EndTime}: {contract.Amount}");
}
}
// Add Universe Selection
IEnumerable<Symbol> UniverseSelection(IEnumerable<BaseData> altCoarse)
{
return from d in altCoarse.OfType<QuiverGovernmentContractUniverse>()
select d.Symbol;
}
var universe = qb.AddUniverse<QuiverGovernmentContractUniverse<(UniverseSelection);
// Historical Universe data
var universeHistory = qb.UniverseHistory(universe, qb.Time.AddDays(-360), qb.Time);
foreach (var contracts in universeHistory)
{
foreach (QuiverGovernmentContractUniverse contract in contracts)
{
Console.WriteLine($"{contract.Symbol} amount at {contract.EndTime}: {contract.Amount}");
}
}
qb = QuantBook()
# Requesting Data
aapl = qb.add_equity("AAPL", Resolution.DAILY).symbol
symbol = qb.add_data(QuiverGovernmentContract, aapl).symbol
# Historical data
history = qb.history(QuiverGovernmentContract, symbol, 360, Resolution.DAILY)
for (symbol, time), contracts in history.items():
for contract in contracts:
print(f"{contract.symbol} amount at {contract.end_time}: {contract.amount}")
# Add Universe Selection
def universe_selection(alt_coarse: List[QuiverGovernmentContractUniverse]) -> List[Symbol]:
return [d.symbol for d in alt_coarse]
universe = qb.add_universe(QuiverGovernmentContractUniverse, universe_selection)
# Historical Universe data
universe_history = qb.universe_history(universe, qb.time-timedelta(360), qb.time)
for (_, time), contracts in universe_history.items():
for contract in contracts:
print(f"{contract.symbol} amount at {contract.end_time}: {contract.amount}")
US Government Contracts is allowed to be used in the cloud for personal and commercial projects with a subscription. The data is permissioned for use within the licensed organization only
Subscription Required | License Now
US Government Contracts can be downloaded on premise with the LEAN CLI, for a charge per file downloaded. This download is for the licensed organization's internal LEAN use only and cannot be redistributed or converted in any format.
Starting at 10 QCC/file | Learn More
LEAN CLI is a cross-platform wrapper on the QuantConnect algorithmic trading engine called LEAN. The CLI makes using LEAN incredibly easy, reducing most of the pain points of developing and managing an algorithmic trading strategy to a few lines of bash.
Using the CLI you can download the same data QuantConnect hosts in the cloud for a small fee. These fees are per file downloaded, and are paid for in QuantConnect-Credits (QCC). We recommend purchasing credits to enable downloading.
The CLI command generator is a helpful tool to generate a copy-paste command to download this dataset from the form below.
lean data download \
--dataset "US Government Contracts" \
--ticker "AAPL, MSFT"
lean data download `
--dataset "US Government Contracts" `
--ticker "AAPL, MSFT"
Download US Government Contract historical records for your LEAN backtesting on premise with the LEAN CLI.
Harness US Government Contract data in the QuantConnect Cloud for your backtesting and live trading purposes.
What people are saying about this
This product has not received any reviews yet, be the first to post one!
Rate the Module:
Provider offers 2 licensing options
Explore free and paid datasets available on QuantConnect covering fundamentals, pricing, and alternative options.
Dataset Status from to
No Runs
OK
Degraded
Failure
Explore free and paid datasets available on QuantConnect covering fundamentals, pricing, and alternative options.
Lorem ipsum dolor sit amet conjectura lorem ipsum dolor sit amet conjectura lorem ipsum
Configuration Keys
Environment Variables
Lorem ipsum dolor sit amet conjectura lorem ipsum dolor sit amet conjectura lorem ipsum
File Link
Lorem ipsum dolor sit amet conjectura lorem ipsum dolor sit amet conjectura lorem ipsum
Lorem ipsum dolor sit amet conjectura lorem ipsum dolor sit amet conjectura lorem ipsum
Upload a manually created tar or zip file to all cloud data systems.
Add a link and click the Sync Dataset button to upload the dataset
Upload Destinations
The dataset synchronizer is an internal tool for the QuantConnect team to upload data to the
cloud data storage environments. It supports TAR files which are extracted in the root directory
of the cloud data environments.
Take extreme care to carefully structure your data TAR package with
the same folders as the LEAN data folder. Ensure all folders and file names are lowercase as Linux is case-sensitive.
Support
Algorithm Lab is your playground for developing and refining trading algorithms with QuantConnect. Utilize advanced tools, historical data, and robust backtesting to enhance your trading strategies. Transform your ideas into actionable insights and optimize your trading approach with ease.
Sign Up for FreeAlready have an account Log In.
â‘
â‘
â‘
â‘
â‘
Hover and click over the stars to rate us.
It looks like you are not fully satisfied with your experience on QuantConnect, please take a moment to let us know how we can improve our services for you:
If you have a minute to spare, please leave us a review on Trustpilot.
Stories like yours help others see the full potential of QuantConnect.
Organization Name |
---|
Upgrade to Team plan or higher to enable custom invoicing
Changes will be applied to future invoices.
Users will be able to join by following the link in the invitation email.
You’ve been invited by Jared Broad to join his G-Force Organization.
Would you like to accept the invitation?
Are you sure you want to delete the encryption key "undefined"?
Caution: We will not be able to decrypt encrypted projects without the original key.
Drag & Drop or
Keys are added to the local storage in your web browser and not uploaded to QuantConnect. To use an encrypted project on another computer you will need to bring a copy of the key.
This project is encrypted using the key .
This project will be encrypted using the key .