Giter Club home page Giter Club logo

upstox-python's Introduction

Upstox Python SDK for API v2

PyPI

Introduction

The official Python 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
  • Package version: 2.0.0
  • Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen

This Python package is automatically generated by the Swagger Codegen project.

Documentation.

Upstox API Documentation

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install upstox-python-sdk

(you may need to run pip with root permission: sudo pip install upstox-python-sdk)

Then import the package:

import upstox_client 

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import upstox_client

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function
import time
import upstox_client
from upstox_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAUTH2
configuration = upstox_client.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = upstox_client.ChargeApi(upstox_client.ApiClient(configuration))
instrument_token = 'instrument_token_example' # str | Key of the instrument
quantity = 56 # int | Quantity with which the order is to be placed
product = 'product_example' # str | Product with which the order is to be placed
transaction_type = 'transaction_type_example' # str | Indicates whether its a BUY or SELL order
price = 3.4 # float | Price with which the order is to be placed
api_version = 'api_version_example' # str | API Version Header

try:
    # Brokerage details
    api_response = api_instance.get_brokerage(instrument_token, quantity, product, transaction_type, price, api_version)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ChargeApi->get_brokerage: %s\n" % e)

Documentation for API Endpoints

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

Class Method HTTP request Description
ChargeApi get_brokerage GET /charges/brokerage Brokerage details
HistoryApi get_historical_candle_data GET /historical-candle/{instrumentKey}/{interval}/{to_date} Historical candle data
HistoryApi get_historical_candle_data1 GET /historical-candle/{instrumentKey}/{interval}/{to_date}/{from_date} Historical candle data
HistoryApi get_intra_day_candle_data GET /historical-candle/intraday/{instrumentKey}/{interval} Intra day candle data
LoginApi authorize GET /login/authorization/dialog Authorize API
LoginApi logout DELETE /logout Logout
LoginApi token POST /login/authorization/token Get token API
MarketQuoteApi get_full_market_quote GET /market-quote/quotes Market quotes and instruments - Full market quotes
MarketQuoteApi get_market_quote_ohlc GET /market-quote/ohlc Market quotes and instruments - OHLC quotes
MarketQuoteApi ltp GET /market-quote/ltp Market quotes and instruments - LTP quotes.
OrderApi cancel_order DELETE /order/cancel Cancel order
OrderApi get_order_book GET /order/retrieve-all Get order book
OrderApi get_order_details GET /order/history Get order details
OrderApi get_trade_history GET /order/trades/get-trades-for-day Get trades
OrderApi get_trades_by_order GET /order/trades Get trades for order
OrderApi modify_order PUT /order/modify Modify order
OrderApi place_order POST /order/place Place order
PortfolioApi convert_positions PUT /portfolio/convert-position Convert Positions
PortfolioApi get_holdings GET /portfolio/long-term-holdings Get Holdings
PortfolioApi get_positions GET /portfolio/short-term-positions Get Positions
TradeProfitAndLossApi get_profit_and_loss_charges GET /trade/profit-loss/charges Get profit and loss on trades
TradeProfitAndLossApi get_trade_wise_profit_and_loss_data GET /trade/profit-loss/data Get Trade-wise Profit and Loss Report Data
TradeProfitAndLossApi get_trade_wise_profit_and_loss_meta_data GET /trade/profit-loss/metadata Get profit and loss meta data on trades
UserApi get_profile GET /user/profile Get profile
UserApi get_user_fund_margin GET /user/get-funds-and-margin Get User Fund And Margin
WebsocketApi get_market_data_feed GET /feed/market-data-feed Market Data Feed
WebsocketApi get_market_data_feed_authorize GET /feed/market-data-feed/authorize Market Data Feed Authorize
WebsocketApi get_portfolio_stream_feed GET /feed/portfolio-stream-feed Portfolio Stream Feed
WebsocketApi get_portfolio_stream_feed_authorize GET /feed/portfolio-stream-feed/authorize Portfolio Stream Feed Authorize

Documentation For Models

upstox-python's People

Contributors

alokgaira avatar svishi avatar rahulzz avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.