Skip to content

Commit

Permalink
Refactor to use camel case (#7981)
Browse files Browse the repository at this point in the history
* Camel case results

- Camel case lean results and streamed packets

* Update packets to camel case
  • Loading branch information
Martin-Molinero authored May 8, 2024
1 parent bb7a7f2 commit d40ec77
Show file tree
Hide file tree
Showing 33 changed files with 365 additions and 352 deletions.
115 changes: 95 additions & 20 deletions Common/Algorithm/Framework/Alphas/Serialization/SerializedInsight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,22 @@ public class SerializedInsight
/// <summary>
/// See <see cref="Insight.Id"/>
/// </summary>
[JsonProperty("id")]
public string Id { get; set; }

/// <summary>
/// See <see cref="Insight.GroupId"/>
/// </summary>
[JsonProperty("group-id")]
public string GroupId { get; set; }

/// <summary>
/// See <see cref="Insight.SourceModel"/>
/// </summary>
[JsonProperty("source-model")]
public string SourceModel { get; set; }

/// <summary>
/// Pass-through for <see cref="CreatedTime"/>
/// </summary>
[Obsolete("Deprecated as of 2020-01-23. Please use the `CreatedTime` property instead.")]
[JsonProperty("generated-time")]
public double GeneratedTime
{
get { return _createdTime; }
Expand All @@ -60,7 +56,6 @@ public double GeneratedTime
/// <summary>
/// See <see cref="Insight.GeneratedTimeUtc"/>
/// </summary>
[JsonProperty("created-time")]
public double CreatedTime
{
get { return _createdTime; }
Expand All @@ -70,27 +65,23 @@ public double CreatedTime
/// <summary>
/// See <see cref="Insight.CloseTimeUtc"/>
/// </summary>
[JsonProperty("close-time")]
public double CloseTime { get; set; }

/// <summary>
/// See <see cref="Insight.Symbol"/>
/// The symbol's security identifier string
/// </summary>
[JsonProperty("symbol")]
public string Symbol { get; set; }

/// <summary>
/// See <see cref="Insight.Symbol"/>
/// The symbol's ticker at the generated time
/// </summary>
[JsonProperty("ticker")]
public string Ticker { get; set; }

/// <summary>
/// See <see cref="Insight.Type"/>
/// </summary>
[JsonProperty("type")]
public InsightType Type { get; set; }

/// <summary>
Expand All @@ -102,72 +93,61 @@ public double CreatedTime
/// <summary>
/// See <see cref="Insight.ReferenceValueFinal"/>
/// </summary>
[JsonProperty("reference-final")]
public decimal ReferenceValueFinal { get; set; }

/// <summary>
/// See <see cref="Insight.Direction"/>
/// </summary>
[JsonProperty("direction")]
public InsightDirection Direction { get; set; }

/// <summary>
/// See <see cref="Insight.Period"/>
/// </summary>
[JsonProperty("period")]
public double Period { get; set; }

/// <summary>
/// See <see cref="Insight.Magnitude"/>
/// </summary>
[JsonProperty("magnitude")]
[JsonConverter(typeof(JsonRoundingConverter))]
public double? Magnitude { get; set; }

/// <summary>
/// See <see cref="Insight.Confidence"/>
/// </summary>
[JsonProperty("confidence")]
[JsonConverter(typeof(JsonRoundingConverter))]
public double? Confidence { get; set; }

/// <summary>
/// See <see cref="Insight.Weight"/>
/// </summary>
[JsonProperty("weight")]
public double? Weight { get; set; }

/// <summary>
/// See <see cref="InsightScore.IsFinalScore"/>
/// </summary>
[JsonProperty("score-final")]
public bool ScoreIsFinal { get; set; }

/// <summary>
/// See <see cref="InsightScore.Magnitude"/>
/// </summary>
[JsonProperty("score-magnitude")]
[JsonConverter(typeof(JsonRoundingConverter))]
public double ScoreMagnitude { get; set; }

/// <summary>
/// See <see cref="InsightScore.Direction"/>
/// </summary>
[JsonProperty("score-direction")]
[JsonConverter(typeof(JsonRoundingConverter))]
public double ScoreDirection { get; set; }

/// <summary>
/// See <see cref="Insight.EstimatedValue"/>
/// </summary>
[JsonProperty("estimated-value")]
[JsonConverter(typeof(JsonRoundingConverter))]
public decimal EstimatedValue { get; set; }

/// <summary>
/// See <see cref="Insight.Tag"/>
/// </summary>
[JsonProperty("tag")]
public string Tag { get; set; }

/// <summary>
Expand Down Expand Up @@ -204,5 +184,100 @@ public SerializedInsight(Insight insight)
Weight = insight.Weight;
Tag = insight.Tag;
}

#region BackwardsCompatibility
[JsonProperty("group-id")]
string OldGroupId
{
set
{
GroupId = value;
}
}

[JsonProperty("source-model")]
string OldSourceModel
{
set
{
SourceModel = value;
}
}

[JsonProperty("generated-time")]
double OldGeneratedTime
{
set
{
GeneratedTime = value;
}
}

[JsonProperty("created-time")]
public double OldCreatedTime
{
set
{
CreatedTime = value;
}
}

[JsonProperty("close-time")]
public double OldCloseTime
{
set
{
CloseTime = value;
}
}

[JsonProperty("reference-final")]
decimal OldReferenceValueFinal
{
set
{
ReferenceValueFinal = value;
}
}

[JsonProperty("score-final")]
bool OldScoreIsFinal
{
set
{
ScoreIsFinal = value;
}
}

[JsonProperty("score-magnitude")]
[JsonConverter(typeof(JsonRoundingConverter))]
double OldScoreMagnitude
{
set
{
ScoreMagnitude = value;
}
}

[JsonProperty("score-direction")]
[JsonConverter(typeof(JsonRoundingConverter))]
double OldScoreDirection
{
set
{
ScoreDirection = value;
}
}

[JsonProperty("estimated-value")]
[JsonConverter(typeof(JsonRoundingConverter))]
decimal OldEstimatedValue
{
set
{
EstimatedValue = value;
}
}
#endregion
}
}
16 changes: 3 additions & 13 deletions Common/AlgorithmConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,71 +32,61 @@ public class AlgorithmConfiguration
/// <summary>
/// The algorithm's name
/// </summary>
[JsonProperty(PropertyName = "Name")]
public string Name;

