Removed unused cons variables
This commit is contained in:
1 parent
03e2433201
commit
cfec77bb96
4 files changed
+43
-42
No files matched your search
@@ -5,9 +5,6 @@ namespace orderman {
|
||||
|
||||
SecurityLimitNode::SecurityLimitNode(
|
||||
uint32_t account_id,
|
||||
uint32_t,
|
||||
const bts::api::admin::AccountSecurityPositionLimitUnit&,
|
||||
bool,
|
||||
ProductLimitNode& product_node,
|
||||
uint32_t clip_size)
|
||||
:
|
||||
|
||||
@@ -36,9 +36,6 @@ private:
|
||||
uint32_t _short_pos;
|
||||
public:
|
||||
SecurityLimitNode(uint32_t account_id,
|
||||
uint32_t parent_account_id,
|
||||
const bts::api::admin::AccountSecurityPositionLimitUnit& limit,
|
||||
bool apply_sec_position_limits,
|
||||
ProductLimitNode& product_limit,
|
||||
uint32_t clip_size);
|
||||
// accessors ///////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1,29 +1,27 @@
|
||||
#include "lib/orderman/limiter/SecurityLimitTree.h"
|
||||
|
||||
using namespace bts::api::admin;
|
||||
using namespace bts::admin;
|
||||
|
||||
namespace bts {
|
||||
namespace orderman {
|
||||
|
||||
SecurityLimitTree::SecurityLimitTree(
|
||||
const api::Security &security, ProductLimitTree &product_tree,
|
||||
const bts::api::admin::AdminData &admin_data,
|
||||
const bts::api::admin::AccountSecurityPositionLimitUnit &zero_limit) {
|
||||
const api::Security &security,
|
||||
ProductLimitTree &product_tree,
|
||||
const AdminData &admin_data,
|
||||
const AccountSecurityPositionLimitUnit&) {
|
||||
for (const auto &account : admin_data.accounts()) {
|
||||
ProductLimitNode *product_node_ptr =
|
||||
product_tree.find_account(account.id());
|
||||
ProductLimitNode *product_node_ptr =
|
||||
product_tree.find_account(account.id());
|
||||
bts_assert(product_node_ptr != nullptr);
|
||||
const bts::api::admin::AccountSecurityPositionLimitUnit *limit =
|
||||
bts::admin::AdminServiceUtils::find_account_security_position_limit(
|
||||
account, security);
|
||||
uint32_t clip_size =
|
||||
bts::admin::AdminServiceUtils::find_account_security_clip_size(
|
||||
account, security);
|
||||
AdminServiceUtils::find_account_security_clip_size(account,
|
||||
security);
|
||||
_tree.emplace_back(
|
||||
account.id(),
|
||||
bts::admin::AdminServiceUtils::has_id(account.parent_account_id())
|
||||
? account.parent_account_id()
|
||||
: 0,
|
||||
limit != nullptr ? *limit : zero_limit, limit != nullptr,
|
||||
*product_node_ptr, clip_size);
|
||||
*product_node_ptr,
|
||||
clip_size);
|
||||
}
|
||||
}
|
||||
} // namespace orderman
|
||||
|
||||
@@ -13,28 +13,31 @@
|
||||
|
||||
namespace bts{
|
||||
namespace orderman{
|
||||
// this keeps the state for all the accounts
|
||||
// for a single security. the only state is a
|
||||
// vector of SecurityLimitNode (which keeps
|
||||
// Scope : <security>
|
||||
// this keeps the state a single security for all accounts
|
||||
// The only state is a vector of SecurityLimitNode (which keeps
|
||||
// the actual data)
|
||||
class SecurityLimitTree{
|
||||
private:
|
||||
std::vector<SecurityLimitNode> _tree;
|
||||
public:
|
||||
SecurityLimitTree(const api::Security& security,
|
||||
ProductLimitTree& product_tree,
|
||||
const bts::api::admin::AdminData& admin_data,
|
||||
const bts::api::admin::AccountSecurityPositionLimitUnit& zero_limit);
|
||||
// position updates
|
||||
///////////////////
|
||||
void add_working_order(AccountID account_id, api::Side side,
|
||||
Quantity quantity){
|
||||
SecurityLimitTree(
|
||||
const api::Security& security,
|
||||
ProductLimitTree& product_tree,
|
||||
const bts::api::admin::AdminData& admin_data,
|
||||
const bts::api::admin::AccountSecurityPositionLimitUnit& zero_limit);
|
||||
// position updates ////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
void add_working_order(AccountID account_id,
|
||||
api::Side side,
|
||||
Quantity quantity){
|
||||
SecurityLimitNode* node_ptr = _find_account(account_id.value());
|
||||
bts_assert(node_ptr != nullptr);
|
||||
node_ptr->add_working_order(side, quantity.value());
|
||||
}
|
||||
void remove_working_order(AccountID account_id,
|
||||
api::Side side, Quantity quantity){
|
||||
api::Side side,
|
||||
Quantity quantity){
|
||||
SecurityLimitNode* account_ptr = _find_account(account_id.value());
|
||||
bts_assert(account_ptr != nullptr);
|
||||
account_ptr->remove_working_order(side, quantity.value());
|
||||
@@ -46,33 +49,39 @@ public:
|
||||
bts_assert(account_ptr != nullptr);
|
||||
account_ptr->update_position(account_id, long_pos, short_pos);
|
||||
}
|
||||
void copy_positions_from(SecurityLimitTree& source){
|
||||
void copy_positions_from(const SecurityLimitTree& source){
|
||||
for (SecurityLimitNode& node : _tree){
|
||||
SecurityLimitNode* source_node_ptr = source._find_account(node.account_id());
|
||||
SecurityLimitNode const* source_node_ptr =
|
||||
source._find_account(node.account_id());
|
||||
// this object is the updated one, so a new account wont
|
||||
// be found in the old object
|
||||
if(source_node_ptr != nullptr)
|
||||
node.copy_positions_from(*source_node_ptr);
|
||||
}
|
||||
}
|
||||
// risk limit checks
|
||||
////////////////////
|
||||
// risk limit checks ///////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
Limiter::LimiterQueryResult can_send_new_order(AccountID account_id,
|
||||
api::Side side,
|
||||
Quantity quantity,
|
||||
bool enforce_clip = true) const{
|
||||
bool enforce_clip = true)
|
||||
const{
|
||||
const SecurityLimitNode* node_ptr = _find_account(account_id.value());
|
||||
bts_assert(node_ptr!=nullptr);
|
||||
return node_ptr->can_send_new_order(side, quantity, enforce_clip);
|
||||
}
|
||||
Limiter::LimiterQueryResult can_update_order(AccountID account_id,
|
||||
api::Side side,
|
||||
Quantity from, Quantity to,
|
||||
bool enforce_clip = true) const{
|
||||
Quantity from,
|
||||
Quantity to,
|
||||
bool enforce_clip = true)
|
||||
const{
|
||||
const SecurityLimitNode* node_ptr = _find_account(account_id.value());
|
||||
bts_assert(node_ptr!=nullptr);
|
||||
return node_ptr->can_update_order(side, from, to, enforce_clip);
|
||||
}
|
||||
// accessors
|
||||
////////////
|
||||
// accessors ///////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
const SecurityLimitNode* find_account (uint32_t account_id) const{
|
||||
return _find_account(account_id);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user