Cleanup, removing some decaying code which was making for bad readibility
This commit is contained in:
1 parent
cfec77bb96
commit
a10a49cf4f
8 files changed
+20
-22
No files matched your search
@@ -19,8 +19,9 @@ LimitStore::LimitStore(const bts::api::admin::AdminData &admin_data,
|
||||
ProductLimitTree *product_tree_ptr = _find_product_for_security(security);
|
||||
bts_assert(product_tree_ptr != nullptr);
|
||||
_sec_map.insert(std::pair<uint32_t, SecurityLimitTree>(
|
||||
security.id(), SecurityLimitTree(security, *product_tree_ptr,
|
||||
_admin_data, _zero_security_limit)));
|
||||
security.id(), SecurityLimitTree(security,
|
||||
*product_tree_ptr,
|
||||
_admin_data)));
|
||||
}
|
||||
_set_user_data();
|
||||
}
|
||||
|
||||
@@ -72,9 +72,7 @@ private:
|
||||
// this is passed over to the SecurityLimitTree
|
||||
// entried (above)
|
||||
std::vector<ProductLimitTree> _prod_map;
|
||||
// these are kept here and references passes to each node
|
||||
const bts::api::admin::AccountProductPositionLimitUnit _zero_product_limit;
|
||||
const bts::api::admin::AccountSecurityPositionLimitUnit _zero_security_limit;
|
||||
public:
|
||||
LimitStore(const bts::api::admin::AdminData& admin_data,
|
||||
const std::map<uint32_t,api::Security const*>& sec_map);
|
||||
|
||||
@@ -5,7 +5,6 @@ namespace orderman {
|
||||
|
||||
ProductLimitNode::ProductLimitNode(
|
||||
uint32_t account_id,
|
||||
uint32_t,
|
||||
const bts::api::admin::AccountProductPositionLimitUnit &limit,
|
||||
bool enforce_net)
|
||||
:
|
||||
|
||||
@@ -29,7 +29,6 @@ private:
|
||||
public:
|
||||
ProductLimitNode(
|
||||
uint32_t account_id,
|
||||
uint32_t parent_account_id,
|
||||
const bts::api::admin::AccountProductPositionLimitUnit& limit,
|
||||
bool enforce_net);
|
||||
// accessors ///////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1,26 +1,28 @@
|
||||
#include "ProductLimitTree.h"
|
||||
|
||||
using namespace bts::api::admin;
|
||||
using namespace bts::admin;
|
||||
|
||||
namespace bts {
|
||||
namespace orderman {
|
||||
|
||||
ProductLimitTree::ProductLimitTree(
|
||||
const api::Product &product, const bts::api::admin::AdminData &admin_data,
|
||||
const bts::api::admin::AccountProductPositionLimitUnit &zero_limit)
|
||||
: _product(product) {
|
||||
const api::Product &product,
|
||||
const AdminData &admin_data,
|
||||
const AccountProductPositionLimitUnit &zero_limit)
|
||||
:
|
||||
_product(product) {
|
||||
for (const auto &account : admin_data.accounts()) {
|
||||
bool enforce_net = true; // default is net
|
||||
if (account.has_risk_limit_enforcement())
|
||||
enforce_net =
|
||||
account.risk_limit_enforcement().product_limit_in_net_terms();
|
||||
const bts::api::admin::AccountProductPositionLimitUnit *limit =
|
||||
bts::admin::AdminServiceUtils::find_account_product_position_limit(
|
||||
account, _product);
|
||||
_tree.emplace_back(
|
||||
account.id(),
|
||||
bts::admin::AdminServiceUtils::has_id(account.parent_account_id())
|
||||
? account.parent_account_id()
|
||||
: 0,
|
||||
limit != nullptr ? *limit : zero_limit, enforce_net);
|
||||
const AccountProductPositionLimitUnit *limit =
|
||||
AdminServiceUtils::find_account_product_position_limit(account,
|
||||
_product);
|
||||
_tree.emplace_back(account.id(),
|
||||
limit != nullptr ? *limit : zero_limit,
|
||||
enforce_net);
|
||||
}
|
||||
}
|
||||
} // namespace orderman
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
namespace bts{
|
||||
namespace orderman{
|
||||
// Scope : <Product>
|
||||
// this keeps the state for all the accounts
|
||||
// for a single product, via a vector of
|
||||
// ProductLimitNode, which is the only state
|
||||
|
||||
@@ -9,8 +9,7 @@ namespace orderman {
|
||||
SecurityLimitTree::SecurityLimitTree(
|
||||
const api::Security &security,
|
||||
ProductLimitTree &product_tree,
|
||||
const AdminData &admin_data,
|
||||
const AccountSecurityPositionLimitUnit&) {
|
||||
const AdminData &admin_data) {
|
||||
for (const auto &account : admin_data.accounts()) {
|
||||
ProductLimitNode *product_node_ptr =
|
||||
product_tree.find_account(account.id());
|
||||
|
||||
@@ -24,8 +24,7 @@ public:
|
||||
SecurityLimitTree(
|
||||
const api::Security& security,
|
||||
ProductLimitTree& product_tree,
|
||||
const bts::api::admin::AdminData& admin_data,
|
||||
const bts::api::admin::AccountSecurityPositionLimitUnit& zero_limit);
|
||||
const bts::api::admin::AdminData& admin_data);
|
||||
// position updates ////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
void add_working_order(AccountID account_id,
|
||||
|
||||
Reference in new issue
Block a user