npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

upstoxjsclient

v0.0.4

Published

Build_your_App_on_the_Upstox_platform_Banner_httpsapi_v2_upstox_comapi_docsimagesbanner_jpg_banner_IntroductionUpstox_API_is_a_set_of_rest_APIs_that_provide_data_required_to_build_a_complete_investment_and_trading_platform__Execute_orders_in_real_time_man

Downloads

5

Readme

upstox_developer_api

UpstoxDeveloperApi - JavaScript client for upstox_developer_api Build your App on the Upstox platform ![Banner](https://api-v2.upstox.com/api-docs/images/banner.jpg "banner") # Introduction 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. All requests are over HTTPS and the requests are sent with the content-type ‘application/json’. Developers have the option of choosing the response type as JSON or CSV for a few API calls. To be able to use these APIs you need to create an App in the Developer Console and generate your apiKey and apiSecret. You can use a redirect URL which will be called after the login flow. If you are a trader, you can directly create apps from Upstox mobile app or the desktop platform itself from Apps sections inside the Account Tab. Head over to <a href="http://account.upstox.com/developer/apps" target="_blank">account.upstox.com/developer/apps. If you are a business looking to integrate Upstox APIs, reach out to us and we will get a custom app created for you in no time. It is highly recommended that you do not embed the apiSecret in your frontend app. Create a remote backend which does the handshake on behalf of the frontend app. Marking the apiSecret in the frontend app will make your app vulnerable to threats and potential issues. This SDK is automatically generated by the Swagger Codegen project:

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

Installation

For Node.js

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install upstox_developer_api --save

git

If the library is hosted at a git repository, e.g. https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

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

var UpstoxDeveloperApi = require('upstox_developer_api');
var defaultClient = UpstoxDeveloperApi.ApiClient.instance;

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

var api = new UpstoxDeveloperApi.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

Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- UpstoxDeveloperApi.ChargeApi | getBrokerage | GET /charges/brokerage | Brokerage details UpstoxDeveloperApi.HistoryApi | getHistoricalCandleData | GET /historical-candle/{instrumentKey}/{interval}/{to_date} | Historical candle data UpstoxDeveloperApi.HistoryApi | getHistoricalCandleData1 | GET /historical-candle/{instrumentKey}/{interval}/{to_date}/{from_date} | Historical candle data UpstoxDeveloperApi.HistoryApi | getIntraDayCandleData | GET /historical-candle/intraday/{instrumentKey}/{interval} | Intra day candle data UpstoxDeveloperApi.LoginApi | authorize | GET /login/authorization/dialog | Authorize API UpstoxDeveloperApi.LoginApi | logout | DELETE /logout | Logout UpstoxDeveloperApi.LoginApi | token | POST /login/authorization/token | Get token API UpstoxDeveloperApi.MarketQuoteApi | getFullMarketQuote | GET /market-quote/quotes | Market quotes and instruments - Full market quotes UpstoxDeveloperApi.MarketQuoteApi | getMarketQuoteOHLC | GET /market-quote/ohlc | Market quotes and instruments - OHLC quotes UpstoxDeveloperApi.MarketQuoteApi | ltp | GET /market-quote/ltp | Market quotes and instruments - LTP quotes. UpstoxDeveloperApi.OrderApi | cancelOrder | DELETE /order/cancel | Cancel order UpstoxDeveloperApi.OrderApi | getOrderBook | GET /order/retrieve-all | Get order book UpstoxDeveloperApi.OrderApi | getOrderDetails | GET /order/history | Get order details UpstoxDeveloperApi.OrderApi | getTradeHistory | GET /order/trades/get-trades-for-day | Get trades UpstoxDeveloperApi.OrderApi | getTradesByOrder | GET /order/trades | Get trades for order UpstoxDeveloperApi.OrderApi | modifyOrder | PUT /order/modify | Modify order UpstoxDeveloperApi.OrderApi | placeOrder | POST /order/place | Place order UpstoxDeveloperApi.PortfolioApi | convertPositions | PUT /portfolio/convert-position | Convert Positions UpstoxDeveloperApi.PortfolioApi | getHoldings | GET /portfolio/long-term-holdings | Get Holdings UpstoxDeveloperApi.PortfolioApi | getPositions | GET /portfolio/short-term-positions | Get Positions UpstoxDeveloperApi.TradeProfitAndLossApi | getProfitAndLossCharges | GET /trade/profit-loss/charges | Get profit and loss on trades UpstoxDeveloperApi.TradeProfitAndLossApi | getTradeWiseProfitAndLossData | GET /trade/profit-loss/data | Get Trade-wise Profit and Loss Report Data UpstoxDeveloperApi.TradeProfitAndLossApi | getTradeWiseProfitAndLossMetaData | GET /trade/profit-loss/metadata | Get profit and loss meta data on trades UpstoxDeveloperApi.UserApi | getProfile | GET /user/profile | Get profile UpstoxDeveloperApi.UserApi | getUserFundMargin | GET /user/get-funds-and-margin | Get User Fund And Margin UpstoxDeveloperApi.WebsocketApi | getMarketDataFeed | GET /feed/market-data-feed | Market Data Feed UpstoxDeveloperApi.WebsocketApi | getMarketDataFeedAuthorize | GET /feed/market-data-feed/authorize | Market Data Feed Authorize UpstoxDeveloperApi.WebsocketApi | getPortfolioStreamFeed | GET /feed/portfolio-stream-feed | Portfolio Stream Feed UpstoxDeveloperApi.WebsocketApi | getPortfolioStreamFeedAuthorize | GET /feed/portfolio-stream-feed/authorize | Portfolio Stream Feed Authorize

Documentation for Models

Documentation for Authorization

OAUTH2

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL: https://api-v2.upstox.com/login/authorization/dialog
  • Scopes:
    • :