CPPKiteConnect
kiteconnect::kite Class Reference

kite represents a KiteConnect session. It wraps around the KiteConnect REST API and provides a native interface. More...

#include <kite.hpp>

Public Member Functions

 kite (string apikey)
 Construct a new kite object. More...
 
void setApiKey (const string &arg)
 Set the API key for current session. More...
 
string getApiKey () const
 Get current session's API key. More...
 
string loginURL () const
 Get the login URL to which the user should be redirected to initiate the login flow. More...
 
void setAccessToken (const string &arg)
 Set the access token current session. More...
 
string getAccessToken () const
 Get access token set for current session. More...
 
userSession generateSession (const string &requestToken, const string &apiSecret)
 Generate an user session. Use this method to generate an access token. More...
 
bool invalidateSession ()
 This method invalidates the access token and destroys current session. More...
 
userProfile profile ()
 Get user's profile. More...
 
allMargins getMargins ()
 Get margins for all segments. More...
 
margins getMargins (const string &segment)
 Get margins for a particular segment. More...
 
string placeOrder (const placeOrderParams &params)
 Place an order. More...
 
string modifyOrder (const modifyOrderParams &params)
 modify an order More...
 
string cancelOrder (const string &variety, const string &orderId, const string &parentOrderId="")
 cancel an order More...
 
std::vector< orderorders ()
 Get list of orders. More...
 
std::vector< orderorderHistory (const string &orderId)
 Get history of an order. More...
 
std::vector< tradetrades ()
 Get list of trades. More...
 
std::vector< tradeorderTrades (const string &orderId)
 Get the list of trades executed for a particular order. More...
 
int placeGtt (const placeGttParams &params)
 Place a GTT. More...
 
std::vector< GTTtriggers ()
 Get list of GTTs. More...
 
GTT getGtt (int triggerId)
 Get details of a particular GTT. More...
 
int modifyGtt (const kc::modifyGttParams &params)
 Modify a GTT. More...
 
int deleteGtt (int triggerId)
 Delete a GTT. More...
 
std::vector< holdingholdings ()
 Get holdings. More...
 
positions getPositions ()
 Get positions. More...
 
bool convertPosition (const convertPositionParams &params)
 Convert an open position to a different product type. More...
 
std::vector< instrumentgetInstruments (const string &exchange="")
 Retrieve the list of market instruments available to trade. More...
 
std::unordered_map< string, quotegetQuote (const std::vector< string > &symbols)
 Retrieve quote for a list of instruments. More...
 
std::unordered_map< string, ohlcQuotegetOhlc (const std::vector< string > &symbols)
 Retrieve OHLC info for a list of instruments. More...
 
std::unordered_map< string, ltpQuotegetLtp (const std::vector< string > &symbols)
 Retrieve Last Traded Price for a list of instruments. More...
 
std::vector< historicalDatagetHistoricalData (const historicalDataParams &params)
 Retrieve historical data of an instrument. More...
 
string placeMfOrder (const placeMfOrderParams &params)
 Place a mutual fund order. More...
 
string cancelMfOrder (const string &orderId)
 Cancel a mutual fund order. More...
 
std::vector< mfOrdergetMfOrders ()
 Get mutual fund orders. More...
 
mfOrder getMfOrder (const string &orderId)
 Get details of a particular mutual fund order. More...
 
std::vector< mfHoldinggetMfHoldings ()
 Get mutual fund holdings. More...
 
placeMfSipResponse placeMfSip (const placeMfSipParams &params)
 Place a mutual fund SIP order. More...
 
string modifyMfSip (const modifyMfSipParams &params)
 Modify a mutual SIP order. More...
 
string cancelMfSip (const string &sipId)
 Cancel a mutual fund SIP. More...
 
std::vector< mfSipgetSips ()
 Get list of SIPs. More...
 
mfSip getSip (const string &sipId)
 Get details of a particular SIP. More...
 
std::vector< mfInstrumentgetMfInstruments ()
 Get the list of mutual fund instruments available for trading. More...
 
std::vector< orderMarginsgetOrderMargins (const std::vector< marginsParams > &params)
 Get margins required for placing particular orders. More...
 
