OrderStress - do asks first so the console looks like little text ladders

This commit is contained in:
Eric Harding committed 2019-05-01 17:53:47 -04:00
1 parent 975f7f64b7
commit 9f9da1847b
1 file changed
+8 -8
+8 -8
View File
@@ -132,6 +132,14 @@ namespace bts {
foreach (var m in all_markets(ctx)) {
ConsoleEx.WriteLine(m.security.security_desc(), ConsoleColor.White);
var tick = m.security.ContractSpec.LowTick;
if (m.ask.HasValue) {
for (var x = 0; x < o.depth; ++x) {
var price = m.ask.Value.price() + (tick * x);
ConsoleEx.WriteLine($"Sell {o.quantity} at {price}", ConsoleColor.Red);
orders.create_order_async(mkorder(m.security.Id, price, o.quantity, Side.Sell));
System.Threading.Thread.Sleep(o.sleep);
}
}
if (m.bid.HasValue) {
// start at bid and place 1 order at 10 levels
for (var x=0; x < o.depth; ++x) {
@@ -141,14 +149,6 @@ namespace bts {
System.Threading.Thread.Sleep(o.sleep);
}
}
if (m.ask.HasValue) {
for (var x = 0; x < o.depth; ++x) {
var price = m.ask.Value.price() + (tick * x);
ConsoleEx.WriteLine($"Sell {o.quantity} at {price}", ConsoleColor.Red);
orders.create_order_async(mkorder(m.security.Id, price, o.quantity, Side.Sell));
System.Threading.Thread.Sleep(o.sleep);
}
}
}
return 3;
}