00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #pragma once
00019
00020 #include <exch_lib/OrderEntry.h>
00021
00022 #include "RTExchangeType.h"
00023
00024 #include <list>
00025
00026
00027 namespace RT
00028 {
00029
00030
00031
00032
00033
00034
00035 class RTOrder
00036 {
00037 public:
00038
00040 RTOrder();
00042 virtual ~RTOrder();
00043
00045 void original_qty(int original_qty) { original_qty_ = original_qty;}
00046 int original_qty() const {return original_qty_;}
00047
00049 void remaining_qty(int remaining_qty){remaining_qty_ = remaining_qty;}
00050 int remaining_qty() const {return remaining_qty_;}
00051
00053 void last_qty(int last_qty){last_qty_ = last_qty;}
00054 int last_qty() const {return last_qty_;}
00055
00057 int total_fill_qty() const { return total_fill_qty_; }
00058 void total_fill_qty(int val) { total_fill_qty_ = val; }
00059
00061 void stop_price(int stop_price){stop_price_ = stop_price;}
00062 int stop_price()const {return stop_price_;}
00063
00065 void price(int price){price_ = price;}
00066 int price()const {return price_;}
00067
00069 void last_price(int last_price){last_price_ = last_price;}
00070 int last_price()const {return last_price_;}
00071
00073 const std::string& symbol() const{return symbol_;}
00074 void symbol(const std::string& symbol){symbol_ = symbol;}
00075
00077 const std::string& sec_id() const{return sec_id_;}
00078 void sec_id(const std::string& sec_id){sec_id_ = sec_id;}
00079
00081 const std::string& currency() const { return currency_; }
00082 void currency(const std::string& val) { currency_ = val; }
00083
00085 const std::string& trader_id() const {return trader_id_;}
00086 void trader_id(const std::string& lp){trader_id_ = lp;}
00087
00089 TimeInForce tif() const {return time_in_force_;}
00090 void tif(TimeInForce time_in_force){time_in_force_ = time_in_force;}
00091
00093 OrderSide side() const {return side_;}
00094 void side(OrderSide side){side_ = side;}
00095
00097 OrderType type() const {return type_;}
00098 void type(OrderType type){type_ = type;}
00099
00101 OrderState state() const {return state_;}
00102 void state(OrderState state);
00103
00105 OrderState state_prev() const { return state_prev_; }
00106 void state_prev(OrderState val) { state_prev_ = val; }
00107
00109 bool state_is_active();
00110 void state_prev_store();
00111 void state_restore();
00112 void state_prev_clean();
00113
00115 const std::string& cl_id() const {return cl_id_;}
00116 void cl_id (const std::string& id) {cl_id_ = id;}
00117
00119 const std::string& orig_cl_id() const {return orig_cl_id_;}
00120 void orig_cl_id (const std::string& id) {orig_cl_id_ = id;}
00121
00123 const std::string& text() const {return text_;}
00124 void text (const std::string& id) {text_ = id;}
00125
00127 const std::string& exchange_id() const {return exchange_id_;}
00128 void exchange_id (const std::string& exchange_id) {exchange_id_ = exchange_id;}
00129
00131 const std::string& orig_exchange_id() const {return orig_exchange_id_;}
00132 void orig_exchange_id (const std::string& orig_exchange_id) {orig_exchange_id_ = orig_exchange_id;}
00133
00135 char exchange_char() const { return exchange_char_; }
00136 void exchange_char(char val) { exchange_char_ = val; }
00137
00139 time_t init_time() const {return init_time_;}
00140 void init_time(time_t t) {init_time_ = t;}
00141
00143 time_t last_time() const {return last_time_;}
00144 void last_time(time_t t) {last_time_ = t;}
00145
00147 time_t effective_time() const {return effective_time_;}
00148 void effective_time(time_t t) {effective_time_ = t;}
00149
00151 const std::string& account() const {return account_;}
00152 void account (const std::string& account) {account_ = account;}
00153
00155 const std::string& sender_sub_id() const {return sender_sub_id_;}
00156 void sender_sub_id (const std::string& sender_sub_id) {sender_sub_id_ = sender_sub_id;}
00157
00159 const std::string& cl_ordid_in_cancel() const {return cl_ordid_in_cancel_;}
00160 void cl_ordid_in_cancel (const std::string& cl_ordid_in_cancel) {cl_ordid_in_cancel_ = cl_ordid_in_cancel;}
00161
00163 replace_order_type_t replace_order_type () const {return replace_type_;}
00164 void replace_order_type (replace_order_type_t type) {replace_type_ = type;}
00165
00167 ExchangeType exchange_type() const {return exch_type_;}
00168 void exchange_type(ExchangeType type) {exch_type_ = type;}
00169
00171 const std::string& exchange_name() const {return exchange_name_;}
00172 void exchange_name (const std::string& id) {exchange_name_ = id;}
00173
00175 std::string market_exchange_name() const { return market_exchange_name_; }
00176 void market_exchange_name(std::string val) { market_exchange_name_ = val; }
00177
00179 std::string security_sub_type() const { return security_sub_type_; }
00180 void security_sub_type(const std::string & sst) { security_sub_type_ = sst; }
00181
00183 int denominator()const {return denominator_; }
00184 void denominator(const int denominator){ denominator_ = denominator; }
00185
00187 const std::string& root_exchange_id() {return root_exchange_id_;}
00188 void root_exchange_id(const std::string& value) {root_exchange_id_ = value;}
00189
00191 const std::string& underlying_symbol() {return underlying_symbol_;}
00192 void underlying_symbol(const std::string& value){underlying_symbol_ = value;}
00193
00194
00196 void max_show(int val){max_show_ = val;}
00197 int max_show()const {return max_show_;}
00198
00200 bool is_automated_trading_system() { return is_automated_trading_system_; }
00201 void is_automated_trading_system(bool val) { is_automated_trading_system_ = val; }
00202
00204 const std::string& trader_location() {return trader_location_;}
00205 void trader_location(const std::string& value) {trader_location_ = value;}
00206 protected:
00207
00208 std::string security_sub_type_;
00209
00210 std::string adapter_name_;
00211 std::string exchange_name_;
00212 std::string market_exchange_name_;
00213
00214 ExchangeType exch_type_;
00215 CoreModeType exch_mode_;
00216
00217 std::string trader_id_;
00218
00219
00220 std::string cl_id_;
00221 std::string orig_cl_id_;
00222 std::string exchange_id_;
00223 std::string orig_exchange_id_;
00224
00225 char exchange_char_;
00226
00227 OrderType type_ ;
00228 TimeInForce time_in_force_ ;
00229 OrderState state_ ;
00230 OrderState state_prev_ ;
00231 OrderSide side_;
00232 replace_order_type_t replace_type_;
00233
00234 int price_;
00235 int stop_price_;
00236 int last_price_;
00237 int original_qty_;
00238 int remaining_qty_;
00239 int last_qty_;
00240 int total_fill_qty_;
00241
00242 time_t init_time_;
00243 time_t last_time_;
00244
00245 time_t effective_time_;
00246
00247 std::string text_;
00248 std::string sender_sub_id_;
00249 std::string on_behalf_of_comp_id_;
00250 std::string cl_ordid_in_cancel_;
00251
00252 std::string account_;
00253 std::string symbol_;
00254 std::string sec_id_;
00255 std::string currency_;
00256
00257 int denominator_;
00258
00259 std::string root_exchange_id_;
00260 std::string underlying_symbol_;
00261
00262 int max_show_;
00263
00264 bool is_automated_trading_system_;
00265 std::string trader_location_;
00266 };
00267
00268 }