Skip to content

New apis #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 34 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The official Python client for communicating with the <a href="https://upstox.co
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.14.0
- Package version: 2.15.0
- Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen

This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project.
Expand Down Expand Up @@ -90,9 +90,16 @@ Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*ChargeApi* | [**get_brokerage**](docs/ChargeApi.md#get_brokerage) | **GET** /v2/charges/brokerage | Brokerage details
*ChargeApi* | [**post_margin**](docs/ChargeApi.md#post_margin) | **POST** /v2/charges/margin | Calculate Margin
*HistoryApi* | [**get_historical_candle_data**](docs/HistoryApi.md#get_historical_candle_data) | **GET** /v2/historical-candle/{instrumentKey}/{interval}/{to_date} | Historical candle data
*HistoryApi* | [**get_historical_candle_data1**](docs/HistoryApi.md#get_historical_candle_data1) | **GET** /v2/historical-candle/{instrumentKey}/{interval}/{to_date}/{from_date} | Historical candle data
*HistoryApi* | [**get_intra_day_candle_data**](docs/HistoryApi.md#get_intra_day_candle_data) | **GET** /v2/historical-candle/intraday/{instrumentKey}/{interval} | Intra day candle data
*ExpiredInstrumentApi* | [**get_expired_future_contracts**](docs/ExpiredInstrumentApi.md#get_expired_future_contracts) | **GET** /v2/expired-instruments/future/contract | Expired instruments - Get future contracts
*ExpiredInstrumentApi* | [**get_expired_historical_candle_data**](docs/ExpiredInstrumentApi.md#get_expired_historical_candle_data) | **GET** /v2/expired-instruments/historical-candle/{expired_instrument_key}/{interval}/{to_date}/{from_date} | Expired Historical candle data
*ExpiredInstrumentApi* | [**get_expired_option_contracts**](docs/ExpiredInstrumentApi.md#get_expired_option_contracts) | **GET** /v2/expired-instruments/option/contract | Get expired option contracts
*ExpiredInstrumentApi* | [**get_expiries**](docs/ExpiredInstrumentApi.md#get_expiries) | **GET** /v2/expired-instruments/expiries | Expired instruments - Get expiries
*HistoryApi* | [**get_historical_candle_data2**](docs/HistoryApi.md#get_historical_candle_data2) | **GET** /v2/historical-candle/{instrumentKey}/{interval}/{to_date} | Historical candle data
*HistoryApi* | [**get_historical_candle_data3**](docs/HistoryApi.md#get_historical_candle_data3) | **GET** /v2/historical-candle/{instrumentKey}/{interval}/{to_date}/{from_date} | Historical candle data
*HistoryApi* | [**get_intra_day_candle_data1**](docs/HistoryApi.md#get_intra_day_candle_data1) | **GET** /v2/historical-candle/intraday/{instrumentKey}/{interval} | Intra day candle data
*HistoryV3Api* | [**get_historical_candle_data**](docs/HistoryV3Api.md#get_historical_candle_data) | **GET** /v3/historical-candle/{instrumentKey}/{unit}/{interval}/{to_date} | Historical candle data
*HistoryV3Api* | [**get_historical_candle_data1**](docs/HistoryV3Api.md#get_historical_candle_data1) | **GET** /v3/historical-candle/{instrumentKey}/{unit}/{interval}/{to_date}/{from_date} | Historical candle data
*HistoryV3Api* | [**get_intra_day_candle_data**](docs/HistoryV3Api.md#get_intra_day_candle_data) | **GET** /v3/historical-candle/intraday/{instrumentKey}/{unit}/{interval} | Intra day candle data
*LoginApi* | [**authorize**](docs/LoginApi.md#authorize) | **GET** /v2/login/authorization/dialog | Authorize API
*LoginApi* | [**init_token_request_for_indie_user**](docs/LoginApi.md#init_token_request_for_indie_user) | **POST** /v3/login/auth/token/request/{client_id} | Init token API
*LoginApi* | [**logout**](docs/LoginApi.md#logout) | **DELETE** /v2/logout | Logout
Expand All @@ -104,6 +111,9 @@ Class | Method | HTTP request | Description
*MarketQuoteApi* | [**get_full_market_quote**](docs/MarketQuoteApi.md#get_full_market_quote) | **GET** /v2/market-quote/quotes | Market quotes and instruments - Full market quotes
*MarketQuoteApi* | [**get_market_quote_ohlc**](docs/MarketQuoteApi.md#get_market_quote_ohlc) | **GET** /v2/market-quote/ohlc | Market quotes and instruments - OHLC quotes
*MarketQuoteApi* | [**ltp**](docs/MarketQuoteApi.md#ltp) | **GET** /v2/market-quote/ltp | Market quotes and instruments - LTP quotes.
*MarketQuoteV3Api* | [**get_ltp**](docs/MarketQuoteV3Api.md#get_ltp) | **GET** /v3/market-quote/ltp | Market quotes and instruments - LTP quotes.
*MarketQuoteV3Api* | [**get_market_quote_ohlc**](docs/MarketQuoteV3Api.md#get_market_quote_ohlc) | **GET** /v3/market-quote/ohlc | Market quotes and instruments - OHLC quotes
*MarketQuoteV3Api* | [**get_market_quote_option_greek**](docs/MarketQuoteV3Api.md#get_market_quote_option_greek) | **GET** /v3/market-quote/option-greek | Market quotes and instruments - Option Greek
*OptionsApi* | [**get_option_contracts**](docs/OptionsApi.md#get_option_contracts) | **GET** /v2/option/contract | Get option contracts
*OptionsApi* | [**get_put_call_option_chain**](docs/OptionsApi.md#get_put_call_option_chain) | **GET** /v2/option/chain | Get option chain
*OrderApi* | [**cancel_multi_order**](docs/OrderApi.md#cancel_multi_order) | **DELETE** /v2/order/multi/cancel | Cancel multi order
Expand All @@ -119,6 +129,7 @@ Class | Method | HTTP request | Description
*OrderApi* | [**place_order**](docs/OrderApi.md#place_order) | **POST** /v2/order/place | Place order
*PortfolioApi* | [**convert_positions**](docs/PortfolioApi.md#convert_positions) | **PUT** /v2/portfolio/convert-position | Convert Positions
*PortfolioApi* | [**get_holdings**](docs/PortfolioApi.md#get_holdings) | **GET** /v2/portfolio/long-term-holdings | Get Holdings
*PortfolioApi* | [**get_mtf_positions**](docs/PortfolioApi.md#get_mtf_positions) | **GET** /v3/portfolio/mtf-positions | Get MTF positions
*PortfolioApi* | [**get_positions**](docs/PortfolioApi.md#get_positions) | **GET** /v2/portfolio/short-term-positions | Get Positions
*PostTradeApi* | [**get_trades_by_date_range**](docs/PostTradeApi.md#get_trades_by_date_range) | **GET** /v2/charges/historical-trades | Get historical trades
*TradeProfitAndLossApi* | [**get_profit_and_loss_charges**](docs/TradeProfitAndLossApi.md#get_profit_and_loss_charges) | **GET** /v2/trade/profit-loss/charges | Get profit and loss on trades
Expand Down Expand Up @@ -809,15 +820,22 @@ if __name__ == "__main__":
- [DepthMap](docs/DepthMap.md)
- [DpPlan](docs/DpPlan.md)
- [ExchangeTimingData](docs/ExchangeTimingData.md)
- [ExpiredFutureData](docs/ExpiredFutureData.md)
- [GetBrokerageResponse](docs/GetBrokerageResponse.md)
- [GetExchangeTimingResponse](docs/GetExchangeTimingResponse.md)
- [GetExpiredFuturesContractResponse](docs/GetExpiredFuturesContractResponse.md)
- [GetExpiriesResponse](docs/GetExpiriesResponse.md)
- [GetFullMarketQuoteResponse](docs/GetFullMarketQuoteResponse.md)
- [GetGttOrderResponse](docs/GetGttOrderResponse.md)
- [GetHistoricalCandleResponse](docs/GetHistoricalCandleResponse.md)
- [GetHoldingsResponse](docs/GetHoldingsResponse.md)
- [GetHolidayResponse](docs/GetHolidayResponse.md)
- [GetIntraDayCandleResponse](docs/GetIntraDayCandleResponse.md)
- [GetMarketQuoteLastTradedPriceResponse](docs/GetMarketQuoteLastTradedPriceResponse.md)
- [GetMarketQuoteLastTradedPriceResponseV3](docs/GetMarketQuoteLastTradedPriceResponseV3.md)
- [GetMarketQuoteOHLCResponse](docs/GetMarketQuoteOHLCResponse.md)
- [GetMarketQuoteOHLCResponseV3](docs/GetMarketQuoteOHLCResponseV3.md)
- [GetMarketQuoteOptionGreekResponseV3](docs/GetMarketQuoteOptionGreekResponseV3.md)
- [GetMarketStatusResponse](docs/GetMarketStatusResponse.md)
- [GetOptionChainResponse](docs/GetOptionChainResponse.md)
- [GetOptionContractResponse](docs/GetOptionContractResponse.md)
Expand All @@ -831,6 +849,13 @@ if __name__ == "__main__":
- [GetTradeWiseProfitAndLossDataResponse](docs/GetTradeWiseProfitAndLossDataResponse.md)
- [GetTradeWiseProfitAndLossMetaDataResponse](docs/GetTradeWiseProfitAndLossMetaDataResponse.md)
- [GetUserFundMarginResponse](docs/GetUserFundMarginResponse.md)
- [GttCancelOrderRequest](docs/GttCancelOrderRequest.md)
- [GttModifyOrderRequest](docs/GttModifyOrderRequest.md)
- [GttOrderData](docs/GttOrderData.md)
- [GttOrderDetails](docs/GttOrderDetails.md)
- [GttPlaceOrderRequest](docs/GttPlaceOrderRequest.md)
- [GttRule](docs/GttRule.md)
- [GttTriggerOrderResponse](docs/GttTriggerOrderResponse.md)
- [HistoricalCandleData](docs/HistoricalCandleData.md)
- [HoldingsData](docs/HoldingsData.md)
- [HolidayData](docs/HolidayData.md)
Expand All @@ -846,8 +871,11 @@ if __name__ == "__main__":
- [MarginRequest](docs/MarginRequest.md)
- [MarketData](docs/MarketData.md)
- [MarketQuoteOHLC](docs/MarketQuoteOHLC.md)
- [MarketQuoteOHLCV3](docs/MarketQuoteOHLCV3.md)
- [MarketQuoteOptionGreekV3](docs/MarketQuoteOptionGreekV3.md)
- [MarketQuoteSymbol](docs/MarketQuoteSymbol.md)
- [MarketQuoteSymbolLtp](docs/MarketQuoteSymbolLtp.md)
- [MarketQuoteSymbolLtpV3](docs/MarketQuoteSymbolLtpV3.md)
- [MarketStatusData](docs/MarketStatusData.md)
- [ModifyOrderData](docs/ModifyOrderData.md)
- [ModifyOrderRequest](docs/ModifyOrderRequest.md)
Expand All @@ -864,6 +892,7 @@ if __name__ == "__main__":
- [OAuthClientExceptionCauseStackTrace](docs/OAuthClientExceptionCauseStackTrace.md)
- [OAuthClientExceptionCauseSuppressed](docs/OAuthClientExceptionCauseSuppressed.md)
- [Ohlc](docs/Ohlc.md)
- [OhlcV3](docs/OhlcV3.md)
- [OptionStrikeData](docs/OptionStrikeData.md)
- [OrderBookData](docs/OrderBookData.md)
- [OrderData](docs/OrderData.md)
Expand All @@ -885,6 +914,7 @@ if __name__ == "__main__":
- [ProfitAndLossMetaDataWrapper](docs/ProfitAndLossMetaDataWrapper.md)
- [ProfitAndLossOtherChargesTaxes](docs/ProfitAndLossOtherChargesTaxes.md)
- [PutCallOptionChainData](docs/PutCallOptionChainData.md)
- [Rule](docs/Rule.md)
- [TokenRequest](docs/TokenRequest.md)
- [TokenResponse](docs/TokenResponse.md)
- [TradeData](docs/TradeData.md)
Expand Down
23 changes: 23 additions & 0 deletions docs/ExpiredFutureData.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# ExpiredFutureData

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | Name of the instrument | [optional]
**segment** | **str** | Segment of the instrument | [optional]
**exchange** | **str** | Exchange of the instrument | [optional]
**expiry** | **str** | Expiry date of the instrument | [optional]
**instrument_key** | **str** | Unique key identifying the instrument | [optional]
**exchange_token** | **str** | Token assigned by the exchange | [optional]
**trading_symbol** | **str** | Symbol used for trading | [optional]
**tick_size** | **float** | Minimum price movement | [optional]
**lot_size** | **int** | Number of units per lot | [optional]
**instrument_type** | **str** | Type of the instrument | [optional]
**freeze_quantity** | **float** | Maximum allowed quantity | [optional]
**underlying_key** | **str** | Key of the underlying asset | [optional]
**underlying_type** | **str** | Type of the underlying asset | [optional]
**underlying_symbol** | **str** | Symbol of the underlying asset | [optional]
**minimum_lot** | **int** | Minimum lot size | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

229 changes: 229 additions & 0 deletions docs/ExpiredInstrumentApi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
# upstox_client.ExpiredInstrumentApi

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

Method | HTTP request | Description
------------- | ------------- | -------------
[**get_expired_future_contracts**](ExpiredInstrumentApi.md#get_expired_future_contracts) | **GET** /v2/expired-instruments/future/contract | Expired instruments - Get future contracts
[**get_expired_historical_candle_data**](ExpiredInstrumentApi.md#get_expired_historical_candle_data) | **GET** /v2/expired-instruments/historical-candle/{expired_instrument_key}/{interval}/{to_date}/{from_date} | Expired Historical candle data
[**get_expired_option_contracts**](ExpiredInstrumentApi.md#get_expired_option_contracts) | **GET** /v2/expired-instruments/option/contract | Get expired option contracts
[**get_expiries**](ExpiredInstrumentApi.md#get_expiries) | **GET** /v2/expired-instruments/expiries | Expired instruments - Get expiries

# **get_expired_future_contracts**
> GetExpiredFuturesContractResponse get_expired_future_contracts(instrument_key, expiry_date)

Expired instruments - Get future contracts

This API provides the functionality to retrieve expired future contracts for a given instrument key and expiry date.

### Example
```python
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.ExpiredInstrumentApi(upstox_client.ApiClient(configuration))
instrument_key = 'instrument_key_example' # str | Instrument Key of asset
expiry_date = 'expiry_date_example' # str | Expiry date of the instrument

try:
# Expired instruments - Get future contracts
api_response = api_instance.get_expired_future_contracts(instrument_key, expiry_date)
pprint(api_response)
except ApiException as e:
print("Exception when calling ExpiredInstrumentApi->get_expired_future_contracts: %s\n" % e)
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**instrument_key** | **str**| Instrument Key of asset |
**expiry_date** | **str**| Expiry date of the instrument |

### Return type

[**GetExpiredFuturesContractResponse**](GetExpiredFuturesContractResponse.md)

### Authorization

[OAUTH2](../README.md#OAUTH2)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json, */*

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **get_expired_historical_candle_data**
> GetHistoricalCandleResponse get_expired_historical_candle_data(expired_instrument_key, interval, to_date, from_date)

Expired Historical candle data

Get Expired OHLC values for all instruments across various timeframes. Expired Historical data can be fetched for the following durations. 1minute: last 1 month candles till endDate 30minute: last 1 year candles till endDate day: last 1 year candles till endDate week: last 10 year candles till endDate month: last 10 year candles till endDate

### Example
```python
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.ExpiredInstrumentApi(upstox_client.ApiClient(configuration))
expired_instrument_key = 'expired_instrument_key_example' # str | Expired Instrument Key of asset
interval = 'interval_example' # str | Interval to get expired ohlc data
to_date = 'to_date_example' # str | to date
from_date = 'from_date_example' # str | from date

try:
# Expired Historical candle data
api_response = api_instance.get_expired_historical_candle_data(expired_instrument_key, interval, to_date, from_date)
pprint(api_response)
except ApiException as e:
print("Exception when calling ExpiredInstrumentApi->get_expired_historical_candle_data: %s\n" % e)
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**expired_instrument_key** | **str**| Expired Instrument Key of asset |
**interval** | **str**| Interval to get expired ohlc data |
**to_date** | **str**| to date |
**from_date** | **str**| from date |

### Return type

[**GetHistoricalCandleResponse**](GetHistoricalCandleResponse.md)

### Authorization

[OAUTH2](../README.md#OAUTH2)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json, */*

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **get_expired_option_contracts**
> GetOptionContractResponse get_expired_option_contracts(instrument_key, expiry_date)

Get expired option contracts

This API provides the functionality to retrieve the expired option contracts

### Example
```python
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.ExpiredInstrumentApi(upstox_client.ApiClient(configuration))
instrument_key = 'instrument_key_example' # str | Instrument key for an underlying symbol
expiry_date = 'expiry_date_example' # str | Expiry date in format: YYYY-mm-dd

try:
# Get expired option contracts
api_response = api_instance.get_expired_option_contracts(instrument_key, expiry_date)
pprint(api_response)
except ApiException as e:
print("Exception when calling ExpiredInstrumentApi->get_expired_option_contracts: %s\n" % e)
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**instrument_key** | **str**| Instrument key for an underlying symbol |
**expiry_date** | **str**| Expiry date in format: YYYY-mm-dd |

### Return type

[**GetOptionContractResponse**](GetOptionContractResponse.md)

### Authorization

[OAUTH2](../README.md#OAUTH2)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json, */*

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **get_expiries**
> GetExpiriesResponse get_expiries(instrument_key)

Expired instruments - Get expiries

This API provides the functionality to retrieve expiry dates for a given instrument key.

### Example
```python
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.ExpiredInstrumentApi(upstox_client.ApiClient(configuration))
instrument_key = 'instrument_key_example' # str | Instrument Key of asset

try:
# Expired instruments - Get expiries
api_response = api_instance.get_expiries(instrument_key)
pprint(api_response)
except ApiException as e:
print("Exception when calling ExpiredInstrumentApi->get_expiries: %s\n" % e)
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**instrument_key** | **str**| Instrument Key of asset |

### Return type

[**GetExpiriesResponse**](GetExpiriesResponse.md)

### Authorization

[OAUTH2](../README.md#OAUTH2)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json, */*

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

Loading
Loading