chore: Add security type to py reqs
Venue and sec name alone don't always identify a unique security.
This commit is contained in:
1 parent
1f67456cc5
commit
399f9e61e2
15 files changed
+88
-1
No files matched your search
@@ -31,6 +31,13 @@ void PyCancelOrderRequest::set_venue(string value) {
|
||||
venue_ = std::move(value);
|
||||
}
|
||||
|
||||
const string &PyCancelOrderRequest::security_type() const {
|
||||
return security_type_;
|
||||
}
|
||||
void PyCancelOrderRequest::set_security_type(string value) {
|
||||
security_type_ = std::move(value);
|
||||
}
|
||||
|
||||
bool PyCancelOrderRequest::is_buy() const { return is_buy_; }
|
||||
void PyCancelOrderRequest::set_is_buy(bool value) {
|
||||
is_buy_ = std::move(value);
|
||||
@@ -41,6 +48,7 @@ void to_json(nlohmann::json &j, const PyCancelOrderRequest &req) {
|
||||
j["eoid"] = req.exchange_order_id();
|
||||
j["esid"] = req.exchange_security_id();
|
||||
j["venue"] = req.venue();
|
||||
j["styp"] = req.security_type();
|
||||
j["side"] = req.is_buy() ? 'B' : 'S';
|
||||
}
|
||||
|
||||
@@ -49,6 +57,7 @@ void from_json(const nlohmann::json &j, PyCancelOrderRequest &req) {
|
||||
j.at("eoid").get_to(req.exchange_order_id_);
|
||||
j.at("esid").get_to(req.exchange_security_id_);
|
||||
j.at("venue").get_to(req.venue_);
|
||||
j.at("styp").get_to(req.security_type_);
|
||||
const auto str = j.at("side").get<string>();
|
||||
if (!str.empty()) {
|
||||
switch (str[0]) {
|
||||
|
||||
@@ -26,6 +26,9 @@ class PyCancelOrderRequest {
|
||||
const std::string &venue() const;
|
||||
void set_venue(std::string value);
|
||||
|
||||
const std::string &security_type() const;
|
||||
void set_security_type(std::string value);
|
||||
|
||||
bool is_buy() const;
|
||||
void set_is_buy(bool value);
|
||||
|
||||
@@ -34,6 +37,7 @@ class PyCancelOrderRequest {
|
||||
std::string exchange_order_id,
|
||||
std::string exchange_security_id,
|
||||
std::string venue,
|
||||
std::string security_type,
|
||||
bool is_buy);
|
||||
|
||||
std::string to_string() const;
|
||||
@@ -43,6 +47,7 @@ class PyCancelOrderRequest {
|
||||
std::string exchange_order_id_;
|
||||
std::string exchange_security_id_;
|
||||
std::string venue_;
|
||||
std::string security_type_;
|
||||
bool is_buy_;
|
||||
|
||||
friend void from_json(const nlohmann::json &j, PyCancelOrderRequest &req);
|
||||
@@ -73,11 +78,13 @@ inline void PyCancelOrderRequest::set_data(
|
||||
std::string exchange_order_id,
|
||||
std::string exchange_security_id,
|
||||
std::string venue,
|
||||
std::string security_type,
|
||||
bool is_buy) {
|
||||
key_ = key;
|
||||
exchange_order_id_ = std::move(exchange_order_id);
|
||||
exchange_security_id_ = std::move(exchange_security_id);
|
||||
venue_ = std::move(venue);
|
||||
security_type_ = std::move(security_type);
|
||||
is_buy_ = is_buy;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,13 @@ void PyCancelReplaceOrderRequest::set_venue(string value) {
|
||||
venue_ = std::move(value);
|
||||
}
|
||||
|
||||
const string &PyCancelReplaceOrderRequest::security_type() const {
|
||||
return security_type_;
|
||||
}
|
||||
void PyCancelReplaceOrderRequest::set_security_type(string value) {
|
||||
security_type_ = std::move(value);
|
||||
}
|
||||
|
||||
bool PyCancelReplaceOrderRequest::is_buy() const { return is_buy_; }
|
||||
void PyCancelReplaceOrderRequest::set_is_buy(bool value) {
|
||||
is_buy_ = std::move(value);
|
||||
@@ -49,6 +56,7 @@ void to_json(nlohmann::json &j, const PyCancelReplaceOrderRequest &req) {
|
||||
j["eoid"] = req.exchange_order_id();
|
||||
j["esid"] = req.exchange_security_id();
|
||||
j["venue"] = req.venue();
|
||||
j["styp"] = req.security_type();
|
||||
j["side"] = req.is_buy() ? 'B' : 'S';
|
||||
j["px"] = req.price();
|
||||
j["qty"] = req.quantity();
|
||||
@@ -59,6 +67,7 @@ void from_json(const nlohmann::json &j, PyCancelReplaceOrderRequest &req) {
|
||||
j.at("eoid").get_to(req.exchange_order_id_);
|
||||
j.at("esid").get_to(req.exchange_security_id_);
|
||||
j.at("venue").get_to(req.venue_);
|
||||
j.at("styp").get_to(req.security_type_);
|
||||
const auto str = j.at("side").get<string>();
|
||||
if (!str.empty()) {
|
||||
switch (str[0]) {
|
||||
|
||||
@@ -27,6 +27,9 @@ class PyCancelReplaceOrderRequest {
|
||||
const std::string &venue() const;
|
||||
void set_venue(std::string value);
|
||||
|
||||
const std::string &security_type() const;
|
||||
void set_security_type(std::string value);
|
||||
|
||||
bool is_buy() const;
|
||||
void set_is_buy(bool value);
|
||||
|
||||
@@ -41,6 +44,7 @@ class PyCancelReplaceOrderRequest {
|
||||
std::string exchange_order_id,
|
||||
std::string exchange_security_id,
|
||||
std::string venue,
|
||||
std::string security_type,
|
||||
bool is_buy,
|
||||
double price,
|
||||
double quantity);
|
||||
@@ -52,6 +56,7 @@ class PyCancelReplaceOrderRequest {
|
||||
std::string exchange_order_id_;
|
||||
std::string exchange_security_id_;
|
||||
std::string venue_;
|
||||
std::string security_type_;
|
||||
float price_;
|
||||
float quantity_;
|
||||
bool is_buy_;
|
||||
@@ -85,6 +90,7 @@ inline void PyCancelReplaceOrderRequest::set_data(
|
||||
std::string exchange_order_id,
|
||||
std::string exchange_security_id,
|
||||
std::string venue,
|
||||
std::string security_type,
|
||||
bool is_buy,
|
||||
double price,
|
||||
double quantity) {
|
||||
@@ -92,6 +98,7 @@ inline void PyCancelReplaceOrderRequest::set_data(
|
||||
exchange_order_id_ = std::move(exchange_order_id);
|
||||
exchange_security_id_ = std::move(exchange_security_id);
|
||||
venue_ = std::move(venue);
|
||||
security_type_ = std::move(security_type);
|
||||
is_buy_ = is_buy;
|
||||
price_ = price;
|
||||
quantity_ = quantity;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "spark/api/services/native_order_type.h"
|
||||
#include "spark/api/services/time_in_force.h"
|
||||
#include "spark/domain_model/Security.pb.h"
|
||||
#include "spark/domain_model/SecurityType.h"
|
||||
#include "spark/domain_model/Venue.h"
|
||||
#include "spark/orderman/CreateOrderMsg.h"
|
||||
|
||||
@@ -27,6 +28,13 @@ void PyCreateOrderRequest::set_venue(string value) {
|
||||
venue_ = std::move(value);
|
||||
}
|
||||
|
||||
const string &PyCreateOrderRequest::security_type() const {
|
||||
return security_type_;
|
||||
}
|
||||
void PyCreateOrderRequest::set_security_type(string value) {
|
||||
security_type_ = std::move(value);
|
||||
}
|
||||
|
||||
float PyCreateOrderRequest::price() const { return price_; }
|
||||
void PyCreateOrderRequest::set_price(float value) { price_ = value; }
|
||||
|
||||
@@ -54,6 +62,7 @@ void to_json(nlohmann::json &j, const PyCreateOrderRequest &req) {
|
||||
j["key"] = req.key();
|
||||
j["esid"] = req.exchange_security_id();
|
||||
j["venue"] = req.venue();
|
||||
j["styp"] = req.security_type();
|
||||
j["side"] = req.is_buy() ? "B" : "S";
|
||||
j["px"] = req.price();
|
||||
j["qty"] = req.quantity();
|
||||
@@ -65,6 +74,7 @@ void from_json(const nlohmann::json &j, PyCreateOrderRequest &req) {
|
||||
j.at("key").get_to(req.key_);
|
||||
j.at("eid").get_to(req.exchange_security_id_);
|
||||
j.at("venue").get_to(req.venue_);
|
||||
j.at("styp").get_to(req.security_type_);
|
||||
const auto str = j.at("side").get<string>();
|
||||
if (!str.empty()) {
|
||||
switch (str[0]) {
|
||||
|
||||
@@ -24,6 +24,9 @@ class PyCreateOrderRequest {
|
||||
const std::string &venue() const;
|
||||
void set_venue(std::string value);
|
||||
|
||||
const std::string &security_type() const;
|
||||
void set_security_type(std::string value);
|
||||
|
||||
bool is_buy() const;
|
||||
void set_is_buy(bool value);
|
||||
|
||||
@@ -43,6 +46,7 @@ class PyCreateOrderRequest {
|
||||
std::uint32_t key,
|
||||
std::string exchange_security_id,
|
||||
std::string venue,
|
||||
std::string security_type,
|
||||
bool is_buy,
|
||||
double price,
|
||||
double quantity,
|
||||
@@ -57,6 +61,7 @@ class PyCreateOrderRequest {
|
||||
float quantity_;
|
||||
std::string exchange_security_id_;
|
||||
std::string venue_;
|
||||
std::string security_type_;
|
||||
std::string order_type_;
|
||||
std::string time_in_force_;
|
||||
bool is_buy_;
|
||||
@@ -88,6 +93,7 @@ inline void PyCreateOrderRequest::set_data(
|
||||
std::uint32_t key,
|
||||
std::string exchange_security_id,
|
||||
std::string venue,
|
||||
std::string security_type,
|
||||
bool is_buy,
|
||||
double price,
|
||||
double quantity,
|
||||
@@ -96,6 +102,7 @@ inline void PyCreateOrderRequest::set_data(
|
||||
key_ = key;
|
||||
exchange_security_id_ = std::move(exchange_security_id);
|
||||
venue_ = std::move(venue);
|
||||
security_type_ = std::move(security_type);
|
||||
is_buy_ = is_buy;
|
||||
price_ = price;
|
||||
quantity_ = quantity;
|
||||
|
||||
@@ -213,6 +213,7 @@ PYBIND11_MODULE(python_interop_module, m) {
|
||||
.PROP(PyCreateOrderRequest, key)
|
||||
.PROP(PyCreateOrderRequest, exchange_security_id)
|
||||
.PROP(PyCreateOrderRequest, venue)
|
||||
.PROP(PyCreateOrderRequest, security_type)
|
||||
.PROP(PyCreateOrderRequest, is_buy)
|
||||
.PROP(PyCreateOrderRequest, price)
|
||||
.PROP(PyCreateOrderRequest, quantity)
|
||||
@@ -226,6 +227,7 @@ PYBIND11_MODULE(python_interop_module, m) {
|
||||
.PROP(PyCancelOrderRequest, exchange_order_id)
|
||||
.PROP(PyCancelOrderRequest, exchange_security_id)
|
||||
.PROP(PyCancelOrderRequest, venue)
|
||||
.PROP(PyCancelOrderRequest, security_type)
|
||||
.PROP(PyCancelOrderRequest, is_buy)
|
||||
.def("__str__", &PyCancelOrderRequest::to_string);
|
||||
py::class_<
|
||||
@@ -236,6 +238,7 @@ PYBIND11_MODULE(python_interop_module, m) {
|
||||
.PROP(PyCancelReplaceOrderRequest, exchange_order_id)
|
||||
.PROP(PyCancelReplaceOrderRequest, exchange_security_id)
|
||||
.PROP(PyCancelReplaceOrderRequest, venue)
|
||||
.PROP(PyCancelReplaceOrderRequest, security_type)
|
||||
.PROP(PyCancelReplaceOrderRequest, is_buy)
|
||||
.PROP(PyCancelReplaceOrderRequest, price)
|
||||
.PROP(PyCancelReplaceOrderRequest, quantity)
|
||||
|
||||
Reference in new issue
Block a user