API  Version 2.0.1
Low-Latency HFT API
 All Classes Functions Variables
sharedSingleOrder.h
1 #ifndef SHARED_SINGLE_ORDER_H
2 #define SHARED_SINGLE_ORDER_H
3 #include <apiDataTypes.h>
4 #include <sgSymbolDataDefines.h>
5 #include <sharedCommands.h>
6 #include <sharedResponse.h>
7 #include <boost/shared_ptr.hpp>
8 #include <cmdDefines.h>
9 extern "C"
10 {
11 namespace API2
12 {
13 
14 class SingleOrderImpl;
15 class SpreadContractImpl;
16 
22 {
23 
24 protected:
25 
26  // SingleOrderImpl *pimpl;
27 
31  DATA_TYPES::CLORDER_ID _clOrdId;
32 
36  DATA_TYPES::CLORDER_ID _origClientOrderId;
37 
41  DATA_TYPES::SYMBOL_ID _symbolId; // From symbolId, exchange will infer which exchange
42 
46  DATA_TYPES::CLIENT_ID _clientId;
47 
51  DATA_TYPES::QTY _quantity;
52 
56  DATA_TYPES::QTY _disclosedQuantity;
57 
61  DATA_TYPES::QTY _filledQuantity;
62 
66  DATA_TYPES::QTY _oldQuantity;
67 
71  DATA_TYPES::PRICE _price;
72 
76  DATA_TYPES::PRICE _stopPrice;
77 
81  DATA_TYPES::PRICE _optionStrikePrice;
82 
86  DATA_TYPES::EXPIRY_DATE _expiryDate;
87 
88 
92  DATA_TYPES::EXCHANGE_TIME _exchangeEntryTime;
93 
97  DATA_TYPES::EXCHANGE_TIME _exchangeModifyTime;
98 
102  DATA_TYPES::ENUM _transactionType;
103 
107  DATA_TYPES::ENUM _orderMode;
108 
112  DATA_TYPES::ENUM _securityType;
113 
117  DATA_TYPES::ENUM _optionMode;
118 
122  DATA_TYPES::ENUM _optionAttribute;
123 
127  DATA_TYPES::ENUM _orderValidity;
128 
132  DATA_TYPES::ENUM _productType;
133 
137  DATA_TYPES::ENUM _orderType;
138 
142  DATA_TYPES::ENUM _instrumentType;
143 
147  DATA_TYPES::SETTLEMENT_PERIOD _settlementPeriod; // Default 10 days
148 
152  DATA_TYPES::ENUM _orderStatus; // Needed for OMS
153 
154  // /**
155  // * @brief _traderId
156  // */
157  // DATA_TYPES::TRADER_ID _traderId;
158 
162  char _symbol[SYMBOL_SIZE];
163 
167  char _series[SERIES_SIZE];
168 
172  char _exchangeOrderId[EXCHANGE_ORDERID_SIZE];
173 
177  UNSIGNED_INTEGER _tokenId;
178 
179  AccountDetail _AccountDetails;
180 
181  // CREATE_FIELD(API2::AccountDetail, AccountDetails);
182  // boost::shared_ptr<AccountDetail> _AccountDetails;
186  DATA_TYPES::ENUM _orderCategory;
187 
188 
189 
190 
191 public :
192 
193  // SingleOrderImpl *getImpl()const{return pimpl;}
194  // void setImpl(SingleOrderImpl *impl) {pimpl = impl;}
195 
196  SingleOrder(const SingleOrder& other);
197  SingleOrder& operator =(const SingleOrder& );
198 
199  SingleOrder *clone();
200 
201 
205  virtual void dump();
206 
207  virtual ~SingleOrder();
208 
212  SingleOrder();
213 
217  void initialize();
218 
234  SingleOrder(DATA_TYPES::SYMBOL_ID symbolId,
235  SymbolStaticData& staticData,
236  DATA_TYPES::CLIENT_ID clientId,
237  DATA_TYPES::QTY quantity,
238  DATA_TYPES::QTY disclosedQuantity,
239  DATA_TYPES::PRICE price,
240  DATA_TYPES::PRICE stopPrice,
241  DATA_TYPES::OrderType type, // Limit, Market, Stop, Stop Limit
242  DATA_TYPES::ProductType product, // Intraday, Delivery
243  DATA_TYPES::OrderMode mode, // Buy, Sell
244  DATA_TYPES::OrderValidity validity, // GTD, FOK etc.
245  DATA_TYPES::TRADER_ID traderId,
246  const AccountDetail &accountDetails=AccountDetail());
247 
264  int initialize(DATA_TYPES::SYMBOL_ID symbolId,
265  SymbolStaticData& staticData,
266  DATA_TYPES::CLIENT_ID clientId,
267  DATA_TYPES::QTY quantity,
268  DATA_TYPES::QTY disclosedQuantity,
269  DATA_TYPES::PRICE price,
270  DATA_TYPES::PRICE stopPrice,
271  DATA_TYPES::OrderType type, // Limit, Market, Stop, Stop Limit
272  DATA_TYPES::ProductType product, // Intraday, Delivery
273  DATA_TYPES::OrderMode mode, // Buy, Sell
274  DATA_TYPES::OrderValidity validity, // GTD, FOK etc.
275  DATA_TYPES::TRADER_ID traderId,
276  const AccountDetail &accountDetails= AccountDetail());
277 
282  SIGNED_LONG getExchangeSecurityId() const ;
283 
288  DATA_TYPES::ExchangeId getExchangeId() const;
289 
294  DATA_TYPES::CLORDER_ID getClOrdId() const ;
295 
300  DATA_TYPES::CLORDER_ID getOrigClientOrderId() const ;
301 
306  const char* getExchangeOrderId() const ;
307 
312  DATA_TYPES::SYMBOL_ID getSymbolId() const ;
313 
318  DATA_TYPES::CLIENT_ID getClientId() const ;
319 
324  DATA_TYPES::QTY getQuantity() const ;
325 
330  DATA_TYPES::QTY getDisclosedQuantity() const ;
331 
336  DATA_TYPES::QTY getFilledQuantity() const ;
337 
342  DATA_TYPES::QTY getOldQuantity() const ;
343 
348  DATA_TYPES::PRICE getPrice() const ;
349 
354  DATA_TYPES::PRICE getStopPrice() const ;
355 
360  DATA_TYPES::EXCHANGE_TIME getExchangeEntryTime() const ;
361 
366  DATA_TYPES::EXCHANGE_TIME getExchangeModifyTime() const ;
367 
373  DATA_TYPES::TransactionType getTransactionType() const ;
374 
379  DATA_TYPES::OrderMode getOrderMode() const ;
380 
385  DATA_TYPES::SecurityType getSecurityType() const ;
386 
391  DATA_TYPES::OptionMode getOptionMode() const ;
392 
397  DATA_TYPES::PRICE getOptionStrikePrice() const;
398 
403  DATA_TYPES::EXPIRY_DATE getExpiryDate() const;
404 
409  DATA_TYPES::OptionAttribute getOptionAttribute() const ;
410 
415  DATA_TYPES::OrderValidity getOrderValidity() const ;
416 
421  DATA_TYPES::ProductType getProductType() const ;
422 
427  DATA_TYPES::OrderType getOrderType() const ;
428 
433  DATA_TYPES::InstrumentType getInstrumentType() const ;
434 
439  DATA_TYPES::SETTLEMENT_PERIOD getSettlementPeriod() const;
440 
445  DATA_TYPES::OrderStatus getOrderStatus() const;
446 
451  const char* getSymbol() const;
452 
457  const char* getSeries() const;
458 
463  UNSIGNED_INTEGER getTokenId() const;
464  // Required for BSE
465 
470  int getDeltaQty() const;
471 
476  DATA_TYPES::TRADER_ID getTraderId() const;
477 
482  void setClOrdId(DATA_TYPES::CLORDER_ID clOrdId);
483 
488  void setOrigClientOrderId(DATA_TYPES::CLORDER_ID origClientOrderId) ;
489 
494  void setExchangeOrderId(char exchangeOrderId[]);
495 
500  void setExchangeOrderId(const char *exchangeOrderId);
501 
506  void setExchangeOrderId(std::string exchangeOrderId);
507 
512  void setSymbolId(DATA_TYPES::SYMBOL_ID symbolId);
513 
518  void setClientId(DATA_TYPES::CLIENT_ID clientId);
519 
524  void setQuantity(DATA_TYPES::QTY quantity) ;
525 
530  void setDisclosedQuantity(DATA_TYPES::QTY disclosedQuantity);
531 
536  void setFilledQuantity(DATA_TYPES::QTY filledQuantity);
537 
542  void setOldQuantity(DATA_TYPES::QTY oldQuantity) ;
543 
548  void setPrice(DATA_TYPES::PRICE price);
549 
554  void setStopPrice(DATA_TYPES::PRICE stopPrice) ;
555 
560  void setOptionStrikePrice(DATA_TYPES::PRICE strikePrice) ;
561 
566  void setExpiryDate(DATA_TYPES::EXPIRY_DATE expiryDate);
567 
572  void setExchangeEntryTime(DATA_TYPES::EXCHANGE_TIME exchangeEntryTime) ;
573 
578  void setExchangeModifyTime(DATA_TYPES::EXCHANGE_TIME exchangeModifyTime) ;
579 
584  void setTransactionType(DATA_TYPES::TransactionType transactionType);
585 
590  void setOrderMode(DATA_TYPES::OrderMode orderMode) ;
591 
596  void setSecurityType(DATA_TYPES::SecurityType securityType) ;
597 
602  void setOptionMode(DATA_TYPES::OptionMode optionMode) ;
603 
608  void setOptionAttribute(DATA_TYPES::OptionAttribute optionAttribute) ;
609 
614  void setOrderValidity(DATA_TYPES::OrderValidity orderValidity) ;
615 
620  void setProductType(DATA_TYPES::ProductType productType) ;
621 
626  void setOrderType(DATA_TYPES::OrderType orderType) ;
627 
632  void setInstrumentType(DATA_TYPES::InstrumentType instrumentType) ;
633 
638  void setSettlementPeriod(DATA_TYPES::SETTLEMENT_PERIOD settlementPeriod) ;
639 
644  void setOrderStatus(DATA_TYPES::OrderStatus orderStatus) ;
645 
650  void setSymbol(const char *symbol ) ;
651 
656  void setSeries(const char *series) ;
657 
662  void setTraderId(DATA_TYPES::TRADER_ID traderId);
663 
668  void setTokenId(UNSIGNED_INTEGER val) ;
669 
674  void setOrderCategory(DATA_TYPES::ENUM orderCategory);
675 
681 
687 
692  void setAccountDetails(AccountDetail detail);
693 
698  long getLocationId() const;
699 
704  DATA_TYPES::ENUM getOrderCategory() const;
705 
706 };
707 
708 class SpreadOrder : public SingleOrder{
709 
710 protected:
711 
715  CREATE_FIELD(DATA_TYPES::EXPIRY_DATE, ExpiryDate1);
716  CREATE_FIELD(DATA_TYPES::SYMBOL_ID, SymbolId1);
717  CREATE_FIELD(DATA_TYPES::SYMBOL_ID, SymbolId2);
718 
719 public:
720 
721  SpreadOrder();
722  SpreadOrder(DATA_TYPES::SYMBOL_ID symbolId,
723  DATA_TYPES::SYMBOL_ID symbolId1,
724  DATA_TYPES::SYMBOL_ID symbolId2,
725  SymbolStaticData &staticData,
726  DATA_TYPES::CLIENT_ID clientId,
727  DATA_TYPES::QTY quantity,
728  DATA_TYPES::QTY disclosedQuantity,
729  DATA_TYPES::PRICE price, // Limit, Market, Stop, Stop Limit
730  DATA_TYPES::PRICE stopPrice, // Intraday, Delivery
731  DATA_TYPES::OrderType type, // Buy, Sell
732  DATA_TYPES::ProductType product, // GTD, FOK etc.
733  DATA_TYPES::OrderMode mode,
734  DATA_TYPES::OrderValidity validity,
735  DATA_TYPES::TRADER_ID traderId,
736  const AccountDetail &accountDetails=AccountDetail()
737  );
738  void initialize(DATA_TYPES::SYMBOL_ID symbolId,
739  DATA_TYPES::SYMBOL_ID symbolId1,
740  DATA_TYPES::SYMBOL_ID symbolId2,
741  SymbolStaticData &staticData,
742  DATA_TYPES::CLIENT_ID clientId,
743  DATA_TYPES::QTY quantity,
744  DATA_TYPES::QTY disclosedQuantity,
745  DATA_TYPES::PRICE price,
746  DATA_TYPES::PRICE stopPrice,
747  DATA_TYPES::OrderType type,
748  DATA_TYPES::ProductType product,
749  DATA_TYPES::OrderMode mode,
750  DATA_TYPES::OrderValidity validity,
751  DATA_TYPES::TRADER_ID traderId,
752  const AccountDetail &accountDetails
753  );
754  // DATA_TYPES::EXPIRY_DATE getExpiryDate() const;
755  // DATA_TYPES::EXPIRY_DATE getExpiryDate1() const;
756  // DATA_TYPES::SYMBOL_ID getSymbolId1() const;
757  // void setSymbolId1(const DATA_TYPES::SYMBOL_ID &symbolId);
758  // void setExpiryDate1(const DATA_TYPES::EXPIRY_DATE &);
759 
760  void initialize();
761 
762 };
763 }
764 }
765 #endif
virtual void dump()
dump
DATA_TYPES::PRICE _optionStrikePrice
_optionStrikePrice
Definition: sharedSingleOrder.h:81
DATA_TYPES::PRICE getPrice() const
getPrice To get the Limit price provided for order
void setOldQuantity(DATA_TYPES::QTY oldQuantity)
setOldQuantity
DATA_TYPES::QTY _quantity
_quantity
Definition: sharedSingleOrder.h:51
DATA_TYPES::TransactionType getTransactionType() const
getTransactionType To get thr transaction type for the Order tbd
void setExpiryDate(DATA_TYPES::EXPIRY_DATE expiryDate)
setExpiryDate
void setOrderStatus(DATA_TYPES::OrderStatus orderStatus)
setOrderStatus
DATA_TYPES::ENUM _orderCategory
_orderCategory
Definition: sharedSingleOrder.h:186
char _exchangeOrderId[50]
_exchangeOrderId
Definition: sharedSingleOrder.h:172
void setOptionStrikePrice(DATA_TYPES::PRICE strikePrice)
setOptionStrikePrice
DATA_TYPES::OrderType getOrderType() const
getOrderType
void setOrderType(DATA_TYPES::OrderType orderType)
setOrderType
Definition: sharedSingleOrder.h:708
DATA_TYPES::SYMBOL_ID _symbolId
_symbolId
Definition: sharedSingleOrder.h:41
void setSeries(const char *series)
setSeries
DATA_TYPES::ENUM getOrderCategory() const
getOrderCategory
DATA_TYPES::TRADER_ID getTraderId() const
getTraderId
UNSIGNED_INTEGER _tokenId
_tokenId
Definition: sharedSingleOrder.h:177
DATA_TYPES::SETTLEMENT_PERIOD getSettlementPeriod() const
getSettlementPeriod
DATA_TYPES::SYMBOL_ID getSymbolId() const
getSymbolId To get SymbolId
DATA_TYPES::EXCHANGE_TIME _exchangeEntryTime
_exchangeEntryTime
Definition: sharedSingleOrder.h:92
void setInstrumentType(DATA_TYPES::InstrumentType instrumentType)
setInstrumentType
DATA_TYPES::CLIENT_ID getClientId() const
getClientId
DATA_TYPES::ENUM _orderType
_orderType
Definition: sharedSingleOrder.h:137
void setClientId(DATA_TYPES::CLIENT_ID clientId)
setClientId
DATA_TYPES::CLORDER_ID _origClientOrderId
_origClientOrderId
Definition: sharedSingleOrder.h:36
DATA_TYPES::ENUM _instrumentType
_instrumentType
Definition: sharedSingleOrder.h:142
DATA_TYPES::EXCHANGE_TIME _exchangeModifyTime
_exchangeModifyTime
Definition: sharedSingleOrder.h:97
DATA_TYPES::OrderValidity getOrderValidity() const
getOrderValidity
void setOptionAttribute(DATA_TYPES::OptionAttribute optionAttribute)
setOptionAttribute
DATA_TYPES::ENUM _orderValidity
_orderValidity
Definition: sharedSingleOrder.h:127
DATA_TYPES::QTY _oldQuantity
_oldQuantity
Definition: sharedSingleOrder.h:66
void setExchangeOrderId(char exchangeOrderId[])
setExchangeOrderId
char _symbol[24]
_traderId
Definition: sharedSingleOrder.h:162
Definition: sharedCommands.h:23
void setOrderValidity(DATA_TYPES::OrderValidity orderValidity)
setOrderValidity
AccountDetail & getRefAccountDetails()
getRefAccountDetails
DATA_TYPES::EXCHANGE_TIME getExchangeModifyTime() const
getExchangeModifyTime To get the Time for Order modification at Exchange
DATA_TYPES::QTY _disclosedQuantity
_disclosedQuantity
Definition: sharedSingleOrder.h:56
char _series[20]
_series
Definition: sharedSingleOrder.h:167
DATA_TYPES::QTY getFilledQuantity() const
getFilledQuantity To get Filled Quantity
void setOrderCategory(DATA_TYPES::ENUM orderCategory)
setOrderCategory
int getDeltaQty() const
getDeltaQty
void setDisclosedQuantity(DATA_TYPES::QTY disclosedQuantity)
setDisclosedQuantity
DATA_TYPES::CLORDER_ID _clOrdId
_clOrdId
Definition: sharedSingleOrder.h:31
DATA_TYPES::CLORDER_ID getClOrdId() const
getClOrdId To get the unique Client Order Id (unique to the system)
DATA_TYPES::OptionMode getOptionMode() const
getOptionMode
void setSecurityType(DATA_TYPES::SecurityType securityType)
setSecurityType
DATA_TYPES::PRICE getStopPrice() const
getStopPrice To get the stop Price provided for Order
void setTransactionType(DATA_TYPES::TransactionType transactionType)
setTransactionType
void setSymbol(const char *symbol)
setSymbol
DATA_TYPES::QTY _filledQuantity
_filledQuantity
Definition: sharedSingleOrder.h:61
DATA_TYPES::QTY getQuantity() const
getQuantity To get Order quantity
void setQuantity(DATA_TYPES::QTY quantity)
setQuantity
DATA_TYPES::PRICE getOptionStrikePrice() const
getOptionStrikePrice
DATA_TYPES::EXPIRY_DATE _expiryDate
_expiryDate
Definition: sharedSingleOrder.h:86
DATA_TYPES::EXCHANGE_TIME getExchangeEntryTime() const
getExchangeEntryTime To get the Time for Order entry at Exchange
void setFilledQuantity(DATA_TYPES::QTY filledQuantity)
setFilledQuantity
void setOrigClientOrderId(DATA_TYPES::CLORDER_ID origClientOrderId)
setOrigClientOrderId
void setAccountDetails(AccountDetail detail)
setAccountDetails
AccountDetail getAccountDetails() const
getAccountDetails
SingleOrder()
ApiSingleOrder.
void setExchangeModifyTime(DATA_TYPES::EXCHANGE_TIME exchangeModifyTime)
setExchangeModifyTime
DATA_TYPES::OrderStatus getOrderStatus() const
getOrderStatus
DATA_TYPES::SETTLEMENT_PERIOD _settlementPeriod
_settlementPeriod
Definition: sharedSingleOrder.h:147
void setOrderMode(DATA_TYPES::OrderMode orderMode)
setOrderMode
DATA_TYPES::ENUM _securityType
_securityType
Definition: sharedSingleOrder.h:112
DATA_TYPES::ProductType getProductType() const
getProductType
DATA_TYPES::CLORDER_ID getOrigClientOrderId() const
getOrigClientOrderId If the order is modified, it returns the Parent Order's ClientOrderId ...
UNSIGNED_INTEGER getTokenId() const
getTokenId
void setProductType(DATA_TYPES::ProductType productType)
setProductType
void setExchangeEntryTime(DATA_TYPES::EXCHANGE_TIME exchangeEntryTime)
setExchangeEntryTime
DATA_TYPES::OrderMode getOrderMode() const
getOrderMode To get the Order Mode
void setSymbolId(DATA_TYPES::SYMBOL_ID symbolId)
setSymbolId
SIGNED_LONG getExchangeSecurityId() const
getExchangeSecurityId
void setSettlementPeriod(DATA_TYPES::SETTLEMENT_PERIOD settlementPeriod)
setSettlementPeriod
DATA_TYPES::PRICE _price
_price
Definition: sharedSingleOrder.h:71
DATA_TYPES::ExchangeId getExchangeId() const
getExchangeId returns Exchange ID
DATA_TYPES::QTY getOldQuantity() const
getOldQuantity
DATA_TYPES::CLIENT_ID _clientId
_clientId
Definition: sharedSingleOrder.h:46
DATA_TYPES::ENUM _optionAttribute
_optionAttribute
Definition: sharedSingleOrder.h:122
void setOptionMode(DATA_TYPES::OptionMode optionMode)
setOptionMode
const char * getExchangeOrderId() const
getExchangeOrderId It returns Exchange's Order Id
void setClOrdId(DATA_TYPES::CLORDER_ID clOrdId)
setClOrdId
The SingleOrder class. This wrapper is used for sending Single Leg Orders. Usage: Create an object fo...
Definition: sharedSingleOrder.h:21
DATA_TYPES::ENUM _optionMode
_optionMode
Definition: sharedSingleOrder.h:117
DATA_TYPES::EXPIRY_DATE getExpiryDate() const
getExpiryDate
const char * getSeries() const
getSeries
DATA_TYPES::OptionAttribute getOptionAttribute() const
getOptionAttribute
void setTraderId(DATA_TYPES::TRADER_ID traderId)
setTraderId
void setPrice(DATA_TYPES::PRICE price)
setPrice
DATA_TYPES::ENUM _orderMode
_orderMode
Definition: sharedSingleOrder.h:107
const char * getSymbol() const
getSymbol
long getLocationId() const
getLocationId
DATA_TYPES::InstrumentType getInstrumentType() const
getInstrumentType
void setStopPrice(DATA_TYPES::PRICE stopPrice)
setStopPrice
DATA_TYPES::ENUM _transactionType
_transactionType
Definition: sharedSingleOrder.h:102
DATA_TYPES::SecurityType getSecurityType() const
getSecurityType
DATA_TYPES::ENUM _orderStatus
_orderStatus
Definition: sharedSingleOrder.h:152
DATA_TYPES::ENUM _productType
_productType
Definition: sharedSingleOrder.h:132
The API_SymbolStaticData struct.
Definition: sgSymbolDataDefines.h:10
void setTokenId(UNSIGNED_INTEGER val)
setTokenId
DATA_TYPES::QTY getDisclosedQuantity() const
getDisclosedQuantity To get Disclosed Order Qty
void initialize()
initialize
DATA_TYPES::PRICE _stopPrice
_stopPrice
Definition: sharedSingleOrder.h:76