basketMargins getBasketMargins (const std::vector< marginsParams > &params, bool considerPositions)
 Get margins required for a basket. More...
 

Protected Member Functions

utils::http::response sendReq (const utils::http::endpoint &endpoint, const utils::http::Params &body, const utils::FmtArgs &fmtArgs)
 send a http request with the context used by kite More...
 

Detailed Description

kite represents a KiteConnect session. It wraps around the KiteConnect REST API and provides a native interface.

Constructor & Destructor Documentation

◆ kite()

kiteconnect::kite::kite ( string  apikey)
inlineexplicit

Construct a new kite object.

Parameters
apikeykiteconnect api key

Member Function Documentation

◆ cancelMfOrder()

string kiteconnect::kite::cancelMfOrder ( const string &  orderId)
inline

Cancel a mutual fund order.

Parameters
orderIdID of order to cancel
Returns
string ID of cancelled order

example

// std::string mfOrderId =
// Kite.cancelMfOrder("51ac086a-0e39-42b5-a725-157507614d79");
// if (!mfOrderId.empty()) {
// std::cout << "order ID: " << mfOrderId << '\n';
// } else {
// std::cout << "failed to cancel order\n";
// };

◆ cancelMfSip()

string kiteconnect::kite::cancelMfSip ( const string &  sipId)
inline

Cancel a mutual fund SIP.

Parameters
sipIdID of SIP to cancel
Returns
string ID of cancelled SIP

example

// std::string sipId = Kite.cancelMfSip("823098377587704");
// if (!sipId.empty()) {
// std::cout << "cancelled SIP\n";
// } else {
// std::cout << "failed to cancel SIP\n";
// };

◆ cancelOrder()

string kiteconnect::kite::cancelOrder ( const string &  variety,
const string &  orderId,
const string &  parentOrderId = "" 
)
inline

cancel an order

Parameters
varietyvariety of the order
ordIDorder ID
parentOrdIDparent order ID
Returns
string order ID

example

// std::string cancelldOrderId =
// Kite.cancelOrder("amo", "220929004253728");
// if (!cancelldOrderId.empty()) {
// std::cout << "order ID: " << cancelldOrderId << "\n";
// } else {
// std::cout << "failed to cancel order\n";
// };

Cancel an order.

Parameters
varietyvariety of order to cancel
orderIdID of order to cancel
parentOrderIdparent order ID of the order to cancel (if any)
Returns
string ID of the cancelled order

example

// std::string cancelldOrderId =
// Kite.cancelOrder("amo", "220929004253728");
// if (!cancelldOrderId.empty()) {
// std::cout << "order ID: " << cancelldOrderId << "\n";
// } else {
// std::cout << "failed to cancel order\n";
// };

◆ convertPosition()

bool kiteconnect::kite::convertPosition ( const convertPositionParams params)
inline

Convert an open position to a different product type.

Parameters
paramsparameters required to convert a position
Returns
bool true the if position was successfully modified, false otherwise.

example

// if (Kite.convertPosition(kc::convertPositionParams()
// .Symbol("BHEL")
// .Exchange("NSE")
// .TransactionType("BUY")
// .Quantity(1)
// .PositionType("day")
// .OldProduct("MIS")
// .NewProduct("CNC"))) {
// std::cout << "successfully converted the position\n";
// } else {
// std::cout << "failed to convert the position\n";
// };

◆ deleteGtt()

int kiteconnect::kite::deleteGtt ( int  triggerId)
inline

Delete a GTT.

Parameters
triggerIdID of trigger to delete
Returns
int ID of deleted trigger

example

// int triggerId = Kite.deleteGtt(119865602);
// std::cout << "trigger ID: " << triggerId << '\n';

◆ generateSession()

userSession kiteconnect::kite::generateSession ( const string &  requestToken,
const string &  apiSecret 
)
inline

Generate an user session. Use this method to generate an access token.

Parameters
requestTokenrequest token to use
apiSecretcorresponding API secret
Returns
userSession session details

example

