58 lines
2.0 KiB
C++
58 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include <memory>
|
|
#include "lib/orderman/orders/Order.h"
|
|
#include "lib/api/services/OrderService.pb.h"
|
|
#include "lib/tracing/PerfLog.h"
|
|
|
|
namespace bts {
|
|
namespace orderman {
|
|
struct RoutingRecord;
|
|
class NewExecutionReportEvent;
|
|
class CancelRejectEvent;
|
|
class GatewayStatusChangeEvent;
|
|
class ExecutionReport;
|
|
|
|
class NativeOrder : public Order
|
|
{
|
|
public:
|
|
NativeOrder();
|
|
~NativeOrder() override;
|
|
|
|
api::orderman::OrderDefinition const &definition() const override;
|
|
void on_init_new(api::orderman::OrderDefinition const&,
|
|
const PreActivationOrderServices&) override;
|
|
void on_init_recovered(api::orderman::OrderRecord const&,
|
|
const PreActivationOrderServices &) override;
|
|
void on_activate(Price,Quantity,OrderServices &, trace::CorID const&) override ;
|
|
void on_update(Price , Quantity,trace::CorID const&) override ;
|
|
void on_crack(trace::CorID const&) override ;
|
|
void on_cancel(trace::CorID const&) override ;
|
|
|
|
void on_init_from_exe_report(ExecutionReport const&,const PreActivationOrderServices &);
|
|
private:
|
|
struct PImpl;
|
|
std::unique_ptr<PImpl> me;
|
|
void on_exe_report(const NewExecutionReportEvent &);
|
|
void on_cancel_reject(const CancelRejectEvent&);
|
|
void on_gateway_status(const GatewayStatusChangeEvent&);
|
|
void report_state(trace::CorID const&trace = trace::CorID());
|
|
|
|
void init_fix();
|
|
void add_exchange_order_id_to_fix();
|
|
|
|
void transition(api::orderman::OrderStatus new_state,std::string const&msg);
|
|
void transition(api::orderman::OrderStatus new_state);
|
|
void transition_to_error(api::orderman::NativeOrderState::SubError sub_error,
|
|
std::string const&msg);
|
|
|
|
void update_working_position();
|
|
bool has_exchange_order_id() ;
|
|
Quantity position_contribution();
|
|
bool is_old_exe_report( api::orderman::NativeOrderState &, const NewExecutionReportEvent &) const;
|
|
bool terminal_state(api::orderman::OrderStatus status) const;
|
|
api::orderman::NativeOrderState& get_native_state(api::orderman::OrderState &);
|
|
};
|
|
|
|
}}
|