upstox-dotnet-sdk 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package upstox-dotnet-sdk --version 1.0.0                
NuGet\Install-Package upstox-dotnet-sdk -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="upstox-dotnet-sdk" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add upstox-dotnet-sdk --version 1.0.0                
#r "nuget: upstox-dotnet-sdk, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install upstox-dotnet-sdk as a Cake Addin
#addin nuget:?package=upstox-dotnet-sdk&version=1.0.0

// Install upstox-dotnet-sdk as a Cake Tool
#tool nuget:?package=upstox-dotnet-sdk&version=1.0.0                

Upstox .Net SDK for API v2

Introduction

The official .Net 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.dotnet.CSharpClientCodegen

This .Net package is automatically generated by the Swagger Codegen project:

Documentation.

Upstox API Documentation

Frameworks supported

  • .NET 4.0 or later

  • Windows Phone 7.1 (Mango)

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:


Install-Package RestSharp

Install-Package Newtonsoft.Json

Install-Package JsonSubTypes

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742

Installation

Nuget

Run nuget install upstox-dotnet-sdk to install the SDK from Nuget.

Github

Run the following command to generate the DLL

  • [Mac/Linux] /bin/sh build.sh

  • [Windows] build.bat

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using UpstoxClient.Api;
using UpstoxClient.Client;
using UpstoxClient.Model;

Packaging

A .nuspec is included with the project. You can follow the Nuget quickstart to create and publish packages.

This .nuspec uses placeholders from the .csproj, so build the .csproj directly:

nuget pack -Build -OutputDirectory out UpstoxClient.csproj

Then, publish to a local feed or other host and consume the new package via Nuget as usual.

Getting Started

using System;
using System.Diagnostics;
using UpstoxClient.Api;
using UpstoxClient.Client;
using UpstoxClient.Model;

namespace Example
{
    public class Example
    {
        public void main()
        {
            // Configure OAuth2 access token for authorization: OAUTH2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new ChargeApi();
            var instrumentToken = instrumentToken_example;  // string | Key of the instrument
            var quantity = 56;  // int? | 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;  // float? | Price with which the order is to be placed
            var apiVersion = apiVersion_example;  // string | API Version Header

            try
            {
                // Brokerage details
                GetBrokerageResponse result = apiInstance.GetBrokerage(instrumentToken, quantity, product, transactionType, price, apiVersion);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling ChargeApi.GetBrokerage: " + e.Message );
            }
        }
    }
}

Documentation for API Endpoints

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

Class Method HTTP request Description
ChargeApi GetBrokerage GET /charges/brokerage Brokerage details
HistoryApi GetHistoricalCandleData GET /historical-candle/{instrumentKey}/{interval}/{to_date} Historical candle data
HistoryApi GetHistoricalCandleData1 GET /historical-candle/{instrumentKey}/{interval}/{to_date}/{from_date} Historical candle data
HistoryApi GetIntraDayCandleData 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 GetFullMarketQuote GET /market-quote/quotes Market quotes and instruments - Full market quotes
MarketQuoteApi GetMarketQuoteOHLC GET /market-quote/ohlc Market quotes and instruments - OHLC quotes
MarketQuoteApi Ltp GET /market-quote/ltp Market quotes and instruments - LTP quotes.
OrderApi CancelOrder DELETE /order/cancel Cancel order
OrderApi GetOrderBook GET /order/retrieve-all Get order book
OrderApi GetOrderDetails GET /order/history Get order history
OrderApi GetTradeHistory GET /order/trades/get-trades-for-day Get trades
OrderApi GetTradesByOrder GET /order/trades Get trades for order
OrderApi ModifyOrder PUT /order/modify Modify order
OrderApi PlaceOrder POST /order/place Place order
PortfolioApi ConvertPositions PUT /portfolio/convert-position Convert Positions
PortfolioApi GetHoldings GET /portfolio/long-term-holdings Get Holdings
PortfolioApi GetPositions GET /portfolio/short-term-positions Get Positions
TradeProfitAndLossApi GetProfitAndLossCharges GET /trade/profit-loss/charges Get profit and loss on trades
TradeProfitAndLossApi GetTradeWiseProfitAndLossData GET /trade/profit-loss/data Get Trade-wise Profit and Loss Report Data
TradeProfitAndLossApi GetTradeWiseProfitAndLossMetaData GET /trade/profit-loss/metadata Get profit and loss meta data on trades
UserApi GetProfile GET /user/profile Get profile
UserApi GetUserFundMargin GET /user/get-funds-and-margin Get User Fund And Margin
WebsocketApi GetMarketDataFeed GET /feed/market-data-feed Market Data Feed
WebsocketApi GetMarketDataFeedAuthorize GET /feed/market-data-feed/authorize Market Data Feed Authorize
WebsocketApi GetPortfolioStreamFeed GET /feed/portfolio-stream-feed Portfolio Stream Feed
WebsocketApi GetPortfolioStreamFeedAuthorize GET /feed/portfolio-stream-feed/authorize Portfolio Stream Feed Authorize

Documentation for Models

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.0 388 3/19/2024
1.1.0 279 12/27/2023
1.0.0 382 10/6/2023