API  Version 2.0.1
Low-Latency HFT API
 All Classes Functions Variables
sgCommon.h
1 #ifndef SG_COMMON_H
2 #define SG_COMMON_H
3 
4 #include "time.h"
5 #include <sharedDefines.h>
6 #include <sharedResponse.h>
7 #include <sharedCommands.h>
8 #include <fstream>
9 #include <list>
10 #include <sgMktData.h>
11 
12 #include <memory>
13 #include <string>
14 
15 #include <cmdDefines.h>
16 #include <apiConstants.h>
17 
18 #include <sgSymbolDataDefines.h>
19 
20 typedef uint64_t SYMBOL_ID;
21 
22 namespace API2{
23  namespace COMMON {
24 
25  struct OrderId;
26  struct Position;
27  struct Instrument;
28 
34  {
35 
40  SIGNED_LONG getOpenQty();
41 
47  SIGNED_LONG getTradedQty(const DATA_TYPES::OrderMode &mode);
48 
53  DATA_TYPES::OrderMode getOpenSide();
54 
59  SIGNED_LONG getBookedPnl();
60 
66  SIGNED_LONG getMtmPnl(UNSIGNED_LONG ltp);
67 
73  DATA_TYPES::PRICE getAvgPrice(const DATA_TYPES::OrderMode &mode);
74 
80  UNSIGNED_LONG getPendingQty(const DATA_TYPES::OrderMode &mode);
81 
82 #if API_COMPILATION == 0
83 #include <sgInstrumentPosition.ph>
84 #endif
85  };
86 
90  class Instrument
91  {
92 
93  public:
94 
100 
105  time_t getLastQuoteUpdateTime();
106 
111  SYMBOL_ID getSymbolId();
112 
118 
124  UNSIGNED_LONG getLastQuotedPrice(const DATA_TYPES::OrderMode &mode);
125 
126 
133  void updatePositionFromString(const std::string &positionString,const char *delimiter="|");
134 
141  std::string getPositionString(const char *delimiter="|");
142 
143 #if API_COMPILATION == 0
144 #include <sgInstrument.ph>
145 #endif
146  };
147 
148 
149  } //namspace COMMON
150 }//namspace SG
151 #endif // SGCOMMON_H
SIGNED_LONG getBookedPnl()
getBookedPnl, To get Booked Pnl
InstrumentPosition * getPosition()
void updatePositionFromString(const std::string &positionString, const char *delimiter="|")
updatePositionFromString Format: Buy Qty <delimeter> Sell Qty <delimeter> Buy Avg Price <delimeter> S...
UNSIGNED_LONG getLastQuotedPrice(const DATA_TYPES::OrderMode &mode)
getLastQuotedPrice To get last quoted price from this Instrument
time_t getLastQuoteUpdateTime()
getLastQuoteUpdateTime To get Last time when the Quote for the Instrument was updated ...
DATA_TYPES::PRICE getAvgPrice(const DATA_TYPES::OrderMode &mode)
getAvgPrice, Get Average Trade Price at requested OrderMode
The Instrument class Provides all the information about Market Instrument.
Definition: sgCommon.h:90
The InstrumentPosition struct Provides the basic information like Open Qty, OpenSide, Traded Quantity in Buy/Sell Side, Average traded Price in Buy/Sell Side, Booked and Mark-To-Market Profit and loss.
Definition: sgCommon.h:33
std::string getPositionString(const char *delimiter="|")
getPositionString Format: Buy Qty <delimeter> Sell Qty <delimeter> Buy Avg Price <delimeter> Sell Avg...
SIGNED_LONG getOpenQty()
getOpenQty, To get the Open Quantity i,e Buy Qty-Sell Qty
SYMBOL_ID getSymbolId()
getSymbolId To get The System unique ID of the Instrument
DATA_TYPES::OrderMode getOpenSide()
getOpenSide, To get Open Side Position, if BuyQty>SellQty, returns API2::CONSTANTS::CMD_OrderMode_BUY...
SymbolStaticData * getStaticData()
getStaticData To get the static details of a tradable Instrument
SIGNED_LONG getTradedQty(const DATA_TYPES::OrderMode &mode)
getTradedQty To get Traded Quantity at requested OrderMode
UNSIGNED_LONG getPendingQty(const DATA_TYPES::OrderMode &mode)
getPendingQty, To get Quantity Pending (or not filled)
SIGNED_LONG getMtmPnl(UNSIGNED_LONG ltp)
getMtmPnl, To get Mark to Market Pnl
The API_SymbolStaticData struct.
Definition: sgSymbolDataDefines.h:10