Simplify getting a security

This commit is contained in:
Eric Harding authored and Pedro Pinto committed 2019-02-11 16:48:53 -05:00
1 parent a384eb9f73
commit 4efd853c96
1 file changed
+37 -3
+37 -3
View File
@@ -12,6 +12,7 @@ using bts.test;
using bts.api.orderman;
using mbts;
using mbts.tests;
using bts.co2;
namespace bts.tests
{
@@ -36,6 +37,39 @@ namespace bts.tests
Disposable.dispose(ref _context);
}
async Task<IEnumerable<SecurityImmutable>> all_futures(string symbol) {
var request = new MDRequest() {
Host = "system_test",
Channels = {
new SecurityChannel() {
Time = 0,
Flags = 0,
Type = SecurityType.Future,
Exchange = Venue.Sim,
Symbol = symbol,
TradeCursor = 0,
RfqCursor = 0
}
}
};
var relay = _context.locate<MarketDataRelay>();
await Task.Delay(100);
var result = await relay.requestmd_async(request);
List<SecurityImmutable> securities = new List<SecurityImmutable>();
if (result.success) {
foreach (var ch in result.value.Channels) {
foreach (var update in ch.Updates) {
if (update.Security != null) {
securities.Add(new SecurityImmutable(update.Security));
}
}
}
}
return securities;
}
[Test]
public async Task test_clip_limits() {
//Get and set limit values from the admin service
@@ -53,9 +87,9 @@ namespace bts.tests
//create Orders Here
bts.md.MarketDataClient mdc = new bts.md.MarketDataClient();
SecurityImmutable? sec = await mdc.find_security_async(y => y.Symbol == test_symbol && y.Exchange == Venue.Sim);
var all = await all_futures(test_symbol);
SecurityImmutable? sec = all.FirstOrDefault();
Assert.IsTrue(sec.HasValue);
uint under_limit_order_key;
uint over_limit_order_key;