00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #pragma once
00019
00026 namespace RT
00027 {
00028
00034 class IAccount
00035 {
00036 public:
00037
00038
00039 enum AccountStatus
00040 {
00041 ac_st_non_active = 0,
00042 ac_st_active = 1 << 0,
00043 ac_st_liquidation_only = 1 << 1,
00044 };
00045
00046 virtual ~IAccount(void){}
00047
00049 virtual const char* name() const = 0;
00051 virtual const char* currency() const = 0;
00053 virtual AccountStatus status() const = 0;
00055 virtual double realized_pnl() const = 0;
00057 virtual double unrealized_pnl() const = 0;
00059 virtual double balance() const = 0;
00061 virtual double net_asset_value() const = 0;
00063 virtual double unused_margin() const = 0;
00065 virtual double used_margin() const = 0;
00067 virtual double total_value() const = 0;
00069 virtual const char* risk_profile_id()const = 0;
00071 virtual double settl_realized_profit_loss() const = 0;
00073 virtual double settl_unrealized_profit_loss() const = 0;
00075 virtual const char* exchange_acct() const = 0;
00077 virtual const char* display_name() const = 0;
00078 };
00079
00080
00086 class IPosition
00087 {
00088 public:
00089 virtual ~IPosition(void){}
00090
00092 virtual const char* acct() const = 0;
00094 virtual const char* sec_id() const = 0;
00096 virtual const char* symbol() const = 0;
00098 virtual const char* exchange() const = 0;
00100 virtual double trade_price() const = 0;
00102 virtual double average_price() const = 0;
00104 virtual double value() const = 0;
00106 virtual double realized_pnl() const = 0;
00108 virtual double unrealized_pnl() const = 0;
00110 virtual int qty() const = 0;
00112 virtual double settl_unrealized_pnl() const = 0;
00114 virtual double settl_realized_pnl() const = 0;
00116 virtual int maintenance_qty() const = 0;
00118 virtual int initial_qty() const = 0;
00120 virtual double initial_margin() const = 0;
00122 virtual double maintenance_margin() const = 0;
00124 virtual const char* parent_sec_id() const = 0;
00126 virtual int wrk_buys() const = 0;
00128 virtual int wrk_sells() const = 0;
00129 };
00130
00136 class IAlert
00137 {
00138 public:
00140 enum AlertType
00141 {
00142 at_account,
00143 at_position,
00144 at_risk_alarm
00145 };
00146
00148 virtual const char* alert_id() const = 0;
00150 virtual const char* alert_name() const = 0;
00152 virtual AlertType alert_type() const = 0;
00154 virtual const char* account() const = 0;
00156 virtual const char* symbol() const = 0;
00158 virtual const char* exchange_id() const = 0;
00160 virtual const char* xml_formula() const = 0;
00162 virtual time_t timestamp() const = 0;
00163
00165 virtual const char* alarm_description() const = 0;
00166 };
00167
00175 class IRiskInfoConsumer
00176 {
00177 public:
00179 virtual void process_account(IAccount&) = 0;
00181 virtual void process_position(IPosition&) = 0;
00183 virtual void process_alert(IAlert&) = 0;
00184
00186 virtual void on_connect () = 0;
00188 virtual void on_disconnect () = 0;
00189 };
00190
00196 class IRiskInfoHelper
00197 {
00198 public:
00199 virtual bool is_valid() = 0;
00200
00202 virtual void subscribe_account(IRiskInfoConsumer*, const std::string& account) = 0;
00204 virtual void subscribe_positions(IRiskInfoConsumer*, const std::string& account, const std::string& symbol = "", const std::string& parent_sec_id = "") = 0;
00205
00207 virtual IAccount* get_account(const std::string& account) = 0;
00209 virtual void get_positions(const std::string& account, std::list<IPosition*>&) = 0;
00210 };
00211
00212 }