Lean  $LEAN_TAG$
AlphaResultPacket.cs
1 /*
2  * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
3  * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  *
15 */
16 
17 using Newtonsoft.Json;
18 using QuantConnect.Orders;
19 using System.Collections.Generic;
21 
22 namespace QuantConnect.Packets
23 {
24  /// <summary>
25  /// Provides a packet type for transmitting alpha insights data
26  /// </summary>
27  public class AlphaResultPacket : Packet
28  {
29  /// <summary>
30  /// The user's id that deployed the alpha stream
31  /// </summary>
32  public int UserId { get; set; }
33 
34  /// <summary>
35  /// The deployed alpha id. This is the id generated upon submssion to the alpha marketplace.
36  /// If this is a user backtest or live algo then this will not be specified
37  /// </summary>
38  [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
39  public string AlphaId { get; set; }
40 
41  /// <summary>
42  /// The algorithm's unique identifier
43  /// </summary>
44  public string AlgorithmId { get; set; }
45 
46  /// <summary>
47  /// The generated insights
48  /// </summary>
49  [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
50  public List<Insight> Insights { get; set; }
51 
52  /// <summary>
53  /// The generated OrderEvents
54  /// </summary>
55  [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
56  public List<OrderEvent> OrderEvents { get; set; }
57 
58  /// <summary>
59  /// The new or updated Orders
60  /// </summary>
61  [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
62  public List<Order> Orders { get; set; }
63 
64  /// <summary>
65  /// Initializes a new instance of the <see cref="AlphaResultPacket"/> class
66  /// </summary>
68  : base(PacketType.AlphaResult)
69  {
70  }
71 
72  /// <summary>
73  /// Initializes a new instance of the <see cref="AlphaResultPacket"/> class
74  /// </summary>
75  /// <param name="algorithmId">The algorithm's unique identifier</param>
76  /// <param name="userId">The user's id</param>
77  /// <param name="insights">Alphas generated by the algorithm</param>
78  /// <param name="orderEvents">OrderEvents generated by the algorithm</param>
79  /// <param name="orders">Orders generated or updated by the algorithm</param>
80  public AlphaResultPacket(string algorithmId, int userId, List<Insight> insights = null, List<OrderEvent> orderEvents = null, List<Order> orders = null)
81  : base(PacketType.AlphaResult)
82  {
83  UserId = userId;
84  AlgorithmId = algorithmId;
85  Insights = insights;
86  OrderEvents = orderEvents;
87  Orders = orders;
88  }
89  }
90 }