/// <summary>
/// List of tags associated with the algorithm
/// </summary>
[JsonProperty(PropertyName = "Tags")]
public ISet<string> Tags;

/// <summary>
/// The algorithm's account currency
/// </summary>
[JsonProperty(PropertyName = "AccountCurrency", NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string AccountCurrency;

/// <summary>
/// The algorithm's brokerage model
/// </summary>
/// <remarks> Required to set the correct brokerage model on report generation.</remarks>
[JsonProperty(PropertyName = "Brokerage")]
public BrokerageName BrokerageName;
public BrokerageName Brokerage;

/// <summary>
/// The algorithm's account type
/// </summary>
/// <remarks> Required to set the correct brokerage model on report generation.</remarks>
[JsonProperty(PropertyName = "AccountType")]
public AccountType AccountType;

/// <summary>
/// The parameters used by the algorithm
/// </summary>
[JsonProperty(PropertyName = "Parameters")]
public IReadOnlyDictionary<string, string> Parameters;

/// <summary>
/// Backtest maximum end date
/// </summary>
[JsonProperty(PropertyName = "OutOfSampleMaxEndDate")]
public DateTime? OutOfSampleMaxEndDate;

/// <summary>
/// The backtest out of sample day count
/// </summary>
[JsonProperty(PropertyName = "OutOfSampleDays")]
public int OutOfSampleDays;

/// <summary>
/// The backtest start date
/// </summary>
[JsonProperty(PropertyName = "StartDate")]
[JsonConverter(typeof(DateTimeJsonConverter), DateFormat.UI)]
public DateTime StartDate;

/// <summary>
/// The backtest end date
/// </summary>
[JsonProperty(PropertyName = "EndDate")]
[JsonConverter(typeof(DateTimeJsonConverter), DateFormat.UI)]
public DateTime EndDate;

/// <summary>
/// Number of trading days per year for Algorithm's portfolio statistics.
/// </summary>
[JsonProperty(PropertyName = "TradingDaysPerYear")]
public int TradingDaysPerYear;

/// <summary>
Expand All @@ -112,7 +102,7 @@ public AlgorithmConfiguration(string name, ISet<string> tags, string accountCurr
TradingDaysPerYear = tradingDaysPerYear;
OutOfSampleDays = outOfSampleDays;
AccountCurrency = accountCurrency;
BrokerageName = brokerageName;
Brokerage = brokerageName;
AccountType = accountType;
Parameters = parameters;
StartDate = startDate;
Expand Down
5 changes: 1 addition & 4 deletions Common/Api/RestResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* limitations under the License.
*/
using System.Collections.Generic;
using Newtonsoft.Json;

namespace QuantConnect.Api
{
Expand All @@ -34,13 +33,11 @@ public RestResponse()
/// <summary>
/// Indicate if the API request was successful.
/// </summary>
[JsonProperty(PropertyName = "success")]
public bool Success { get; set; }

/// <summary>
/// List of errors with the API call.
/// </summary>
[JsonProperty(PropertyName = "errors")]
public List<string> Errors { get; set; }
}
}
}
3 changes: 1 addition & 2 deletions Common/Chart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
using System.Data;
using System.Drawing;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using QuantConnect.Logging;
using QuantConnect.Util;

namespace QuantConnect
{
Expand All @@ -28,7 +28,6 @@ namespace QuantConnect
/// </summary>
public class Chart
{

/// <summary>
/// Name of the Chart
/// </summary>
Expand Down
2 changes: 0 additions & 2 deletions Common/Packets/AlgorithmNameUpdatePacket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ public class AlgorithmNameUpdatePacket : Packet
/// <summary>
/// Algorithm id for this order event
/// </summary>
[JsonProperty(PropertyName = "sAlgorithmID")]
public string AlgorithmId;

/// <summary>
/// The new name
/// </summary>
[JsonProperty(PropertyName = "sName")]
public string Name;

/// <summary>
Expand Down
Loading

0 comments on commit d40ec77

Please sign in to comment.