// std::string apiSecret = std::getenv("KITE_API_SECRET");
// std::string reqToken;
// std::cout << "enter obtained request token: ";
// std::cin >> reqToken;
// std::string accessToken =
// Kite.generateSession(reqToken, apiSecret).tokens.accessToken;
// std::cout << "access token: " << accessToken << "\n";

◆ getAccessToken()

string kiteconnect::kite::getAccessToken ( ) const
inline

Get access token set for current session.

Returns
string access token

◆ getApiKey()

string kiteconnect::kite::getApiKey ( ) const
inline

Get current session's API key.

Returns
string API key

◆ getBasketMargins()

basketMargins kiteconnect::kite::getBasketMargins ( const std::vector< marginsParams > &  params,
bool  considerPositions 
)
inline

Get margins required for a basket.

Parameters
paramslist of paramters required to fetch margins. each entry represents an order.
considerPositionsif true, current positions are considered
Returns
basketMargins margins

example

// kc::basketMargins basketMargins =
// Kite.getBasketMargins({ {
// kc::marginsParams()
// .Exchange("NSE")
// .Tradingsymbol("INFY")
// .OrderType("MARKET")
// .TransactionType("BUY")
// .Variety("regular")
// .Product("CNC")
// .Quantity(1)
// .Price(0)
// .TriggerPrice(0),
// },
// {
// kc::marginsParams()
// .Exchange("NSE")
// .Tradingsymbol("HDFCBANK")
// .OrderType("SL")
// .TransactionType("BUY")
// .Variety("regular")
// .Product("MIS")
// .Quantity(100)
// .Price(1510)
// .TriggerPrice(1500),
// } },
// true);
// std::cout << "final total: " << basketMargins.final.total << "\n";

◆ getGtt()

GTT kiteconnect::kite::getGtt ( int  triggerId)
inline

Get details of a particular GTT.

Parameters
triggerIdID of trigger whose details should be fetched
Returns
GTT trigger details

example

// kc::GTT gtt = Kite.getGtt(119865602);
// std::cout << "created at: " << gtt.createdAt
// << " first trigger value : " <<
// gtt.condition.triggerValues[0]
// << '\n';

◆ getHistoricalData()

std::vector< historicalData > kiteconnect::kite::getHistoricalData ( const historicalDataParams params)
inline

Retrieve historical data of an instrument.

Parameters
paramsparamters required to fetch the data.
Returns
std::vector<historicalData> historical data

example

// std::vector<kc::historicalData> data =
// Kite.getHistoricalData(kc::historicalDataParams()
// .InstrumentToken(5633)
// .From("2022-07-02
// 09:30:00")
// .To("2022-08-10
// 10:30:00")
// .Interval("minute"));
// for (const auto& i : data) {
// std::cout << "datetime: " << i.datetime << " close: " << i.close
// << "\n";
// };

◆ getInstruments()

std::vector< instrument > kiteconnect::kite::getInstruments ( const string &  exchange = "")
inline

Retrieve the list of market instruments available to trade.

Parameters
exchangeif specified, only instruments available on this exchange are fetched.
Returns
std::vector<instrument> instruments
Attention
Results could be large, with tens of thousands of entries.

example

// std::vector<kc::instrument> inst = Kite.getInstruments();
// for (auto const& i : inst) {
// std::cout << "symbol: " << i.tradingsymbol
// << " token: " << i.instrumentToken << '\n';
// };

◆ getLtp()

std::unordered_map< string, ltpQuote > kiteconnect::kite::getLtp ( const std::vector< string > &  symbols)
inline

Retrieve Last Traded Price for a list of instruments.

Parameters
symbolslist of instruments whose OHLC info should be fetched. format of each entry should be exchange:tradingsymbol. example: NSE:INFY.
Returns
std::unordered_map<string, LTPQuote> LTP info mapped to respective insruments. format of keys is similar to symbols.

example

// std::unordered_map<std::string, kc::ltpQuote> ltpQuotes =
// Kite.getLtp({ "NSE:INFY", "NSE:NIFTY 50", "NSE:RELIANCE" });
// std::cout << "RELIANCE LTP: " << ltpQuotes["NSE:RELIANCE"].lastPrice
// << '\n';

