forked from worldexplorer/SquareOne
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBacktestStreamingProvider.cs
More file actions
44 lines (38 loc) · 1.44 KB
/
BacktestStreamingProvider.cs
File metadata and controls
44 lines (38 loc) · 1.44 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
using System;
using Sq1.Core.DataTypes;
using Sq1.Core.Streaming;
using Sq1.Core.Support;
namespace Sq1.Core.Backtesting {
[SkipInstantiationAt(Startup = true)]
public class BacktestStreamingProvider : StreamingProvider {
public BacktestSpreadModeler SpreadModeler;
public BacktestStreamingProvider() {
string msg = "We should never be here; skip instantiation by Activator in MainModule::InitializeProviders()";
//throw new Exception(msg);
}
public BacktestStreamingProvider(string symbol) : base() {
base.Name = "BacktestStreamingProvider";
this.SpreadModeler = new BacktestSpreadModelerConstant(10);
}
public void GeneratedQuoteEnrichSymmetricallyAndPush(Quote quote) {
if (this.SpreadModeler == null) {
string msg = "Don't leave quoteToReach.Bid and quoteToReach.Ask uninitialized!!!";
throw new Exception(msg);
}
this.SpreadModeler.GenerateFillBidAskSymmetricallyFromLastPrice(quote);
base.PushQuoteReceived(quote);
}
public override void UpstreamSubscribe(string symbol) {
base.UpstreamSubscribeRegistryHelper(symbol);
}
public override void UpstreamUnSubscribe(string symbol) {
base.UpstreamUnSubscribeRegistryHelper(symbol);
}
public override bool UpstreamIsSubscribed(string symbol) {
return base.UpstreamIsSubscribedRegistryHelper(symbol);
}
public override string ToString() {
return Name + ": DataSource[" + this.DataSource + "]";
}
}
}