Documentation
¶
Index ¶
- Constants
- func GetErrorName(code int) string
- func NewError(etype string, message string, data interface{}) error
- type AllMargins
- type AvailableMargins
- type Bank
- type BasketMargins
- type Client
- func (c *Client) CancelMFOrder(orderID string) (MFOrderResponse, error)
- func (c *Client) CancelMFSIP(sipID string) (MFSIPResponse, error)
- func (c *Client) CancelOrder(variety string, orderID string, parentOrderID *string) (OrderResponse, error)
- func (c *Client) ConvertPosition(positionParams ConvertPositionParams) (bool, error)
- func (c *Client) DeleteGTT(triggerID int) (GTTResponse, error)
- func (c *Client) ExitOrder(variety string, orderID string, parentOrderID *string) (OrderResponse, error)
- func (c *Client) GetBasketMargins(baskparam GetBasketParams) (BasketMargins, error)
- func (c *Client) GetGTT(triggerID int) (GTT, error)
- func (c *Client) GetGTTs() (GTTs, error)
- func (c *Client) GetHistoricalData(instrumentToken int, interval string, fromDate time.Time, toDate time.Time, ...) ([]HistoricalData, error)
- func (c *Client) GetHoldings() (Holdings, error)
- func (c *Client) GetInstruments() (Instruments, error)
- func (c *Client) GetInstrumentsByExchange(exchange string) (Instruments, error)
- func (c *Client) GetLTP(instruments ...string) (QuoteLTP, error)
- func (c *Client) GetMFAllottedISINs() (MFAllottedISINs, error)
- func (c *Client) GetMFHoldingInfo(isin string) (MFHoldingBreakdown, error)
- func (c *Client) GetMFHoldings() (MFHoldings, error)
- func (c *Client) GetMFInstruments() (MFInstruments, error)
- func (c *Client) GetMFOrderInfo(OrderID string) (MFOrder, error)
- func (c *Client) GetMFOrders() (MFOrders, error)
- func (c *Client) GetMFOrdersByDate(fromDate, toDate string) (MFOrders, error)
- func (c *Client) GetMFSIPInfo(sipID string) (MFSIP, error)
- func (c *Client) GetMFSIPs() (MFSIPs, error)
- func (c *Client) GetOHLC(instruments ...string) (QuoteOHLC, error)
- func (c *Client) GetOrderHistory(OrderID string) ([]Order, error)
- func (c *Client) GetOrderMargins(marparam GetMarginParams) ([]OrderMargins, error)
- func (c *Client) GetOrderTrades(OrderID string) ([]Trade, error)
- func (c *Client) GetOrders() (Orders, error)
- func (c *Client) GetPositions() (Positions, error)
- func (c *Client) GetQuote(instruments ...string) (Quote, error)
- func (c *Client) GetTrades() (Trades, error)
- func (c *Client) GetUserMargins() (AllMargins, error)
- func (c *Client) GetUserProfile() (UserProfile, error)
- func (c *Client) GetUserSegmentMargins(segment string) (Margins, error)
- func (c *Client) ModifyGTT(triggerID int, o GTTParams) (GTTResponse, error)
- func (c *Client) ModifyMFSIP(sipID string, sipParams MFSIPModifyParams) (MFSIPResponse, error)
- func (c *Client) ModifyOrder(variety string, orderID string, orderParams OrderParams) (OrderResponse, error)
- func (c *Client) PlaceGTT(o GTTParams) (GTTResponse, error)
- func (c *Client) PlaceMFOrder(orderParams MFOrderParams) (MFOrderResponse, error)
- func (c *Client) PlaceMFSIP(sipParams MFSIPParams) (MFSIPResponse, error)
- func (c *Client) PlaceOrder(variety string, orderParams OrderParams) (OrderResponse, error)
- func (c *Client) SetAccessToken(accessToken string)
- func (c *Client) SetBaseURI(baseURI string)
- func (c *Client) SetDebug(debug bool)
- func (c *Client) SetHTTPClient(h *http.Client)
- func (c *Client) SetTimeout(timeout time.Duration)
- type ConvertPositionParams
- type Error
- type GTT
- type GTTCondition
- type GTTMeta
- type GTTOneCancelsOtherTrigger
- type GTTParams
- type GTTResponse
- type GTTSingleLegTrigger
- type GTTType
- type GTTs
- type GetBasketParams
- type GetMarginParams
- type HTTPClient
- type HTTPResponse
- type HistoricalData
- type Holding
- type Holdings
- type Instrument
- type Instruments
- type MFAllottedISINs
- type MFHolding
- type MFHoldingBreakdown
- type MFHoldings
- type MFInstrument
- type MFInstruments
- type MFOrder
- type MFOrderParams
- type MFOrderResponse
- type MFOrders
- type MFSIP
- type MFSIPModifyParams
- type MFSIPParams
- type MFSIPResponse
- type MFSIPStepUp
- type MFSIPs
- type MFTrade
- type Margins
- type Order
- type OrderMarginParam
- type OrderMargins
- type OrderParams
- type OrderResponse
- type Orders
- type PNL
- type PlainResponse
- type Position
- type Positions
- type Quote
- type QuoteLTP
- type QuoteOHLC
- type Trade
- type Trades
- type Trigger
- type TriggerParams
- type UsedMargins
- type UserMeta
- type UserProfile
- type UserSession
- type UserSessionTokens
Constants ¶
const ( // Varieties VarietyRegular = "regular" VarietyAMO = "amo" VarietyBO = "bo" VarietyCO = "co" VarietyIceberg = "iceberg" // Products ProductBO = "BO" ProductCO = "CO" ProductMIS = "MIS" ProductCNC = "CNC" ProductNRML = "NRML" // Order types OrderTypeMarket = "MARKET" OrderTypeLimit = "LIMIT" OrderTypeSL = "SL" OrderTypeSLM = "SL-M" // Validities ValidityDay = "DAY" ValidityIOC = "IOC" ValidityTTL = "TTL" // Position Type PositionTypeDay = "day" PositionTypeOvernight = "overnight" // Transaction type TransactionTypeBuy = "BUY" TransactionTypeSell = "SELL" // Exchanges ExchangeNSE = "NSE" ExchangeBSE = "BSE" ExchangeMCX = "MCX" ExchangeNFO = "NFO" ExchangeBFO = "BFO" ExchangeCDS = "CDS" ExchangeBCD = "BCD" // Margins segments MarginsEquity = "equity" MarginsCommodity = "commodity" // Order status OrderStatusComplete = "COMPLETE" OrderStatusRejected = "REJECTED" OrderStatusCancelled = "CANCELLED" )
Useful public constants
const ( URIUserSession string = "/session/token" URIUserSessionInvalidate string = "/session/token" URIUserSessionRenew string = "/session/refresh_token" URIUserProfile string = "/user/profile" URIUserMargins string = "/user/margins" URIUserMarginsSegment string = "/user/margins/%s" // "/user/margins/{segment}" URIGetOrders string = "/orders" URIGetTrades string = "/trades" URIGetOrderHistory string = "/orders/%s" // "/orders/{order_id}" URIGetOrderTrades string = "/orders/%s/trades" // "/orders/{order_id}/trades" URIPlaceOrder string = "/orders/%s" // "/orders/{variety}" URIModifyOrder string = "/orders/%s/%s" // "/orders/{variety}/{order_id}" URICancelOrder string = "/orders/%s/%s" // "/orders/{variety}/{order_id}" URIGetPositions string = "/portfolio/positions" URIGetHoldings string = "/portfolio/holdings" URIInitHoldingsAuth string = "/portfolio/holdings/authorise" URIConvertPosition string = "/portfolio/positions" URIOrderMargins string = "/margins/orders" URIBasketMargins string = "/margins/basket" // MF endpoints URIGetMFOrders string = "/mf/orders" URIGetMFOrderInfo string = "/mf/orders/%s" // "/mf/orders/{order_id}" URIPlaceMFOrder string = "/mf/orders" URICancelMFOrder string = "/mf/orders/%s" // "/mf/orders/{order_id}" URIGetMFSIPs string = "/mf/sips" URIGetMFSIPInfo string = "/mf/sips/%s" // "/mf/sips/{sip_id}" URIPlaceMFSIP string = "/mf/sips" URIModifyMFSIP string = "/mf/sips/%s" // "/mf/sips/{sip_id}" URICancelMFSIP string = "/mf/sips/%s" // "/mf/sips/{sip_id}" URIGetMFHoldings string = "/mf/holdings" URIGetMFHoldingInfo string = "/mf/holdings/%s" // "/mf/holdings/{isin}" URIGetAllotedISINs string = "/mf/allotments" // GTT endpoints URIPlaceGTT string = "/gtt/triggers" URIGetGTTs string = "/gtt/triggers" URIGetGTT string = "/gtt/triggers/%d" URIModifyGTT string = "/gtt/triggers/%d" URIDeleteGTT string = "/gtt/triggers/%d" URIGetInstruments string = "/instruments" URIGetMFInstruments string = "/mf/instruments" URIGetInstrumentsExchange string = "/instruments/%s" // "/instruments/{exchange}" URIGetHistorical string = "/instruments/historical/%d/%s" // "/instruments/historical/{instrument_token}/{interval}" URIGetTriggerRange string = "/instruments/%s/%s/trigger_range" // "/instruments/{exchange}/{tradingsymbol}/trigger_range" URIGetQuote string = "/quote" URIGetLTP string = "/quote/ltp" URIGetOHLC string = "/quote/ohlc" )
API endpoints
const ( GeneralError = "GeneralException" TokenError = "TokenException" PermissionError = "PermissionError" UserError = "UserException" TwoFAError = "TwoFAException" OrderError = "OrderException" InputError = "InputException" DataError = "DataException" NetworkError = "NetworkException" )
API errors. Check documantation to learn about individual exception: https://kite.trade/docs/connect/v3/exceptions/.
Variables ¶
This section is empty.
Functions ¶
func GetErrorName ¶
GetErrorName returns an error name given an HTTP code.
Types ¶
type AllMargins ¶
AllMargins contains both equity and commodity margins.
type AvailableMargins ¶
type AvailableMargins struct { AdHocMargin float64 `json:"adhoc_margin"` Cash float64 `json:"cash"` Collateral float64 `json:"collateral"` IntradayPayin float64 `json:"intraday_payin"` LiveBalance float64 `json:"live_balance"` OpeningBalance float64 `json:"opening_balance"` }
AvailableMargins represents the available margins from the margins response for a single segment.
type Bank ¶
type Bank struct { Name string `json:"name"` Branch string `json:"branch"` Account string `json:"account"` }
Bank represents the details of a single bank account entry on a user's file.
type BasketMargins ¶
type BasketMargins struct { Initial OrderMargins `json:"initial"` Final OrderMargins `json:"final"` Orders []OrderMargins `json:"orders"` }
BasketMargins represents response from the Margin Calculator API for Basket orders
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents interface for Kite Connect client.
func (*Client) CancelMFOrder ¶
func (c *Client) CancelMFOrder(orderID string) (MFOrderResponse, error)
CancelMFOrder cancels an mutualfund order.
func (*Client) CancelMFSIP ¶
func (c *Client) CancelMFSIP(sipID string) (MFSIPResponse, error)
CancelMFSIP cancels an mutualfund SIP.
func (*Client) CancelOrder ¶
func (c *Client) CancelOrder(variety string, orderID string, parentOrderID *string) (OrderResponse, error)
CancelOrder cancels/exits an order.
func (*Client) ConvertPosition ¶
func (c *Client) ConvertPosition(positionParams ConvertPositionParams) (bool, error)
ConvertPosition converts postion's product type.
func (*Client) DeleteGTT ¶
func (c *Client) DeleteGTT(triggerID int) (GTTResponse, error)
DeleteGTT deletes a GTT order.
func (*Client) ExitOrder ¶
func (c *Client) ExitOrder(variety string, orderID string, parentOrderID *string) (OrderResponse, error)
ExitOrder is an alias for CancelOrder which is used to cancel/exit an order.
func (*Client) GetBasketMargins ¶
func (c *Client) GetBasketMargins(baskparam GetBasketParams) (BasketMargins, error)
func (*Client) GetHistoricalData ¶
func (c *Client) GetHistoricalData(instrumentToken int, interval string, fromDate time.Time, toDate time.Time, continuous bool, OI bool) ([]HistoricalData, error)
GetHistoricalData gets list of historical data.
func (*Client) GetHoldings ¶
GetHoldings gets a list of holdings.
func (*Client) GetInstruments ¶
func (c *Client) GetInstruments() (Instruments, error)
GetInstruments retrives list of instruments.
func (*Client) GetInstrumentsByExchange ¶
func (c *Client) GetInstrumentsByExchange(exchange string) (Instruments, error)
GetInstrumentsByExchange retrives list of instruments for a given exchange.
func (*Client) GetLTP ¶
GetLTP gets map of LTP quotes for given instruments in the format of `exchange:tradingsymbol`.
func (*Client) GetMFAllottedISINs ¶
func (c *Client) GetMFAllottedISINs() (MFAllottedISINs, error)
GetMFAllottedISINs gets list of user mutualfund holdings.
func (*Client) GetMFHoldingInfo ¶
func (c *Client) GetMFHoldingInfo(isin string) (MFHoldingBreakdown, error)
GetMFHoldingInfo get individual Holding info.
func (*Client) GetMFHoldings ¶
func (c *Client) GetMFHoldings() (MFHoldings, error)
GetMFHoldings gets list of user mutualfund holdings.
func (*Client) GetMFInstruments ¶
func (c *Client) GetMFInstruments() (MFInstruments, error)
GetMFInstruments retrives list of mutualfund instruments.
func (*Client) GetMFOrderInfo ¶
GetMFOrderInfo get individual mutualfund order info.
func (*Client) GetMFOrders ¶
GetMFOrders gets list of mutualfund orders.
func (*Client) GetMFOrdersByDate ¶
GetMFOrdersByDate gets list of mutualfund orders for a custom date range.
func (*Client) GetMFSIPInfo ¶
GetMFSIPInfo get individual SIP info.
func (*Client) GetOHLC ¶
GetOHLC gets map of OHLC quotes for given instruments in the format of `exchange:tradingsymbol`.
func (*Client) GetOrderHistory ¶
GetOrderHistory gets history of an individual order.
func (*Client) GetOrderMargins ¶
func (c *Client) GetOrderMargins(marparam GetMarginParams) ([]OrderMargins, error)
func (*Client) GetOrderTrades ¶
GetOrderTrades gets list of trades executed for a particular order.
func (*Client) GetPositions ¶
GetPositions gets user positions.
func (*Client) GetQuote ¶
GetQuote gets map of quotes for given instruments in the format of `exchange:tradingsymbol`.
func (*Client) GetUserMargins ¶
func (c *Client) GetUserMargins() (AllMargins, error)
GetUserMargins gets all user margins.
func (*Client) GetUserProfile ¶
func (c *Client) GetUserProfile() (UserProfile, error)
GetUserProfile gets user profile.
func (*Client) GetUserSegmentMargins ¶
GetUserSegmentMargins gets segmentwise user margins.
func (*Client) ModifyGTT ¶
func (c *Client) ModifyGTT(triggerID int, o GTTParams) (GTTResponse, error)
ModifyGTT modifies the condition or orders inside an already created GTT order.
func (*Client) ModifyMFSIP ¶
func (c *Client) ModifyMFSIP(sipID string, sipParams MFSIPModifyParams) (MFSIPResponse, error)
ModifyMFSIP modifies an mutualfund SIP.
func (*Client) ModifyOrder ¶
func (c *Client) ModifyOrder(variety string, orderID string, orderParams OrderParams) (OrderResponse, error)
ModifyOrder modifies an order.
func (*Client) PlaceGTT ¶
func (c *Client) PlaceGTT(o GTTParams) (GTTResponse, error)
PlaceGTT constructs and places a GTT order using GTTParams.
func (*Client) PlaceMFOrder ¶
func (c *Client) PlaceMFOrder(orderParams MFOrderParams) (MFOrderResponse, error)
PlaceMFOrder places an mutualfund order.
func (*Client) PlaceMFSIP ¶
func (c *Client) PlaceMFSIP(sipParams MFSIPParams) (MFSIPResponse, error)
PlaceMFSIP places an mutualfund SIP order.
func (*Client) PlaceOrder ¶
func (c *Client) PlaceOrder(variety string, orderParams OrderParams) (OrderResponse, error)
PlaceOrder places an order.
func (*Client) SetAccessToken ¶
SetAccessToken sets the access token to the Kite Connect instance.
func (*Client) SetBaseURI ¶
SetBaseURI overrides the base Kiteconnect API endpoint with custom url.
func (*Client) SetHTTPClient ¶
SetHTTPClient overrides default http handler with a custom one. This can be used to set custom timeouts and transport.
func (*Client) SetTimeout ¶
SetTimeout sets request timeout for default http client.
type ConvertPositionParams ¶
type ConvertPositionParams struct { Exchange string `url:"exchange"` TradingSymbol string `url:"tradingsymbol"` OldProduct string `url:"old_product"` NewProduct string `url:"new_product"` PositionType string `url:"position_type"` TransactionType string `url:"transaction_type"` Quantity int `url:"quantity"` }
ConvertPositionParams represents the input params for a position conversion.
type GTT ¶
type GTT struct { ID int `json:"id"` UserID string `json:"user_id"` Type GTTType `json:"type" url:""` CreatedAt models.Time `json:"created_at"` UpdatedAt models.Time `json:"updated_at"` ExpiresAt models.Time `json:"expires_at"` Status string `json:"status"` Condition GTTCondition `json:"condition"` Orders []Order `json:"orders"` Meta GTTMeta `json:"meta"` }
GTT represents a single GTT order.
type GTTCondition ¶
type GTTCondition struct { Exchange string `json:"exchange"` Tradingsymbol string `json:"tradingsymbol"` LastPrice float64 `json:"last_price"` TriggerValues []float64 `json:"trigger_values"` }
GTTCondition represents the condition inside a GTT order.
type GTTMeta ¶
type GTTMeta struct {
RejectionReason string `json:"rejection_reason"`
}
GTTMeta contains information about the rejection reason received after GTT order was triggered.
type GTTOneCancelsOtherTrigger ¶
type GTTOneCancelsOtherTrigger struct { Upper TriggerParams Lower TriggerParams }
GTTOneCancelsOtherTrigger implements Trigger interface for the GTTOneCancelsOtherTrigger.
func (*GTTOneCancelsOtherTrigger) LimitPrices ¶
func (t *GTTOneCancelsOtherTrigger) LimitPrices() []float64
LimitPrices -
func (*GTTOneCancelsOtherTrigger) Quantities ¶
func (t *GTTOneCancelsOtherTrigger) Quantities() []float64
Quantities -
func (*GTTOneCancelsOtherTrigger) TriggerValues ¶
func (t *GTTOneCancelsOtherTrigger) TriggerValues() []float64
TriggerValues -
type GTTParams ¶
type GTTParams struct { Tradingsymbol string Exchange string LastPrice float64 TransactionType string Trigger Trigger }
GTTParams is a helper struct used to populate an actual GTT before sending it to the API.
type GTTResponse ¶
type GTTResponse struct {
TriggerID int `json:"trigger_id"`
}
GTTResponse is returned by the API calls to GTT API.
type GTTSingleLegTrigger ¶
type GTTSingleLegTrigger struct {
TriggerParams
}
GTTSingleLegTrigger implements Trigger interface for the SingleLegTrigger.
func (*GTTSingleLegTrigger) LimitPrices ¶
func (t *GTTSingleLegTrigger) LimitPrices() []float64
LimitPrices - limit prices
func (*GTTSingleLegTrigger) Quantities ¶
func (t *GTTSingleLegTrigger) Quantities() []float64
Quantities - Quantities
func (*GTTSingleLegTrigger) TriggerValues ¶
func (t *GTTSingleLegTrigger) TriggerValues() []float64
TriggerValues - trigger values
type GetBasketParams ¶
type GetBasketParams struct { OrderParams []OrderMarginParam Compact bool ConsiderPositions bool }
type GetMarginParams ¶
type GetMarginParams struct { OrderParams []OrderMarginParam Compact bool }
type HTTPClient ¶
type HTTPClient interface { Do(method, rURL string, params url.Values, headers http.Header) (HTTPResponse, error) DoRaw(method, rURL string, reqBody []byte, headers http.Header) (HTTPResponse, error) DoEnvelope(method, url string, params url.Values, headers http.Header, obj interface{}) error DoJSON(method, url string, params url.Values, headers http.Header, obj interface{}) (HTTPResponse, error) GetClient() *httpClient }
HTTPClient represents an HTTP client.
func NewHTTPClient ¶
NewHTTPClient returns a self-contained HTTP request object with underlying keep-alive transport.
type HTTPResponse ¶
HTTPResponse encompasses byte body + the response of an HTTP request.
type HistoricalData ¶
type HistoricalData struct { Date models.Time `json:"date"` Open float64 `json:"open"` High float64 `json:"high"` Low float64 `json:"low"` Close float64 `json:"close"` Volume int `json:"volume"` OI int `json:"oi"` }
HistoricalData represents individual historical data response.
type Holding ¶
type Holding struct { Tradingsymbol string `json:"tradingsymbol"` Exchange string `json:"exchange"` InstrumentToken uint32 `json:"instrument_token"` ISIN string `json:"isin"` Product string `json:"product"` Price float64 `json:"price"` UsedQuantity int `json:"used_quantity"` Quantity int `json:"quantity"` T1Quantity int `json:"t1_quantity"` RealisedQuantity int `json:"realised_quantity"` AuthorisedQuantity int `json:"authorised_quantity"` AuthorisedDate models.Time `json:"authorised_date"` OpeningQuantity int `json:"opening_quantity"` CollateralQuantity int `json:"collateral_quantity"` CollateralType string `json:"collateral_type"` Discrepancy bool `json:"discrepancy"` AveragePrice float64 `json:"average_price"` LastPrice float64 `json:"last_price"` ClosePrice float64 `json:"close_price"` PnL float64 `json:"pnl"` DayChange float64 `json:"day_change"` DayChangePercentage float64 `json:"day_change_percentage"` }
Holding - Holding is an individual holdings response.
type Instrument ¶
type Instrument struct { InstrumentToken int `csv:"instrument_token"` ExchangeToken int `csv:"exchange_token"` Tradingsymbol string `csv:"tradingsymbol"` Name string `csv:"name"` LastPrice float64 `csv:"last_price"` Expiry models.Time `csv:"expiry"` StrikePrice float64 `csv:"strike"` TickSize float64 `csv:"tick_size"` LotSize float64 `csv:"lot_size"` InstrumentType string `csv:"instrument_type"` Segment string `csv:"segment"` Exchange string `csv:"exchange"` }
Instrument represents individual instrument response.
type MFAllottedISINs ¶
type MFAllottedISINs []string
MFAllottedISINs represents a list of all ISINs in which atleast one allotment is present.
type MFHolding ¶
type MFHolding struct { Folio string `json:"folio"` Fund string `json:"fund"` Tradingsymbol string `json:"tradingsymbol"` AveragePrice float64 `json:"average_price"` LastPrice float64 `json:"last_price"` LastPriceDate string `json:"last_price_date"` Pnl float64 `json:"pnl"` Quantity float64 `json:"quantity"` }
MFHolding represents a individual mutualfund holding.
type MFHoldingBreakdown ¶
type MFHoldingBreakdown []MFTrade
MFHoldingBreakdown represents a list of mutualfund holdings.
type MFInstrument ¶
type MFInstrument struct { Tradingsymbol string `csv:"tradingsymbol"` Name string `csv:"name"` LastPrice float64 `csv:"last_price"` AMC string `csv:"amc"` PurchaseAllowed bool `csv:"purchase_allowed"` RedemtpionAllowed bool `csv:"redemption_allowed"` MinimumPurchaseAmount float64 `csv:"minimum_purchase_amount"` PurchaseAmountMultiplier float64 `csv:"purchase_amount_multiplier"` MinimumAdditionalPurchaseAmount float64 `csv:"additional_purchase_multiple"` MinimumRedemptionQuantity float64 `csv:"minimum_redemption_quantity"` RedemptionQuantityMultiplier float64 `csv:"redemption_quantity_multiplier"` DividendType string `csv:"dividend_type"` SchemeType string `csv:"scheme_type"` Plan string `csv:"plan"` SettlementType string `csv:"settlement_type"` LastPriceDate models.Time `csv:"last_price_date"` }
MFInstrument represents individual mutualfund instrument response.
type MFInstruments ¶
type MFInstruments []MFInstrument
MFInstruments represents list of mutualfund instruments.
type MFOrder ¶
type MFOrder struct { OrderID string `json:"order_id"` ExchangeOrderID string `json:"exchange_order_id"` Tradingsymbol string `json:"tradingsymbol"` Status string `json:"status"` StatusMessage string `json:"status_message"` Folio string `json:"folio"` Fund string `json:"fund"` OrderTimestamp models.Time `json:"order_timestamp"` ExchangeTimestamp models.Time `json:"exchange_timestamp"` SettlementID string `json:"settlement_id"` TransactionType string `json:"transaction_type"` Variety string `json:"variety"` PurchaseType string `json:"purchase_type"` Quantity float64 `json:"quantity"` Amount float64 `json:"amount"` LastPrice float64 `json:"last_price"` AveragePrice float64 `json:"average_price"` PlacedBy string `json:"placed_by"` Tag string `json:"tag"` }
MFOrder represents a individual mutualfund order response.
type MFOrderParams ¶
type MFOrderParams struct { Tradingsymbol string `json:"tradingsymbol" url:"tradingsymbol"` TransactionType string `json:"transaction_type" url:"transaction_type"` Quantity float64 `json:"quantity" url:"quantity,omitempty"` Amount float64 `json:"amount" url:"amount,omitempty"` Tag string `json:"tag" url:"tag,omitempty"` }
MFOrderParams represents parameters for placing an order.
type MFOrderResponse ¶
type MFOrderResponse struct {
OrderID string `json:"order_id"`
}
MFOrderResponse represents the successful order place response.
type MFSIP ¶
type MFSIP struct { ID string `json:"sip_id"` Tradingsymbol string `json:"tradingsymbol"` FundName string `json:"fund"` DividendType string `json:"dividend_type"` TransactionType string `json:"transaction_type"` Status string `json:"status"` SipType string `json:"sip_type"` Created models.Time `json:"created"` Frequency string `json:"frequency"` InstalmentAmount float64 `json:"instalment_amount"` Instalments int `json:"instalments"` LastInstalment models.Time `json:"last_instalment"` PendingInstalments int `json:"pending_instalments"` InstalmentDay int `json:"instalment_day"` CompletedInstalments int `json:"completed_instalments"` NextInstalment string `json:"next_instalment"` TriggerPrice float64 `json:"trigger_price"` StepUp MFSIPStepUp `json:"step_up"` Tag string `json:"tag"` }
MFSIP represents a individual mutualfund SIP response.
type MFSIPModifyParams ¶
type MFSIPModifyParams struct { Amount float64 `json:"amount" url:"amount,omitempty"` Frequency string `json:"frequency" url:"frequency,omitempty"` InstalmentDay int `json:"instalment_day" url:"instalment_day,omitempty"` Instalments int `json:"instalments" url:"instalments,omitempty"` StepUp string `json:"step_up" url:"step_up,omitempty"` Status string `json:"status" url:"status,omitempty"` }
MFSIPModifyParams represents parameters for modifying a SIP.
type MFSIPParams ¶
type MFSIPParams struct { Tradingsymbol string `json:"tradingsymbol" url:"tradingsymbol"` Amount float64 `json:"amount" url:"amount"` Instalments int `json:"instalments" url:"instalments"` Frequency string `json:"frequency" url:"frequency"` InstalmentDay int `json:"instalment_day" url:"instalment_day,omitempty"` InitialAmount float64 `json:"initial_amount" url:"initial_amount,omitempty"` TriggerPrice float64 `json:"trigger_price" url:"trigger_price,omitempty"` StepUp string `json:"step_up" url:"step_up,omitempty"` SipType string `json:"sip_type" url:"sip_type,omitempty"` Tag string `json:"tag" url:"tag,omitempty"` }
MFSIPParams represents parameters for placing a SIP.
type MFSIPResponse ¶
MFSIPResponse represents the successful SIP place response.
type MFSIPStepUp ¶
MFSIPStepUp represents stepup date and percentage for SIPs.
type MFTrade ¶
type MFTrade struct { Fund string `json:"fund"` Tradingsymbol string `json:"tradingsymbol"` AveragePrice float64 `json:"average_price"` Variety string `json:"variety"` ExchangeTimestamp models.Time `json:"exchange_timestamp"` Amount float64 `json:"amount"` Folio string `json:"folio"` Quantity float64 `json:"quantity"` }
MFTrade represents a individual trades of a mutualfund holding.
type Margins ¶
type Margins struct { Category string `json:"-"` Enabled bool `json:"enabled"` Net float64 `json:"net"` Available AvailableMargins `json:"available"` Used UsedMargins `json:"utilised"` }
Margins represents the user margins for a segment.
type Order ¶
type Order struct { AccountID string `json:"account_id"` PlacedBy string `json:"placed_by"` OrderID string `json:"order_id"` ExchangeOrderID string `json:"exchange_order_id"` ParentOrderID string `json:"parent_order_id"` Status string `json:"status"` StatusMessage string `json:"status_message"` StatusMessageRaw string `json:"status_message_raw"` OrderTimestamp models.Time `json:"order_timestamp"` ExchangeUpdateTimestamp models.Time `json:"exchange_update_timestamp"` ExchangeTimestamp models.Time `json:"exchange_timestamp"` Variety string `json:"variety"` Meta map[string]interface{} `json:"meta"` Exchange string `json:"exchange"` TradingSymbol string `json:"tradingsymbol"` InstrumentToken uint32 `json:"instrument_token"` OrderType string `json:"order_type"` TransactionType string `json:"transaction_type"` Validity string `json:"validity"` ValidityTTL int `json:"validity_ttl"` Product string `json:"product"` Quantity float64 `json:"quantity"` DisclosedQuantity float64 `json:"disclosed_quantity"` Price float64 `json:"price"` TriggerPrice float64 `json:"trigger_price"` AveragePrice float64 `json:"average_price"` FilledQuantity float64 `json:"filled_quantity"` PendingQuantity float64 `json:"pending_quantity"` CancelledQuantity float64 `json:"cancelled_quantity"` Tag string `json:"tag"` Tags []string `json:"tags"` }
Order represents a individual order response.
type OrderMarginParam ¶
type OrderMarginParam struct { Exchange string `json:"exchange"` Tradingsymbol string `json:"tradingsymbol"` TransactionType string `json:"transaction_type"` Variety string `json:"variety"` Product string `json:"product"` OrderType string `json:"order_type"` Quantity float64 `json:"quantity"` Price float64 `json:"price,omitempty"` TriggerPrice float64 `json:"trigger_price,omitempty"` }
OrderMarginParam represents an order in the Margin Calculator API
type OrderMargins ¶
type OrderMargins struct { Type string `json:"type"` TradingSymbol string `json:"tradingsymbol"` Exchange string `json:"exchange"` SPAN float64 `json:"span"` Exposure float64 `json:"exposure"` OptionPremium float64 `json:"option_premium"` Additional float64 `json:"additional"` BO float64 `json:"bo"` Cash float64 `json:"cash"` VAR float64 `json:"var"` PNL PNL `json:"pnl"` Total float64 `json:"total"` }
OrdersMargins represents response from the Margin Calculator API.
type OrderParams ¶
type OrderParams struct { Exchange string `url:"exchange,omitempty"` Tradingsymbol string `url:"tradingsymbol,omitempty"` Validity string `url:"validity,omitempty"` ValidityTTL int `url:"validity_ttl,omitempty"` Product string `url:"product,omitempty"` OrderType string `url:"order_type,omitempty"` TransactionType string `url:"transaction_type,omitempty"` Quantity int `url:"quantity,omitempty"` DisclosedQuantity int `url:"disclosed_quantity,omitempty"` Price float64 `url:"price,omitempty"` TriggerPrice float64 `url:"trigger_price,omitempty"` Squareoff float64 `url:"squareoff,omitempty"` Stoploss float64 `url:"stoploss,omitempty"` TrailingStoploss float64 `url:"trailing_stoploss,omitempty"` IcebergLegs int `url:"iceberg_legs,omitempty"` IcebergQty int `url:"iceberg_quantity,omitempty"` Tag string `json:"tag" url:"tag,omitempty"` }
OrderParams represents parameters for placing an order.
type OrderResponse ¶
type OrderResponse struct {
OrderID string `json:"order_id"`
}
OrderResponse represents the order place success response.
type PlainResponse ¶
PlainResponse is a helper for receiving blank HTTP envelop responses without any payloads.
type Position ¶
type Position struct { Tradingsymbol string `json:"tradingsymbol"` Exchange string `json:"exchange"` InstrumentToken uint32 `json:"instrument_token"` Product string `json:"product"` Quantity int `json:"quantity"` OvernightQuantity int `json:"overnight_quantity"` Multiplier float64 `json:"multiplier"` AveragePrice float64 `json:"average_price"` ClosePrice float64 `json:"close_price"` LastPrice float64 `json:"last_price"` Value float64 `json:"value"` PnL float64 `json:"pnl"` M2M float64 `json:"m2m"` Unrealised float64 `json:"unrealised"` Realised float64 `json:"realised"` BuyQuantity int `json:"buy_quantity"` BuyPrice float64 `json:"buy_price"` BuyValue float64 `json:"buy_value"` BuyM2MValue float64 `json:"buy_m2m"` SellQuantity int `json:"sell_quantity"` SellPrice float64 `json:"sell_price"` SellValue float64 `json:"sell_value"` SellM2MValue float64 `json:"sell_m2m"` DayBuyQuantity int `json:"day_buy_quantity"` DayBuyPrice float64 `json:"day_buy_price"` DayBuyValue float64 `json:"day_buy_value"` DaySellQuantity int `json:"day_sell_quantity"` DaySellPrice float64 `json:"day_sell_price"` DaySellValue float64 `json:"day_sell_value"` }
Position represents an individual position response.
type Quote ¶
type Quote map[string]struct { InstrumentToken int `json:"instrument_token"` Timestamp models.Time `json:"timestamp"` LastPrice float64 `json:"last_price"` LastQuantity int `json:"last_quantity"` LastTradeTime models.Time `json:"last_trade_time"` AveragePrice float64 `json:"average_price"` Volume int `json:"volume"` BuyQuantity int `json:"buy_quantity"` SellQuantity int `json:"sell_quantity"` OHLC models.OHLC `json:"ohlc"` NetChange float64 `json:"net_change"` OI float64 `json:"oi"` OIDayHigh float64 `json:"oi_day_high"` OIDayLow float64 `json:"oi_day_low"` LowerCircuitLimit float64 `json:"lower_circuit_limit"` UpperCircuitLimit float64 `json:"upper_circuit_limit"` Depth models.Depth `json:"depth"` }
Quote represents the full quote response.
type QuoteLTP ¶
type QuoteLTP map[string]struct { InstrumentToken int `json:"instrument_token"` LastPrice float64 `json:"last_price"` }
QuoteLTP represents last price quote response.
type QuoteOHLC ¶
type QuoteOHLC map[string]struct { InstrumentToken int `json:"instrument_token"` LastPrice float64 `json:"last_price"` OHLC models.OHLC `json:"ohlc"` }
QuoteOHLC represents OHLC quote response.
type Trade ¶
type Trade struct { AveragePrice float64 `json:"average_price"` Quantity float64 `json:"quantity"` TradeID string `json:"trade_id"` Product string `json:"product"` FillTimestamp models.Time `json:"fill_timestamp"` ExchangeTimestamp models.Time `json:"exchange_timestamp"` ExchangeOrderID string `json:"exchange_order_id"` OrderID string `json:"order_id"` TransactionType string `json:"transaction_type"` TradingSymbol string `json:"tradingsymbol"` Exchange string `json:"exchange"` InstrumentToken uint32 `json:"instrument_token"` }
Trade represents an individual trade response.
type Trigger ¶
type Trigger interface { TriggerValues() []float64 LimitPrices() []float64 Quantities() []float64 Type() GTTType }
Trigger is an abstraction over multiple GTT types.
type TriggerParams ¶
TriggerParams -
type UsedMargins ¶
type UsedMargins struct { Debits float64 `json:"debits"` Exposure float64 `json:"exposure"` M2MRealised float64 `json:"m2m_realised"` M2MUnrealised float64 `json:"m2m_unrealised"` OptionPremium float64 `json:"option_premium"` Payout float64 `json:"payout"` Span float64 `json:"span"` HoldingSales float64 `json:"holding_sales"` Turnover float64 `json:"turnover"` LiquidCollateral float64 `json:"liquid_collateral"` StockCollateral float64 `json:"stock_collateral"` Delivery float64 `json:"delivery"` }
UsedMargins represents the used margins from the margins response for a single segment.
type UserMeta ¶
type UserMeta struct {
DematConsent string `json:"demat_consent"`
}
UserMeta contains meta data of the user.
type UserProfile ¶
type UserProfile struct { UserID string `json:"user_id"` UserName string `json:"user_name"` UserShortName string `json:"user_shortname"` AvatarURL string `json:"avatar_url"` UserType string `json:"user_type"` Email string `json:"email"` Broker string `json:"broker"` Meta UserMeta `json:"meta"` Products []string `json:"products"` OrderTypes []string `json:"order_types"` Exchanges []string `json:"exchanges"` }
UserProfile represents a user's personal and financial profile.
type UserSession ¶
type UserSession struct { UserProfile UserSessionTokens UserID string `json:"user_id"` APIKey string `json:"api_key"` PublicToken string `json:"public_token"` LoginTime models.Time `json:"login_time"` }
UserSession represents the response after a successful authentication.
type UserSessionTokens ¶
type UserSessionTokens struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` }
UserSessionTokens represents response after renew access token.