◆ getMargins() [1/2]

allMargins kiteconnect::kite::getMargins ( )
inline

Get margins for all segments.

Returns
allMargins margins

example

// kc::allMargins Margins = Kite.getMargins();
// std::cout << "available cash for equity segment is "
// << Margins.equity.available.cash << "\n";
// kc::margins eqMargins = Kite.getMargins("equity");
// std::cout << "adhoc margin for equity segment is "
// << eqMargins.available.adHocMargin << "\n";

◆ getMargins() [2/2]

margins kiteconnect::kite::getMargins ( const string &  segment)
inline

Get margins for a particular segment.

Parameters
segmentsegment whose margins should be fetched
Returns
margins segment margins

example

// kc::allMargins Margins = Kite.getMargins();
// std::cout << "available cash for equity segment is "
// << Margins.equity.available.cash << "\n";
// kc::margins eqMargins = Kite.getMargins("equity");
// std::cout << "adhoc margin for equity segment is "
// << eqMargins.available.adHocMargin << "\n";

◆ getMfHoldings()

std::vector< mfHolding > kiteconnect::kite::getMfHoldings ( )
inline

Get mutual fund holdings.

Returns
std::vector<mfHolding> holdings

example

// std::vector<kc::mfHolding> mfholdings = Kite.getMfHoldings();
// for (const auto& i : mfholdings) {
// std::cout << "fund: " << i.fund << " last price: " << i.lastPrice
// << '\n';
// };

◆ getMfInstruments()

std::vector< mfInstrument > kiteconnect::kite::getMfInstruments ( )
inline

Get the list of mutual fund instruments available for trading.

Returns
std::vector<mfInstrument> instruments

example

// std::vector<kc::mfInstrument> inst = Kite.getMfInstruments();
// for (auto const& i : inst) {
// std::cout << "symbol: " << i.tradingsymbol
// << " last price: " << i.lastPrice << '\n';
// };

◆ getMfOrder()

mfOrder kiteconnect::kite::getMfOrder ( const string &  orderId)
inline

Get details of a particular mutual fund order.

Parameters
orderIdID of the order whose details should be fetched
Returns
mfOrder order details

example

// kc::mfOrder mforder =
// Kite.getMfOrder("51ac086a-0e39-42b5-a725-157507614d79");
// std::cout << "status: " << mforder.status << '\n';

◆ getMfOrders()

std::vector< mfOrder > kiteconnect::kite::getMfOrders ( )
inline

Get mutual fund orders.

Returns
std::vector<mfOrder> orders

example

// std::vector<kc::mfOrder> mforders = Kite.getMfOrders();
// for (const auto& i : mforders) {
// std::cout << "order ID: " << i.orderID << " status: " << i.status
// << '\n';
// };

◆ getOhlc()

std::unordered_map< string, ohlcQuote > kiteconnect::kite::getOhlc ( const std::vector< string > &  symbols)
inline

Retrieve OHLC info for a list of instruments.

Parameters
symbolslist of instruments whose OHLC info should be fetched. format of each entry should be exchange:tradingsymbol. example: NSE:INFY.
Returns
std::unordered_map<string, OHLCQuote> OHLC info mapped to respective insruments. format of keys is similar to symbols.

example

// std::unordered_map<std::string, kc::ohlcQuote> ohlcQuotes =
// Kite.getOhlc({ "NSE:INFY", "NSE:NIFTY 50", "NSE:RELIANCE" });
// std::cout << "NIFTY50 close: " << ohlcQuotes["NSE:NIFTY
// 50"].OHLC.close << '\n';

◆ getOrderMargins()

std::vector< orderMargins > kiteconnect::kite::getOrderMargins ( const std::vector< marginsParams > &  params)
inline

Get margins required for placing particular orders.

Parameters
paramslist of paramters required to fetch margins. each entry represents an order.
Returns
std::vector<orderMargins> margins

example

