5 #include <sharedSingleOrder.h>
6 #include <sgApiParameters.h>
7 #include <sgDebugLogDefines.h>
8 #include <baseCommands.h>
109 const UNSIGNED_LONG &qty=0,
110 const UNSIGNED_LONG &discQty=0,
111 const DATA_TYPES::OrderMode &mode=CONSTANTS::CMD_OrderMode_BUY,
112 const DATA_TYPES::OrderType &type = CONSTANTS::CMD_OrderType_LIMIT,
113 const DATA_TYPES::OrderValidity &validity = CONSTANTS::CMD_OrderValidity_DAY,
114 const DATA_TYPES::ProductType &product = CONSTANTS::CMD_ProductType_DELIVERY,
115 const UNSIGNED_LONG &price=0,
116 const UNSIGNED_LONG &stopPrice=0
129 const DATA_TYPES::OrderMode &mode
147 COMMON::OrderId *orderId);
162 COMMON::OrderId *orderId);
170 bool reqCancelOrder(DATA_TYPES::RiskStatus &riskStatus, COMMON::OrderId *orderId);
206 void *
reqStartAlgo(
bool marketDataEventRequired,
bool tradeTicksEventRequired);
261 DATA_TYPES::ResponseType responseType,
262 DATA_TYPES::RiskStatus riskStatus,
263 DATA_TYPES::StrategyComment strategyComment = CONSTANTS::RSP_StrategyComment_MAX
283 const DATA_TYPES::ExchangeId &exch,
284 const DATA_TYPES::SecurityType &securityType = CONSTANTS::CMD_SecurityType_MAX
389 DATA_TYPES::OrderMode mode);
440 DATA_TYPES::String
getStrOrderId(
const COMMON::OrderId *orderId);
631 SGContextImpl *pimpl;
637 #endif // SGCONTEXT_H
virtual void onPartialFill(OrderConfirmation &confirmation, COMMON::OrderId *orderId)
onPartialFill Call back when an order gets partially filled at the exchange
Definition: sgContext.h:592
DATA_TYPES::String getStrConfirmation(const OrderConfirmation &confirmation)
getStrConfirmation. Prints OrderConfirmation fields
virtual void onIOCCanceled(OrderConfirmation &Confirmation, COMMON::OrderId *orderId)
onIOCCanceled Call back when an IOC order gets canceled the exchange
Definition: sgContext.h:578
virtual void onFilled(OrderConfirmation &confirmation, COMMON::OrderId *orderId)
onFilled Call back when an order gets filled at the exchange
Definition: sgContext.h:585
COMMON::OhlcQuote * reqQryOHLCQuote(bool &error, SYMBOL_ID symbolId)
reqQryOHLCQuote
virtual bool reqQryTestSegment(const DATA_TYPES::ExchangeId &exch, const DATA_TYPES::SecurityType &securityType=CONSTANTS::CMD_SecurityType_MAX)
reqQryTestSegment To know whether a given exchange segment is being used in the strategy or not ...
virtual void onCMDPauseStartegy()
onCMDPauseStartegy Called when strategy receives Pause Command from Frontend
COMMON::OrderId * createNewOrderId(COMMON::Instrument *instrument, const API2::AccountDetail &accountDetail, const DATA_TYPES::OrderMode &mode)
createNewOrderId Creates and Inserts a new OrderId Instance to the Instrument for the requested Orde...
COMMON::MktData * reqQryUpdateMarketData(SYMBOL_ID symbolId)
reqQryUpdateMarketData This function call will return the Pointer to API2::COMMON::MktData structure ...
COMMON::MktData * reqQryMarketData(SYMBOL_ID symbolId)
reqQryMarketData This function call will return the Pointer to API2::COMMON::MktData structure Here...
StrategyParameters * reqQryStrategyParams()
reqQryStrategyParams To get StartegyParameters
void * reqStartOHLCAlgo()
reqStartOHLCAlgo function call to Start the Strategy listening to OHLC update events ...
virtual void onProcessOrderConfirmation(OrderConfirmation &confirmation)
onProcessOrderConfirmation Call back after OrderConfirmation Processing is done Not necessary to ove...
Definition: sgContext.h:528
The MktData class, The wrapper class for getting Market Feed for both Snapshot and Tick-By-Tick...
Definition: sgMktData.h:118
virtual void onMarketDataEvent(UNSIGNED_LONG symbolId)
onMarketDataEvent Called if Configured to received marketData Event while Running Algo ...
virtual void onDefaultEvent()
onDefaultEvent Called as an event if Not configured to received marketData Event while Running Algo ...
void reqSendStrategyResponse(DATA_TYPES::ResponseType responseType, DATA_TYPES::RiskStatus riskStatus, DATA_TYPES::StrategyComment strategyComment=CONSTANTS::RSP_StrategyComment_MAX)
reqSendStrategyResponse To send a Response to the frontend
DATA_TYPES::String reqQryExchangeOrderId(COMMON::OrderId *orderId)
reqQryExchangeOrderId To get Exchange OrderId of requested Order
virtual void onCMDRunStrategy()
onCMDRunStrategy Called when strategy receives Run Command from Frontend
The Instrument class Provides all the information about Market Instrument.
Definition: sgCommon.h:90
int reqQryClientID()
reqQryClientID To get ClientId
virtual void onFrozen(API2::OrderConfirmation &confirmation, API2::COMMON::OrderId *orderId)
onFrozen Call back when an order gets frozen by exchange
Definition: sgContext.h:606
The TradeTick struct.
Definition: sgMktData.h:87
virtual void onCMDAdminCommand(DATA_TYPES::CommandCategory command)
onCMDAdminCommand Called when ever a command from frontend is issued.
Definition: sgContext.h:452
The SGContext class The main class to be inherited for creating a new Strategy.
Definition: sgContext.h:37
API2::DATA_TYPES::STRATEGY_ID reqQryStrategyId()
reqQryStrategyId To get StartegyId of current running Strategy.
void reqCancelAllOrders()
reqCancelAllOrders To cancel all Orders ( Confirmed or Partial Filled )
Definition: sharedCommands.h:23
DATA_TYPES::String getStrSingleOrder(SingleOrder *order)
getStrSingleOrder. Prints Single Order fields
The StrategyParameters class provides the Basic Strategy Parameters, StrategyId and ClientId...
Definition: sgApiParameters.h:9
UNSIGNED_LONG reqQryPendingQty(COMMON::Instrument *instrument, DATA_TYPES::OrderMode mode)
reqQryPendingQty To get Pending Quantity of an Instrument
The OrderConfirmation class contains the Exchange Order Confirmation Message data.
Definition: sharedResponse.h:15
void reqExitStrategy()
reqExitStrategy To exit a strategy terminates the Strategy thread and returns the StrategyDriver...
virtual void onCancelRejected(OrderConfirmation &confirmation, COMMON::OrderId *orderId)
onCancelRejected Call back when a cancel order gets rejected by the exchange
Definition: sgContext.h:557
virtual void onCMDModifyStrategy(AbstractUserParams *newParams)=0
onCMDModifyStrategy Called when strategy modify command is received
DebugLog * reqQryDebugLog()
reqQryDebugLog To get Pointer to the DebugLog Object used to dump debug messages. Sample Usage: DE...
virtual void onMarketToLimit(API2::OrderConfirmation &confirmation, API2::COMMON::OrderId *orderId)
onMarketToLimit Call back when Orderstatus changes from Market To Limit by exchange ...
Definition: sgContext.h:599
SIGNED_LONG reqQryNetBookedPL()
reqQryNetBookedPL This function will return net Booked Profit and Loss for the strategy( sum of all I...
DATA_TYPES::String getStrOrderId(const COMMON::OrderId *orderId)
getStrOrderId. Prints OrderId Fields
The AbstractUserParams class.
Definition: baseCommands.h:278
virtual void reqTerminateStrategy(bool reqCancelAllOrders=true)
reqTerminateStrategy Called to Terminate Strategy Can be overriden Default behaviour: 1) Cancel All...
DATA_TYPES::OrderStatus reqQryOrderStatus(COMMON::OrderId *orderId)
reqQryOrderStatus To get OrderStatus of requested Order
virtual void onCMDTerminateSqOffStrategy()
onCMDTerminateSqOffStrategy Called when strategy receives Terminate SqOff Command from Frontend ...
virtual ~SGContext()
~SGContext A destructor
The OhlcQuote class.
Definition: sgMktData.h:23
std::list< API2::COMMON::Instrument * > reqQryInstrumentList(UNSIGNED_LONG symbolId)
reqQryInstrumentList To get list of all Instruments added for the requested SymbolId ...
bool reqProcessTradeTicks(bool &error, SYMBOL_ID symbolId)
reqProcessTradeTicks
virtual void reqTerminateSquareOffStrategy()
reqTerminateSquareOffStrategy Called to Terminate strategy and Square-Off all Positions Can be overri...
SingleOrder * createNewOrder(COMMON::Instrument *instrument, const UNSIGNED_LONG &qty=0, const UNSIGNED_LONG &discQty=0, const DATA_TYPES::OrderMode &mode=CONSTANTS::CMD_OrderMode_BUY, const DATA_TYPES::OrderType &type=CONSTANTS::CMD_OrderType_LIMIT, const DATA_TYPES::OrderValidity &validity=CONSTANTS::CMD_OrderValidity_DAY, const DATA_TYPES::ProductType &product=CONSTANTS::CMD_ProductType_DELIVERY, const UNSIGNED_LONG &price=0, const UNSIGNED_LONG &stopPrice=0)
createNewOrder To create a New Order for an instrument
COMMON::Instrument * createNewInstrument(UNSIGNED_LONG symbolId, bool regMktData, bool useSnapShot=false, bool useOhlc=true)
createNewInstrument To add a new Instrument in the strategy The Pointer to the added Instrument is ...
bool reqUpdateMarketData()
reqUpdateMarketData To manually update Market Feed for all registered Instruments. Not required if marketDataEventRequired is set to be True while starting the strategy using API2::SGContext::reqStartAlgo()
The DebugLog class.
Definition: sgDebugLogDefines.h:9
void reqRemoveAllInstruments()
reqRemoveAllInstruments This will remove all Instrument from the registered Instrument list ...
DATA_TYPES::CLORDER_ID reqQryClientOrderId(COMMON::OrderId *orderId)
reqQryClientOrderId To get ClientOrderId of requested Order
bool reqNewSingleOrder(DATA_TYPES::RiskStatus &riskStatus, COMMON::Instrument *instrument, SingleOrder *&order, COMMON::OrderId *orderId)
reqNewSingleOrder To Send a new Order
virtual void onCMDInit()
OnCMDInit To Set Initial state of the algo.
Definition: sgContext.h:490
bool reqCancelOrder(DATA_TYPES::RiskStatus &riskStatus, COMMON::OrderId *orderId)
reqCancelOrder To Cancel Order
virtual void onConfirmed(OrderConfirmation &confirmation, COMMON::OrderId *orderId)
onConfirmed Call back when a new Order gets confirmed by exchange.
Definition: sgContext.h:536
virtual void onOhlcTimeOutEvent()
onOhlcTimeOutEvent Called if Configured to received OHLC update Event while Running Algo Callback i...
void reqAddStrategyComment(DATA_TYPES::StrategyComment com)
reqAddStrategyComment To set the current Startegy Comment Whenever a strategy Response is sent to fro...
API2::SingleOrder * reqQryOrder(long clOrderId)
reqQryOrder To get Pointer to Single Order using a clientOrderId
void * reqStartAlgo(bool marketDataEventRequired, bool tradeTicksEventRequired)
reqStartAlgo function call to Start the Strategy
virtual void onCMDDisconnection(const DATA_TYPES::CommandCategory &command)
onCMDDisconnection Called whenever a disconnection is received disconnected entity to be determined f...
The SingleOrder class. This wrapper is used for sending Single Leg Orders. Usage: Create an object fo...
Definition: sharedSingleOrder.h:21
bool reqReplaceOrder(DATA_TYPES::RiskStatus &riskStatus, COMMON::Instrument *instrument, SingleOrder *&order, COMMON::OrderId *orderId)
reqReplaceOrder To send a replace Order
void reqRemoveInstrument(COMMON::Instrument *instrument)
reqRemoveInstrument To remove Instrument from the context. Removing will remove all the data relatin...
virtual void onReplaceRejected(OrderConfirmation &confirmation, COMMON::OrderId *orderId)
onReplaceRejected Call back when a replace order gets rejected by the exchange
Definition: sgContext.h:543
virtual void onCMDTerminateStartegy()
onCMDTerminateStartegy Called when strategy receives Terminate Command from Frontend ...
SIGNED_LONG reqQryNetMarkToMarkPL()
reqQryNetMarkToMarkPL This function will return net Mark To Market Profit and Loss for the strategy( ...
virtual void onTradeTickEvent(COMMON::TradeTick tradeTick)
onTradeTickEvent Called if Configured to received Trade Ticks update Event while Running Algo Callb...
virtual void onNewReject(OrderConfirmation &confirmation, COMMON::OrderId *orderId)
onNewRejected Call back when a new order gets rejected by the exchange
Definition: sgContext.h:571
virtual void onReplaced(OrderConfirmation &confirmation, COMMON::OrderId *orderId)
onReplaced Call back when a Order gets replaced sucessfully at the exchange.
Definition: sgContext.h:564
DATA_TYPES::SYMBOL_ID reqQrySymbolID(std::string instrumentName)
reqQrySymbolID This function will return System Unique ID for the Instrument as API2::DATA_TYPES::SYM...
virtual void onCanceled(OrderConfirmation &confirmation, COMMON::OrderId *orderId)
onCanceled Call back when a cancel order gets accepted by the exchange
Definition: sgContext.h:550