00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00023 #pragma once
00024
00025 #include "RobotHelperInterfaces.h"
00026
00027 namespace RT
00028 {
00029
00030
00035 template<class T>
00036 class IArray
00037 {
00038 public:
00039
00041 virtual size_t size() const = 0;
00043 virtual T& operator[](size_t indx) = 0;
00044 };
00045
00046
00052 struct IExchange
00053 {
00055 enum Feature
00056 {
00057 enIfDone,
00058 enTrailInTicks,
00059 enWorseFillInTicks,
00060 enAnyInstrument,
00061 enAccountUpdate,
00062 enPositionUpdate,
00063 enCancelOrdersEOD,
00064 enNeedExchIdForCancel,
00065 enIFMEnabled,
00066 enOCO,
00067 enQuoteRequest,
00068
00069 enMaxShow,
00070 enMaxFloor,
00071 enGiveUpFirm,
00072
00073 enAdditionalFields
00074 };
00075
00077 virtual const char* name() const = 0;
00078
00080 virtual bool is_available() const = 0;
00081
00083 virtual IArray<TimeInForce>& tifs() const = 0;
00084
00086 virtual IArray<OrderType>& order_types() const = 0;
00087
00089 virtual IArray<const char*>& destinations() const = 0;
00090
00092 virtual IArray<const char*>& subdestinations() const = 0;
00093
00095 virtual IArray<Feature>& features() const = 0;
00096
00098
00099 virtual IArray<const char*>& ExecInstr () const = 0;
00100
00101 virtual IArray<const char*>& HandlInst () const = 0;
00102
00103 virtual IArray<const char*>& DisplayIndicator () const = 0;
00104
00105 virtual IArray<const char*>& BatsRoutingInst () const = 0;
00106 };
00107
00108
00109
00115 class IOrderConsumer
00116 {
00117 public:
00119 virtual void execution_report (const RTExecutionReport& rp) = 0;
00121 virtual void order_cancel_reject (const RTOrderCancelReject& rp) = 0;
00123 virtual void business_message_reject (const RTBusinessMessageReject& rp) = 0;
00125 virtual void trade_report (const RTExecutionReport& rp) = 0;
00127 virtual void order_state_report (const RTExecutionReport& rp) = 0;
00128
00130 virtual void on_order_handler_connected () = 0;
00132 virtual void on_order_handler_disconnected () = 0;
00134 virtual void on_trading_venue_state_changed (const char* name) = 0;
00135 };
00136
00137 enum OrderRequestTypeMask
00138 {
00139 ort_Working = 1 << 0,
00140 ort_Filled = 1 << 1,
00141 ort_Canceled = 1 << 2,
00142 ort_All = ort_Working | ort_Filled | ort_Canceled,
00143 };
00144
00145
00146 #define SECONDS_IN_1HOUR 3600
00147 #define SECONDS_IN_1DAY 3600*24
00148
00154 class IOrderHelper
00155 {
00156 public:
00157 virtual bool is_valid() = 0;
00158
00160 virtual IArray<IExchange*>& exDestinations() const = 0;
00161
00163 virtual int sendOrder (RTOrder*) =0;
00165 virtual int modifyOrder(RTOrder*) =0;
00167 virtual int cancelOrder(RTOrder*) =0;
00169 virtual int cancelAllOrders(const char* account, const char* symbol, const char* request_id)=0;
00170
00178 virtual int orderMassStatusRequest(const char* account, const char* exchange = "", int for_last_secs = SECONDS_IN_1DAY, const char* symbol = "", int ord_state_mask = ort_All ) = 0;
00185 virtual int tradesMassStatusRequest(const char* account, const char* exchange = "", int for_last_secs = SECONDS_IN_1DAY, const char* symbol = "" ) = 0;
00186
00188 virtual int subscribe_account(const char* account) = 0;
00190 virtual int unsubscribe_account(const char* account) = 0;
00191
00192 virtual void robotrader(IOrderConsumer* robotrader) { robotrader_= robotrader; }
00193 virtual IOrderConsumer* robotrader() { return robotrader_; }
00194
00195 private:
00196 IOrderConsumer* robotrader_;
00197 };
00198
00199
00200 }