upstox-dotnet-sdk
1.0.0
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
<PackageReference Include="upstox-dotnet-sdk" Version="1.0.0" />
paket add upstox-dotnet-sdk --version 1.0.0
#r "nuget: upstox-dotnet-sdk, 1.0.0"
// 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.
Frameworks supported
.NET 4.0 or later
Windows Phone 7.1 (Mango)
Dependencies
RestSharp - 105.1.0 or later
Json.NET - 7.0.0 or later
JsonSubTypes - 1.2.0 or later
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
- Model.ApiGatewayErrorResponse
- Model.BrokerageData
- Model.BrokerageTaxes
- Model.BrokerageWrapperData
- Model.CancelOrderData
- Model.CancelOrderResponse
- Model.ConvertPositionData
- Model.ConvertPositionRequest
- Model.ConvertPositionResponse
- Model.Depth
- Model.DepthMap
- Model.DpPlan
- Model.GetBrokerageResponse
- Model.GetFullMarketQuoteResponse
- Model.GetHistoricalCandleResponse
- Model.GetHoldingsResponse
- Model.GetIntraDayCandleResponse
- Model.GetMarketQuoteLastTradedPriceResponse
- Model.GetMarketQuoteOHLCResponse
- Model.GetOrderBookResponse
- Model.GetOrderResponse
- Model.GetPositionResponse
- Model.GetProfileResponse
- Model.GetProfitAndLossChargesResponse
- Model.GetTradeResponse
- Model.GetTradeWiseProfitAndLossDataResponse
- Model.GetTradeWiseProfitAndLossMetaDataResponse
- Model.GetUserFundMarginResponse
- Model.HistoricalCandleData
- Model.HoldingsData
- Model.IntraDayCandleData
- Model.LogoutResponse
- Model.MarketQuoteOHLC
- Model.MarketQuoteSymbol
- Model.MarketQuoteSymbolLtp
- Model.ModifyOrderData
- Model.ModifyOrderRequest
- Model.ModifyOrderResponse
- Model.OAuthClientException
- Model.OAuthClientExceptionCause
- Model.OAuthClientExceptionCauseStackTrace
- Model.OAuthClientExceptionCauseSuppressed
- Model.Ohlc
- Model.OrderBookData
- Model.OrderData
- Model.OtherTaxes
- Model.PlaceOrderData
- Model.PlaceOrderRequest
- Model.PlaceOrderResponse
- Model.PositionData
- Model.Problem
- Model.ProfileData
- Model.ProfitAndLossChargesData
- Model.ProfitAndLossChargesTaxes
- Model.ProfitAndLossChargesWrapperData
- Model.ProfitAndLossMetaData
- Model.ProfitAndLossMetaDataWrapper
- Model.ProfitAndLossOtherChargesTaxes
- Model.TokenRequest
- Model.TokenResponse
- Model.TradeData
- Model.TradeWiseMetaData
- Model.TradeWiseProfitAndLossData
- Model.UserFundMarginData
- Model.WebsocketAuthRedirectResponse
- Model.WebsocketAuthRedirectResponseData
Learn more about Target Frameworks and .NET Standard.
-
- JsonSubTypes (>= 1.2.0)
- NewtonSoft.Json (>= 13.0.1)
- RestSharp (>= 105.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.