// std::vector<kc::orderMargins> ordMargins =
// Kite.getOrderMargins({ kc::marginsParams()
// .Exchange("NSE")
// .Tradingsymbol("INFY")
// .OrderType("MARKET")
// .TransactionType("BUY")
// .Variety("regular")
// .Product("CNC")
// .Quantity(1)
// .Price(0)
// .TriggerPrice(0) });
// std::cout << "trading symbol: " << ordMargins[0].tradingSymbol
// << " total: " << ordMargins[0].total << "\n";

◆ getPositions()

positions kiteconnect::kite::getPositions ( )
inline

Get positions.

Returns
positions positions

example

// kc::positions Positions = Kite.getPositions();
// if (!Positions.day.empty()) {
// std::cout << "tradingsymbol: " << Positions.day[0].tradingsymbol
// << " & quantity: " << Positions.day[0].quantity <<
// '\n';
// };

◆ getQuote()

std::unordered_map< string, quote > kiteconnect::kite::getQuote ( const std::vector< string > &  symbols)
inline

Retrieve quote for a list of instruments.

Parameters
symbolslist of instruments whose quotes should be fetched. format of each entry should be exchange:tradingsymbol. example: NSE:INFY.
Returns
std::unordered_map<string, quote> quotes mapped to respective insruments. format of keys is similar to symbols.

example

// std::unordered_map<std::string, kc::quote> quotes =
// Kite.getQuote({ "NSE:INFY", "NSE:NIFTY 50", "NSE:RELIANCE" });
// std::cout << "NIFTY50 close: " << quotes["NSE:NIFTY 50"].OHLC.close
// << "\n"; std::cout << "INFY close: " << quotes["NSE:INFY"].OHLC.close
// << "\n";

◆ getSip()

mfSip kiteconnect::kite::getSip ( const string &  sipId)
inline

Get details of a particular SIP.

Parameters
sipIdID of the SIP whose details should be fetched
Returns
mfSip SIP details

example

// kc::mfSip sip = Kite.getSip("555299391983723");
// std::cout << "SIP ID: " << sip.ID << " status:" << sip.status <<
// '\n';

◆ getSips()

std::vector< mfSip > kiteconnect::kite::getSips ( )
inline

Get list of SIPs.

Returns
std::vector<mfSips> SIPs

example

// std::vector<kc::mfSip> sips = Kite.getSips();
// for (const auto& sip : sips) {
// std::cout << "ID: " << sip.ID
// << "
// status : " << sip.status << "\n "; };

◆ holdings()

std::vector< holding > kiteconnect::kite::holdings ( )
inline

Get holdings.

Returns
std::vector<holding> holdings

example

// std::vector<kc::holding> holdings = Kite.holdings();
// for (const auto& i : holdings) {
// std::cout << "trading symbol: " << i.tradingsymbol << " average
// price: " << i.averagePrice << '\n';
// };

◆ invalidateSession()

bool kiteconnect::kite::invalidateSession ( )
inline

This method invalidates the access token and destroys current session.

Note
After this, the user should be sent through a new login flow before further interactions. This does not log the user out of the official Kite web or mobile applications.
Returns
true if session was invalidated successfully, false otherwise.

example

// if (Kite.invalidateSession()) {
// std::cout << "invalidated session\n";
// } else {
// std::cout << "failed to invalid session\n";
// }

◆ loginURL()

string kiteconnect::kite::loginURL ( ) const
inline

Get the login URL to which the user should be redirected to initiate the login flow.

Returns
string login URL

example

// std::cout << "login URL: " << Kite.loginURL() << '\n';
// std::cout << "login with this URL and obtain the request token\n";

◆ modifyGtt()

int kiteconnect::kite::modifyGtt ( const kc::modifyGttParams params)
inline

Modify a GTT.

Parameters
paramsparameters required to modify a GTT
Returns
int ID of modified trigger

example

// int modifiedTriggerId =
// Kite.modifyGtt(kc::modifyGttParams()
// .TriggerId(119865602)
// .TriggerType("single")
// .Symbol("NESTLEIND")
// .Exchange("NSE")
// .LastPrice(18979.15)
// .TriggerValues({ 19200.65 })
// .GttParamsList({ kc::gttParams()
// .Quantity(10)
// .Price(19000.85)
// .TransactionType("BUY")
// .OrderType("LIMIT")
// .Product("MIS") }));
// std::cout << "trigger ID: " << modifiedTriggerId << '\n';

