121 lines
5.7 KiB
C#
121 lines
5.7 KiB
C#
/*
|
|
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
|
|
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
namespace QuantConnect
|
|
{
|
|
/// <summary>
|
|
/// Provides user-facing message construction methods and static messages for the <see cref="Algorithm"/> namespace
|
|
/// </summary>
|
|
public static partial class Messages
|
|
{
|
|
/// <summary>
|
|
/// Provides user-facing messages for the <see cref="Algorithm.QCAlgorithm"/> class and its consumers or related classes
|
|
/// </summary>
|
|
public static class QCAlgorithm
|
|
{
|
|
/// <summary>
|
|
/// Returns a string message saying the time zone cannot be changed after the algorithm is running
|
|
/// </summary>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static string SetTimeZoneAlreadyRunning()
|
|
{
|
|
return $"{AlgorithmPrefix()}.{FormatCode("SetTimeZone")}(): Cannot change time zone after algorithm running.";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns a string message saying the benchmark cannot be changed after the algorithm is initialized
|
|
/// </summary>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static string SetBenchmarkAlreadyInitialized()
|
|
{
|
|
return $"{AlgorithmPrefix()}.{FormatCode("SetBenchmark")}(): Cannot change Benchmark after algorithm initialized.";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns a string message saying the account currency cannot be changed after the algorithm is initialized
|
|
/// </summary>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static string SetAccountCurrencyAlreadyInitialized()
|
|
{
|
|
return $"{AlgorithmPrefix()}.{FormatCode("SetAccountCurrency")}(): Cannot change AccountCurrency after algorithm initialized.";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns a string message saying the cash cannot be changed after the algorithm is initialized
|
|
/// </summary>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static string SetCashAlreadyInitialized()
|
|
{
|
|
return $"{AlgorithmPrefix()}.{FormatCode("SetCash")}(): Cannot change cash available after algorithm initialized.";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns a string message saying the start date cannot be changed after the algorithm is initialized
|
|
/// </summary>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static string SetStartDateAlreadyInitialized()
|
|
{
|
|
return $"{AlgorithmPrefix()}.{FormatCode("SetStartDate")}(): Cannot change start date after algorithm initialized.";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns a string message saying the end date cannot be changed after the algorithm is initialized
|
|
/// </summary>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static string SetEndDateAlreadyInitialized()
|
|
{
|
|
return $"{AlgorithmPrefix()}.{FormatCode("SetEndDate")}(): Cannot change end date after algorithm initialized.";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns a string message saying SetWarmup cannot be used after the algorithm is initialized
|
|
/// </summary>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static string SetWarmupAlreadyInitialized()
|
|
{
|
|
return $"{AlgorithmPrefix()}.{FormatCode("SetWarmup")}(): This method cannot be used after algorithm initialized";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns a string message saying the first argument to AddData must be a custom data class
|
|
/// </summary>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static string AddDataInvalidPyObjectType(string repr)
|
|
{
|
|
return $"{AlgorithmPrefix()}.{FormatCode("AddData")}(): the first argument must be a custom data type (a Python class deriving from {FormatCode("PythonData")} or a CLR {FormatCode("BaseData")} type), but received {repr}. " +
|
|
$"To subscribe to built-in asset classes use, for example, {FormatCode("AddEquity")} or {FormatCode("AddCrypto")}.";
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Provides user-facing messages for the <see cref="AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper"/> class
|
|
/// and its consumers or related classes
|
|
/// </summary>
|
|
public static class AlgorithmPythonWrapper
|
|
{
|
|
/// <summary>
|
|
/// Returns a string message saying OnMarginCall must return a non-empty list of SubmitOrderRequest
|
|
/// </summary>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static string OnMarginCallMustReturnNonEmptyList()
|
|
{
|
|
return $"{FormatCode("OnMarginCall")} must return a non-empty list of SubmitOrderRequest";
|
|
}
|
|
}
|
|
}
|
|
}
|