Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asset plot improvement #7699

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Common/BaseSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,6 @@ public enum SeriesType
/// Heatmap Plot (9) -- NOTE: 8 is reserved
Heatmap = 9,
/// Scatter 3D Plot (10)
Scatter3d,
/// A stock plot
StockPlot
Scatter3d
}
}
18 changes: 17 additions & 1 deletion Common/Chart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public class Chart
/// List of Series Objects for this Chart:
public Dictionary<string, BaseSeries> Series = new Dictionary<string, BaseSeries>();

/// <summary>
/// Associated symbol if any, making this an asset plot
/// </summary>
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public Symbol Symbol { get; set; }

/// <summary>
/// Default constructor for chart:
/// </summary>
Expand All @@ -60,9 +66,19 @@ public Chart(string name, ChartType type = ChartType.Overlay)
/// Constructor for a chart
/// </summary>
/// <param name="name">String name of the chart</param>
public Chart(string name)
public Chart(string name) : this(name, null)
{
}

/// <summary>
/// Constructor for a chart
/// </summary>
/// <param name="name">String name of the chart</param>
/// <param name="symbol">Associated symbol if any</param>
public Chart(string name, Symbol symbol)
{
Name = name;
Symbol = symbol;
Series = new Dictionary<string, BaseSeries>();
}

Expand Down
7 changes: 7 additions & 0 deletions Common/Orders/OrderJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ public static Order CreateOrderFromJObject(JObject jObject)
order.OrderSubmissionData = new OrderSubmissionData(bidPrice, askPrice, lastPrice);
}

var priceAdjustmentMode = jObject["PriceAdjustmentMode"];
if (priceAdjustmentMode != null && priceAdjustmentMode.Type != JTokenType.Null)
{
var value = priceAdjustmentMode.Value<int>();
order.PriceAdjustmentMode = (DataNormalizationMode)value;
}

var lastFillTime = jObject["LastFillTime"];
var lastUpdateTime = jObject["LastUpdateTime"];
var canceledTime = jObject["CanceledTime"];
Expand Down
4 changes: 3 additions & 1 deletion Tests/Common/Orders/OrderJsonConverterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,8 @@ public void RoundTripUsingJsonConverter(string timeInForceStr)
CanceledTime = DateTime.UtcNow,
Status = OrderStatus.Filled,
OrderSubmissionData = new OrderSubmissionData(321.47m, 321.48m, 321.49m),
Properties = { TimeInForce = timeInForce }
Properties = { TimeInForce = timeInForce },
PriceAdjustmentMode = DataNormalizationMode.Adjusted
};

var converter = new OrderJsonConverter();
Expand Down Expand Up @@ -541,6 +542,7 @@ public void RoundTripUsingJsonConverter(string timeInForceStr)
Assert.AreEqual(expected.OrderSubmissionData.AskPrice, actual.OrderSubmissionData.AskPrice);
Assert.AreEqual(expected.OrderSubmissionData.BidPrice, actual.OrderSubmissionData.BidPrice);
Assert.AreEqual(expected.OrderSubmissionData.LastPrice, actual.OrderSubmissionData.LastPrice);
Assert.AreEqual(expected.PriceAdjustmentMode, actual.PriceAdjustmentMode);
}

[Test]
Expand Down
Loading