◆ modifyMfSip()

string kiteconnect::kite::modifyMfSip ( const modifyMfSipParams params)
inline

Modify a mutual SIP order.

Parameters
paramsparameters required to modify the order
Returns
string ID of the modified order

example

// std::string mfOrderId = Kite.modifyMfSip(kc::modifyMfSipParams()
// .SipId("555299391983723")
// .Amount(5000)
// .Status("paused")
// .InstallmentDay(10)
// .Frequency("monthly")
// .Installments(5));
// if (!mfOrderId.empty()) {
// std::cout << "order ID: " << mfOrderId << '\n';
// } else {
// std::cout << "failed to modify order\n";
// };

◆ modifyOrder()

string kiteconnect::kite::modifyOrder ( const modifyOrderParams params)
inline

modify an order

Parameters
varietyvariety of the order
ordIDorder ID
parentOrdIDparent order ID
quantityquantity to transact
pricethe min or max price to execute the order at (for LIMIT orders)
ordTypeorder type
trigPricetrigger price
validityorder validity
discQuantitydisclosed quantity
Returns
string order ID

example

// std::string modifiedOrderId =
// Kite.modifyOrder(kc::modifyOrderParams()
// .OrderId("220929004253728")
// .OrderType("MARKET")
// .Quantity(11)
// .Variety("amo"));
// if (!modifiedOrderId.empty()) {
// std::cout << "order ID: " << modifiedOrderId << "\n";
// } else {
// std::cout << "failed to modify order\n";
// };

Modify an order.

Parameters
paramsparameters of the order to modify
Returns
string ID of modified order

example

// std::string modifiedOrderId =
// Kite.modifyOrder(kc::modifyOrderParams()
// .OrderId("220929004253728")
// .OrderType("MARKET")
// .Quantity(11)
// .Variety("amo"));
// if (!modifiedOrderId.empty()) {
// std::cout << "order ID: " << modifiedOrderId << "\n";
// } else {
// std::cout << "failed to modify order\n";
// };

◆ orderHistory()

std::vector< order > kiteconnect::kite::orderHistory ( const string &  orderId)
inline

Get history of an order.

Parameters
orderIdID of order whose history should be fetched.
Returns
std::vector<order> order history

example

// std::vector<kc::order> OrderHistory =
// Kite.orderHistory("220929004253728");
// for (const auto& i : OrderHistory) {
// std::cout << "status: " << i.status
// << " filled quantity: " << i.filledQuantity << '\n';
// };

◆ orders()

std::vector< order > kiteconnect::kite::orders ( )
inline

Get list of orders.

Returns
std::vector<order> orders

example

// std::vector<kc::order> Orders = Kite.orders();
// for (const auto& i : Orders) {
// std::cout << "order ID: " << i.orderID << " status: " << i.status
// << "\n";
// }

◆ orderTrades()

std::vector< trade > kiteconnect::kite::orderTrades ( const string &  orderId)
inline

Get the list of trades executed for a particular order.

Parameters
orderIdID of order whose trades should be fetched
Returns
std::vector<trade> trades

example

// std::vector<kc::trade> Trades = Kite.orderTrades("220929004253728");
// for (const auto& i : Trades) {
// std::cout << "trade ID: " << i.tradeID
// << "filled at : " << i.fillTimestamp << '\n';
// };

◆ placeGtt()

int kiteconnect::kite::placeGtt ( const placeGttParams params)
inline

Place a GTT.

Parameters
paramsparameters of the GTT to place.
Returns
int trigger ID

example

// int triggerId =
// Kite.placeGtt(kc::placeGttParams()
// .TriggerType("single")
// .Symbol("NESTLEIND")
// .Exchange("NSE")
// .LastPrice(18979.15)
// .TriggerValues({ 19200.65 })
// .GttParamsList({ kc::gttParams()
// .Quantity(1)
// .Price(19000.75)
// .TransactionType("BUY")
// .OrderType("LIMIT")
// .Product("MIS") }));
// std::cout << "trigger ID: " << triggerId << '\n';

