More algo man.
This commit is contained in:
1 parent
3d9aa58ac1
commit
cca7ded152
7 files changed
+38
-43
No files matched your search
@@ -1,53 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
#include "feed_handler/IFeedObserver.h"
|
||||
#include "gateway/IGatewayObserver.h"
|
||||
#include "domain/MarketSegmentID.h"
|
||||
#include "domain/SecurityID.h"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace bts::spartan {
|
||||
namespace mdp3 {
|
||||
|
||||
class SecuritySnapshot;
|
||||
}
|
||||
struct BookUpdate;
|
||||
struct OrderUpdate;
|
||||
struct TradeSignal;
|
||||
class IGateway;
|
||||
class IAlgo;
|
||||
class AlgoParam;
|
||||
class IAlgoManagerObserver;
|
||||
|
||||
// This class manages a set of algos, routing to them market data and
|
||||
struct BookEv;
|
||||
struct TradeSummaryEv;
|
||||
struct SecurityStatusEv;
|
||||
struct TimerEv;
|
||||
struct OrderStatusEv;
|
||||
|
||||
// This class manages a set of algos, routing relevant market data and
|
||||
// order updates as well as providing facilities for algos to create
|
||||
// and manage their own orders.
|
||||
class AlgoManager : public IFeedObserver,
|
||||
public IGatewayObserver {
|
||||
// and manage their own orders. This class handles only the "happy
|
||||
// path", that is it assumes that live, valid connections to the
|
||||
// exchange have already been established and no errors will occurr in
|
||||
// these connections. It is up to external controller classes to
|
||||
// handle both setup and errors.
|
||||
class AlgoManager {
|
||||
public:
|
||||
AlgoManager();
|
||||
~AlgoManager();
|
||||
|
||||
void init(
|
||||
IGateway &, std::vector<std::pair<AlgoParam, IAlgo *>> const &algos);
|
||||
IAlgoManagerObserver &,
|
||||
std::map<SecurityID, SecuritySnapshot const *> const &,
|
||||
std::map<IAlgo *, AlgoParam> const &);
|
||||
|
||||
void run();
|
||||
|
||||
// From IFeedObserver
|
||||
void on_recovery_complete(InitialSnapshot const &) override {}
|
||||
void on_packet_begin(MDP3PacketView const &) override {}
|
||||
void on_packet_end() override {}
|
||||
void on_event_begin(mdp3::FeedEvent const &) override {}
|
||||
void on_books(
|
||||
SecuritySnapshot const &,
|
||||
mdp3::Book const &,
|
||||
mdp3::ImpliedBook const &) override {}
|
||||
void on_trade_summary_signal(
|
||||
SecuritySnapshot const &,
|
||||
mdp3::TradeSummarySignal const &) override {}
|
||||
void on_event_end(mdp3::FeedEvent const &) override {}
|
||||
void on_packet_loss() override {}
|
||||
|
||||
// From IGatewayObserver
|
||||
void on_gateway_ready() override;
|
||||
void on_gateway_error(GatewayError const&) override;
|
||||
void on_order_update(OrderUpdate const&) override;
|
||||
void on_ev(const BookEv &);
|
||||
void on_ev(const TradeSummaryEv &);
|
||||
void on_ev(const SecurityStatusEv &);
|
||||
void on_ev(const TimerEv &);
|
||||
void on_ev(const OrderStatusEv &);
|
||||
|
||||
private:
|
||||
struct PImpl;
|
||||
|
||||
@@ -7,7 +7,7 @@ class IAlgoInitService;
|
||||
class IAlgoRunService;
|
||||
|
||||
class TimerEv;
|
||||
class BooksEv;
|
||||
class BookEv;
|
||||
class TradeSummaryEv;
|
||||
class SecurityStatusEv;
|
||||
class OrderStatusEv;
|
||||
@@ -24,7 +24,7 @@ class IAlgo {
|
||||
// orders
|
||||
virtual void run(IAlgoRunService &) = 0;
|
||||
|
||||
virtual void on_ev(const BooksEv &){};
|
||||
virtual void on_ev(const BookEv &){};
|
||||
virtual void on_ev(const TradeSummaryEv &) {}
|
||||
virtual void on_ev(const SecurityStatusEv &) {}
|
||||
virtual void on_ev(const TimerEv &){};
|
||||
|
||||
@@ -8,10 +8,7 @@ class Polygon;
|
||||
|
||||
class IAlgoInitService {
|
||||
public:
|
||||
virtual void subscribe_books(SecurityID) = 0;
|
||||
virtual void subscribe_trade_summary(SecurityID) = 0;
|
||||
virtual void subscribe_security_status(SecurityID) = 0;
|
||||
virtual void subscribe_timer() = 0;
|
||||
virtual void subscribe_security(SecurityID) = 0;
|
||||
virtual SecuritySnapshot const &get_instrument(SecurityID const&) = 0;
|
||||
virtual SecuritySnapshot const &get_instrument(std::string const&) = 0;
|
||||
virtual Polygon const &get_polygon(std::string const&) = 0;
|
||||
|
||||
@@ -26,7 +26,7 @@ class FeedHandler {
|
||||
// Initialization. This should be called once, before run()
|
||||
void init(IFeedObserver &, IMDP3StreamController &);
|
||||
|
||||
// Begin mdp3::IFeedObserverll once, after init()
|
||||
// Call once, after init()
|
||||
void run();
|
||||
|
||||
// These should only be called after run() is called.
|
||||
|
||||
@@ -13,11 +13,13 @@ class IFeedObserver : public IRecoveryFeedObserver,
|
||||
void on_packet_end() override {}
|
||||
void on_event_begin(mdp3::FeedEvent const &) override {}
|
||||
void on_books(
|
||||
SecuritySnapshot const &, mdp3::Book const &, mdp3::ImpliedBook const &) override {}
|
||||
SecuritySnapshot const &,
|
||||
mdp3::Book const &,
|
||||
mdp3::ImpliedBook const &) override {}
|
||||
void on_trade_summary_signal(
|
||||
SecuritySnapshot const &, mdp3::TradeSummarySignal const &) override {}
|
||||
void on_event_end(mdp3::FeedEvent const &) override {}
|
||||
void on_packet_loss() override {}
|
||||
};
|
||||
|
||||
} // namespace bts::spartan::mdp3
|
||||
} // namespace bts::spartan
|
||||
@@ -35,9 +35,9 @@ Gateway::Gateway() : me() {}
|
||||
Gateway::~Gateway() {}
|
||||
|
||||
void Gateway::init(
|
||||
IGatewayObserver &observer,
|
||||
IL3GatewayCfg const &cfg,
|
||||
IIL3SessionStore &store,
|
||||
IGatewayObserver &observer,
|
||||
IConnection &connection,
|
||||
Clock &clock) {
|
||||
bts_assert(!me);
|
||||
|
||||
@@ -40,9 +40,9 @@ class Gateway : public IConnectionObserver, // Incoming byte stream observer
|
||||
|
||||
// Initialization. This should be called once, befor run()
|
||||
void init(
|
||||
IGatewayObserver &,
|
||||
IL3GatewayCfg const &,
|
||||
IIL3SessionStore &,
|
||||
IGatewayObserver &,
|
||||
IConnection &, // IConnection is assumed to be disconnected
|
||||
Clock &);
|
||||
|
||||
|
||||
Reference in new issue
Block a user