Documentation
¶
Index ¶
- Constants
- func GetErrorName(code int) string
- func InitializeVortexApi(applicationId string, apiKey string, apiClient *VortexApi) error
- func InitializeWire(accessToken string, wire *Wire) error
- func NewError(etype string, message string, data interface{}) error
- type AlertCondition
- type AlertInfo
- type AlertProperty
- type BankDetails
- type BanksResponse
- type BasketMarginOrder
- type BasketMarginRequest
- type BasketMarginResponse
- type CancelIcebergOrderResponse
- type ConvertPositionRequest
- type ConvertPositionResponse
- type DateOptionData
- type Error
- type ExchangeAuthTokenRequest
- type ExchangeBankDetails
- type ExchangeDetail
- type ExchangeDetails
- type ExchangeFundResponse
- type ExchangeTypes
- type FullQuoteData
- type FundDetails
- type FundResponse
- type FundWithdrawalCancelRequest
- type FundWithdrawalItem
- type FundWithdrawalListResponse
- type FundWithdrawalRequest
- type FundsResponse
- type Greeks
- type GttInfo
- type GttInfoOrder
- type GttLegs
- type GttOrderResponse
- type GttOrderResponseOrders
- type GttOrderStatus
- type GttOrderbookResponse
- type GttTriggerType
- type HTTPClient
- type HTTPResponse
- type HistoricalResponse
- type Holding
- type HoldingsResponse
- type IcebergOrderData
- type IcebergOrderResponse
- type InstrumentName
- type LegStockGreek
- type LoginResponse
- type LogoutResponse
- type LtpQuoteData
- type MarginModes
- type MarginResponse
- type MarketDepthResponse
- type Metadata
- type ModifyGttRequest
- type ModifyIcebergOrderRequest
- type ModifyOrderRequest
- type MultipleOrderCancelRequest
- type MultipleOrderResponse
- type NetDayPositions
- type OhlcvQuoteData
- type OptionChainRequest
- type OptionChainResponse
- type OptionType
- type OptionchainResult
- type Order
- type OrderBookGttInfo
- type OrderBookIcebergInfo
- type OrderBookResponse
- type OrderHistory
- type OrderHistoryResponse
- type OrderMarginRequest
- type OrderResponse
- type OrderStatus
- type PayOff
- type PayOffData
- type PayoffAction
- type PayoffOption
- type PayoffRequest
- type PayoffResponse
- type PlaceGttLegRequest
- type PlaceGttRequest
- type PlaceIcebergOrderRequest
- type PlaceOrderRequest
- type PositionItem
- type PositionResponse
- type PredictionType
- type ProductTypes
- type QuoteDepth
- type QuoteEntry
- type QuoteModes
- type QuoteResponse
- type Resolutions
- type SocketMessage
- type SocketMessageData
- type StockWithGreek
- type StrategiesRequest
- type StrategiesResponse
- type StrategiesResult
- type Strategy
- type StrategyBuilderRequest
- type StrategyLeg
- type StrategyStock
- type TagInfo
- type TagRequest
- type TagResponse
- type TagsResponse
- type Trade
- type TradeBookResponse
- type TradingOpportunity
- type Trail
- type TrailJumpType
- type TransactionTypes
- type UserData
- type ValidityTypes
- type VarietyTypes
- type VortexApi
- func (v *VortexApi) Banks(ctx context.Context) (*BanksResponse, error)
- func (v *VortexApi) BasketMargin(ctx context.Context, request *BasketMarginRequest) (*BasketMarginResponse, error)
- func (v *VortexApi) BuildStrategy(ctx context.Context, req StrategyBuilderRequest) (*StrategiesResponse, error)
- func (v *VortexApi) CancelGttOrder(ctx context.Context, gtt_order_id string) (*OrderResponse, error)
- func (v *VortexApi) CancelIcebergOrder(ctx context.Context, iceberg_order_id string) (*CancelIcebergOrderResponse, error)
- func (v *VortexApi) CancelMultipleRegularOrders(ctx context.Context, req MultipleOrderCancelRequest) (*MultipleOrderResponse, error)
- func (v *VortexApi) CancelOrder(ctx context.Context, orderID string) (*OrderResponse, error)
- func (v *VortexApi) ConvertPosition(ctx context.Context, req ConvertPositionRequest) (*ConvertPositionResponse, error)
- func (v *VortexApi) CreateTag(ctx context.Context, request TagRequest) (*TagResponse, error)
- func (v *VortexApi) DeleteTag(ctx context.Context, tag_id int) (*TagResponse, error)
- func (v *VortexApi) DownloadMaster(ctx context.Context) ([]map[string]string, error)
- func (v *VortexApi) ExchangeToken(ctx context.Context, auth_token string) (*LoginResponse, error)
- func (v *VortexApi) Funds(ctx context.Context) (*FundsResponse, error)
- func (v *VortexApi) GetLoginUrl() string
- func (v *VortexApi) GetOptionChain(ctx context.Context, req OptionChainRequest) (*OptionChainResponse, error)
- func (v *VortexApi) GetPayoff(ctx context.Context, req PayoffRequest) (*PayoffResponse, error)
- func (v *VortexApi) GetStrategies(ctx context.Context, req StrategiesRequest) (*StrategiesResponse, error)
- func (v *VortexApi) GttOrders(ctx context.Context) (*GttOrderbookResponse, error)
- func (v *VortexApi) HistoricalCandles(ctx context.Context, exchange ExchangeTypes, token int, from time.Time, ...) (*HistoricalResponse, error)
- func (v *VortexApi) Holdings(ctx context.Context) (*HoldingsResponse, error)
- func (v *VortexApi) Login(ctx context.Context, clientCode string, password string, totp string) (*LoginResponse, error)
- func (v *VortexApi) Logout(ctx context.Context) (*LogoutResponse, error)
- func (v *VortexApi) ModifyGttOrder(ctx context.Context, gtt_order_id string, request ModifyGttRequest) (*OrderResponse, error)
- func (v *VortexApi) ModifyIcebergOrder(ctx context.Context, iceberg_order_id string, ...) (*IcebergOrderResponse, error)
- func (v *VortexApi) ModifyOrder(ctx context.Context, request ModifyOrderRequest, exchange ExchangeTypes, ...) (*OrderResponse, error)
- func (v *VortexApi) OrderHistory(ctx context.Context, orderId string) (*OrderHistoryResponse, error)
- func (v *VortexApi) OrderMargin(ctx context.Context, request *OrderMarginRequest) (*MarginResponse, error)
- func (v *VortexApi) Orders(ctx context.Context) (*OrderBookResponse, error)
- func (v *VortexApi) PlaceGttOrder(ctx context.Context, request PlaceGttRequest) (*OrderResponse, error)
- func (v *VortexApi) PlaceIcebergOrder(ctx context.Context, request PlaceIcebergOrderRequest) (*IcebergOrderResponse, error)
- func (v *VortexApi) PlaceOrder(ctx context.Context, request PlaceOrderRequest) (*OrderResponse, error)
- func (v *VortexApi) Positions(ctx context.Context) (*PositionResponse, error)
- func (v *VortexApi) Quotes(ctx context.Context, instruments []string, mode QuoteModes) (*QuoteResponse, error)
- func (v *VortexApi) SSOLogin(ctx context.Context, callback_param string) (string, error)
- func (v *VortexApi) SetAccessToken(accessToken string)
- func (v *VortexApi) SetHTTPClient(h *http.Client)
- func (v *VortexApi) SetLogging(flag bool)
- func (v *VortexApi) Tags(ctx context.Context) (*TagsResponse, error)
- func (v *VortexApi) Trades(ctx context.Context, offset int, limit int) (*TradeBookResponse, error)
- func (v *VortexApi) UpdateTag(ctx context.Context, tag_id int, request TagRequest) (*TagResponse, error)
- type Wire
- func (t *Wire) Close() error
- func (t *Wire) OnClose(f func(code int, reason string))
- func (t *Wire) OnConnect(f func())
- func (t *Wire) OnError(f func(err error))
- func (t *Wire) OnMessage(f func(messageType int, message []byte))
- func (t *Wire) OnNoReconnect(f func(attempt int))
- func (t *Wire) OnOrderUpdate(f func(order SocketMessage))
- func (t *Wire) OnPriceUpdate(f func(*FullQuoteData))
- func (t *Wire) OnReconnect(f func(attempt int, delay time.Duration))
- func (t *Wire) Resubscribe()
- func (t *Wire) Serve()
- func (t *Wire) ServeWithContext(ctx context.Context)
- func (t *Wire) SetAccessToken(accessToken string)
- func (t *Wire) SetAutoReconnect(val bool)
- func (t *Wire) SetConnectTimeout(val time.Duration)
- func (t *Wire) SetReconnectMaxDelay(val time.Duration) error
- func (t *Wire) SetReconnectMaxRetries(val int)
- func (t *Wire) SetRootURL(u url.URL)
- func (t *Wire) Stop()
- func (t *Wire) Subscribe(exchange ExchangeTypes, token int, mode QuoteModes)
- func (t *Wire) Unsubscribe(exchange ExchangeTypes, token int, mode QuoteModes)
Constants ¶
const ( URILogin string = "/user/login" URISession string = "/user/session" URIInstruments string = "/data/instruments" URIPlaceOrder string = "/trading/orders/%s" //"/trading/orders/regular" URIModifyOrder string = "/trading/orders/%s/%s" //"/trading/orders/{{order_type}}/{order_id}" URIModifyOrderTags string = "/trading/orders/%s/%s/tags" //"/trading/orders/{{order_type}}/{order_id}/tags" URIDeleteOrder string = "/trading/orders/%s/%s" //"/trading/orders/{{order_type}}/{order_id}" URIDeleteMultipleOrder string = "/trading/orders/%s/multi_delete" //"/trading/orders/{{order_type}}/{order_id}" URIGttOrderBook string = "/trading/orders/gtt" //"/trading/orders/gtt" URIOrderBook string = "/trading/orders" //"/trading/orders" URIMultiCancelrders string = "/trading/orders/regular/multi_delete" //"/trading/orders/regular/multi_delete" URIOrderHistory string = "/trading/orders/%s" //"/trading/orders/{order_id}" URITrades string = "/trading/trades" URIPositions string = "/trading/portfolio/positions" URIConvertposition string = "/trading/portfolio/positions" URIHoldings string = "/trading/portfolio/holdings" URIFunds string = "/user/funds" URIBanks string = "/user/profile/banks" URIBrokerage string = "/user/profile/brokerage" URIWithdrawal string = "/user/funds/withdrawal" URIOrderMargin string = "/margins/order" URIBasketMargin string = "/margins/basket" URIQuotes string = "/data/quote" URIHistory string = "/data/history" URIOptionChain string = "/strategies/option_chain" URIStrategies string = "/strategies" URIBuildStrategies string = "/strategies/build" URIPayoffStrategies string = "/strategies/payoff" URITradeReport string = "/reports/trades/%s?from_date=%s&to_date=%s" URITurnoverSummaryReport string = "/reports/turnover/summary/%s?from_date=%s&to_date=%s" URITurnoverDetailsReport string = "/reports/turnover/details/%s?from_date=%s&to_date=%s" URIPnLReport string = "/reports/pnl/%s?from_date=%s&to_date=%s" URIMTFInterestReport string = "/reports/mtf_interest/%s?from_date=%s&to_date=%s" URITags string = "/reports/tags" URITag string = "/reports/tags/%d" )
Constants for the API endpoints
const ( GeneralError = "GeneralException" TokenError = "TokenException" PermissionError = "PermissionError" UserError = "UserException" TwoFAError = "TwoFAException" OrderError = "OrderException" InputError = "InputException" DataError = "DataException" NetworkError = "NetworkException" NotFoundError = "NotFoundException" )
Variables ¶
This section is empty.
Functions ¶
func GetErrorName ¶
GetErrorName returns an error name given an HTTP code.
func InitializeVortexApi ¶
Function to get a new instance of VortexApi Client.
func InitializeWire ¶
Default method to create a new instance of Wire which can be used to get price updates and order updates
Types ¶
type AlertCondition ¶
type AlertCondition string
const ( AlertConditionLE AlertCondition = "LE" AlertConditionGE AlertCondition = "GE" AlertConditionEQ AlertCondition = "EQ" )
type AlertInfo ¶
type AlertInfo struct {
Name string `json:"name"`
ClientCode string `json:"client_code"`
Token int `json:"token"`
Exchange ExchangeTypes `json:"exchange"`
TriggerValue float64 `json:"trigger_value"`
Property AlertProperty `json:"property"`
Condition AlertCondition `json:"condition"`
Status string `json:"status" `
Note string `json:"note"`
Expiry time.Time `json:"expiry"`
LastExecutedAt time.Time `json:"last_executed_at"`
IsExecuted *bool `json:"is_executed"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type AlertProperty ¶
type AlertProperty string
const ( AlertPropertyLTP AlertProperty = "LTP" AlertPropertyVOLUME AlertProperty = "VOLUME" AlertPropertyAVGPRICE AlertProperty = "AVGPRICE" )
type BankDetails ¶
type BanksResponse ¶
type BanksResponse struct {
Status string `json:"status"`
Data ExchangeBankDetails `json:"data"`
}
type BasketMarginOrder ¶
type BasketMarginOrder struct {
Exchange ExchangeTypes `json:"exchange"` // Required: Exchange type.
Token int `json:"token"` // Required: Token of the underlying instrument.
TransactionType TransactionTypes `json:"transaction_type"` // Required: Type of transaction.
Product ProductTypes `json:"product"` // Required: Type of product.
Variety VarietyTypes `json:"variety"` // Required: Type of variety.
Quantity int `json:"quantity"` // Required: Quantity of the order.
Price float64 `json:"price"` // Required: Price of the order.
}
type BasketMarginRequest ¶
type BasketMarginRequest struct {
Orders []BasketMarginOrder `json:"orders"`
}
type BasketMarginResponse ¶
type ConvertPositionRequest ¶
type ConvertPositionRequest struct {
Exchange ExchangeTypes `json:"exchange"` // Required: Exchange type.
Token int `json:"token"` // Required: Token of the underlying instrument.
TransactionType TransactionTypes `json:"transaction_type"` // Required: Type of transaction.
Quantity int `json:"quantity"` // Required: Quantity of the position to convert.
OldProductType ProductTypes `json:"old_product"` // Required: Old product type of the position.
NewProductType ProductTypes `json:"new_product"` // Required: New product type to convert the position to.
}
ConvertPositionRequest represents a request to convert a position.
type ConvertPositionResponse ¶
type DateOptionData ¶
type DateOptionData struct {
StrikePrice float64 `json:"strike_price"`
IV float64 `json:"iv"`
Theta float64 `json:"theta"`
Vega float64 `json:"vega"`
Gamma float64 `json:"gamma"`
CE StockWithGreek `json:"CE"`
PE StockWithGreek `json:"PE"`
}
type ExchangeBankDetails ¶
type ExchangeBankDetails struct {
Nse []BankDetails `json:"nse"`
Mcx []BankDetails `json:"mcx"`
}
type ExchangeDetail ¶
type ExchangeDetail struct {
Token int `json:"token"`
Exchange ExchangeTypes `json:"exchange"`
Symbol string `json:"symbol"`
}
type ExchangeDetails ¶
type ExchangeFundResponse ¶
type ExchangeFundResponse struct {
Deposit float64 `json:"deposit"`
FundsTransferred float64 `json:"funds_transferred"`
Collateral float64 `json:"collateral"`
CreditForSale float64 `json:"credit_for_sale"`
OptionCreditForSale float64 `json:"option_credit_for_sale"`
LimitUtilization float64 `json:"limit_utilization"`
MtmAndBookedLoss float64 `json:"mtm_and_booked_loss"`
BookedProfit float64 `json:"booked_profit"`
TotalTradingPower float64 `json:"total_trading_power"`
TotalUtilization float64 `json:"total_utilization"`
NetAvailable float64 `json:"net_available"`
FundsWithdrawal float64 `json:"funds_withdrawal"`
}
type ExchangeTypes ¶
type ExchangeTypes string
const ( ExchangeTypesNSEFO ExchangeTypes = "NSE_FO" ExchangeTypesBSEFO ExchangeTypes = "BSE_FO" ExchangeTypesBSEEQUITY ExchangeTypes = "BSE_EQ" ExchangeTypesNSEEQUITY ExchangeTypes = "NSE_EQ" ExchangeTypesNSECURRENCY ExchangeTypes = "NSE_CD" ExchangeTypesMCX ExchangeTypes = "MCX_FO" )
type FullQuoteData ¶
type FullQuoteData struct {
Exchange string `json:"exchange"`
Token int `json:"token"`
LastTradeTime int `json:"last_trade_time"`
LastUpdateTime int `json:"last_update_time"`
LastTradePrice float64 `json:"last_trade_price"`
Volume int `json:"volume"`
AverageTradePrice float64 `json:"average_trade_price"`
TotalBuyQuantity int64 `json:"total_buy_quantity"`
TotalSellQuantity int64 `json:"total_sell_quantity"`
OpenInterest int `json:"open_interest"`
OpenPrice float64 `json:"open_price"`
HighPrice float64 `json:"high_price"`
LowPrice float64 `json:"low_price"`
ClosePrice float64 `json:"close_price"`
LastTradeQuantity int `json:"last_trade_quantity"`
Depth *QuoteDepth `json:"depth"`
DPRHigh float64 `json:"dpr_high"`
DPRLow float64 `json:"dpr_low"`
}
type FundDetails ¶
type FundDetails struct {
Deposit float64 `json:"deposit"`
FundsTransferred float64 `json:"funds_transferred"`
Collateral float64 `json:"collateral"`
CreditForSale float64 `json:"credit_for_sale"`
OptionCreditForSale float64 `json:"option_credit_for_sale"`
LimitUtilization float64 `json:"limit_utilization"`
FundsWithdrawn float64 `json:"funds_withdrawn"`
MtmAndBookedLoss float64 `json:"mtm_and_booked_loss"`
BookedProfit float64 `json:"booked_profit"`
TotalTradingPower float64 `json:"total_trading_power"`
TotalUtilization float64 `json:"total_utilization"`
NetAvailable float64 `json:"net_available"`
}
type FundResponse ¶
type FundResponse struct {
Nse ExchangeFundResponse `json:"nse"`
Mcx ExchangeFundResponse `json:"mcx"`
}
type FundWithdrawalCancelRequest ¶
type FundWithdrawalCancelRequest struct {
TransactionId string `json:"transaction_id"` // Required: Transaction ID.
Exchange ExchangeTypes `json:"exchange"` // Required: Exchange type.
Amount float64 `json:"amount"` // Required: Amount of the withdrawal.
}
FundWithdrawalCancelRequest represents a request to cancel a fund withdrawal.
type FundWithdrawalItem ¶
type FundWithdrawalListResponse ¶
type FundWithdrawalListResponse struct {
Status string `json:"status"`
Message string `json:"message,omitempty"`
Data []FundWithdrawalItem `json:"data"`
}
type FundWithdrawalRequest ¶
type FundWithdrawalRequest struct {
BankAccountNumber string `json:"bank_account_number"` // Required: Bank account number.
Ifsc string `json:"ifsc"` // Required: IFSC code.
Amount float64 `json:"amount"` // Required: Amount to withdraw.
Exchange ExchangeTypes `json:"exchange"` // Required: Exchange type.
}
FundWithdrawalRequest represents a request to withdraw funds.
type FundsResponse ¶
type FundsResponse struct {
NSE FundDetails `json:"nse"`
MCX FundDetails `json:"mcx"`
}
type GttInfo ¶
type GttInfo struct {
Id string `json:"id"`
Token int `json:"token"`
Exchange ExchangeTypes `json:"exchange"`
Symbol string `json:"symbol"`
StrikePrice float64 `json:"strike_price"`
InstrumentName string `json:"instrument_name"`
ExpiryDate string `json:"expiry_date"`
OptionType OptionType `json:"option_type"`
LotSize int `json:"lot_size"`
TriggerType GttTriggerType `json:"trigger_type"`
TransactionType TransactionTypes `json:"transaction_type"`
TagIds pq.Int32Array `json:"tag_ids"`
OrderIdentifier string `json:"order_identifier"`
Orders []GttInfoOrder `json:"orders"`
}
type GttInfoOrder ¶
type GttInfoOrder struct {
Id uint `json:"id"`
Product ProductTypes `json:"product"`
Variety VarietyTypes `json:"variety"`
Price *float64 `json:"price"`
TriggerPrice *float64 `json:"trigger_price"`
Quantity int `json:"quantity"`
Status GttOrderStatus `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
TrigerredAt time.Time `json:"trigerred_at"`
}
type GttLegs ¶
type GttLegs struct {
SlTriggerPercent *float64 `json:"sl_trigger_percent"` // Optional: Stop loss trigger percentage.
ProfitTriggerPercent *float64 `json:"profit_trigger_percent"` // Optional: Profit trigger percentage.
SlVariety *VarietyTypes `json:"sl_variety"`
ProfitVariety *VarietyTypes `json:"profit_variety"`
TrailJumpPoint *float64 `json:"trail_jump_point"`
TrailJumpType *TrailJumpType `json:"trail_jump_type"`
}
GttLegs represents legs of a Good 'til Triggered (GTT) order.
type GttOrderResponse ¶
type GttOrderResponse struct {
Id string `json:"id"`
Token int `json:"token" binding:"required"`
Exchange ExchangeTypes `json:"exchange" binding:"required"`
Symbol string `json:"symbol" binding:"required"`
Series string `json:"series" binding:"required"`
InstrumentName InstrumentName `json:"instrument_name" binding:"required"`
ExpiryDate string `json:"expiry_date" binding:"required"`
StrikePrice float64 `json:"strike_price" binding:"required"`
OptionType OptionType `json:"option_type" binding:"required"`
LotSize int `json:"lot_size" binding:"required"`
TriggerType GttTriggerType `json:"trigger_type" binding:"required"`
TransactionType TransactionTypes `json:"transaction_type" binding:"required"`
TagIds pq.Int32Array `json:"tag_ids"`
Product ProductTypes `json:"product"`
ParentMiddlewareId *uint `json:"parent_middleware_id"`
Orders []GttOrderResponseOrders `json:"orders" binding:"required"`
}
type GttOrderResponseOrders ¶
type GttOrderResponseOrders struct {
Id uint `json:"id"`
ProductType ProductTypes `json:"product"`
Variety VarietyTypes `json:"variety"`
TransactionType TransactionTypes `json:"transaction_type"`
Price float64 `json:"price"`
TriggerPrice float64 `json:"trigger_price"`
Quantity int `json:"quantity"`
Status GttOrderStatus `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
TrigerredAt time.Time `json:"trigerred_at"`
}
type GttOrderStatus ¶
type GttOrderStatus string
const ( GttOrderStatusTriggered GttOrderStatus = "triggered" GttOrderStatusActive GttOrderStatus = "active" GttOrderStatusCancelled GttOrderStatus = "cancelled" GttOrderStatusExpired GttOrderStatus = "expired" GttOrderStatusCompleted GttOrderStatus = "completed" )
type GttOrderbookResponse ¶
type GttOrderbookResponse struct {
Status string `json:"status"`
Data []*GttOrderResponse `json:"data"`
}
type GttTriggerType ¶
type GttTriggerType string
GttTriggerType represents the trigger type for a Good 'til Triggered (GTT) order.
const ( GttTriggerTypeSingle GttTriggerType = "single" // Single trigger type. GttTriggerTypeOCO GttTriggerType = "oco" // One Cancels the Other (OCO) trigger type. )
type HTTPClient ¶
type HTTPClient interface {
GetClient() *httpClient
// contains filtered or unexported methods
}
HTTPClient defines the interface for performing HTTP requests.
func NewHTTPClient ¶
NewHTTPClient creates a new instance of the httpClient with the given HTTP client, logger, and debug flag. If the logger is nil, it uses a default logger that writes to os.Stdout. If the HTTP client is nil, it uses a default client with a 5-second timeout and default transport settings.
type HTTPResponse ¶
HTTPResponse contains the response body and the HTTP response object.
type HistoricalResponse ¶
type Holding ¶
type Holding struct {
ISIN string `json:"isin"`
NSE *ExchangeDetail `json:"nse,omitempty"`
BSE *ExchangeDetail `json:"bse,omitempty"`
TotalFree int `json:"total_free"`
DPFree int `json:"dp_free"`
PoolFree int `json:"pool_free"`
T1Quantity int `json:"t1_quantity"`
AveragePrice float64 `json:"average_price"`
LastPrice float64 `json:"last_price"`
Product string `json:"product"`
CollateralQuantity int `json:"collateral_quantity"`
CollateralValue float64 `json:"collateral_value"`
}
type HoldingsResponse ¶
type IcebergOrderData ¶
type IcebergOrderResponse ¶
type IcebergOrderResponse struct {
Message string `json:"message"`
Code string `json:"code"`
Status string `json:"status"`
Data IcebergOrderData `json:"data"`
}
type InstrumentName ¶
type InstrumentName string
const ( InstrumentNameEqIndex InstrumentName = "EQIDX" InstrumentNameCom InstrumentName = "COM" InstrumentNameEquities InstrumentName = "EQUITIES" InstrumentNameCommodityFuture InstrumentName = "FUTCOM" InstrumentNameCurrencyFuture InstrumentName = "FUTCUR" InstrumentNameIndexFuture InstrumentName = "FUTIDX" InstrumentNameInterestFuture InstrumentName = "FUTIRC" InstrumentNameInterestFutureT InstrumentName = "FUTIRT" InstrumentNameStockFuture InstrumentName = "FUTSTK" InstrumentNameCurrencyOption InstrumentName = "OPTCUR" InstrumentNameCommodityOption InstrumentName = "OPTFUT" InstrumentNameIndexOption InstrumentName = "OPTIDX" InstrumentNameInterestOption InstrumentName = "OPTIRC" InstrumentNameStockOption InstrumentName = "OPTSTK" InstrumentNameCurrentcyUnderlying InstrumentName = "UNDCUR" )
type LegStockGreek ¶
type LegStockGreek struct {
Token int `json:"token" binding:"required"`
StrikePrice float64 `json:"strike_price"`
OptionType OptionType `json:"option_type"`
ExpYYYYMMDD string `json:"expiry_date"`
Action string `json:"action"`
LotSize int `json:"lot_size"`
Quantity int `json:"quantity"`
Ltp float64 `json:"last_trade_price"` // Update
Iv float64 `json:"iv"` // Update *hide
Greeks Greeks `json:"greeks" gorm:"-"`
}
type LoginResponse ¶
type LogoutResponse ¶
type LtpQuoteData ¶
type MarginModes ¶
type MarginModes string
const ( MarginModeNew MarginModes = "NEW" MarginModeMODIFY MarginModes = "MODIFY" )
type MarginResponse ¶
type MarketDepthResponse ¶
type MarketDepthResponse struct {
Status string `json:"status"`
Data QuoteDepth `json:"data"`
}
type ModifyGttRequest ¶
type ModifyGttRequest struct {
Id uint `json:"id"` // Required: Identifier of the GTT order to modify.
TriggerPrice *float64 `json:"trigger_price"` // Required: New trigger price for the GTT order.
Price *float64 `json:"price"` // Required: New price for the GTT order.
Quantity *int `json:"quantity"` // Required: New quantity for the GTT order.
Variety ValidityTypes `json:"variety"` // Required: Type of variety. Accepted values: [RL,RL-MKT].
Trail *Trail `json:"trail"` // Optional: Trail information for the GTT order.
}
ModifyGttRequest represents a request to modify a Good 'til Triggered (GTT) order.
type ModifyIcebergOrderRequest ¶
type ModifyIcebergOrderRequest struct {
Price float64 `json:"price"` // Required: Price of the order.
TriggerPrice float64 `json:"trigger_price"` // Required: Trigger price for the order.
TradedQuantity int `json:"traded_quantity"` // Required: Quantity already traded.
}
ModifyIcebergOrderRequest represents a request to modify an Iceberg order.
type ModifyOrderRequest ¶
type ModifyOrderRequest struct {
Variety VarietyTypes `json:"variety" ` // Required: Type of variety.
Quantity int `json:"quantity" ` // Required: Quantity of the order.
TradedQuantity *int `json:"traded_quantity" ` // Required: Quantity which has already been traded according to you. This is important..
Price float64 `json:"price" ` // Optional if market order. Price of the order.
TriggerPrice float64 `json:"trigger_price"` // Optional if not stoploss order. Trigger price for the order.
DisclosedQuantity int `json:"disclosed_quantity"` // Optional: Disclosed quantity for the order.
Validity ValidityTypes `json:"validity" ` // Required: Validity type for the order.
ValidityDays int `json:"validity_days"` // Optional: Number of validity days.
TagIds []int `json:"tag_ids"` // Optional: IDs of tags associated with the order.
}
type MultipleOrderCancelRequest ¶
type MultipleOrderCancelRequest struct {
OrderIds []string `json:"order_ids"`
}
type MultipleOrderResponse ¶
type MultipleOrderResponse struct {
Status string `json:"status"`
Data []OrderResponse `json:"data"`
}
type NetDayPositions ¶
type NetDayPositions struct {
Net []PositionItem `json:"net"`
Day []PositionItem `json:"day"`
}
type OhlcvQuoteData ¶
type OhlcvQuoteData struct {
Exchange string `json:"exchange"`
Token int `json:"token"`
LastTradePrice float64 `json:"last_trade_price"`
LastTradeTime int `json:"last_trade_time"`
Volume int `json:"volume"`
OpenPrice float64 `json:"open_price"`
HighPrice float64 `json:"high_price"`
LowPrice float64 `json:"low_price"`
ClosePrice float64 `json:"close_price"`
}
type OptionChainRequest ¶
type OptionChainRequest struct {
Token int `json:"token"` // Required: Token of the underlying instrument.
ExpiryDate string `json:"expiry_date"` // Optional: Expiry date of options in format YYYYMMDD. If not provided, the result will be of the closest expiry.
Exchange ExchangeTypes `json:"exchange"` // Required: Exchange type.
AddGreek bool `json:"greeks"` // Optional: Include Greeks in the result. Default is false.
}
OptionChainRequest represents a request to retrieve an option chain.
type OptionChainResponse ¶
type OptionChainResponse struct {
Status string `json:"status"`
Message string `json:"message"`
Response OptionchainResult `json:"response"`
}
type OptionType ¶
type OptionType string
const ( OptionTypeCall OptionType = "CE" OptionTypePut OptionType = "PE" )
type OptionchainResult ¶
type OptionchainResult struct {
Symbol string `json:"symbol"`
ExpiryDate string `json:"expiry_date"`
HasParentStock bool `json:"has_parent_stock"`
ExpiryDates []string `json:"expiry_dates"`
Options struct {
Exchange ExchangeTypes `json:"exchange"`
List []*DateOptionData `json:"list"`
} `json:"options"`
ParentStock struct {
Symbol string `json:"symbol"`
Exchange ExchangeTypes `json:"exchange"`
Token int `json:"token"`
ISINCode string `json:"isin"`
LTP float64 `json:"ltp"`
} `json:"parent"`
}
type Order ¶
type Order struct {
OrderID string `json:"order_id"`
Exchange ExchangeTypes `json:"exchange"`
Token int `json:"token"`
OrderNumber string `json:"order_number"`
Status string `json:"status"`
ErrorReason string `json:"error_reason"`
TransactionType TransactionTypes `json:"transaction_type"`
Product ProductTypes `json:"product"`
Variety VarietyTypes `json:"variety"`
TotalQuantity int `json:"total_quantity"`
PendingQuantity int `json:"pending_quantity"`
TradedQuantity int `json:"traded_quantity"`
DisclosedQuantity int `json:"disclosed_quantity"`
DisclosedQuantityRemaining int `json:"disclosed_quantity_remaining"`
OrderPrice float64 `json:"order_price"`
TriggerPrice float64 `json:"trigger_price"`
TradedPrice float64 `json:"traded_price,omitempty"`
Validity ValidityTypes `json:"validity"`
Symbol string `json:"symbol"`
Series string `json:"series"`
InstrumentName InstrumentName `json:"instrument_name"`
ExpiryDate string `json:"expiry_date"`
StrikePrice float64 `json:"strike_price"`
OptionType OptionType `json:"option_type"`
LotSize int `json:"lot_size"`
OrderCreatedAt string `json:"order_created_at"`
InitiatedBy string `json:"initiated_by"`
ModifiedBy string `json:"modified_by"`
IsAMO bool `json:"is_amo"`
OrderIdentifier string `json:"order_identifier"`
TagsIds pq.Int32Array `json:"tags_ids"`
MiddlewareOrderId uint `json:"middleware_order_id"`
Iceberg *OrderBookIcebergInfo `json:"iceberg,omitempty"`
Gtt *OrderBookGttInfo `json:"gtt,omitempty"`
}
type OrderBookGttInfo ¶
type OrderBookGttInfo struct {
TriggerType GttTriggerType `json:"trigger_type"`
SlTriggerPercent *float64 `json:"sl_trigger_percent,omitempty"`
ProfitTriggerPercent *float64 `json:"profit_trigger_percent,omitempty"`
}
type OrderBookIcebergInfo ¶
type OrderBookResponse ¶
type OrderHistory ¶
type OrderHistory struct {
OrderID string `json:"order_id"`
Exchange ExchangeTypes `json:"exchange"`
Token int `json:"token"`
OrderNumber string `json:"order_number"`
Status string `json:"status"`
ErrorReason string `json:"error_reason"`
TransactionType TransactionTypes `json:"transaction_type"`
Product ProductTypes `json:"product"`
Variety VarietyTypes `json:"variety"`
TotalQuantity int `json:"total_quantity"`
PendingQuantity int `json:"pending_quantity"`
TradedQuantity int `json:"traded_quantity"`
DisclosedQuantity int `json:"disclosed_quantity"`
OrderPrice float64 `json:"order_price"`
TriggerPrice float64 `json:"trigger_price"`
Validity ValidityTypes `json:"validity"`
ValidityDays int `json:"validity_days"`
Symbol string `json:"symbol"`
Series string `json:"series"`
InstrumentName InstrumentName `json:"instrument_name"`
ExpiryDate string `json:"expiry_date"`
StrikePrice float64 `json:"strike_price"`
OptionType OptionType `json:"option_type"`
OrderCreatedAt string `json:"order_created_at"`
ExchangeOrderCreatedAt string `json:"exchange_order_created_at"`
InitiatedBy string `json:"initiated_by"`
ModifiedBy string `json:"modified_by"`
IsAMO bool `json:"is_amo"`
OrderIdentifier string `json:"order_identifier"`
}
type OrderHistoryResponse ¶
type OrderHistoryResponse struct {
Status string `json:"status"`
Code string `json:"code"`
Message string `json:"message"`
Data []OrderHistory `json:"orders"`
Metadata Metadata `json:"metadata"`
}
type OrderMarginRequest ¶
type OrderMarginRequest struct {
Exchange ExchangeTypes `json:"exchange"` // Required: Exchange type.
Token int `json:"token"` // Required: Token of the underlying instrument.
TransactionType TransactionTypes `json:"transaction_type"` // Required: Type of transaction.
Product ProductTypes `json:"product"` // Required: Type of product.
Variety VarietyTypes `json:"variety"` // Required: Type of variety.
Quantity int `json:"quantity"` // Required: Quantity of the order.
Price float64 `json:"price"` // Required: Price of the order.
OldPrice float64 `json:"old_price"` // Required: Old price of the order.
OldQuantity int `json:"old_quantity"` // Required: Old quantity of the order.
Mode MarginModes `json:"mode"` // Required: Mode of margin calculation.
}
OrderMarginRequest represents a request to calculate margin for an order.
type OrderResponse ¶
type OrderStatus ¶
type OrderStatus string
const ( OrderStatusPending OrderStatus = "PENDING" OrderStausMiddlewarePending OrderStatus = "middleware_pending" OrderStatusMiddlewareRejected OrderStatus = "middleware_rejected" OrderStatusRejected OrderStatus = "REJECTED" OrderStatusCancelled OrderStatus = "CANCELLED" OrderStatusCompleted OrderStatus = "COMPLETED" )
type PayOffData ¶
type PayOffData struct {
MaxLoss float64 `json:"max_loss"`
MaxProfit float64 `json:"max_profit"`
IsInfiniteProfit bool `json:"infinite_profit"`
IsInfiniteLoss bool `json:"infinite_loss"`
BreakEvens []float64 `json:"breakevens"`
PayOffs []PayOff `json:"payoffs"`
CombinedGreeks Greeks `json:"combined_greeks"`
LivePrice float64 `json:"last_trade_price"`
LegStocks []LegStockGreek `json:"leg_greeks"`
MinDaysToExpiry int `json:"min_days_to_expiry"`
}
type PayoffAction ¶
type PayoffAction string
const ( PayoffActionBUY PayoffAction = "BUY" PayoffActionSELL PayoffAction = "SELL" )
PayoffAction represents the action for a trading strategy.
type PayoffOption ¶
type PayoffOption struct {
Token int `json:"token"` // Required: Token of the underlying instrument.
Action PayoffAction `json:"action"` // Required: Action for the option.
Quantity int `json:"quantity"` // Required: Quantity of the option.
Ltp float64 `json:"last_trade_price"` // Optional: Last traded price for the option.
}
PayoffOption represents an option within a trading strategy.
type PayoffRequest ¶
type PayoffRequest struct {
Symbol string `json:"symbol" ` // Required: Symbol for the underlying asset.
Exchange ExchangeTypes `json:"exchange" ` // Required: Exchange type.
Legs []PayoffOption `json:"legs"` // Required: Legs of the trading strategy.
InpDaysToExpiry *int `json:"days_to_expiry"` // Optional: Number of days to expiry.
CurrentPnl float64 `json:"current_pnl"` // Optional: Current profit or loss.
}
PayoffRequest represents a request to calculate the payoff for a trading strategy.
type PayoffResponse ¶
type PayoffResponse struct {
Status string `json:"status"`
Message string `json:"message"`
Data PayOffData `json:"data"`
}
type PlaceGttLegRequest ¶
type PlaceGttLegRequest struct {
Quantity int `json:"quantity" binding:"required"`
Price *float64 `json:"price"`
TriggerPrice float64 `json:"trigger_price" binding:"required"`
ProductType ProductTypes `json:"product"`
Variety *VarietyTypes `json:"variety"`
Trail *Trail `json:"trail"`
}
PlaceGttLegRequest represents a leg of a Good 'til Triggered (GTT) order.
type PlaceGttRequest ¶
type PlaceGttRequest struct {
Exchange ExchangeTypes `json:"exchange"` // Required: Exchange type.
Token int `json:"token"` // Required: Token of the underlying instrument.
TransactionType TransactionTypes `json:"transaction_type"` // Required: Type of transaction.
Variety ValidityTypes `json:"variety"` // Optional: Type of variety. By default RL is considered. Accepted values: [RL,RL-MKT].
Quantity *int `json:"quantity"` // Required: Quantity of the order.
TriggerPrice *float64 `json:"trigger_price"` // Required: Trigger price for the order.
Price *float64 `json:"price"` // Required: Price of the order.
OrderIdentifier string `json:"order_identifier"` // Required: Identifier for the order.
GttTriggerType GttTriggerType `json:"gtt_trigger_type"` // Required: Type of GTT trigger.
Product ProductTypes `json:"product"` // Required: Type of product.
Stoploss *PlaceGttLegRequest `json:"stoploss"` // Optional: Stop loss leg of the GTT order.
Profit *PlaceGttLegRequest `json:"profit"` // Optional: Profit leg of the GTT order.
SingleTrailingSL *Trail `json:"single_trailing_sl"` // Optional: Use when GttTriggerType is single.
TagIds []int `json:"tag_ids"` // Required: IDs of tags associated with the order.
}
PlaceGttRequest represents a request to place a Good 'til Triggered (GTT) order.
type PlaceIcebergOrderRequest ¶
type PlaceIcebergOrderRequest struct {
Exchange ExchangeTypes `json:"exchange"` // Required: Exchange type.
Token int `json:"token"` // Required: Token of the underlying instrument.
TransactionType TransactionTypes `json:"transaction_type"` // Required: Type of transaction.
Product ProductTypes `json:"product"` // Required: Type of product.
Variety VarietyTypes `json:"variety"` // Required: Type of variety.
Quantity int `json:"quantity"` // Required: Quantity of the order.
Price *float64 `json:"price"` // Optional if market order. Price of the order.
TriggerPrice float64 `json:"trigger_price"` // Optional if not stoploss order. Trigger price for the order.
OrderIdentifier string `json:"order_identifier"` // Optional: Your identifier for the order.
Validity ValidityTypes `json:"validity"` // Required: Validity type for the order.
Legs int `json:"legs"` // Required: Number of legs for the order.
TagIds pq.Int32Array `json:"tag_ids"` // IDs of tags associated with the order.
}
PlaceIcebergOrderRequest represents a request to place an Iceberg order.
type PlaceOrderRequest ¶
type PlaceOrderRequest struct {
Exchange ExchangeTypes `json:"exchange"` // Required: Exchange type.
Token int `json:"token"` // Required: Token of the underlying instrument.
TransactionType TransactionTypes `json:"transaction_type"` // Required: Type of transaction.
Product ProductTypes `json:"product"` // Required: Type of product.
Variety VarietyTypes `json:"variety"` // Required: Type of variety.
Quantity int `json:"quantity"` // Required: Quantity of the order.
Price float64 `json:"price"` // Optional if market order. Price of the order.
TriggerPrice float64 `json:"trigger_price"` // Optional if not stoploss order. Trigger price for the order.
OrderIdentifier string `json:"order_identifier"` // Optional: Your identifier for the order.
DisclosedQuantity int `json:"disclosed_quantity"` // Optional: Disclosed quantity for the order.
Validity ValidityTypes `json:"validity"` // Required: Validity type for the order.
ValidityDays int `json:"validity_days"` // Optional: Number of validity days.
IsAMO bool `json:"is_amo"` // Optional: Flag indicating if the order is an after-market order.
Gtt *GttLegs `json:"gtt"` // Optional: Good 'til Triggered (GTT) legs.
TagIds []int `json:"tag_ids"` // Optional: IDs of tags associated with the order.
}
PlaceOrderRequest represents a request to place an order.
type PositionItem ¶
type PositionItem struct {
Exchange ExchangeTypes `json:"exchange"`
Symbol string `json:"symbol"`
ExpiryDate string `json:"expiry_date"`
OptionType OptionType `json:"option_type"`
StrikePrice float64 `json:"strike_price"`
Token int `json:"token"`
Product ProductTypes `json:"product"`
Quantity int `json:"quantity"`
OvernightBuyValue float64 `json:"overnight_buy_value"`
OvernightSellValue float64 `json:"overnight_sell_value"`
OvernightAveragePrice float64 `json:"overnight_average_price"`
LotSize int `json:"lot_size"`
Multiplier float64 `json:"multiplier"`
AveragePrice float64 `json:"average_price"`
Value float64 `json:"value"`
BuyValue float64 `json:"buy_value"`
SellValue float64 `json:"sell_value"`
BuyQuantity int `json:"buy_quantity"`
SellQuantity int `json:"sell_quantity"`
BuyPrice float64 `json:"buy_price"`
SellPrice float64 `json:"sell_price"`
}
type PositionResponse ¶
type PositionResponse struct {
Status string `json:"status"`
Data NetDayPositions `json:"data"`
}
type PredictionType ¶
type PredictionType string
PredictionType represents the type of prediction for a trading strategy.
const ( PredictionTypeABOVE PredictionType = "ABOVE" // Predict that the asset price will be above a certain level. PredictionTypeBELOW PredictionType = "BELOW" // Predict that the asset price will be below a certain level. PredictionTypeBETWEEN PredictionType = "BETWEEN" // Predict that the asset price will be within a certain range. )
type ProductTypes ¶
type ProductTypes string
const ( ProductTypesIntraday ProductTypes = "INTRADAY" ProductTypesDelivery ProductTypes = "DELIVERY" ProductTypesMTF ProductTypes = "MTF" )
type QuoteDepth ¶
type QuoteDepth struct {
Buy []QuoteEntry `json:"buy"`
Sell []QuoteEntry `json:"sell"`
}
type QuoteEntry ¶
type QuoteModes ¶
type QuoteModes string
const ( QuoteModesLTP QuoteModes = "ltp" QuoteModesFULL QuoteModes = "full" QuoteModesOHLCV QuoteModes = "ohlcv" )
type QuoteResponse ¶
type Resolutions ¶
type Resolutions string
const ( ResolutionsMin1 Resolutions = "1" ResolutionsMin2 Resolutions = "2" ResolutionsMin3 Resolutions = "3" ResolutionsMin4 Resolutions = "4" ResolutionsMin5 Resolutions = "5" ResolutionsMin10 Resolutions = "10" ResolutionsMin15 Resolutions = "15" ResolutionsMin30 Resolutions = "30" ResolutionsMin45 Resolutions = "45" ResolutionsMin60 Resolutions = "60" ResolutionsMin120 Resolutions = "120" ResolutionsMin180 Resolutions = "180" ResolutionsMin240 Resolutions = "240" ResolutionsDay Resolutions = "1D" ResolutionsWeek Resolutions = "1W" ResolutionsMonth Resolutions = "1M" )
const ( Min1 Resolutions = "1" Min2 Resolutions = "2" Min3 Resolutions = "3" Min4 Resolutions = "4" Min5 Resolutions = "5" Min10 Resolutions = "10" Min15 Resolutions = "15" Min30 Resolutions = "30" Min45 Resolutions = "45" Min60 Resolutions = "60" Min120 Resolutions = "120" Min180 Resolutions = "180" Min240 Resolutions = "240" Day1 Resolutions = "day" Week1 Resolutions = "week" Month1 Resolutions = "month" )
type SocketMessage ¶
type SocketMessage struct {
Type string `json:"type"`
Data *SocketMessageData `json:"data,omitempty"`
AlertInfo *AlertInfo `json:"alert_info,omitempty"`
Gtt *GttInfo `json:"gtt,omitempty"`
ClientCode string `json:"client_code,omitempty"`
}
type SocketMessageData ¶
type SocketMessageData struct {
OrderId string `json:"order_id"`
MiddlewareOrderId uint `json:"middleware_order_id"`
TriggersGtt bool `json:"triggers_gtt"`
OrderNumber string `json:"order_number"`
AmoOrderId string `json:"amo_order_id"`
PlacedBy string `json:"placed_by"`
ModifiedBy string `json:"modified_by"`
Status OrderStatus `json:"status"`
StatusMessage string `json:"status_message"`
Symbol string `json:"symbol"`
Series string `json:"series"`
InstrumentName string `json:"instrument_name"`
Token int `json:"token"`
Exchange ExchangeTypes `json:"exchange"`
ExpiryDate string `json:"expiry_date"`
StrikePrice float32 `json:"strike_price"`
OptionType string `json:"option_type"`
TransactionType TransactionTypes `json:"transaction_type"`
Validity ValidityTypes `json:"validity"`
ValidityDays int `json:"validity_days"`
Product ProductTypes `json:"product"` //Intraday, Delivery or MTF
Variety VarietyTypes `json:"variety"` //regular , SL , SL-MKT,amo etc
DisclosedQuantity int `json:"disclosed_quantity"`
DisclosedQuantityRemaining int `json:"disclosed_quantity_remaining"`
TotalQuantity int `json:"total_quantity"`
PendingQuantity int `json:"pending_quantity"`
TradedQuantity int `json:"traded_quantity"`
ThisTradeQuantity int `json:"this_trade_quantity,omitempty"`
MarketType string `json:"market_type"`
OrderPrice float32 `json:"order_price"`
TriggerPrice float32 `json:"trigger_price"`
CoverTriggerPrice float32 `json:"cover_trigger_price"`
TradedPrice float32 `json:"traded_price"`
IsAmo bool `json:"is_amo"`
OrderIdentifier string `json:"order_identifier"`
InternalRemarks string `json:"internal_remarks"`
OrderCreatedAt string `json:"order_created_at"`
OrderUpdatedAt string `json:"order_updated_at"`
TradeNumber string `json:"trade_number,omitempty"`
TradeTime string `json:"trade_time,omitempty"`
MarketSegmentId int `json:"market_segment_id"`
GtdOrderStatus OrderStatus `json:"gtd_order_status"`
SequenceNumber int `json:"sequence_number"`
}
type StockWithGreek ¶
type StockWithGreek struct {
Token int `json:"token"`
InstrumentName string `json:"instrument_name"`
LotSize int `json:"lot_size"`
SecurityDesc string `json:"security_description"`
Eligibility int `json:"eligibility"`
Ltp float64 `json:"ltp"`
OpenInterest int `json:"open_interest"`
DayFirstTickOI int `json:"day_first_tick_oi" `
Volume int `json:"volume"`
Delta float64 `json:"delta"`
}
type StrategiesRequest ¶
type StrategiesRequest struct {
Token int `json:"token"` // Required: Token for authentication.
Symbol string `json:"symbol"` // Required: Symbol for the underlying asset.
ExpYYYYMMDD string `json:"expiry_date"` // Required: Expiry date of the strategy in format YYYYMMDD.
}
StrategiesRequest represents a request to retrieve strategies.
type StrategiesResponse ¶
type StrategiesResponse struct {
Status string `json:"status"`
Message string `json:"message"`
Data StrategiesResult `json:"data"`
}
type StrategiesResult ¶
type Strategy ¶
type Strategy struct {
Name string `json:"strategy_name"`
TradingOpportunities []TradingOpportunity `json:"trading_opportunities"`
}
type StrategyBuilderRequest ¶
type StrategyBuilderRequest struct {
Token int `json:"token"` // Required: Token of the underlying instrument.
Symbol string `json:"symbol"` // Required: Symbol of the underlying instrument.
MarketView PredictionType `json:"prediction"` // Required: Prediction type. Should be one of ["ABOVE", "BELOW", "BETWEEN"]
ExpiryDate string `json:"expiry_date"` // Required: Expiry date of options in format: YYYYMMDD
PriceRange []float64 `json:"price_range"` // Price range for the strategy.
}
type StrategyLeg ¶
type StrategyLeg struct {
Option StrategyStock `json:"option"`
Action string `json:"action"`
Quantity int `json:"quantity"`
}
type StrategyStock ¶
type StrategyStock struct {
Token int `json:"token"`
InstrumentName string `json:"instrument_name"`
Symbol string `json:"symbol"`
StrikePrice float64 `json:"strike_price"`
OptionType OptionType `json:"option_type"`
LotSize int `json:"lot_size"`
SecurityDesc string `json:"security_description"`
Exchange ExchangeTypes `json:"exchange"`
ExpYyyymmdd string `json:"expiry_date"`
Ltp float64 `json:"ltp"`
Greeks struct {
Theta float64 `json:"theta"`
Delta float64 `json:"delta"`
Gamma float64 `json:"gamma"`
Vega float64 `json:"vega"`
Iv float64 `json:"iv"`
} `json:"greeks"`
}
type TagRequest ¶
type TagRequest struct {
Name string `json:"name"` // Name of the tag.
Description string `json:"description"` // Description of the tag.
}
TagRequest represents a request to create a tag.
type TagResponse ¶
type TagsResponse ¶
type Trade ¶
type Trade struct {
OrderID string `json:"order_id"`
Exchange ExchangeTypes `json:"exchange"`
Token int `json:"token"`
TradeNo string `json:"trade_no"`
ExchangeOrderNo string `json:"exchange_order_no"`
TransactionType TransactionTypes `json:"transaction_type"`
Product ProductTypes `json:"product"`
Variety VarietyTypes `json:"variety"`
TradeQuantity int `json:"trade_quantity"`
TradePrice float64 `json:"trade_price"`
Symbol string `json:"symbol"`
Series string `json:"series"`
InstrumentName string `json:"instrument_name"`
ExpiryDate string `json:"expiry_date"`
StrikePrice float64 `json:"strike_price"`
OptionType OptionType `json:"option_type"`
TradedAt string `json:"traded_at"`
InitiatedBy string `json:"initiated_by"`
ModifiedBy string `json:"modified_by"`
OrderIdentifier string `json:"order_identifier"`
}
type TradeBookResponse ¶
type TradingOpportunity ¶
type Trail ¶
type Trail struct {
ID uint `json:"id"`
TrailJumpPoint *float64 `json:"trail_jump_point"`
TrailJumpType *TrailJumpType `json:"trail_jump_type"`
TriggerTrail *float64 `json:"trigger_trail"` // This is only used for gtt order book not for accepting the value, we are using ltp as current trail while creating
TrailFirstJump *float64 `json:"trail_first_jump"`
}
type TrailJumpType ¶
type TrailJumpType string
const ( TrailJumpTypePercent TrailJumpType = "Percent" TrailJumpTypePoint TrailJumpType = "Point" )
type TransactionTypes ¶
type TransactionTypes string
const ( TransactionTypesBUY TransactionTypes = "BUY" TransactionTypesSELL TransactionTypes = "SELL" )
type UserData ¶
type UserData struct {
AccessToken string `json:"access_token"`
UserName string `json:"user_name"`
LoginTime string `json:"login_time"`
Email string `json:"email"`
Mobile string `json:"mobile"`
Exchanges []string `json:"exchanges"`
ProductTypes []string `json:"product_types"`
Others struct {
UserCode string `json:"userCode"`
POA int `json:"POA"`
} `json:"others"`
UserID string `json:"user_id"`
TradingActive bool `json:"tradingActive"`
}
type ValidityTypes ¶
type ValidityTypes string
const ( ValidityTypesFullDay ValidityTypes = "DAY" ValidityTypesImmediateOrCancel ValidityTypes = "IOC" ValidityTypesAfterMarket ValidityTypes = "AMO" )
type VarietyTypes ¶
type VarietyTypes string
const ( VarietyTypesRegularLimitOrder VarietyTypes = "RL" VarietyTypesRegularMarketOrder VarietyTypes = "RL-MKT" VarietyTypesStopLimitOrder VarietyTypes = "SL" VarietyTypesStopMarketOrder VarietyTypes = "SL-MKT" )
type VortexApi ¶
type VortexApi struct {
AccessToken string
// contains filtered or unexported fields
}
VortexApi is a struct representing the Vortex API client
func (*VortexApi) Banks ¶
func (v *VortexApi) Banks(ctx context.Context) (*BanksResponse, error)
Banks retrieves a list of banks from the Vortex API. It returns a BanksResponse containing the list of banks and an error if any.
func (*VortexApi) BasketMargin ¶
func (v *VortexApi) BasketMargin(ctx context.Context, request *BasketMarginRequest) (*BasketMarginResponse, error)
BasketMargin gets the required margin to place a collection of new orders in the Vortex API. It takes a context and an BasketMarginRequest as input. It returns a BasketMarginResponse and an error.
func (*VortexApi) BuildStrategy ¶
func (v *VortexApi) BuildStrategy(ctx context.Context, req StrategyBuilderRequest) (*StrategiesResponse, error)
BuildStrategy initiates the strategy building process with the Vortex API based on the provided StrategyBuilderRequest. It takes a context and a StrategyBuilderRequest as input. It returns a StrategiesResponse and an error.
func (*VortexApi) CancelGttOrder ¶
func (v *VortexApi) CancelGttOrder(ctx context.Context, gtt_order_id string) (*OrderResponse, error)
CancelGttOrder cancels an existing Good Till Trigger (GTT) order with the Vortex API. It takes a context and a GTT order ID as input. It returns an OrderResponse and an error.
func (*VortexApi) CancelIcebergOrder ¶
func (v *VortexApi) CancelIcebergOrder(ctx context.Context, iceberg_order_id string) (*CancelIcebergOrderResponse, error)
CancelIcebergOrder cancels an existing iceberg order with the Vortex API. It takes a context and an iceberg order ID as input. It returns a CancelIcebergOrderResponse and an error.
func (*VortexApi) CancelMultipleRegularOrders ¶
func (v *VortexApi) CancelMultipleRegularOrders(ctx context.Context, req MultipleOrderCancelRequest) (*MultipleOrderResponse, error)
func (*VortexApi) CancelOrder ¶
CancelOrder cancels an existing order with the Vortex API. It takes a context, an ExchangeTypes value, and an order ID as input. It returns an OrderResponse and an error.
func (*VortexApi) ConvertPosition ¶
func (v *VortexApi) ConvertPosition(ctx context.Context, req ConvertPositionRequest) (*ConvertPositionResponse, error)
func (*VortexApi) CreateTag ¶
func (v *VortexApi) CreateTag(ctx context.Context, request TagRequest) (*TagResponse, error)
CreateTag creates a new tag with the Vortex API. It takes a context and a TagRequest as input. It returns a TagResponse and an error.
func (*VortexApi) DeleteTag ¶
DeleteTag deletes an existing tag with the Vortex API. It takes a context and a tag ID as input. It returns a TagResponse and an error.
func (*VortexApi) DownloadMaster ¶
DownloadMaster retrieves the master data from the Vortex API. It returns a slice of maps representing the CSV records and an error if any.
func (*VortexApi) ExchangeToken ¶
ExchangeToken exchanges auth token received for the access_token from the Vortex API. It takes a context and auth_token as input. If the login is successful, the method updates the accessToken field of the VortexApi instance. It returns the LoginResponse and an error.
func (*VortexApi) Funds ¶
func (v *VortexApi) Funds(ctx context.Context) (*FundsResponse, error)
Funds retrieves the funds information from the Vortex API. It returns a FundsResponse containing the funds information and an error if any.
func (*VortexApi) GetLoginUrl ¶
GetLoginUrl returns the login URL for the Vortex API
func (*VortexApi) GetOptionChain ¶
func (v *VortexApi) GetOptionChain(ctx context.Context, req OptionChainRequest) (*OptionChainResponse, error)
GetOptionChain retrieves the option chain from the Vortex API based on the provided OptionChainRequest. It takes a context and an OptionChainRequest as input. It returns an OptionChainResponse and an error.
func (*VortexApi) GetPayoff ¶
func (v *VortexApi) GetPayoff(ctx context.Context, req PayoffRequest) (*PayoffResponse, error)
GetPayoff calculates the payoff for strategies with the Vortex API based on the provided PayoffRequest. It takes a context and a PayoffRequest as input. It returns a PayoffResponse and an error.
func (*VortexApi) GetStrategies ¶
func (v *VortexApi) GetStrategies(ctx context.Context, req StrategiesRequest) (*StrategiesResponse, error)
GetStrategies retrieves strategies from the Vortex API based on the provided StrategiesRequest. It takes a context and a StrategiesRequest as input. It returns a StrategiesResponse and an error.
func (*VortexApi) GttOrders ¶
func (v *VortexApi) GttOrders(ctx context.Context) (*GttOrderbookResponse, error)
GttOrders retrieves the Good Till Trigger (GTT) orderbook from the Vortex API. It takes a context as input. It returns a GttOrderbookResponse and an error.
func (*VortexApi) HistoricalCandles ¶
func (v *VortexApi) HistoricalCandles(ctx context.Context, exchange ExchangeTypes, token int, from time.Time, to time.Time, resolution Resolutions) (*HistoricalResponse, error)
HistoricalCandles retrieves historical candlestick data from the Vortex API. It takes a context, an ExchangeTypes value, a token, a start time, an end time, and a resolution as input. It returns a HistoricalResponse and an error.
func (*VortexApi) Holdings ¶
func (v *VortexApi) Holdings(ctx context.Context) (*HoldingsResponse, error)
Holdings retrieves the holdings information from the Vortex API. It returns a HoldingsResponse and an error.
func (*VortexApi) Login ¶
func (v *VortexApi) Login(ctx context.Context, clientCode string, password string, totp string) (*LoginResponse, error)
Depricated: Use SSO Login instead. Login performs the login operation in the Vortex API. It takes a context, client code, password, and TOTP (Time-Based One-Time Password) as input. If the login is successful, the method updates the accessToken field of the VortexApi instance. It returns the LoginResponse and an error.
func (*VortexApi) Logout ¶
func (v *VortexApi) Logout(ctx context.Context) (*LogoutResponse, error)
Logout logs the user out from the Vortex API and the access token is then no longer useful. It takes a context as input. It returns the LogoutResponse and an error.
func (*VortexApi) ModifyGttOrder ¶
func (v *VortexApi) ModifyGttOrder(ctx context.Context, gtt_order_id string, request ModifyGttRequest) (*OrderResponse, error)
ModifyGttOrder modifies an existing Good Till Trigger (GTT) order with the Vortex API. It takes a context, a GTT order ID, and a ModifyGttRequest as input. It returns an OrderResponse and an error.
func (*VortexApi) ModifyIcebergOrder ¶
func (v *VortexApi) ModifyIcebergOrder(ctx context.Context, iceberg_order_id string, request ModifyIcebergOrderRequest) (*IcebergOrderResponse, error)
ModifyIcebergOrder modifies an existing iceberg order with the Vortex API. It takes a context, an iceberg order ID, and a ModifyIcebergOrderRequest as input. It returns an IcebergOrderResponse and an error.
func (*VortexApi) ModifyOrder ¶
func (v *VortexApi) ModifyOrder(ctx context.Context, request ModifyOrderRequest, exchange ExchangeTypes, orderID string) (*OrderResponse, error)
ModifyOrder modifies an existing order with the Vortex API. It takes a context, a ModifyOrderRequest, an ExchangeTypes value, and an order ID as input. The request's Validity field is used to determine the ValidityDays value. It returns an OrderResponse and an error.
func (*VortexApi) OrderHistory ¶
func (*VortexApi) OrderMargin ¶
func (v *VortexApi) OrderMargin(ctx context.Context, request *OrderMarginRequest) (*MarginResponse, error)
OrderMargin gets the required margin to place or modify an order in the Vortex API. It takes a context and an OrderMarginRequest as input. It returns a MarginResponse and an error.
func (*VortexApi) Orders ¶
func (v *VortexApi) Orders(ctx context.Context) (*OrderBookResponse, error)
Orders retrieves the order book information from the Vortex API. It takes a context, an offset, and a limit as input. It returns an OrderBookResponse and an error.
func (*VortexApi) PlaceGttOrder ¶
func (v *VortexApi) PlaceGttOrder(ctx context.Context, request PlaceGttRequest) (*OrderResponse, error)
PlaceGttOrder places a Good Till Trigger (GTT) order with the Vortex API. It takes a context and a PlaceGttRequest as input. It returns an OrderResponse and an error.
func (*VortexApi) PlaceIcebergOrder ¶
func (v *VortexApi) PlaceIcebergOrder(ctx context.Context, request PlaceIcebergOrderRequest) (*IcebergOrderResponse, error)
PlaceIcebergOrder places an iceberg order with the Vortex API. It takes a context and a PlaceIcebergOrderRequest as input. It returns an IcebergOrderResponse and an error.
func (*VortexApi) PlaceOrder ¶
func (v *VortexApi) PlaceOrder(ctx context.Context, request PlaceOrderRequest) (*OrderResponse, error)
PlaceOrder places an order with the Vortex API. It takes a context and a PlaceOrderRequest as input. The request's Validity field is used to determine the ValidityDays and IsAMO values. It returns an OrderResponse and an error.
func (*VortexApi) Positions ¶
func (v *VortexApi) Positions(ctx context.Context) (*PositionResponse, error)
Positions retrieves the positions information from the Vortex API. It returns a PositionsResponse and an error.
func (*VortexApi) Quotes ¶
func (v *VortexApi) Quotes(ctx context.Context, instruments []string, mode QuoteModes) (*QuoteResponse, error)
Quotes retrieves real-time quote information for the specified instruments from the Vortex API. It takes a context, a slice of instrument names, and a quote mode as input. It returns a QuoteResponse and an error.
func (*VortexApi) SSOLogin ¶
SSOLogin performs the login operation using Single Sign-On (SSO) in the Vortex API. It takes a context and a callback parameter as input. If the applicationId is not set, it returns an error. It returns a URL for the SSO login process. The User will be redirected to the callback url configured on the API Portal.
func (*VortexApi) SetAccessToken ¶
func (*VortexApi) SetHTTPClient ¶
SetHTTPClient sets the HTTP client for the Vortex API client
func (*VortexApi) SetLogging ¶
SetLogging sets the HTTP client with logging enabled
func (*VortexApi) Tags ¶
func (v *VortexApi) Tags(ctx context.Context) (*TagsResponse, error)
Tags retrieves the list of tags from the Vortex API. It takes a context as input. It returns a TagsResponse and an error.
func (*VortexApi) Trades ¶
Trades retrieves the trade book information from the Vortex API. It returns a TradeBookResponse and an error.
func (*VortexApi) UpdateTag ¶
func (v *VortexApi) UpdateTag(ctx context.Context, tag_id int, request TagRequest) (*TagResponse, error)
UpdateTag updates an existing tag with the Vortex API. It takes a context, a tag ID, and a TagRequest as input. It returns a TagResponse and an error.
type Wire ¶
func (*Wire) OnConnect ¶
func (t *Wire) OnConnect(f func())
Set a function to receive update whenever the socket is connected
func (*Wire) OnNoReconnect ¶
func (*Wire) OnOrderUpdate ¶
func (t *Wire) OnOrderUpdate(f func(order SocketMessage))
Set a function to receive Order Updates
func (*Wire) OnPriceUpdate ¶
func (t *Wire) OnPriceUpdate(f func(*FullQuoteData))
Set a function to receive Price Updates
func (*Wire) OnReconnect ¶
Set a function to receive update whenever the socket reconnects
func (*Wire) Resubscribe ¶
func (t *Wire) Resubscribe()
func (*Wire) ServeWithContext ¶
Call this function to start the websocket server with a context
func (*Wire) SetAccessToken ¶
Use this function to change access token
func (*Wire) SetAutoReconnect ¶
Use this function to change auto reconnection setting. Default: true
func (*Wire) SetConnectTimeout ¶
Use this function to change connection timeout value. Dafault: 7 seconds
func (*Wire) SetReconnectMaxDelay ¶
Use this function to change max reconnection delay. Default: 60 seconds
func (*Wire) SetReconnectMaxRetries ¶
Use this function to change max connection retries. Default: 300
func (*Wire) SetRootURL ¶
Use this function to set new url for websocket connection
func (*Wire) Stop ¶
func (t *Wire) Stop()
Stop the wire instance and all the goroutines it has spawned.
func (*Wire) Subscribe ¶
func (t *Wire) Subscribe(exchange ExchangeTypes, token int, mode QuoteModes)
Call this function to subscribe to an instrument
func (*Wire) Unsubscribe ¶
func (t *Wire) Unsubscribe(exchange ExchangeTypes, token int, mode QuoteModes)
Call this function to unsubscribe an instrument