◆ placeMfOrder()

string kiteconnect::kite::placeMfOrder ( const placeMfOrderParams params)
inline

Place a mutual fund order.

Parameters
paramsparameters required to place the order
Returns
string ID of the order placed

example

// std::string mfOrderId = Kite.placeMfOrder(kc::placeMfOrderParams()
// .Symbol("INF174K01LS2")
// .TransactionType("BUY")
// .Amount(10000));
// if (!mfOrderId.empty()) {
// std::cout << "order ID: " << mfOrderId << '\n';
// } else {
// std::cout << "failed to place order\n";
// };

◆ placeMfSip()

placeMfSipResponse kiteconnect::kite::placeMfSip ( const placeMfSipParams params)
inline

Place a mutual fund SIP order.

Parameters
symboltradingsymbol (ISIN) of the fund
Returns
placeMfSipResponse IDs of the placed order

example

// auto sipRes = Kite.placeMfSip(kc::placeMfSipParams()
// .Symbol("INF174K01LS2")
// .Amount(1000)
// .Frequency("monthly")
// .InitialAmount(1000)
// .InstallmentDay(2));
// if (!sipRes.sipId.empty() && !sipRes.orderId.empty()) {
// std::cout << "order ID: " << sipRes.orderId
// << " SIP ID: " << sipRes.sipId << '\n';
// } else {
// std::cout << "failed to place SIP order\n";
// };

◆ placeOrder()

string kiteconnect::kite::placeOrder ( const placeOrderParams params)
inline

Place an order.

Parameters
paramsparameters of order to place
Returns
string ID of placed order

example

// std::string orderId = Kite.placeOrder(kc::placeOrderParams()
// .Symbol("IOB")
// .Exchange("NSE")
// .TransactionType("BUY")
// .OrderType("MARKET")
// .Quantity(1)
// .Product("MIS")
// .Variety("amo")
// .Validity("DAY"));
// if (!orderId.empty()) {
// std::cout << "order ID: " << orderId << "\n";
// } else {
// std::cout << "failed to place order\n";
// };

◆ profile()

userProfile kiteconnect::kite::profile ( )
inline

Get user's profile.

Returns
userProfile user profile

example

// kc::userProfile profile = Kite.profile();
// std::cout << "name: " << profile.userName << '\n';
// std::cout << "email: " << profile.email << '\n';

◆ sendReq()

utils::http::response kiteconnect::kite::sendReq ( const utils::http::endpoint &  endpoint,
const utils::http::Params &  body,
const utils::FmtArgs &  fmtArgs 
)
inlineprotected

send a http request with the context used by kite

Parameters
endpointrequest endpoint
bodybody of the request (sent as form url encoded)
Returns
utils::http::response response received

◆ setAccessToken()

void kiteconnect::kite::setAccessToken ( const string &  arg)
inline

Set the access token current session.

Parameters
argaccess token is set to arg

example

// Kite.setAccessToken(accessToken);
// Kite.setAccessToken(std::getenv("KITE_ACCESS_TOKEN"));

◆ setApiKey()

void kiteconnect::kite::setApiKey ( const string &  arg)
inline

Set the API key for current session.

Parameters
argAPI key is set to arg

◆ trades()

std::vector< trade > kiteconnect::kite::trades ( )
inline

Get list of trades.

Returns
std::vector<trade> trades

example

// std::vector<kc::trade> Trades = Kite.trades();
// for (const auto& i : Trades) {
// std::cout << "trade ID: " << i.tradeID
// << " filled at: " << i.fillTimestamp << '\n';
// };

◆ triggers()

std::vector< GTT > kiteconnect::kite::triggers ( )
inline

Get list of GTTs.

Returns
std::vector<GTT> triggers

example

// std::vector<kc::GTT> triggers = Kite.triggers();
// for (const auto& gtt : triggers) {
// std::cout << "ID: " << gtt.ID
// << "
// created at : " << gtt.createdAt << '\n';
// };

The documentation for this class was generated from the following files: