2.4.0 • Published 3 months ago

upstox-js-sdk v2.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Upstox Node Js SDK for API v2

Introduction

The official Node.js client for communicating with the Upstox API.

Upstox API is a set of rest APIs that provide data required to build a complete investment and trading platform. Execute orders in real time, manage user portfolio, stream live market data (using Websocket), and more, with the easy to understand API collection.

  • API version: v2
  • Build package: io.swagger.codegen.v3.generators.javascript.JavaScriptClientCodegen

This SDK is automatically generated by the Swagger Codegen project.

Documentation.

Upstox API Documentation

Installation

For Node.js

npm

npm install upstox-js-sdk --save

Examples

Sample Implementations can be found within /examples folder.

Getting Started

Please follow the installation instruction and execute the following JS code:

var UpstoxClient = require('upstox-js-sdk');
var defaultClient = UpstoxClient.ApiClient.instance;

// Configure OAuth2 access token for authorization: OAUTH2
var OAUTH2 = defaultClient.authentications['OAUTH2'];
OAUTH2.accessToken = "YOUR ACCESS TOKEN"

var api = new UpstoxClient.ChargeApi()
var instrumentToken = "instrumentToken_example"; // {String} Key of the instrument
var quantity = 56; // {Number} Quantity with which the order is to be placed
var product = "product_example"; // {String} Product with which the order is to be placed
var transactionType = "transactionType_example"; // {String} Indicates whether its a BUY or SELL order
var price = 3.4; // {Number} Price with which the order is to be placed
var apiVersion = "apiVersion_example"; // {String} API Version Header

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getBrokerage(instrumentToken, quantity, product, transactionType, price, apiVersion, callback);

Documentation for API Endpoints

All URIs are relative to https://api-v2.upstox.com

ClassMethodHTTP requestDescription
UpstoxClient.ChargeApigetBrokerageGET /charges/brokerageBrokerage details
UpstoxClient.HistoryApigetHistoricalCandleDataGET /historical-candle/{instrumentKey}/{interval}/{to_date}Historical candle data
UpstoxClient.HistoryApigetHistoricalCandleData1GET /historical-candle/{instrumentKey}/{interval}/{to_date}/{from_date}Historical candle data
UpstoxClient.HistoryApigetIntraDayCandleDataGET /historical-candle/intraday/{instrumentKey}/{interval}Intra day candle data
UpstoxClient.LoginApiauthorizeGET /login/authorization/dialogAuthorize API
UpstoxClient.LoginApilogoutDELETE /logoutLogout
UpstoxClient.LoginApitokenPOST /login/authorization/tokenGet token API
UpstoxClient.MarketQuoteApigetFullMarketQuoteGET /market-quote/quotesMarket quotes and instruments - Full market quotes
UpstoxClient.MarketQuoteApigetMarketQuoteOHLCGET /market-quote/ohlcMarket quotes and instruments - OHLC quotes
UpstoxClient.MarketQuoteApiltpGET /market-quote/ltpMarket quotes and instruments - LTP quotes.
UpstoxClient.OrderApicancelOrderDELETE /order/cancelCancel order
UpstoxClient.OrderApigetOrderBookGET /order/retrieve-allGet order book
UpstoxClient.OrderApigetOrderDetailsGET /order/historyGet order details
UpstoxClient.OrderApigetTradeHistoryGET /order/trades/get-trades-for-dayGet trades
UpstoxClient.OrderApigetTradesByOrderGET /order/tradesGet trades for order
UpstoxClient.OrderApimodifyOrderPUT /order/modifyModify order
UpstoxClient.OrderApiplaceOrderPOST /order/placePlace order
UpstoxClient.PortfolioApiconvertPositionsPUT /portfolio/convert-positionConvert Positions
UpstoxClient.PortfolioApigetHoldingsGET /portfolio/long-term-holdingsGet Holdings
UpstoxClient.PortfolioApigetPositionsGET /portfolio/short-term-positionsGet Positions
UpstoxClient.TradeProfitAndLossApigetProfitAndLossChargesGET /trade/profit-loss/chargesGet profit and loss on trades
UpstoxClient.TradeProfitAndLossApigetTradeWiseProfitAndLossDataGET /trade/profit-loss/dataGet Trade-wise Profit and Loss Report Data
UpstoxClient.TradeProfitAndLossApigetTradeWiseProfitAndLossMetaDataGET /trade/profit-loss/metadataGet profit and loss meta data on trades
UpstoxClient.UserApigetProfileGET /user/profileGet profile
UpstoxClient.UserApigetUserFundMarginGET /user/get-funds-and-marginGet User Fund And Margin
UpstoxClient.WebsocketApigetMarketDataFeedGET /feed/market-data-feedMarket Data Feed
UpstoxClient.WebsocketApigetMarketDataFeedAuthorizeGET /feed/market-data-feed/authorizeMarket Data Feed Authorize
UpstoxClient.WebsocketApigetPortfolioStreamFeedGET /feed/portfolio-stream-feedPortfolio Stream Feed
UpstoxClient.WebsocketApigetPortfolioStreamFeedAuthorizeGET /feed/portfolio-stream-feed/authorizePortfolio Stream Feed Authorize

Documentation for Models