-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathBaseMap.cs
More file actions
83 lines (66 loc) · 2.34 KB
/
Copy pathBaseMap.cs
File metadata and controls
83 lines (66 loc) · 2.34 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
73
74
75
76
77
78
79
80
81
82
83
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
{
protected 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.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 ExecutionReport CreateReport(
Order order,
SQ.ExecType? execType,
SQ.OrderStatus? orderStatus)
{
ExecutionReport report = new ExecutionReport(order);
report.DateTime = framework.Clock.DateTime;
report.AvgPx = order.AvgPx;
report.CumQty = order.CumQty;
report.LeavesQty = order.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
}
}