Added API support for ladder visibility control.

This commit is contained in:
Pedro Pinto committed 2019-06-17 09:47:02 -04:00
1 parent 66d05c63af
commit 69f61757c4
4 files changed
+23 -4

No files matched your search

@@ -47,6 +47,7 @@ struct AlgoWrapperOrder::PImpl {
OrderDefinition definition;
const api::Security *security;
OrderState const &state() const { return _state; }
OrderState &state() { return _state; }
Map<SecurityKey, OrderServices::BookSubID> book_subs;
Map<OrderKey, ChildRecord> children;
@@ -167,7 +168,7 @@ void AlgoWrapperOrder::on_init_recovered(
terminate(ORDER_STATUS_ERROR, "System restarted with active algo order");
return;
// Terminal states
// Terminal states
case ORDER_STATUS_ERROR:
case ORDER_STATUS_REJECTED_BY_SPARK:
case ORDER_STATUS_COMPLETED:
@@ -175,7 +176,7 @@ void AlgoWrapperOrder::on_init_recovered(
terminate(rec.state().status(), rec.state().last_msg());
break;
// It should not be possible to reach these
// It should not be possible to reach these
case ORDER_STATUS_DISCONNECTED:
case ORDER_STATUS_INACTIVE:
case OrderStatus_INT_MIN_SENTINEL_DO_NOT_USE_:
@@ -298,7 +299,7 @@ orderman::OrderOpResult AlgoWrapperOrder::on_cancel() {
cancel();
break;
case IAlgoOrder::OnCancelResponse::IGNORE:
LOG(OrderMan,Info,"Algo order with key {} ignored cancel request",
LOG(OrderMan, Info, "Algo order with key {} ignored cancel request",
key().value());
break;
}
@@ -501,6 +502,15 @@ void AlgoWrapperOrder::update_fill_state(Quantity q, Price p) {
}
}
void AlgoWrapperOrder::set_ladder_visibility(bool is_visible) {
if (!is_working())
return;
ReportStateGuard _(*this);
me->state().set_display_status(is_visible ? OrderState::VISIBLE
: OrderState::HIDDEN);
}
void AlgoWrapperOrder::cancel(std::string const &msg) {
if (!is_working())
return;
@@ -58,7 +58,8 @@ class AlgoWrapperOrder : public Order,
void terminate_error(std::string const &msg) override;
void complete() override;
void update_fill_state(Quantity total_fills, Price last_price) override;
void set_ladder_visibility (bool is_visibile) override;
// Private
struct ReportStateGuard;
struct ChildRecord;
@@ -80,6 +80,13 @@ class IAlgoServices : public IBeforeLaunchAlgoServices {
// active children.
virtual void complete() = 0;
// --------------------------------------------------------------
// Algo State Update
// --------------------------------------------------------------
// Set wheter this algo instance should be displayed in the Spark UI ladder
virtual void set_ladder_visibility(bool is_visible) = 0;
// Update this algos's filled quantity and last price
virtual void update_fill_state(Quantity total_fills, Price last_price) = 0;
};
+1
View File
@@ -46,6 +46,7 @@ struct Proxy : public IAlgoServices {
void terminate_error(std::string const &) {}
void complete() {}
void update_fill_state(Quantity , Price ) {}
void set_ladder_visibility(bool) {}
};
int QuickTest::execute(std::vector<std::string> const &) {