Load security db in mdp3 startup
This commit is contained in:
1 parent
d97b4db80a
commit
fcc29ec2d1
6 files changed
+53
-14
No files matched your search
@@ -91,8 +91,10 @@ public:
|
||||
void add_filter_symbol(const std::string& symbol);
|
||||
void heartbeat();
|
||||
|
||||
private:
|
||||
// Add a new security to the index
|
||||
void add_security(const FixedSecurity& security);
|
||||
|
||||
private:
|
||||
void dequeue_securities();
|
||||
enum SecurityFilterAction { ADD, SKIP, DELETE };
|
||||
template <class Sec>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "MDP3Utils.h"
|
||||
#include "lib/config/config.h"
|
||||
#include "lib/md/coconut2.h"
|
||||
#include "lib/md/SecurityDB.h"
|
||||
#include "lib/os/os.h"
|
||||
#include "lib/utils/Dispatcher.h"
|
||||
#include "lib/utils/proto_helper.h"
|
||||
@@ -16,7 +17,7 @@
|
||||
|
||||
using namespace std;
|
||||
using namespace bts::co2;
|
||||
// using namespace onixs;
|
||||
using std::size_t;
|
||||
|
||||
namespace bts {
|
||||
namespace md {
|
||||
@@ -322,6 +323,14 @@ unique_ptr<MDP3Listener> MDP3Main::prepare_listener(onixs::Handler& handler, con
|
||||
listener->add_filter_symbol(symbol.symbol());
|
||||
}
|
||||
|
||||
// Load the list of known securities and add them to the index for fast startup
|
||||
db_load_securities(channel.symbols, [&](const api::Security& security) {
|
||||
with_security(securitytype_of(security), num_legs(security), [&](FixedSecurity& fs) {
|
||||
convert_security(security, fs, true);
|
||||
listener->add_security(fs);
|
||||
});
|
||||
});
|
||||
|
||||
handler.registerListener(*listener);
|
||||
handler.registerMarketDataListener(*listener);
|
||||
handler.registerSecurityListener(*listener);
|
||||
|
||||
Reference in new issue
Block a user