Merge branch 'SPARK-1659' into grid-settings

This commit is contained in:
John Colvin committed 2018-10-14 15:56:48 -05:00
commit 1cb6066aea
22 files changed
+216 -85

No files matched your search

+4 -1
View File
@@ -26,6 +26,9 @@ namespace mbts.co2 {
}
internal static NativePriceLevel empty => new NativePriceLevel(IntPrice.NaN, 0, IntPrice.NaN, 0);
public override string ToString() {
return $"b [{bid.price} {bid.size}] a [{ask.price} {ask.size}]";
}
}
public readonly struct ImpliedPriceLevel {
readonly IntPrice _bid;
@@ -85,7 +88,7 @@ namespace mbts.co2 {
public override string ToString() {
return "{0} {1}".fmt(price, size);
return "{0} {1} ({2})".fmt(price, size, implied_size);
}
public override bool Equals(object obj) {
@@ -3,5 +3,6 @@ package bts.config;
message ExchangeSim {
optional bool merge_with_md = 1 [default=true];
optional bool forward_implied = 2 [default = false];
}
+3 -1
View File
@@ -209,7 +209,9 @@ const char* intern(const char* str) {
extern "C" BTS_EXPORT void Logger_log (int level, int subsystem, const char *message, const char *file, int line)
{
bts::log::_thread_logger.logger->enqueue(log::log_ts(),log::Subsystem{(uint8_t)subsystem}, log::Level{(uint8_t)level}, intern(file), line, "{}", std::string(message));
if (bts::log::_thread_logger.logger != nullptr) {
bts::log::_thread_logger.logger->enqueue(log::log_ts(), log::Subsystem{ (uint8_t)subsystem }, log::Level{ (uint8_t)level }, intern(file), line, "{}", std::string(message));
}
}
}
#endif
+5 -5
View File
@@ -163,31 +163,31 @@ string dump_entry(const HotDepthEntry& entry) {
res << "'timestamp': " << dump(entry.time()) << ", ";
res << "'key': " << entry.key << ", ";
res << "'bid': [";
res << "\n'bid': [";
for (const auto& level : entry.direct) {
res << dump(level.bid()) << ", ";
}
res << "], ";
res << "'ask': [";
res << "\n'ask': [";
for (const auto& level : entry.direct) {
res << dump(level.ask()) << ", ";
}
res << "], ";
res << "'implied_bid': [";
res << "'\nimplied_bid': [";
for (const auto& level : entry.implied) {
res << dump(level.bid()) << ", ";
}
res << "], ";
res << "'implied_ask': [";
res << "'\nimplied_ask': [";
for (const auto& level : entry.implied) {
res << dump(level.ask()) << ", ";
}
res << "], ";
res << "'settlement': '" << dump(entry.settlement) << "', ";
res << "\n'settlement': '" << dump(entry.settlement) << "', ";
res << "'status': '" << CoconutSecurityStatus_Name((CoconutSecurityStatus)entry.status) << "', ";
res << "'sequence': '" << entry.sequence << "', ";
res << " }";
+4 -1
View File
@@ -39,7 +39,10 @@ class IntPrice {
// logically 100*pow10(1) == 10*pow10(2)
// HOWEVER, once converted to double there are subtelties that can make them not equal so
// this function is conservative
return _mantissa == other._mantissa && _exponent == other._exponent;
if(_exponent == other._exponent)
return _mantissa == other._mantissa;
else
return price()==other.price();
}
bool operator!=(const IntPrice& other) const {
return !(*this == other);
+1 -1
View File
@@ -32,7 +32,7 @@ class PriceSize {
public:
PriceSize(IntPrice price, Size size) :
_price(price),
_price(size == 0 ? INT_NAN : price),
_size(size),
_direct_size(size)
{ }
+1 -1
View File
@@ -82,7 +82,7 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor {
auto start = Timer::now();
for (auto &h : _handles) {
auto &handle = h.handle;
if (handle.get_direct_book(h.last, std::tuple_size<BookSide>(),
if (handle.get_book(h.last, std::tuple_size<BookSide>(),
&book.bid()[0], &book.ask()[0]) ==
md::HandleReadResult::SUCCESS) {
book._security_key = SecurityKey(handle.key());
@@ -160,14 +160,24 @@ public:
if(md_type==bts::spark::LegSpreaderParams::DIRECT){
// since the "size()" in Book is the merged size
// we put the direct in the size
for(size_t i=0;i<source.n_levels();i++){
const md::PriceSize& b=source.bid()[i];
target.bid()[i]=md::PriceSize(b.int_price(),b.direct_size());
size_t target_i=0;
for(size_t source_i=0;source_i<source.n_levels();source_i++){
const md::PriceSize& b=source.bid()[source_i];
if(b.direct_size()>0){
target.bid()[target_i]=md::PriceSize(b.int_price(),b.direct_size());
target_i++;
}
}
for(size_t i=0;i<source.n_levels();i++){
const md::PriceSize& a=source.ask()[i];
target.ask()[i]=md::PriceSize(a.int_price(),a.direct_size());
empty_out_book(target.bid(),target_i,target.n_levels());
target_i=0;
for(size_t source_i=0;source_i<source.n_levels();source_i++){
const md::PriceSize& a=source.ask()[source_i];
if(a.direct_size()>0){
target.ask()[target_i]=md::PriceSize(a.int_price(),a.direct_size());
target_i++;
}
}
empty_out_book(target.ask(),target_i,target.n_levels());
}
else if(md_type==bts::spark::LegSpreaderParams::MERGED){
target.bid()=source.bid();
@@ -175,8 +185,8 @@ public:
}
if(leg_calc==bts::spark::LegSpreaderParams::NET_CHANGE){
if(settlement_price.is_nan()){
empty_out_book(target.bid(),target.n_levels());
empty_out_book(target.ask(),target.n_levels());
empty_out_book(target.bid(),0,target.n_levels());
empty_out_book(target.ask(),0,target.n_levels());
}
else{
offset_book(target.bid(), target.n_levels(),settlement_price);
@@ -196,9 +206,10 @@ public:
}
}
void static empty_out_book (BookSide& book_side,
size_t start_index,
size_t n_levels){
md::PriceSize empty_ps;
for(size_t i=0;i<n_levels;i++){
for(size_t i=start_index;i<n_levels;i++){
book_side[i]=empty_ps;
}
}
@@ -2893,6 +2893,30 @@ TEST_CASE ("simple book addition", "[spreader]"){
new uint16_t[5] {10, 1, 15, 14, 20},
true);
}
SECTION ("direct, book_holes"){
SecurityKey key(12345);
Book in_book (key);
fill_book(in_book,
new double[5] {2000, 2000.01, 2000.03, 2000.04, 2000.1},
new uint16_t[5] {0, 1, 0, 14, 20}, //directs
new uint16_t[5] {1, 12, 0, 0, 0}, //implieds
api::Side::SIDE_BUY,
true);
Book out_book(key);
SpreaderUtils::copy_book(in_book,
md::IntPrice_from_double<7>(1999.0),
bts::spark::LegSpreaderParams::DIRECT,
bts::spark::LegSpreaderParams::BOOK,
out_book);
validate_book(out_book,
key,
api::Side::SIDE_BUY,
0.01,
new double[5] {2000.01, 2000.04, 2000.10, os::nan(), os::nan()},
new uint16_t[5] {1, 14, 20, 0, 0},
true);
}
SECTION ("direct, net_change"){
SecurityKey key(13579);
Book in_book (key);
+34 -2
View File
@@ -11,6 +11,7 @@
#include "lib/os/os.h"
#include "lib/config/protos/Ports.pb.h"
#include "lib/config/protos/ExchangeSimCfg.pb.h"
#include "lib/config/config.h"
#include <quickfix/FileLog.h>
@@ -46,7 +47,8 @@ struct MDPlayer : md::IRelayWriter
{
MDPlayer (IMDPlayerObserver &obs,std::map<uint32_t,md::Security> &known_securities) :
obs (obs),
known_securities(known_securities)
known_securities(known_securities),
forward_implied(config::get<config::ExchangeSim>().forward_implied())
{}
@@ -75,11 +77,41 @@ struct MDPlayer : md::IRelayWriter
size_t n = 0;
for (auto &a : book.asks())
asks[n++] = md::PriceSize({a.mantissa(),(int8_t)a.exponent()},a.size());
obs.on_depth(*sec_ptr, bids, asks);
std::array<md::PriceSize, md::COCONUT_MAX_IMPLIED_DEPTH> implied_bids, implied_asks;
bool has_implied = false;
{size_t x = 0;
for (const auto& b : cr.implied().bids()) {
implied_bids[x] = md::PriceSize({b.mantissa(), (int8_t)b.exponent()}, b.size());
x += 1;
has_implied = true;
}}
{size_t x = 0;
for (const auto& b : cr.implied().asks()) {
implied_asks[x] = md::PriceSize({b.mantissa(), (int8_t)b.exponent()}, b.size());
x += 1;
has_implied = true;
}}
if (has_implied) {
obs.on_depth(*sec_ptr, bids, asks, &implied_bids, &implied_asks);
}
else {
obs.on_depth(*sec_ptr, bids, asks, nullptr, nullptr);
}
if (cr.has_misc()) {
if (cr.misc().has_settlement()) {
const auto& s = cr.misc().settlement();
obs.on_settlement(*sec_ptr, { s.mantissa(), (int8_t)s.exponent() });
}
}
}
}
IMDPlayerObserver &obs;
std::map<uint32_t, md::Security> &known_securities;
bool forward_implied;
};
@@ -527,9 +527,21 @@ void ExchangeSimApplication::on_new_security(api::Security const &s) {
}
}
void ExchangeSimApplication::on_settlement(md::Security const& sec, md::IntPrice price) {
auto sec_desc = get_sim_sec_desc(sec);
auto iter = me->md_producer_handles.find(sec_desc);
if (iter != me->md_producer_handles.end()) {
auto &handle = iter->second;
handle.update_settlement(utils::TimeStamp::now(), price, datetime::today());
}
}
void ExchangeSimApplication::on_depth(
md::Security const &sec, md::PriceSize bids[md::COCONUT_MAX_DEPTH],
md::PriceSize asks[md::COCONUT_MAX_DEPTH]) {
md::Security const &sec,
md::PriceSize bids[md::COCONUT_MAX_DEPTH],
md::PriceSize asks[md::COCONUT_MAX_DEPTH],
std::array<md::PriceSize, md::COCONUT_MAX_IMPLIED_DEPTH>* implied_bids,
std::array<md::PriceSize, md::COCONUT_MAX_IMPLIED_DEPTH>* implied_asks) {
std::lock_guard<std::mutex> l(me->lock);
if (sec.has_synthetic())
@@ -564,6 +576,15 @@ void ExchangeSimApplication::on_depth(
// we generate a set of orders that we apply to our order book
merge_with_order_book(it->second.security.glbx().security_desc(),
previous_md_book, current_md_book);
// pass on implied market unchanged
if (implied_bids || implied_asks) {
auto iter = me->md_producer_handles.find(get_sim_sec_desc(sec));
if (iter != me->md_producer_handles.end()) {
auto &handle = iter->second;
handle.update_implied(utils::TimeStamp::now(), *implied_bids, *implied_asks);
}
}
}
void ExchangeSimApplication::merge_with_order_book(std::string const &sec_desc,
@@ -99,9 +99,12 @@ public:
void persist_book(OrderBook const &b);
void on_new_security(md::Security const&) override;
void on_settlement(md::Security const&, md::IntPrice) override;
void on_depth(md::Security const&s,
md::PriceSize bids[md::COCONUT_MAX_DEPTH],
md::PriceSize asks[md::COCONUT_MAX_DEPTH]) override;
md::PriceSize asks[md::COCONUT_MAX_DEPTH],
std::array<md::PriceSize, md::COCONUT_MAX_IMPLIED_DEPTH>* implied_bids,
std::array<md::PriceSize, md::COCONUT_MAX_IMPLIED_DEPTH>* implied_asks) override;
void merge_with_order_book(std::string const &sec_desc, Book const&previous,Book const&current);
};
}}
@@ -9,9 +9,12 @@ namespace sim {
struct IMDPlayerObserver {
virtual void on_new_security(md::Security const&) = 0;
virtual void on_settlement(const md::Security&, md::IntPrice) = 0;
virtual void on_depth(md::Security const&s,
md::PriceSize bids[md::COCONUT_MAX_DEPTH],
md::PriceSize asks[md::COCONUT_MAX_DEPTH]) = 0;
md::PriceSize asks[md::COCONUT_MAX_DEPTH],
std::array<md::PriceSize, md::COCONUT_MAX_IMPLIED_DEPTH>* implied_bids,
std::array<md::PriceSize, md::COCONUT_MAX_IMPLIED_DEPTH>* implied_asks) = 0;
};
}}
+1 -1
View File
@@ -27,7 +27,7 @@ const VolumeAtPriceLevel& ChannelVolume::add_trade(const TradeMessage& m,
VolumeAtPriceLevel vol;
vol.set_record_id(record_id++);
vol.set_security_id(m.key());
auto p = md::PriceSize({m.mantissa(),(int8_t)m.exponent()},0);
IntPrice p = md::IntPrice (m.mantissa(),(int8_t)m.exponent());
vol.set_price(p.price());
price_map[m.mantissa()] = vol;
price_it=price_map.find(m.mantissa());
@@ -20,6 +20,7 @@ using namespace bts::api::md::auxiliary;
struct MarketDataAuxiliaryServiceServer::PImpl{
bool vap_enabled;
bts::api::ServiceContext& context;
MarketDataRelay relay_service;
MarketDataAuxiliaryServiceBase::Volume_at_priceStatefulPublisher publisher;
std::unique_ptr<utils::DispatcherTimer> trade_timer;
@@ -30,13 +31,14 @@ struct MarketDataAuxiliaryServiceServer::PImpl{
const MarketDataAuxiliaryServiceBase::Volume_at_priceStatefulPublisher& publisher)
:
vap_enabled(config::get<config::toggles::VolumeAtPrice>().enabled()),
context(context),
relay_service(context.locate<MarketDataRelay>()),
publisher(publisher),
trade_timer(),
poll_period_ms(100),
state(),
log_counter(0),
log_trunc(10){
log_trunc(300){
}
};
@@ -46,21 +48,18 @@ MarketDataAuxiliaryServiceServer::MarketDataAuxiliaryServiceServer(
MarketDataAuxiliaryServiceBase(context),
me(new PImpl(context,
make_volume_at_price_stateful_publisher())){
if(me->vap_enabled){
auto& threadpool = utils::Dispatcher::get_named("TradesQuery");
me->trade_timer =
std::make_unique<utils::DispatcherTimer>(threadpool,
me->poll_period_ms,
[this]() {
me->relay_service.requestmd(me->state.md_req(),
[this](const bts::api::Result<MDReply>& md_reply)
{
if(md_reply.result()!=nullptr)
_scan_trades(*md_reply.result());}
);
});
me->trade_timer->start();
}
if(me->vap_enabled)
me->context.post([this](){_poll_md();},me->poll_period_ms);
}
void MarketDataAuxiliaryServiceServer::_poll_md(){
me->relay_service.requestmd(me->state.md_req(),
[this](const bts::api::Result<MDReply>& md_reply)
{
if(md_reply.result()!=nullptr)
_scan_trades(*md_reply.result());
me->context.post([this](){_poll_md();},me->poll_period_ms);
});
}
void MarketDataAuxiliaryServiceServer::_scan_trades(const MDReply& md_reply){
@@ -79,9 +78,9 @@ void MarketDataAuxiliaryServiceServer::_scan_trades(const MDReply& md_reply){
n_trades,total_unique_levels,usecs);
me->log_counter=0;
}
me->publisher.flush();
me->publisher.flush();
}
MarketDataAuxiliaryServiceServer::~MarketDataAuxiliaryServiceServer(){
}
}}}
}}}
@@ -18,6 +18,7 @@ private:
struct PImpl;
std::unique_ptr<PImpl> me;
private:
void _poll_md();
void _scan_trades(const bts::co2::MDReply&);
public:
MarketDataAuxiliaryServiceServer(bts::api::ServiceContext& context);
@@ -113,11 +113,11 @@ void MDP3Listener::onEndOfPacket(onixs::Handler&, const onixs::PacketArgs&) {
// Security discovery
void MDP3Listener::onBookUpdate(onixs::Handler&, const onixs::Security& sec, const onixs::DirectBook& book) {
onBookUpdate<COCONUT_MAX_DEPTH>(sec, book);
onBookUpdate<COCONUT_MAX_DEPTH>(sec, book, book_type_direct);
}
void MDP3Listener::onBookUpdate(onixs::Handler&, const onixs::Security& sec, const onixs::ImpliedBook& book) {
onBookUpdate<COCONUT_MAX_IMPLIED_DEPTH>(sec, book);
onBookUpdate<COCONUT_MAX_IMPLIED_DEPTH>(sec, book, book_type_implied);
}
//
@@ -239,11 +239,21 @@ void MDP3Listener::flush_books() {
// This is called at the end of the packet
// Write all book updates to shared memory and reset for the next packet
for (auto& entry : _book_updates) {
uint16_t sequence = (_latest_sequence & 0xFFFF);
entry.handle.update_books(_packet_arrived,
entry.bids.first, entry.asks.first,
entry.bids.second, entry.asks.second,
sequence);
uint32_t sequence = _latest_sequence;
if (entry.type_flags == book_type_direct) {
entry.handle.update_direct(_packet_arrived,
entry.bids.first, entry.asks.first, sequence);
}
else if (entry.type_flags == book_type_implied) {
entry.handle.update_implied(_packet_arrived,
entry.bids.second, entry.asks.second, sequence);
}
else if (entry.type_flags == book_type_both) {
entry.handle.update_books(_packet_arrived,
entry.bids.first, entry.asks.first,
entry.bids.second, entry.asks.second,
sequence);
}
}
// Reset pending updates
_book_updates.clear();
@@ -255,7 +265,7 @@ void MDP3Listener::update_all_status(CoconutSecurityStatus status) {
});
}
md::MDP3Listener::BookData::BookData(MDProducerHandle & handle) : handle(handle), bids(), asks() { }
md::MDP3Listener::BookData::BookData(MDProducerHandle & handle) : handle(handle), type_flags(0), bids(), asks() { }
}}//namespace
@@ -23,6 +23,11 @@ class MDP3Listener :
public onixs::MarketDataListener,
public onixs::SecurityListener
{
typedef uint32_t BookType;
static constexpr BookType book_type_direct=1;
static constexpr BookType book_type_implied=2;
static constexpr BookType book_type_both=(book_type_direct|book_type_implied);
public:
MDP3Listener(CMESecurityIndex& index,
MDProducer&,
@@ -76,7 +81,7 @@ public:
// void onBookUpdate(onixs::Handler&, const onixs::Security&, const onixs::ConsolidatedBook&) override;
template <size_t MAX_DEPTH,class TBook>
void onBookUpdate(const onixs::Security& sec, const TBook& book);
void onBookUpdate(const onixs::Security& sec, const TBook& book, BookType booktype);
//
// Trades
@@ -197,7 +202,7 @@ private:
struct BookData {
BookData(MDProducerHandle& handle);
MDProducerHandle handle;
BookType type_flags;
std::pair<std::array<PriceSize, COCONUT_MAX_DEPTH>, std::array<PriceSize,COCONUT_MAX_IMPLIED_DEPTH>> bids;
std::pair<std::array<PriceSize, COCONUT_MAX_DEPTH>, std::array<PriceSize,COCONUT_MAX_IMPLIED_DEPTH>> asks;
};
@@ -352,7 +357,7 @@ void MDP3Listener::onSpread(onixs::Handler&, const onixs::Security&, const Instr
}
template <size_t MAX_DEPTH,class TBook>
void MDP3Listener::onBookUpdate(const onixs::Security& sec, const TBook& onixs_book) {
void MDP3Listener::onBookUpdate(const onixs::Security& sec, const TBook& onixs_book, BookType booktype) {
tracepoint (bts_trace,trace_order,(char*) "onBookUpdate", _latest_sequence, (uint16_t) _latest_sequence, 0);
auto data = _index.get_security(sec.id());
@@ -370,6 +375,7 @@ void MDP3Listener::onBookUpdate(const onixs::Security& sec, const TBook& onixs_b
_book_updates.emplace_back(data->handle);
}
BookData& cache = found ? *find_iter : _book_updates.back();
cache.type_flags |= booktype;
auto& cache_bids = std::get<std::array<PriceSize,MAX_DEPTH>>(cache.bids);
auto& cache_asks = std::get<std::array<PriceSize,MAX_DEPTH>>(cache.asks);
@@ -386,12 +392,14 @@ void MDP3Listener::onBookUpdate(const onixs::Security& sec, const TBook& onixs_b
for (size_t x = 0; x < asks_size; ++x) {
cache_asks[x] = pricesize_of_price_size(onixs_book.offers()[x].price(), display_factor, onixs_book.offers()[x].quantity());
}
if (!found) {
// NaN out the remaining depth
for (size_t x = bids_size; x < MAX_DEPTH; ++x) {
cache_bids[x] = NO_MARKET;
}
for (size_t x = asks_size; x < MAX_DEPTH; ++x) {
cache_asks[x] = NO_MARKET;
for (size_t x = bids_size; x < MAX_DEPTH; ++x) {
cache_bids[x] = NO_MARKET;
}
for (size_t x = asks_size; x < MAX_DEPTH; ++x) {
cache_asks[x] = NO_MARKET;
}
}
}
+2 -2
View File
@@ -227,8 +227,8 @@ let update msg (model:Users.Types.Model) : Model * Cmd<Msg> =
model, Cmd.Empty
| UpdateField field ->
{ model with scratchUser = applyUpdate field model.scratchUser; ConfirmModal = ("", Msg.SwitchTab model.currentTab) } , Cmd.Empty
| Clone usr ->
{ model with scratchUser = { usr with id = 0u; name = usr.name + "_copy" }}, Cmd.Empty
| CloneUser ->
{ model with PreviousScratchUser = model.scratchUser; scratchUser = { model.scratchUser with id = 0u; name = sprintf "%s_clone" model.scratchUser.name }; OptionsMenuOpen = ""}, Cmd.ofMsg (SwitchTab General)
| CopyFrom (usrSrc, usrDest) ->
let nusr = { usrSrc with
id = usrDest.id
+1 -1
View File
@@ -36,7 +36,7 @@ type Msg =
| RpcResponse of string
| UpdateAdminData of AdminData
| UpdateField of UserField
| Clone of BTSUser
| CloneUser
| CopyFrom of BTSUser * BTSUser
| Delete of BTSUser
| AddUser
+9 -22
View File
@@ -178,27 +178,6 @@ let userControls (model:Model) (dispatch:Msg->Unit) =
[
saveButton model dispatch
Button.button "Revert" "" "" (if dirty then Button.Enabled else Button.Disabled) (fun _ -> SwitchUser (currentUser) |> dispatch)
(*p [ ClassName "control" ]
[ a [ ClassName "button is-light"
Title "Clone"
OnClick (fun _ -> dispatch <| Clone currentUser)
Disabled disabled
]
[ span [ ClassName "icon is-small" ]
[ i [ ClassName "fa fa-clone" ]
[ ] ]
]
]*)
(*p [ ClassName "control" ]
[ a [ ClassName "button is-light" ]
[ span [ ClassName "icon is-small"
Title "Copy from user 1 ..."
OnClick (fun _ -> dispatch <| CopyFrom (usersList.Head, currentUser))
]
[ i [ ClassName "fa fa-copy" ]
[ ] ]
]
]*)
]
@@ -276,7 +255,11 @@ let userSelectionGrid (usersList:BTSUser list) (currentUser:BTSUser) (dispatch:M
let menuItem (user:BTSUser) (selectedUser:BTSUser) model dispatch =
a [ ClassName (isActiveUser user.id selectedUser)
OnClick (fun _ -> SwitchUser user |> dispatch)
OnClick (fun _ ->
match user.name = model.OptionsMenuOpen with
| false -> SwitchUser user |> dispatch
| _ -> ()
)
] [
span [] [ str user.name ]
span [ Class "is-pulled-right menu-icon" ]
@@ -305,6 +288,10 @@ let menuItem (user:BTSUser) (selectedUser:BTSUser) model dispatch =
OnClick (fun _ -> dispatch <| Delete user)
]
[ str "Remove" ]
a [ Class "dropdown-item"
OnClick (fun _ -> dispatch <| CloneUser)
]
[ str "Clone" ]
]
]
]
@@ -0,0 +1,23 @@
0. This test should run in sim market with merged turned on
ExchangeSim {value {merge_with_md:true}}
1. Bring up a market view for SI futures. There are 3 quantity columns
a. Implied : This is the quantity coming purely from implieds (ex for the spreads, this is
'implied' from the legs)
b. Direct : This comes purely from markets in the security itself
c. Qty (or Merged Qty) == Implied + Direct.
2. Select a future with only implied markets (SI should have lots of them). Verify that the ladder
agrees with the market view (the ladder shows merged by default).
3. Enter buy and sell orders away from the market and make sure they show up as direct market in the ladder.
4. In the ladder settings -> Market Data, select Direct Only. Make sure the ladder does the right thing.
5. Go back to Merged and make sure the Ladder does the right thing.
6. Make you direct bid better than the implied bid (by moving your buy order) and make sure MView does the right thing.
7. Repeat 6 for sell/ask.