API Reference for docs v2 (#6098)
Regression Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled

API Reference for docs v2 

Co-authored-by: Alexandre Catarino <AlexCatarino@users.noreply.github.com>
This commit is contained in:
Louis Szeto
2021-12-09 08:25:36 +08:00
committed by GitHub
parent 72105539fc
commit 8ca9258e70
9 changed files with 605 additions and 15 deletions
+75
View File
@@ -59,6 +59,7 @@ namespace QuantConnect.Algorithm
/// <param name="ticker">Key/Ticker for data</param>
/// <param name="resolution">Resolution of the data</param>
/// <returns>The new <see cref="Security"/></returns>
[DocumentationAttribute(AddingData)]
public Security AddData(PyObject type, string ticker, Resolution? resolution = null)
{
return AddData(type, ticker, resolution, null, false, 1m);
@@ -82,6 +83,7 @@ namespace QuantConnect.Algorithm
/// Adding the three unused parameters makes it choose the correct method when using a string or Symbol. This is
/// due to pythonnet's method precedence, as viewable here: https://github.com/QuantConnect/pythonnet/blob/9e29755c54e6008cb016e3dd9d75fbd8cd19fcf7/src/runtime/methodbinder.cs#L215
/// </remarks>
[DocumentationAttribute(AddingData)]
public Security AddData(PyObject type, Symbol underlying, Resolution? resolution = null)
{
return AddData(type, underlying, resolution, null, false, 1m);
@@ -99,6 +101,7 @@ namespace QuantConnect.Algorithm
/// <param name="fillDataForward">When no data available on a tradebar, return the last data that was generated</param>
/// <param name="leverage">Custom leverage per security</param>
/// <returns>The new <see cref="Security"/></returns>
[DocumentationAttribute(AddingData)]
public Security AddData(PyObject type, string ticker, Resolution? resolution, DateTimeZone timeZone, bool fillDataForward = false, decimal leverage = 1.0m)
{
return AddData(type.CreateType(), ticker, resolution, timeZone, fillDataForward, leverage);
@@ -124,6 +127,7 @@ namespace QuantConnect.Algorithm
/// Adding the three unused parameters makes it choose the correct method when using a string or Symbol. This is
/// due to pythonnet's method precedence, as viewable here: https://github.com/QuantConnect/pythonnet/blob/9e29755c54e6008cb016e3dd9d75fbd8cd19fcf7/src/runtime/methodbinder.cs#L215
/// </remarks>
[DocumentationAttribute(AddingData)]
public Security AddData(PyObject type, Symbol underlying, Resolution? resolution, DateTimeZone timeZone, bool fillDataForward = false, decimal leverage = 1.0m)
{
return AddData(type.CreateType(), underlying, resolution, timeZone, fillDataForward, leverage);
@@ -141,6 +145,7 @@ namespace QuantConnect.Algorithm
/// <param name="fillDataForward">When no data available on a tradebar, return the last data that was generated</param>
/// <param name="leverage">Custom leverage per security</param>
/// <returns>The new <see cref="Security"/></returns>
[DocumentationAttribute(AddingData)]
public Security AddData(Type dataType, string ticker, Resolution? resolution, DateTimeZone timeZone, bool fillDataForward = false, decimal leverage = 1.0m)
{
// NOTE: Invoking methods on BaseData w/out setting the symbol may provide unexpected behavior
@@ -185,6 +190,7 @@ namespace QuantConnect.Algorithm
/// Adding the three unused parameters makes it choose the correct method when using a string or Symbol. This is
/// due to pythonnet's method precedence, as viewable here: https://github.com/QuantConnect/pythonnet/blob/9e29755c54e6008cb016e3dd9d75fbd8cd19fcf7/src/runtime/methodbinder.cs#L215
/// </remarks>
[DocumentationAttribute(AddingData)]
public Security AddData(Type dataType, Symbol underlying, Resolution? resolution = null, DateTimeZone timeZone = null, bool fillDataForward = false, decimal leverage = 1.0m)
{
var symbol = QuantConnect.Symbol.CreateBase(dataType, underlying, Market.USA);
@@ -204,6 +210,7 @@ namespace QuantConnect.Algorithm
/// <param name="fillDataForward">When no data available on a tradebar, return the last data that was generated</param>
/// <param name="leverage">Custom leverage per security</param>
/// <returns>The new <see cref="Security"/></returns>
[DocumentationAttribute(AddingData)]
public Security AddData(PyObject type, string ticker, SymbolProperties properties, SecurityExchangeHours exchangeHours, Resolution? resolution = null, bool fillDataForward = false, decimal leverage = 1.0m)
{
// Get the right key for storage of base type symbols
@@ -224,6 +231,7 @@ namespace QuantConnect.Algorithm
/// <param name="optionFilter">Filter to apply to option contracts loaded as part of the universe</param>
/// <returns>The new Option security, containing a Future as its underlying.</returns>
/// <exception cref="ArgumentException">The symbol provided is not canonical.</exception>
[DocumentationAttribute(AddingData)]
public void AddFutureOption(Symbol futureSymbol, PyObject optionFilter)
{
Func<OptionFilterUniverse, OptionFilterUniverse> optionFilterUniverse;
@@ -276,6 +284,7 @@ namespace QuantConnect.Algorithm
/// will be executed on day changes in the NewYork time zone (<see cref="TimeZones.NewYork"/>
/// </summary>
/// <param name="pyObject">Defines an initial coarse selection</param>
[DocumentationAttribute(Universes)]
public Universe AddUniverse(PyObject pyObject)
{
Func<IEnumerable<CoarseFundamental>, object> coarseFunc;
@@ -309,6 +318,7 @@ namespace QuantConnect.Algorithm
/// </summary>
/// <param name="pyObject">Defines an initial coarse selection or a universe</param>
/// <param name="pyfine">Defines a more detailed selection with access to more data</param>
[DocumentationAttribute(Universes)]
public Universe AddUniverse(PyObject pyObject, PyObject pyfine)
{
Func<IEnumerable<CoarseFundamental>, object> coarseFunc;
@@ -340,6 +350,7 @@ namespace QuantConnect.Algorithm
/// <param name="name">A unique name for this universe</param>
/// <param name="resolution">The resolution this universe should be triggered on</param>
/// <param name="pySelector">Function delegate that accepts a DateTime and returns a collection of string symbols</param>
[DocumentationAttribute(Universes)]
public Universe AddUniverse(string name, Resolution resolution, PyObject pySelector)
{
var selector = pySelector.ConvertToDelegate<Func<DateTime, object>>();
@@ -352,6 +363,7 @@ namespace QuantConnect.Algorithm
/// </summary>
/// <param name="name">A unique name for this universe</param>
/// <param name="pySelector">Function delegate that accepts a DateTime and returns a collection of string symbols</param>
[DocumentationAttribute(Universes)]
public Universe AddUniverse(string name, PyObject pySelector)
{
var selector = pySelector.ConvertToDelegate<Func<DateTime, object>>();
@@ -367,6 +379,7 @@ namespace QuantConnect.Algorithm
/// <param name="market">The market of the universe</param>
/// <param name="universeSettings">The subscription settings used for securities added from this universe</param>
/// <param name="pySelector">Function delegate that accepts a DateTime and returns a collection of string symbols</param>
[DocumentationAttribute(Universes)]
public Universe AddUniverse(SecurityType securityType, string name, Resolution resolution, string market, UniverseSettings universeSettings, PyObject pySelector)
{
var selector = pySelector.ConvertToDelegate<Func<DateTime, object>>();
@@ -381,6 +394,7 @@ namespace QuantConnect.Algorithm
/// <param name="T">The data type</param>
/// <param name="name">A unique name for this universe</param>
/// <param name="selector">Function delegate that performs selection on the universe data</param>
[DocumentationAttribute(Universes)]
public Universe AddUniverse(PyObject T, string name, PyObject selector)
{
return AddUniverse(T.CreateType(), SecurityType.Equity, name, Resolution.Daily, Market.USA, UniverseSettings, selector);
@@ -395,6 +409,7 @@ namespace QuantConnect.Algorithm
/// <param name="name">A unique name for this universe</param>
/// <param name="resolution">The epected resolution of the universe data</param>
/// <param name="selector">Function delegate that performs selection on the universe data</param>
[DocumentationAttribute(Universes)]
public Universe AddUniverse(PyObject T, string name, Resolution resolution, PyObject selector)
{
return AddUniverse(T.CreateType(), SecurityType.Equity, name, resolution, Market.USA, UniverseSettings, selector);
@@ -410,6 +425,7 @@ namespace QuantConnect.Algorithm
/// <param name="resolution">The epected resolution of the universe data</param>
/// <param name="universeSettings">The settings used for securities added by this universe</param>
/// <param name="selector">Function delegate that performs selection on the universe data</param>
[DocumentationAttribute(Universes)]
public Universe AddUniverse(PyObject T, string name, Resolution resolution, UniverseSettings universeSettings, PyObject selector)
{
return AddUniverse(T.CreateType(), SecurityType.Equity, name, resolution, Market.USA, universeSettings, selector);
@@ -424,6 +440,7 @@ namespace QuantConnect.Algorithm
/// <param name="name">A unique name for this universe</param>
/// <param name="universeSettings">The settings used for securities added by this universe</param>
/// <param name="selector">Function delegate that performs selection on the universe data</param>
[DocumentationAttribute(Universes)]
public Universe AddUniverse(PyObject T, string name, UniverseSettings universeSettings, PyObject selector)
{
return AddUniverse(T.CreateType(), SecurityType.Equity, name, Resolution.Daily, Market.USA, universeSettings, selector);
@@ -439,6 +456,7 @@ namespace QuantConnect.Algorithm
/// <param name="resolution">The epected resolution of the universe data</param>
/// <param name="market">The market for selected symbols</param>
/// <param name="selector">Function delegate that performs selection on the universe data</param>
[DocumentationAttribute(Universes)]
public Universe AddUniverse(PyObject T, SecurityType securityType, string name, Resolution resolution, string market, PyObject selector)
{
return AddUniverse(T.CreateType(), securityType, name, resolution, market, UniverseSettings, selector);
@@ -454,6 +472,7 @@ namespace QuantConnect.Algorithm
/// <param name="market">The market for selected symbols</param>
/// <param name="universeSettings">The subscription settings to use for newly created subscriptions</param>
/// <param name="selector">Function delegate that performs selection on the universe data</param>
[DocumentationAttribute(Universes)]
public Universe AddUniverse(PyObject T, SecurityType securityType, string name, Resolution resolution, string market, UniverseSettings universeSettings, PyObject selector)
{
return AddUniverse(T.CreateType(), securityType, name, resolution, market, universeSettings, selector);
@@ -469,6 +488,7 @@ namespace QuantConnect.Algorithm
/// <param name="market">The market for selected symbols</param>
/// <param name="universeSettings">The subscription settings to use for newly created subscriptions</param>
/// <param name="pySelector">Function delegate that performs selection on the universe data</param>
[DocumentationAttribute(Universes)]
public Universe AddUniverse(Type dataType, SecurityType securityType, string name, Resolution resolution, string market, UniverseSettings universeSettings, PyObject pySelector)
{
var marketHoursDbEntry = MarketHoursDatabase.GetEntry(market, name, securityType);
@@ -495,6 +515,7 @@ namespace QuantConnect.Algorithm
/// </summary>
/// <param name="universe">The universe we want to chain an option universe selection model too</param>
/// <param name="optionFilter">The option filter universe to use</param>
[DocumentationAttribute(Universes)]
public void AddUniverseOptions(PyObject universe, PyObject optionFilter)
{
Func<OptionFilterUniverse, OptionFilterUniverse> convertedOptionChain;
@@ -521,6 +542,8 @@ namespace QuantConnect.Algorithm
/// <param name="indicator">The indicator to receive data from the consolidator</param>
/// <param name="resolution">The resolution at which to send data to the indicator, null to use the same resolution as the subscription</param>
/// <param name="selector">Selects a value from the BaseData send into the indicator, if null defaults to a cast (x => (T)x)</param>
[DocumentationAttribute(Indicators)]
[DocumentationAttribute(ConsolidatingData)]
public void RegisterIndicator(Symbol symbol, PyObject indicator, Resolution? resolution = null, PyObject selector = null)
{
RegisterIndicator(symbol, indicator, ResolveConsolidator(symbol, resolution), selector);
@@ -534,6 +557,8 @@ namespace QuantConnect.Algorithm
/// <param name="indicator">The indicator to receive data from the consolidator</param>
/// <param name="resolution">The resolution at which to send data to the indicator, null to use the same resolution as the subscription</param>
/// <param name="selector">Selects a value from the BaseData send into the indicator, if null defaults to a cast (x => (T)x)</param>
[DocumentationAttribute(Indicators)]
[DocumentationAttribute(ConsolidatingData)]
public void RegisterIndicator(Symbol symbol, PyObject indicator, TimeSpan? resolution = null, PyObject selector = null)
{
RegisterIndicator(symbol, indicator, ResolveConsolidator(symbol, resolution), selector);
@@ -547,6 +572,8 @@ namespace QuantConnect.Algorithm
/// <param name="indicator">The indicator to receive data from the consolidator</param>
/// <param name="pyObject">The python object that it is trying to register with, could be consolidator or a timespan</param>
/// <param name="selector">Selects a value from the BaseData send into the indicator, if null defaults to a cast (x => (T)x)</param>
[DocumentationAttribute(Indicators)]
[DocumentationAttribute(ConsolidatingData)]
public void RegisterIndicator(Symbol symbol, PyObject indicator, PyObject pyObject, PyObject selector = null)
{
try
@@ -594,6 +621,8 @@ namespace QuantConnect.Algorithm
/// <param name="indicator">The indicator to receive data from the consolidator</param>
/// <param name="consolidator">The consolidator to receive raw subscription data</param>
/// <param name="selector">Selects a value from the BaseData send into the indicator, if null defaults to a cast (x => (T)x)</param>
[DocumentationAttribute(Indicators)]
[DocumentationAttribute(ConsolidatingData)]
public void RegisterIndicator(Symbol symbol, PyObject indicator, IDataConsolidator consolidator, PyObject selector = null)
{
// TODO: to be removed when https://github.com/QuantConnect/pythonnet/issues/62 is solved
@@ -627,6 +656,8 @@ namespace QuantConnect.Algorithm
/// <param name="indicator">The indicator we want to warm up</param>
/// <param name="resolution">The resolution</param>
/// <param name="selector">Selects a value from the BaseData send into the indicator, if null defaults to a cast (x => (T)x)</param>
[DocumentationAttribute(Indicators)]
[DocumentationAttribute(HistoricalData)]
public void WarmUpIndicator(Symbol symbol, PyObject indicator, Resolution? resolution = null, PyObject selector = null)
{
// TODO: to be removed when https://github.com/QuantConnect/pythonnet/issues/62 is solved
@@ -659,6 +690,7 @@ namespace QuantConnect.Algorithm
/// <param name="series">Name of the plot series</param>
/// <param name="pyObject">PyObject with the value to plot</param>
/// <seealso cref="Plot(string,decimal)"/>
[DocumentationAttribute(Charting)]
public void Plot(string series, PyObject pyObject)
{
using (Py.GIL())
@@ -685,6 +717,7 @@ namespace QuantConnect.Algorithm
/// <param name="third">The third indicator to plot</param>
/// <param name="fourth">The fourth indicator to plot</param>
/// <seealso cref="Plot(string,string,decimal)"/>
[DocumentationAttribute(Charting)]
public void Plot(string chart, Indicator first, Indicator second = null, Indicator third = null, Indicator fourth = null)
{
Plot(chart, new[] { first, second, third, fourth }.Where(x => x != null).ToArray());
@@ -699,6 +732,7 @@ namespace QuantConnect.Algorithm
/// <param name="third">The third indicator to plot</param>
/// <param name="fourth">The fourth indicator to plot</param>
/// <seealso cref="Plot(string,string,decimal)"/>
[DocumentationAttribute(Charting)]
public void Plot(string chart, BarIndicator first, BarIndicator second = null, BarIndicator third = null, BarIndicator fourth = null)
{
Plot(chart, new[] { first, second, third, fourth }.Where(x => x != null).ToArray());
@@ -713,6 +747,7 @@ namespace QuantConnect.Algorithm
/// <param name="third">The third indicator to plot</param>
/// <param name="fourth">The fourth indicator to plot</param>
/// <seealso cref="Plot(string,string,decimal)"/>
[DocumentationAttribute(Charting)]
public void Plot(string chart, TradeBarIndicator first, TradeBarIndicator second = null, TradeBarIndicator third = null, TradeBarIndicator fourth = null)
{
Plot(chart, new[] { first, second, third, fourth }.Where(x => x != null).ToArray());
@@ -721,6 +756,8 @@ namespace QuantConnect.Algorithm
/// <summary>
/// Automatically plots each indicator when a new value is available
/// </summary>
[DocumentationAttribute(Charting)]
[DocumentationAttribute(Indicators)]
public void PlotIndicator(string chart, PyObject first, PyObject second = null, PyObject third = null, PyObject fourth = null)
{
var array = GetIndicatorArray(first, second, third, fourth);
@@ -730,6 +767,8 @@ namespace QuantConnect.Algorithm
/// <summary>
/// Automatically plots each indicator when a new value is available
/// </summary>
[DocumentationAttribute(Charting)]
[DocumentationAttribute(Indicators)]
public void PlotIndicator(string chart, bool waitForReady, PyObject first, PyObject second = null, PyObject third = null, PyObject fourth = null)
{
var array = GetIndicatorArray(first, second, third, fourth);
@@ -745,6 +784,7 @@ namespace QuantConnect.Algorithm
/// <param name="filter">Filters the IBaseData send into the indicator, if null defaults to true (x => true) which means no filter</param>
/// <param name="fieldName">The name of the field being selected</param>
/// <returns>A new FilteredIdentity indicator for the specified symbol and selector</returns>
[DocumentationAttribute(Indicators)]
public FilteredIdentity FilteredIdentity(Symbol symbol, PyObject selector = null, PyObject filter = null, string fieldName = null)
{
var resolution = GetSubscription(symbol).Resolution;
@@ -761,6 +801,7 @@ namespace QuantConnect.Algorithm
/// <param name="filter">Filters the IBaseData send into the indicator, if null defaults to true (x => true) which means no filter</param>
/// <param name="fieldName">The name of the field being selected</param>
/// <returns>A new FilteredIdentity indicator for the specified symbol and selector</returns>
[DocumentationAttribute(Indicators)]
public FilteredIdentity FilteredIdentity(Symbol symbol, Resolution resolution, PyObject selector = null, PyObject filter = null, string fieldName = null)
{
var name = CreateIndicatorName(symbol, fieldName ?? "close", resolution);
@@ -781,6 +822,7 @@ namespace QuantConnect.Algorithm
/// <param name="filter">Filters the IBaseData send into the indicator, if null defaults to true (x => true) which means no filter</param>
/// <param name="fieldName">The name of the field being selected</param>
/// <returns>A new FilteredIdentity indicator for the specified symbol and selector</returns>
[DocumentationAttribute(Indicators)]
public FilteredIdentity FilteredIdentity(Symbol symbol, TimeSpan resolution, PyObject selector = null, PyObject filter = null, string fieldName = null)
{
var name = $"{symbol}({fieldName ?? "close"}_{resolution.ToStringInvariant(null)})";
@@ -799,6 +841,7 @@ namespace QuantConnect.Algorithm
/// <param name="periods">The number of bars to request</param>
/// <param name="resolution">The resolution to request</param>
/// <returns>A python dictionary with pandas DataFrame containing the requested historical data</returns>
[DocumentationAttribute(HistoricalData)]
public PyObject History(PyObject tickers, int periods, Resolution? resolution = null)
{
var symbols = tickers.ConvertToSymbolEnumerable();
@@ -813,6 +856,7 @@ namespace QuantConnect.Algorithm
/// <param name="span">The span over which to retrieve recent historical data</param>
/// <param name="resolution">The resolution to request</param>
/// <returns>A python dictionary with pandas DataFrame containing the requested historical data</returns>
[DocumentationAttribute(HistoricalData)]
public PyObject History(PyObject tickers, TimeSpan span, Resolution? resolution = null)
{
var symbols = tickers.ConvertToSymbolEnumerable();
@@ -827,6 +871,7 @@ namespace QuantConnect.Algorithm
/// <param name="end">The end time in the algorithm's time zone</param>
/// <param name="resolution">The resolution to request</param>
/// <returns>A python dictionary with pandas DataFrame containing the requested historical data</returns>
[DocumentationAttribute(HistoricalData)]
public PyObject History(PyObject tickers, DateTime start, DateTime end, Resolution? resolution = null)
{
var symbols = tickers.ConvertToSymbolEnumerable();
@@ -842,6 +887,7 @@ namespace QuantConnect.Algorithm
/// <param name="end">The end time in the algorithm's time zone</param>
/// <param name="resolution">The resolution to request</param>
/// <returns>pandas.DataFrame containing the requested historical data</returns>
[DocumentationAttribute(HistoricalData)]
public PyObject History(PyObject type, PyObject tickers, DateTime start, DateTime end, Resolution? resolution = null)
{
var symbols = tickers.ConvertToSymbolEnumerable();
@@ -870,6 +916,7 @@ namespace QuantConnect.Algorithm
/// <param name="periods">The number of bars to request</param>
/// <param name="resolution">The resolution to request</param>
/// <returns>pandas.DataFrame containing the requested historical data</returns>
[DocumentationAttribute(HistoricalData)]
public PyObject History(PyObject type, PyObject tickers, int periods, Resolution? resolution = null)
{
var symbols = tickers.ConvertToSymbolEnumerable();
@@ -900,6 +947,7 @@ namespace QuantConnect.Algorithm
/// <param name="span">The span over which to retrieve recent historical data</param>
/// <param name="resolution">The resolution to request</param>
/// <returns>pandas.DataFrame containing the requested historical data</returns>
[DocumentationAttribute(HistoricalData)]
public PyObject History(PyObject type, PyObject tickers, TimeSpan span, Resolution? resolution = null)
{
return History(type, tickers, Time - span, Time, resolution);
@@ -914,6 +962,7 @@ namespace QuantConnect.Algorithm
/// <param name="end">The end time in the algorithm's time zone</param>
/// <param name="resolution">The resolution to request</param>
/// <returns>pandas.DataFrame containing the requested historical data</returns>
[DocumentationAttribute(HistoricalData)]
public PyObject History(PyObject type, Symbol symbol, DateTime start, DateTime end, Resolution? resolution = null)
{
var security = Securities[symbol];
@@ -941,6 +990,7 @@ namespace QuantConnect.Algorithm
/// <param name="periods">The number of bars to request</param>
/// <param name="resolution">The resolution to request</param>
/// <returns>pandas.DataFrame containing the requested historical data</returns>
[DocumentationAttribute(HistoricalData)]
public PyObject History(PyObject type, Symbol symbol, int periods, Resolution? resolution = null)
{
if (resolution == Resolution.Tick) throw new ArgumentException("History functions that accept a 'periods' parameter can not be used with Resolution.Tick");
@@ -960,6 +1010,7 @@ namespace QuantConnect.Algorithm
/// <param name="span">The span over which to retrieve recent historical data</param>
/// <param name="resolution">The resolution to request</param>
/// <returns>pandas.DataFrame containing the requested historical data</returns>
[DocumentationAttribute(HistoricalData)]
public PyObject History(PyObject type, Symbol symbol, TimeSpan span, Resolution? resolution = null)
{
return History(type, symbol, Time - span, Time, resolution);
@@ -970,6 +1021,9 @@ namespace QuantConnect.Algorithm
/// the benchmark at each date/time requested
/// </summary>
/// <param name="benchmark">The benchmark producing function</param>
[DocumentationAttribute(TradingAndOrders)]
[DocumentationAttribute(SecuritiesAndPortfolio)]
[DocumentationAttribute(Indicators)]
public void SetBenchmark(PyObject benchmark)
{
using (Py.GIL())
@@ -989,6 +1043,7 @@ namespace QuantConnect.Algorithm
/// This can be used to set a custom brokerage model.
/// </summary>
/// <param name="model">The brokerage model to use</param>
[DocumentationAttribute(Modeling)]
public void SetBrokerageModel(PyObject model)
{
IBrokerageModel brokerageModel;
@@ -1004,6 +1059,8 @@ namespace QuantConnect.Algorithm
/// Sets the security initializer function, used to initialize/configure securities after creation
/// </summary>
/// <param name="securityInitializer">The security initializer function or class</param>
[DocumentationAttribute(AddingData)]
[DocumentationAttribute(Modeling)]
public void SetSecurityInitializer(PyObject securityInitializer)
{
var securityInitializer1 = PythonUtil.ToAction<Security>(securityInitializer);
@@ -1023,6 +1080,8 @@ namespace QuantConnect.Algorithm
/// <param name="address">A string containing the URI to download</param>
/// <param name="headers">Defines header values to add to the request</param>
/// <returns>The requested resource as a <see cref="string"/></returns>
[DocumentationAttribute(AddingData)]
[DocumentationAttribute(MachineLearning)]
public string Download(string address, PyObject headers) => Download(address, headers, null, null);
/// <summary>
@@ -1034,6 +1093,8 @@ namespace QuantConnect.Algorithm
/// <param name="userName">The user name associated with the credentials</param>
/// <param name="password">The password for the user name associated with the credentials</param>
/// <returns>The requested resource as a <see cref="string"/></returns>
[DocumentationAttribute(AddingData)]
[DocumentationAttribute(MachineLearning)]
public string Download(string address, PyObject headers, string userName, string password)
{
var dict = new Dictionary<string, string>();
@@ -1068,6 +1129,7 @@ namespace QuantConnect.Algorithm
/// <param name="message">Message to send to debug console</param>
/// <seealso cref="Log(PyObject)"/>
/// <seealso cref="Error(PyObject)"/>
[DocumentationAttribute(Logging)]
public void Debug(PyObject message)
{
Debug(message.ToSafeString());
@@ -1079,6 +1141,7 @@ namespace QuantConnect.Algorithm
/// <param name="message">Message to display in errors grid</param>
/// <seealso cref="Debug(PyObject)"/>
/// <seealso cref="Log(PyObject)"/>
[DocumentationAttribute(Logging)]
public void Error(PyObject message)
{
Error(message.ToSafeString());
@@ -1090,6 +1153,7 @@ namespace QuantConnect.Algorithm
/// <param name="message">String message to log.</param>
/// <seealso cref="Debug(PyObject)"/>
/// <seealso cref="Error(PyObject)"/>
[DocumentationAttribute(Logging)]
public void Log(PyObject message)
{
Log(message.ToSafeString());
@@ -1099,6 +1163,7 @@ namespace QuantConnect.Algorithm
/// Terminate the algorithm after processing the current event handler.
/// </summary>
/// <param name="message">Exit message to display on quitting</param>
[DocumentationAttribute(Logging)]
public void Quit(PyObject message)
{
Quit(message.ToSafeString());
@@ -1111,6 +1176,7 @@ namespace QuantConnect.Algorithm
/// <param name="period">The consolidation period</param>
/// <param name="handler">Data handler receives new consolidated data when generated</param>
/// <returns>A new consolidator matching the requested parameters with the handler already registered</returns>
[DocumentationAttribute(ConsolidatingData)]
public IDataConsolidator Consolidate(Symbol symbol, Resolution period, PyObject handler)
{
return Consolidate(symbol, period.ToTimeSpan(), null, handler);
@@ -1124,6 +1190,7 @@ namespace QuantConnect.Algorithm
/// <param name="tickType">The tick type of subscription used as data source for consolidator. Specify null to use first subscription found.</param>
/// <param name="handler">Data handler receives new consolidated data when generated</param>
/// <returns>A new consolidator matching the requested parameters with the handler already registered</returns>
[DocumentationAttribute(ConsolidatingData)]
public IDataConsolidator Consolidate(Symbol symbol, Resolution period, TickType? tickType, PyObject handler)
{
return Consolidate(symbol, period.ToTimeSpan(), tickType, handler);
@@ -1136,6 +1203,7 @@ namespace QuantConnect.Algorithm
/// <param name="period">The consolidation period</param>
/// <param name="handler">Data handler receives new consolidated data when generated</param>
/// <returns>A new consolidator matching the requested parameters with the handler already registered</returns>
[DocumentationAttribute(ConsolidatingData)]
public IDataConsolidator Consolidate(Symbol symbol, TimeSpan period, PyObject handler)
{
return Consolidate(symbol, period, null, handler);
@@ -1149,6 +1217,7 @@ namespace QuantConnect.Algorithm
/// <param name="tickType">The tick type of subscription used as data source for consolidator. Specify null to use first subscription found.</param>
/// <param name="handler">Data handler receives new consolidated data when generated</param>
/// <returns>A new consolidator matching the requested parameters with the handler already registered</returns>
[DocumentationAttribute(ConsolidatingData)]
public IDataConsolidator Consolidate(Symbol symbol, TimeSpan period, TickType? tickType, PyObject handler)
{
// resolve consolidator input subscription
@@ -1174,6 +1243,7 @@ namespace QuantConnect.Algorithm
/// <param name="calendar">The consolidation calendar</param>
/// <param name="handler">Data handler receives new consolidated data when generated</param>
/// <returns>A new consolidator matching the requested parameters with the handler already registered</returns>
[DocumentationAttribute(ConsolidatingData)]
public IDataConsolidator Consolidate(Symbol symbol, Func<DateTime, CalendarInfo> calendar, PyObject handler)
{
return Consolidate(symbol, calendar, null, handler);
@@ -1183,6 +1253,8 @@ namespace QuantConnect.Algorithm
/// Schedules the provided training code to execute immediately
/// </summary>
/// <param name="trainingCode">The training code to be invoked</param>
[DocumentationAttribute(MachineLearning)]
[DocumentationAttribute(ScheduledEvents)]
public ScheduledEvent Train(PyObject trainingCode)
{
return Schedule.TrainingNow(trainingCode);
@@ -1194,6 +1266,8 @@ namespace QuantConnect.Algorithm
/// <param name="dateRule">Specifies what dates the event should run</param>
/// <param name="timeRule">Specifies the times on those dates the event should run</param>
/// <param name="trainingCode">The training code to be invoked</param>
[DocumentationAttribute(MachineLearning)]
[DocumentationAttribute(ScheduledEvents)]
public ScheduledEvent Train(IDateRule dateRule, ITimeRule timeRule, PyObject trainingCode)
{
return Schedule.Training(dateRule, timeRule, trainingCode);
@@ -1207,6 +1281,7 @@ namespace QuantConnect.Algorithm
/// <param name="tickType">The tick type of subscription used as data source for consolidator. Specify null to use first subscription found.</param>
/// <param name="handler">Data handler receives new consolidated data when generated</param>
/// <returns>A new consolidator matching the requested parameters with the handler already registered</returns>
[DocumentationAttribute(ConsolidatingData)]
private IDataConsolidator Consolidate(Symbol symbol, Func<DateTime, CalendarInfo> calendar, TickType? tickType, PyObject handler)
{
// resolve consolidator input subscription