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 ConvertPositionObject
- type ConvertPositionResponse
- type Error
- type ExchangeDetails
- type ExchangeTypes
- type FullQuoteData
- type FundDetails
- type FundsResponse
- type HTTPClient
- type HTTPResponse
- type HistoricalResponse
- type Holding
- type HoldingsResponse
- type LoginResponse
- type LtpQuoteData
- type MarginModes
- type MarginResponse
- type MarketDepthResponse
- type Metadata
- type ModifyOrderRequest
- type OhlcvQuoteData
- type Order
- type OrderBookResponse
- type OrderHistory
- type OrderHistoryResponse
- type OrderMarginRequest
- type OrderResponse
- type PlaceOrderRequest
- type Position
- type PositionData
- type PositionResponse
- type ProductTypes
- type QuoteDepth
- type QuoteEntry
- type QuoteModes
- type QuoteResponse
- type Resolutions
- type SocketMessage
- type SocketMessageData
- type Trade
- type TradeBookResponse
- type TransactionTypes
- type UserData
- type ValidityTypes
- type VarietyTypes
- type VortexApi
- func (v *VortexApi) CancelOrder(ctx context.Context, exchange ExchangeTypes, orderID string) (*OrderResponse, error)
- func (v *VortexApi) ConvertPosition(ctx context.Context, req ConvertPositionObject) (*ConvertPositionResponse, error)
- func (v *VortexApi) DownloadMaster(ctx context.Context) ([]map[string]string, error)
- func (v *VortexApi) Funds(ctx context.Context) (*FundsResponse, error)
- func (v *VortexApi) GetLoginUrl() string
- 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) 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, offset int, limit int) (*OrderBookResponse, 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) SetAccessToken(accessToken string)
- func (v *VortexApi) SetHTTPClient(h *http.Client)
- func (v *VortexApi) SetLogging(h *http.Client)
- func (v *VortexApi) Trades(ctx context.Context, offset int, limit int) (*TradeBookResponse, 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" URIInstruments string = "/data/instruments" URIPlaceOrder string = "/orders/%s" // "/orders/regular" URIModifyOrder string = "/orders/%s/%s/%s" //"/orders/regular/{exchange}/{order_id}" URIDeleterOrder string = "/orders/%s/%s/%s" //"/orders/regular/{exchange}/{order_id}" URIOrderBook string = "/orders" //"/orders?limit={limit}&offset={offset}" URIOrderHistory string = "/orders/%s" //"/orders/{order_id}" URITrades string = "/trades" URIPositions string = "/portfolio/positions" URIConvertposition string = "/portfolio/positions" URIHoldings string = "/portfolio/holdings" URIFunds string = "/user/funds" URIOrderMargin string = "/margins/order" URIQuotes string = "/data/quote" URIHistory string = "/data/history" )
Constants for the API endpoints
const ( GeneralError = "GeneralException" TokenError = "TokenException" PermissionError = "PermissionError" UserError = "UserException" TwoFAError = "TwoFAException" OrderError = "OrderException" InputError = "InputException" DataError = "DataException" NetworkError = "NetworkException" )
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 ConvertPositionObject ¶
type ConvertPositionObject struct { Exchange ExchangeTypes `json:"exchange"` Token int `json:"token"` TransactionType TransactionTypes `json:"transaction_type"` OldProductType ProductTypes `json:"old_product_type"` NewProductType ProductTypes `json:"new_product_type"` }
type ConvertPositionResponse ¶
type ExchangeDetails ¶
type ExchangeTypes ¶
type ExchangeTypes string
const ( ExchangeTypesNSEFO ExchangeTypes = "NSE_FO" 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 FundsResponse ¶
type FundsResponse struct { NSE FundDetails `json:"nse"` MCX FundDetails `json:"mcx"` }
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 ExchangeDetails `json:"nse"` BSE ExchangeDetails `json:"bse"` 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"` CollateralQuantity int `json:"collateral_quantity"` CollateralValue float64 `json:"collateral_value"` }
type HoldingsResponse ¶
type LoginResponse ¶
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 ModifyOrderRequest ¶
type ModifyOrderRequest struct { Variety VarietyTypes `json:"variety"` Quantity int `json:"quantity"` TradedQuantity int `json:"traded_quantity"` Price float64 `json:"price"` TriggerPrice float64 `json:"trigger_price"` DisclosedQuantity int `json:"disclosed_quantity"` Validity ValidityTypes `json:"validity"` ValidityDays int `json:"validity_days"` }
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 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"` Validity ValidityTypes `json:"validity"` ValidityDays int `json:"validity_days"` Symbol string `json:"symbol"` Series string `json:"series"` InstrumentName string `json:"instrument_name"` ExpiryDate string `json:"expiry_date"` StrikePrice float64 `json:"strike_price"` OptionType string `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"` }
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 string `json:"instrument_name"` ExpiryDate string `json:"expiry_date"` StrikePrice float64 `json:"strike_price"` OptionType string `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:"data"` Metadata Metadata `json:"metadata"` }
type OrderMarginRequest ¶
type OrderMarginRequest struct { Exchange ExchangeTypes `json:"exchange"` Token int `json:"token"` TransactionType TransactionTypes `json:"transaction_type"` Product ProductTypes `json:"product"` Variety VarietyTypes `json:"variety"` Quantity int `json:"quantity"` Price float64 `json:"price"` OldPrice float64 `json:"old_price"` OldQuantity int `json:"old_quantity"` Mode MarginModes `json:"mode"` }
type OrderResponse ¶
type PlaceOrderRequest ¶
type PlaceOrderRequest struct { Exchange ExchangeTypes `json:"exchange"` Token int `json:"token"` TransactionType TransactionTypes `json:"transaction_type"` Product ProductTypes `json:"product"` Variety VarietyTypes `json:"variety"` Quantity int `json:"quantity"` Price float64 `json:"price"` TriggerPrice float64 `json:"trigger_price"` DisclosedQuantity int `json:"disclosed_quantity"` Validity ValidityTypes `json:"validity"` ValidityDays int `json:"validity_days"` IsAMO bool `json:"is_amo"` }
type Position ¶
type Position struct { Exchange ExchangeTypes `json:"exchange"` Symbol string `json:"symbol"` ExpiryDate string `json:"expiry_date"` OptionType string `json:"option_type"` 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 PositionData ¶
type PositionResponse ¶
type PositionResponse struct { Status string `json:"status"` Data PositionData `json:"data"` }
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"` }
type SocketMessageData ¶
type SocketMessageData struct { OrderId string `json:"order_id"` OrderNumber string `json:"order_number"` AmoOrderId string `json:"amo_order_id"` PlacedBy string `json:"placed_by"` ModifiedBy string `json:"modified_by"` Status string `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 string `json:"exchange"` ExpiryDate string `json:"expiry_date"` StrikePrice float32 `json:"strike_price"` OptionType string `json:"option_type"` TransactionType string `json:"transaction_type"` Validity string `json:"validity"` ValidityDays int `json:"validity_days"` Product string `json:"product"` Variety string `json:"variety"` 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"` MarketType string `json:"market_type"` OrderPrice float32 `json:"order_price"` TriggerPrice float32 `json:"trigger_price"` TradedPrice float32 `json:"traded_price"` IsAmo bool `json:"is_amo"` OrderIdentifier string `json:"order_identifier"` 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 string `json:"gtd_order_status"` }
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 string `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 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) CancelOrder ¶
func (v *VortexApi) CancelOrder(ctx context.Context, exchange ExchangeTypes, orderID string) (*OrderResponse, error)
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 ConvertPositionObject) (*ConvertPositionResponse, 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) Funds ¶
func (v *VortexApi) Funds(ctx context.Context) (*FundsResponse, error)
Funds retrieves the funds information from the Vortex API.
func (*VortexApi) GetLoginUrl ¶
GetLoginUrl returns the login URL for the Vortex API
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)
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) 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 places an order for margin trading in the Vortex API. It takes a context and an OrderMarginRequest as input. It returns a MarginResponse and an error.
func (*VortexApi) Orders ¶
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) 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) 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
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