forked from QuantBox/QuantBox.APIProvider
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseMap.cs
More file actions
72 lines (58 loc) · 2.14 KB
/
Copy pathBaseMap.cs
File metadata and controls
72 lines (58 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using SmartQuant;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using QB = QuantBox;
using SQ = SmartQuant;
namespace QuantBox.APIProvider.Single
{
class BaseMap
{
private Framework framework;
protected SingleProvider provider;
public BaseMap(Framework framework, SingleProvider provider)
{
this.framework = framework;
this.provider = provider;
}
#region EmitExecutionReport
public ExecutionReport CreateReport(
OrderRecord record,
SQ.ExecType? execType,
SQ.OrderStatus? orderStatus)
{
ExecutionReport report = new ExecutionReport(record.Order);
report.DateTime = framework.Clock.DateTime;
//report.Order = record.Order;
//report.Instrument = record.Order.Instrument;
//report.Side = record.Order.Side;
//report.OrdType = record.Order.Type;
//report.TimeInForce = record.Order.TimeInForce;
//report.OrdQty = record.Order.Qty;
//report.Price = record.Order.Price;
//report.StopPx = record.Order.StopPx;
report.AvgPx = record.AvgPx;
report.CumQty = record.CumQty;
report.LeavesQty = record.LeavesQty;
if (execType != null)
report.ExecType = execType.Value;
if (orderStatus != null)
report.OrdStatus = orderStatus.Value;
return report;
}
public void EmitExecutionReport(OrderRecord record, SQ.ExecType execType, SQ.OrderStatus orderStatus)
{
ExecutionReport report = CreateReport(record, execType, orderStatus);
provider.EmitExecutionReport(report);
}
public void EmitExecutionReport(OrderRecord record, SQ.ExecType execType, SQ.OrderStatus orderStatus, string text)
{
ExecutionReport report = CreateReport(record, execType, orderStatus);
report.Text = text;
provider.EmitExecutionReport(report);
}
#endregion
}
}