forked from StockSharp/AlgoTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNewOrderTest.xaml.cs
54 lines (45 loc) · 1.24 KB
/
NewOrderTest.xaml.cs
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
namespace SpeedTest
{
using System;
using System.Windows;
using Ecng.Collections;
using StockSharp.Algo;
using StockSharp.BusinessEntities;
using StockSharp.Quik;
using StockSharp.SmartCom;
public partial class NewOrderTest
{
private readonly Connector _connector;
public NewOrderTest(Connector connector, FilterableSecurityProvider securityProvider)
{
InitializeComponent();
_connector = connector;
Portfolios.Connector = connector;
Securities.SecurityProvider = securityProvider;
}
private void Ok(object sender, RoutedEventArgs e)
{
try
{
var adapter = ((BasketMessageAdapter)_connector.TransactionAdapter).Portfolios.TryGetValue(Portfolios.SelectedPortfolio.Name);
var sp = new SpeedTestStrategy(int.Parse(NumberOfTests.Text))
{
Connector = _connector,
Portfolio = Portfolios.SelectedPortfolio,
Security = Securities.SelectedSecurity,
Volume = 1,
TraderName = adapter is QuikMessageAdapter
? "Quik"
: adapter is SmartComMessageAdapter ? "SmartCom" : "Plaza",
};
_connector.RegisterMarketDepth(sp.Security);
MainWindow.Strategies.Add(sp);
Close();
}
catch (Exception ex)
{
MessageBox.Show(this, ex.ToString());
}
}
}
}