Categorygithub.com/AsthaTech/govortex/v2
modulepackage
2.0.0-beta.12
Repository: https://github.com/asthatech/govortex.git
Documentation: pkg.go.dev

# README

Go Reference

Vortex API Golang Client

Official golang client for communicating with Vortex API

Vortex APIs are meant for clients who want to execute orders based on their own strategy programatically and for partners to build their own applications. These apis provide a fast and secure way to place trades, manage positions and access real time market data.

Documentation

Installation

    go get github.com/AsthaTech/govortex

Getting Started with APIs

package main

import (
	"context"

	govortex "github.com/AsthaTech/govortex/v2"
)

const (
	applicationId string = "testApplicationId"
	apiKey        string = "testApiKey"
)

func main() {
	var client govortex.VortexApi
	govortex.InitializeVortexApi(applicationId, apiKey, &client)
	ctx := context.Background()
	client.Login(ctx, "clientCode", "password", "totp")
	// Access token is automatically set upon successful login call

	client.Orders(ctx, 1, 20) //orders need an offset and limit
	client.Positions(ctx)     //positions need an offset and limit

	client.PlaceOrder(ctx, govortex.PlaceOrderRequest{
		Exchange:          govortex.ExchangeTypesNSEEQUITY,
		Token:             22,
		TransactionType:   govortex.TransactionTypesBUY,
		Product:           govortex.ProductTypesDelivery,
		Variety:           govortex.VarietyTypesRegularMarketOrder,
		Quantity:          1,
		Price:             1800,
		TriggerPrice:      0,
		DisclosedQuantity: 0,
		Validity:          govortex.ValidityTypesFullDay,
		ValidityDays:      1,
		IsAMO:             false,
	})

	client.Funds(ctx)

}

Getting started with Feed

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"time"

	"github.com/AsthaTech/govortex/v2"
)

var wire *govortex.Wire

const (
	applicationId string = "testApplicationId"
	apiKey        string = "testApiKey"
)

func main() {
	var client govortex.VortexApi
	govortex.InitializeVortexApi(applicationId, apiKey, &client)
	ctx := context.Background()
	client.Login(ctx, "clientCode", "password", "totp")
	accessToken := client.AccessToken

	// Initialize the wire client
	wire = &govortex.Wire{}
	govortex.InitializeWire(accessToken, wire)

	// Define callbacks
	wire.OnConnect(onConnect)
	wire.OnPriceUpdate(onPriceUpdate)
	wire.OnError(onError)
	wire.OnClose(onClose)
	wire.OnReconnect(onReconnect)
	wire.OnOrderUpdate(onOrderUpdate)

	// Start websocket server
	wire.Serve()
}

func onConnect() {
	fmt.Println("connected")
	wire.Subscribe(govortex.ExchangeTypesNSEEQUITY, 22, govortex.QuoteModesFULL)
}

func onPriceUpdate(q *govortex.FullQuoteData) {
	aa, _ := json.Marshal(q)
	fmt.Println(string(aa))
}

func onError(err error) {
	fmt.Println(err.Error())
}

func onClose(code int, reason string) {
	fmt.Println(code, reason)
}

func onReconnect(attempt int, delay time.Duration) {
	fmt.Println(attempt, delay)
}

func onOrderUpdate(msg govortex.SocketMessage) {
	aa, _ := json.Marshal(msg)
	fmt.Println(string(aa))
}

Run Tests

go test

Generate Docs

go doc -all > doc.txt

# Packages

No description provided by the author

# Functions

GetErrorName returns an error name given an HTTP code.
Function to get a new instance of VortexApi Client.
Default method to create a new instance of Wire which can be used to get price updates and order updates.
NewError creates and returns a new instace of Error with custom error metadata.
NewHTTPClient creates a new instance of the httpClient with the given HTTP client, logger, and debug flag.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
One Cancels the Other (OCO) trigger type.
Single trigger type.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
PayoffAction represents the action for a trading strategy.
PayoffAction represents the action for a trading strategy.
No description provided by the author
Predict that the asset price will be above a certain level.
Predict that the asset price will be below a certain level.
Predict that the asset price will be within a certain range.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Constants for the API endpoints.
Constants for the API endpoints.
Constants for the API endpoints.
Constants for the API endpoints.
Constants for the API endpoints.
"/trading/orders/{{order_type}}/{order_id}".
"/trading/orders/{{order_type}}/{order_id}".
Constants for the API endpoints.
"/trading/orders/gtt".
Constants for the API endpoints.
Constants for the API endpoints.
Constants for the API endpoints.
Constants for the API endpoints.
"/trading/orders/{{order_type}}/{order_id}".
"/trading/orders/{{order_type}}/{order_id}/tags".
Constants for the API endpoints.
"/trading/orders/regular/multi_delete".
Constants for the API endpoints.
"/trading/orders".
"/trading/orders/{order_id}".
Constants for the API endpoints.
Constants for the API endpoints.
"/trading/orders/regular".
Constants for the API endpoints.
Constants for the API endpoints.
Constants for the API endpoints.
Constants for the API endpoints.
Constants for the API endpoints.
Constants for the API endpoints.
Constants for the API endpoints.
Constants for the API endpoints.
Constants for the API endpoints.
Constants for the API endpoints.
Constants for the API endpoints.
Constants for the API endpoints.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ConvertPositionRequest represents a request to convert a position.
No description provided by the author
No description provided by the author
Error is the error type used for all API errors.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
FundWithdrawalCancelRequest represents a request to cancel a fund withdrawal.
No description provided by the author
No description provided by the author
FundWithdrawalRequest represents a request to withdraw funds.
No description provided by the author
No description provided by the author
No description provided by the author
GttLegs represents legs of a Good 'til Triggered (GTT) order.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
HTTPResponse contains the response body and the HTTP response object.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ModifyGttRequest represents a request to modify a Good 'til Triggered (GTT) order.
ModifyIcebergOrderRequest represents a request to modify an Iceberg order.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
OptionChainRequest represents a request to retrieve an option chain.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
OrderMarginRequest represents a request to calculate margin for an order.
No description provided by the author
No description provided by the author
No description provided by the author
PayoffOption represents an option within a trading strategy.
PayoffRequest represents a request to calculate the payoff for a trading strategy.
No description provided by the author
PlaceGttLegRequest represents a leg of a Good 'til Triggered (GTT) order.
PlaceGttRequest represents a request to place a Good 'til Triggered (GTT) order.
PlaceIcebergOrderRequest represents a request to place an Iceberg order.
PlaceOrderRequest represents a request to place an order.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
StrategiesRequest represents a request to retrieve strategies.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
TagRequest represents a request to create a tag.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
VortexApi is a struct representing the Vortex API client.
No description provided by the author

# Interfaces

HTTPClient defines the interface for performing HTTP requests.

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
GttTriggerType represents the trigger type for a Good 'til Triggered (GTT) order.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
PredictionType represents the type of prediction for a trading strategy.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author