refactor: Split MarketDataGateway up into providers/sources
MarketDataGateway still exists, but is greatly simplified. It creates several `IMarketDataProvider`s, each of which generates a list of `IMarketDataSource`s. The market data sources provide market data to an `IMarketDataListener`. * EmumbaMarketDataProvider * CCApiMarketDataProvider * PyMarketDataProvider * OnixsMarketDataProvider * ReplayMarketDataProvider As a side effect, individual py market data sources are now explicitly limited to a single venue (it probably should have been this way all along, since the shared memory writers do not expect updates to involve multiple venues).
This commit is contained in:
1 parent
d68fe93422
commit
0aaa6e18fd
60 files changed
+1724
-758
No files matched your search
@@ -20,19 +20,32 @@ class PyBook {
|
||||
const std::string &venue() const;
|
||||
void set_venue(std::string value);
|
||||
|
||||
/**
|
||||
* @brief Gets the name of the security type (e.g., "SPOT", "FUTURE", "OPTION").
|
||||
*
|
||||
* @return const std::string& The name of the security type.
|
||||
*/
|
||||
const std::string &security_type() const;
|
||||
/**
|
||||
* @brief Sets the security type.
|
||||
*
|
||||
* @param value The new security type (should be "SPOT", "FUTURE", or "OPTION").
|
||||
*/
|
||||
void set_security_type(std::string value);
|
||||
|
||||
/**
|
||||
* @brief Gets the exchange security id. This is typically the security's name
|
||||
* (e.g., "BTS-PERPETUAL", or "ESH5").
|
||||
*
|
||||
* @note Must be unique for each security at a particular venue (i.e., a single
|
||||
* venue cannot have 2 securities with the same name).
|
||||
* @note Should be unique for each security at a particular venue (i.e., a single
|
||||
* venue cannot have 2 securities with the same name). MUST be unique for each security
|
||||
* of the same type (e.g., SPOT, FUTURE, OPTION) at a particular venue.
|
||||
*
|
||||
* @note There is no "security_id" member because that is an internal id that
|
||||
* we generate elsewhere in c++ code. The python plugins just need to set the
|
||||
* venue and exchange_security_id.
|
||||
*/
|
||||
const std::string &exchange_security_id() const;
|
||||
|
||||
/**
|
||||
* @brief Sets the exchange security id.
|
||||
*
|
||||
@@ -57,6 +70,7 @@ class PyBook {
|
||||
|
||||
private:
|
||||
std::string venue_;
|
||||
std::string security_type_;
|
||||
std::string exchange_security_id_;
|
||||
PyBookSide bids_;
|
||||
PyBookSide asks_;
|
||||
@@ -69,6 +83,13 @@ class PyBook {
|
||||
inline const std::string &PyBook::venue() const { return venue_; }
|
||||
inline void PyBook::set_venue(std::string value) { venue_ = std::move(value); }
|
||||
|
||||
inline const std::string &PyBook::security_type() const {
|
||||
return security_type_;
|
||||
}
|
||||
inline void PyBook::set_security_type(std::string value) {
|
||||
security_type_ = std::move(value);
|
||||
}
|
||||
|
||||
inline const std::string &PyBook::exchange_security_id() const {
|
||||
return exchange_security_id_;
|
||||
}
|
||||
|
||||
@@ -37,9 +37,6 @@ namespace py = pybind11;
|
||||
// Binds getter -> <name>, and setter -> set_<name>.
|
||||
#define PROP(type, name) \
|
||||
def(_STR(name), &type::name).def(_STR(set_##name), &type::set_##name)
|
||||
// namespace blah {
|
||||
// typedef bts::md::py_interop::PyBookSide & (bts::md::py_interop::PyBook::*bids());
|
||||
// }
|
||||
|
||||
// Define python module with c++ classes.
|
||||
PYBIND11_MODULE(python_md_module, m) {
|
||||
@@ -93,6 +90,7 @@ PYBIND11_MODULE(python_md_module, m) {
|
||||
py::class_<bts::md::py_interop::PyBook>(m, "PyBook")
|
||||
.def(py::init<>())
|
||||
.PROP(PyBook, venue)
|
||||
.PROP(PyBook, security_type)
|
||||
.PROP(PyBook, exchange_security_id)
|
||||
.EXPLICIT_DEF(PyBook, bids, BookSideGetter)
|
||||
.DEF(PyBook, set_bids)
|
||||
@@ -110,6 +108,7 @@ PYBIND11_MODULE(python_md_module, m) {
|
||||
py::class_<PyTrade>(m, "PyTrade")
|
||||
.def(py::init<>())
|
||||
.PROP(PyTrade, venue)
|
||||
.PROP(PyTrade, security_type)
|
||||
.PROP(PyTrade, exchange_security_id)
|
||||
.PROP(PyTrade, price)
|
||||
.PROP(PyTrade, quantity)
|
||||
@@ -142,5 +141,6 @@ PYBIND11_MODULE(python_md_module, m) {
|
||||
}
|
||||
|
||||
#undef PROP
|
||||
#undef EXPLICIT_DEF
|
||||
#undef DEF
|
||||
#undef _STR
|
||||
@@ -12,6 +12,9 @@ class PyTrade {
|
||||
const std::string &venue() const;
|
||||
void set_venue(std::string value);
|
||||
|
||||
const std::string &security_type() const;
|
||||
void set_security_type(std::string value);
|
||||
|
||||
const std::string &exchange_security_id() const;
|
||||
void set_exchange_security_id(std::string value);
|
||||
|
||||
@@ -37,6 +40,7 @@ class PyTrade {
|
||||
|
||||
private:
|
||||
std::string venue_;
|
||||
std::string security_type_;
|
||||
std::string exchange_security_id_;
|
||||
double price_;
|
||||
double quantity_;
|
||||
@@ -51,6 +55,9 @@ class PyTrade {
|
||||
inline const std::string &PyTrade::venue() const { return venue_; }
|
||||
inline void PyTrade::set_venue(std::string value) { venue_ = std::move(value); }
|
||||
|
||||
inline const std::string &PyTrade::security_type() const { return security_type_; }
|
||||
inline void PyTrade::set_security_type(std::string value) { security_type_ = std::move(value); }
|
||||
|
||||
inline const std::string &PyTrade::exchange_security_id() const {
|
||||
return exchange_security_id_;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user