SPARK-1567 partially done
This commit is contained in:
1 parent
7d0eafe389
commit
9e39ebe981
2 files changed
+38
-9
No files matched your search
@@ -6,13 +6,17 @@
|
||||
namespace bts {
|
||||
namespace orderman {
|
||||
|
||||
typedef std::tuple<const api::Security&, api::Side, Quantity, bool> FillRecord;
|
||||
|
||||
struct Limiter::PImpl {
|
||||
std::map<uint32_t,api::Security const*> sec_map;
|
||||
std::unique_ptr<LimitStore> limit_store;
|
||||
std::map<std::string,std::vector<FillRecord>> unaccounted;
|
||||
PImpl()
|
||||
:
|
||||
sec_map(),
|
||||
limit_store(std::make_unique<LimitStore>(bts::api::admin::AdminData(), sec_map))
|
||||
limit_store(std::make_unique<LimitStore>(bts::api::admin::AdminData(), sec_map)),
|
||||
unaccounted()
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -33,7 +37,10 @@ void Limiter::add_security(api::Security const & security) {
|
||||
_add_security(&security);
|
||||
_reset(me->limit_store->admin_data());
|
||||
}
|
||||
void Limiter::add(api::Security const &security, AccountID account_id, api::Side side, Quantity quantity){
|
||||
void Limiter::add(api::Security const &security,
|
||||
AccountID account_id,
|
||||
api::Side side,
|
||||
Quantity quantity){
|
||||
if (!_contains_security(&security))
|
||||
add_security(security);
|
||||
if (!me->limit_store->has_account(account_id)){
|
||||
@@ -42,7 +49,10 @@ void Limiter::add(api::Security const &security, AccountID account_id, api::Side
|
||||
}
|
||||
me->limit_store->add_position(security, account_id, side, quantity);
|
||||
}
|
||||
void Limiter::remove(api::Security const &security, AccountID account_id, api::Side side, Quantity quantity) {
|
||||
void Limiter::remove(api::Security const &security,
|
||||
AccountID account_id,
|
||||
api::Side side,
|
||||
Quantity quantity) {
|
||||
if (!_contains_security(&security))
|
||||
add_security(security);
|
||||
if (!me->limit_store->has_account(account_id)){
|
||||
@@ -50,22 +60,41 @@ void Limiter::remove(api::Security const &security, AccountID account_id, api::S
|
||||
}
|
||||
me->limit_store->remove_position(security, account_id, side, quantity);
|
||||
}
|
||||
Limiter::LimiterQueryResult Limiter::can_trade(UserID user_id, AccountID account_id) const {
|
||||
void Limiter::add(const api::Security& security,
|
||||
const std::string& /* account_name */,
|
||||
api::Side,
|
||||
Quantity){
|
||||
if (!_contains_security(&security))
|
||||
add_security(security);
|
||||
|
||||
}
|
||||
void Limiter::remove(const api::Security& security,
|
||||
std::string const & /* account_name */,
|
||||
api::Side,
|
||||
Quantity){
|
||||
if (!_contains_security(&security))
|
||||
add_security(security);
|
||||
}
|
||||
Limiter::LimiterQueryResult Limiter::can_trade(UserID user_id,
|
||||
AccountID account_id) const {
|
||||
LimiterQueryResult rv = me->limit_store->can_trade(user_id, account_id);
|
||||
//rv.ok = true;
|
||||
return rv;
|
||||
}
|
||||
Limiter::LimiterQueryResult Limiter::can_send_new_order(AccountID account_id,
|
||||
api::Security const & security,
|
||||
api::Side side,
|
||||
Quantity quantity) const {
|
||||
LimiterQueryResult rv = me->limit_store->can_send_new_order(account_id, security, side, quantity);
|
||||
LimiterQueryResult rv = me->limit_store->can_send_new_order(account_id,
|
||||
security,
|
||||
side,
|
||||
quantity);
|
||||
//rv.ok = true;
|
||||
return rv;
|
||||
}
|
||||
Limiter::LimiterQueryResult Limiter::can_update_order(AccountID account_id,
|
||||
api::Security const & security,
|
||||
api::Side side, Quantity from,
|
||||
api::Side side,
|
||||
Quantity from,
|
||||
Quantity to) const {
|
||||
LimiterQueryResult rv = me->limit_store->can_update_order(account_id, security, side, from, to);
|
||||
//rv.ok = true;
|
||||
|
||||
@@ -28,9 +28,9 @@ class Limiter {
|
||||
void remove(api::Security const &, AccountID, api::Side, Quantity);
|
||||
|
||||
void add(api::Security const &, std::string const & /* account_name */,
|
||||
api::Side, Quantity) {}
|
||||
api::Side, Quantity);
|
||||
void remove(api::Security const &, std::string const & /* account_name */,
|
||||
api::Side, Quantity) {}
|
||||
api::Side, Quantity);
|
||||
|
||||
struct LimiterQueryResult {
|
||||
bool ok;
|
||||
|
||||
Reference in new issue
Block a user