better comments

This commit is contained in:
Taha Afzal committed 2017-12-04 09:48:46 -05:00
1 parent 299d513102
commit 055ced0590
4 files changed
+23 -19

No files matched your search

@@ -17,39 +17,40 @@ public:
virtual void build_once (SpreaderOrder* spreader_order) = 0;
virtual SpreaderState state() const = 0;
virtual const std::string& state_text () const = 0;
//virtual SpreaderOrder::State state() const = 0;
// called once and only once, before any other calls.
// the spreaderoder will be in the start stat
// 1. called once and only once, before any other calls.
// makes the spreader go from start to waiting_for_first_conn
virtual void init () = 0;
// called if the execution venue is working, even if the
// 2. called if the execution venue is working, even if the
// connection event happened before the spreader was created. in
// other words, on_connect() is always called. Spreader should
// other words, on_connect() is always called. spreader should
// start by assuming the venue is disconnected and wait until they
// receive on_connect().
virtual void on_connect() = 0;
// called if the venue disconnects. will only be called if there
// 3. called if the venue disconnects. will only be called if there
// was previous on_connect()
virtual void on_disconnect() = 0;
// called when the user updates the order
// 4. called when the user updates the order
virtual void on_update(const api::orderman::UpdateSpreaderOrder&) = 0;
// called when the user cancels an order
// 5. called when the user cancels an order
virtual void on_cancel(const api::orderman::CancelSpreaderOrder&) = 0;
// on market data update (support late joiners)
// 6. on market data update (support late joiners)
virtual void on_book(TickToTradeCorID corid, const Book&) = 0;
virtual void on_time(const TimeStamp&) = 0;
// when a quoter order ack from the exchange has an error
// 7. time event called by the infrastructure
virtual void on_time(const TimeStamp&) = 0;
// 8. when a quoter order ack from the exchange has an error
virtual void on_quoter_order_error(bts::orderman::SpreaderLegData& leg_data, api::orderman::OrderStatus, Quantity filled_quantity, Price average_price, std::string const *reject) = 0;
// on a quoter order fill
// 9. on a quoter order fill
virtual void on_quoter_order_fill(bts::orderman::SpreaderLegData& leg_data, api::orderman::OrderStatus, Quantity filled_quantity, Price average_price) = 0;
// on a quoter status update without a fill
virtual void on_quoter_order_status_update(bts::orderman::SpreaderLegData& leg_data, api::orderman::OrderStatus) = 0;
// when a hedger order ack from the exchange has an error
// 10. on a quoter status update without a fill
virtual void on_quoter_order_status_update(bts::orderman::SpreaderLegData& leg_data, api::orderman::OrderStatus) = 0;
// 11. when a hedger order ack from the exchange has an error
virtual void on_hedger_order_error(OrderKey child_k, api::orderman::OrderStatus, Quantity filled_quantity, Price average_price, std::string const *reject) = 0;
// on a hedgerorder udpate (this may or may not have a fill)
// 12. on a hedgerorder udpate (this may or may not have a fill)
virtual void on_hedger_order_update(OrderKey child_k, api::orderman::OrderStatus, Quantity filled_quantity, Price average_price) = 0;
// called when an external error occurs (which could be a risk limit
// 13. called when an external error occurs (which could be a risk limit
// breach or a system issue)
virtual void on_external_error(std::string const&) = 0;
// 14. is called periodically
virtual void on_check_termination () = 0;
};
@@ -298,4 +298,5 @@ SpreaderLegData& SpreaderOrder::test_only_func_leg_data (size_t index)
SpreaderLegData& leg_data = _bookkeeping_data.get_leg_data (index);
return leg_data;
}
SpreaderBookkeepingData& SpreaderOrder::test_only_func_full_data() {return _bookkeeping_data;}
}}
@@ -65,13 +65,15 @@ public:
// called when an external error occurs (which could be a risk limit
// breach or a system issue)
void on_external_error(std::string const&);
public:
// ISpreaderManager members
const orderman::Book& get_book(size_t leg_index) const override;
const LegPropertyData& get_leg_data(size_t leg_index) const override;
public:
// this is exposed for testing reasons only
SpreaderState test_only_func_state ();
SpreaderLegData& test_only_func_leg_data (size_t index);
SpreaderBookkeepingData& test_only_func_full_data ();
private:
void _transform_to_START();
void _transform_to_WAITING_FOR_FIRST_CONNECTION();
@@ -387,7 +387,7 @@ void test_complete_hedger_state (const SingleFillHedger& hedger, HedgerState sta
{
bts_assert (hedger.test_only_func_hedger_state() == state);
const HedgePriceQuantityState& hedger_pq_state = hedger.test_only_func_price_quantity_state ();
bts_assert (hedger_pq_state.target_price() == target_price);
bts_assert (hedger_pq_state.target_price() == target_price);
bts_assert (hedger_pq_state.target_quantity() == target_quantity);
bts_assert (hedger_pq_state.aggregated_filled_quantity() == aggregated_filled_quantity);
bts_assert (hedger_pq_state.out_price() == out_price);