Skip to content

added update_types parameter #75

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

Merged
merged 9 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ coverage.xml
*,cover
.hypothesis/
venv/
myenv/
.python-version

# Translations
Expand Down
113 changes: 83 additions & 30 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.4.1
- Package version: 2.5.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 @@ -64,35 +64,41 @@ All URIs are relative to *https://api.upstox.com/v2/*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*ChargeApi* | [**get_brokerage**](docs/ChargeApi.md#get_brokerage) | **GET** /charges/brokerage | Brokerage details
*HistoryApi* | [**get_historical_candle_data**](docs/HistoryApi.md#get_historical_candle_data) | **GET** /historical-candle/{instrumentKey}/{interval}/{to_date} | Historical candle data
*HistoryApi* | [**get_historical_candle_data1**](docs/HistoryApi.md#get_historical_candle_data1) | **GET** /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** /historical-candle/intraday/{instrumentKey}/{interval} | Intra day candle data
*LoginApi* | [**authorize**](docs/LoginApi.md#authorize) | **GET** /login/authorization/dialog | Authorize API
*LoginApi* | [**logout**](docs/LoginApi.md#logout) | **DELETE** /logout | Logout
*LoginApi* | [**token**](docs/LoginApi.md#token) | **POST** /login/authorization/token | Get token API
*MarketQuoteApi* | [**get_full_market_quote**](docs/MarketQuoteApi.md#get_full_market_quote) | **GET** /market-quote/quotes | Market quotes and instruments - Full market quotes
*MarketQuoteApi* | [**get_market_quote_ohlc**](docs/MarketQuoteApi.md#get_market_quote_ohlc) | **GET** /market-quote/ohlc | Market quotes and instruments - OHLC quotes
*MarketQuoteApi* | [**ltp**](docs/MarketQuoteApi.md#ltp) | **GET** /market-quote/ltp | Market quotes and instruments - LTP quotes.
*OrderApi* | [**cancel_order**](docs/OrderApi.md#cancel_order) | **DELETE** /order/cancel | Cancel order
*OrderApi* | [**get_order_book**](docs/OrderApi.md#get_order_book) | **GET** /order/retrieve-all | Get order book
*OrderApi* | [**get_order_details**](docs/OrderApi.md#get_order_details) | **GET** /order/history | Get order details
*OrderApi* | [**get_trade_history**](docs/OrderApi.md#get_trade_history) | **GET** /order/trades/get-trades-for-day | Get trades
*OrderApi* | [**get_trades_by_order**](docs/OrderApi.md#get_trades_by_order) | **GET** /order/trades | Get trades for order
*OrderApi* | [**modify_order**](docs/OrderApi.md#modify_order) | **PUT** /order/modify | Modify order
*OrderApi* | [**place_order**](docs/OrderApi.md#place_order) | **POST** /order/place | Place order
*PortfolioApi* | [**convert_positions**](docs/PortfolioApi.md#convert_positions) | **PUT** /portfolio/convert-position | Convert Positions
*PortfolioApi* | [**get_holdings**](docs/PortfolioApi.md#get_holdings) | **GET** /portfolio/long-term-holdings | Get Holdings
*PortfolioApi* | [**get_positions**](docs/PortfolioApi.md#get_positions) | **GET** /portfolio/short-term-positions | Get Positions
*TradeProfitAndLossApi* | [**get_profit_and_loss_charges**](docs/TradeProfitAndLossApi.md#get_profit_and_loss_charges) | **GET** /trade/profit-loss/charges | Get profit and loss on trades
*TradeProfitAndLossApi* | [**get_trade_wise_profit_and_loss_data**](docs/TradeProfitAndLossApi.md#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**](docs/TradeProfitAndLossApi.md#get_trade_wise_profit_and_loss_meta_data) | **GET** /trade/profit-loss/metadata | Get profit and loss meta data on trades
*UserApi* | [**get_profile**](docs/UserApi.md#get_profile) | **GET** /user/profile | Get profile
*UserApi* | [**get_user_fund_margin**](docs/UserApi.md#get_user_fund_margin) | **GET** /user/get-funds-and-margin | Get User Fund And Margin
*WebsocketApi* | [**get_market_data_feed**](docs/WebsocketApi.md#get_market_data_feed) | **GET** /feed/market-data-feed | Market Data Feed
*WebsocketApi* | [**get_market_data_feed_authorize**](docs/WebsocketApi.md#get_market_data_feed_authorize) | **GET** /feed/market-data-feed/authorize | Market Data Feed Authorize
*WebsocketApi* | [**get_portfolio_stream_feed**](docs/WebsocketApi.md#get_portfolio_stream_feed) | **GET** /feed/portfolio-stream-feed | Portfolio Stream Feed
*WebsocketApi* | [**get_portfolio_stream_feed_authorize**](docs/WebsocketApi.md#get_portfolio_stream_feed_authorize) | **GET** /feed/portfolio-stream-feed/authorize | Portfolio Stream Feed Authorize
*ChargeApi* | [**get_brokerage**](docs/ChargeApi.md#get_brokerage) | **GET** /v2/charges/brokerage | Brokerage details
*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
*LoginApi* | [**authorize**](docs/LoginApi.md#authorize) | **GET** /v2/login/authorization/dialog | Authorize API
*LoginApi* | [**logout**](docs/LoginApi.md#logout) | **DELETE** /v2/logout | Logout
*LoginApi* | [**token**](docs/LoginApi.md#token) | **POST** /v2/login/authorization/token | Get token API
*MarketHolidaysAndTimingsApi* | [**get_exchange_timings**](docs/MarketHolidaysAndTimingsApi.md#get_exchange_timings) | **GET** /v2/market/timings/{date} | Get Exchange Timings on particular date
*MarketHolidaysAndTimingsApi* | [**get_holiday**](docs/MarketHolidaysAndTimingsApi.md#get_holiday) | **GET** /v2/market/holidays/{date} | Get Holiday on particular date
*MarketHolidaysAndTimingsApi* | [**get_holidays**](docs/MarketHolidaysAndTimingsApi.md#get_holidays) | **GET** /v2/market/holidays | Get Holiday list of current year
*MarketHolidaysAndTimingsApi* | [**get_market_status**](docs/MarketHolidaysAndTimingsApi.md#get_market_status) | **GET** /v2/market/status/{exchange} | Get Market status for particular exchange
*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.
*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_order**](docs/OrderApi.md#cancel_order) | **DELETE** /v2/order/cancel | Cancel order
*OrderApi* | [**get_order_book**](docs/OrderApi.md#get_order_book) | **GET** /v2/order/retrieve-all | Get order book
*OrderApi* | [**get_order_details**](docs/OrderApi.md#get_order_details) | **GET** /v2/order/history | Get order history
*OrderApi* | [**get_trade_history**](docs/OrderApi.md#get_trade_history) | **GET** /v2/order/trades/get-trades-for-day | Get trades
*OrderApi* | [**get_trades_by_order**](docs/OrderApi.md#get_trades_by_order) | **GET** /v2/order/trades | Get trades for order
*OrderApi* | [**modify_order**](docs/OrderApi.md#modify_order) | **PUT** /v2/order/modify | Modify order
*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_positions**](docs/PortfolioApi.md#get_positions) | **GET** /v2/portfolio/short-term-positions | Get Positions
*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
*TradeProfitAndLossApi* | [**get_trade_wise_profit_and_loss_data**](docs/TradeProfitAndLossApi.md#get_trade_wise_profit_and_loss_data) | **GET** /v2/trade/profit-loss/data | Get Trade-wise Profit and Loss Report Data
*TradeProfitAndLossApi* | [**get_trade_wise_profit_and_loss_meta_data**](docs/TradeProfitAndLossApi.md#get_trade_wise_profit_and_loss_meta_data) | **GET** /v2/trade/profit-loss/metadata | Get profit and loss meta data on trades
*UserApi* | [**get_profile**](docs/UserApi.md#get_profile) | **GET** /v2/user/profile | Get profile
*UserApi* | [**get_user_fund_margin**](docs/UserApi.md#get_user_fund_margin) | **GET** /v2/user/get-funds-and-margin | Get User Fund And Margin
*WebsocketApi* | [**get_market_data_feed**](docs/WebsocketApi.md#get_market_data_feed) | **GET** /v2/feed/market-data-feed | Market Data Feed
*WebsocketApi* | [**get_market_data_feed_authorize**](docs/WebsocketApi.md#get_market_data_feed_authorize) | **GET** /v2/feed/market-data-feed/authorize | Market Data Feed Authorize
*WebsocketApi* | [**get_portfolio_stream_feed**](docs/WebsocketApi.md#get_portfolio_stream_feed) | **GET** /v2/feed/portfolio-stream-feed | Portfolio Stream Feed
*WebsocketApi* | [**get_portfolio_stream_feed_authorize**](docs/WebsocketApi.md#get_portfolio_stream_feed_authorize) | **GET** /v2/feed/portfolio-stream-feed/authorize | Portfolio Stream Feed Authorize

## Documentation for Feeder Functions

Expand Down Expand Up @@ -404,6 +410,40 @@ def main():
if __name__ == "__main__":
main()
```
<br/>

Position and holding updates can be enabled by setting the corresponding flag to `True` in the constructor of the `PortfolioDataStreamer` class.

```python
import upstox_client
import data_token


def on_message(message):
print(message)


def on_open():
print("connection opened")


def main():
configuration = upstox_client.Configuration()
configuration.access_token = <ACCESS_TOKEN>

streamer = upstox_client.PortfolioDataStreamer(upstox_client.ApiClient(configuration),order_update=True,position_update=True,holding_update=True)

streamer.on("message", on_message)
streamer.on("open", on_open)
streamer.connect()


if __name__ == "__main__":
main()

```

<br/>

This example demonstrates initializing the PortfolioDataStreamer, connecting it to the WebSocket, and setting up an event listener to receive and print order updates. Replace <ACCESS_TOKEN> with your valid access token to authenticate the session.

Expand All @@ -425,6 +465,7 @@ This example demonstrates initializing the PortfolioDataStreamer, connecting it

## Documentation For Models

- [AnalyticsData](docs/AnalyticsData.md)
- [ApiGatewayErrorResponse](docs/ApiGatewayErrorResponse.md)
- [BrokerageData](docs/BrokerageData.md)
- [BrokerageTaxes](docs/BrokerageTaxes.md)
Expand All @@ -437,13 +478,19 @@ This example demonstrates initializing the PortfolioDataStreamer, connecting it
- [Depth](docs/Depth.md)
- [DepthMap](docs/DepthMap.md)
- [DpPlan](docs/DpPlan.md)
- [ExchangeTimingData](docs/ExchangeTimingData.md)
- [GetBrokerageResponse](docs/GetBrokerageResponse.md)
- [GetExchangeTimingResponse](docs/GetExchangeTimingResponse.md)
- [GetFullMarketQuoteResponse](docs/GetFullMarketQuoteResponse.md)
- [GetHistoricalCandleResponse](docs/GetHistoricalCandleResponse.md)
- [GetHoldingsResponse](docs/GetHoldingsResponse.md)
- [GetHolidayResponse](docs/GetHolidayResponse.md)
- [GetIntraDayCandleResponse](docs/GetIntraDayCandleResponse.md)
- [GetMarketQuoteLastTradedPriceResponse](docs/GetMarketQuoteLastTradedPriceResponse.md)
- [GetMarketQuoteOHLCResponse](docs/GetMarketQuoteOHLCResponse.md)
- [GetMarketStatusResponse](docs/GetMarketStatusResponse.md)
- [GetOptionChainResponse](docs/GetOptionChainResponse.md)
- [GetOptionContractResponse](docs/GetOptionContractResponse.md)
- [GetOrderBookResponse](docs/GetOrderBookResponse.md)
- [GetOrderResponse](docs/GetOrderResponse.md)
- [GetPositionResponse](docs/GetPositionResponse.md)
Expand All @@ -455,11 +502,15 @@ This example demonstrates initializing the PortfolioDataStreamer, connecting it
- [GetUserFundMarginResponse](docs/GetUserFundMarginResponse.md)
- [HistoricalCandleData](docs/HistoricalCandleData.md)
- [HoldingsData](docs/HoldingsData.md)
- [HolidayData](docs/HolidayData.md)
- [InstrumentData](docs/InstrumentData.md)
- [IntraDayCandleData](docs/IntraDayCandleData.md)
- [LogoutResponse](docs/LogoutResponse.md)
- [MarketData](docs/MarketData.md)
- [MarketQuoteOHLC](docs/MarketQuoteOHLC.md)
- [MarketQuoteSymbol](docs/MarketQuoteSymbol.md)
- [MarketQuoteSymbolLtp](docs/MarketQuoteSymbolLtp.md)
- [MarketStatusData](docs/MarketStatusData.md)
- [ModifyOrderData](docs/ModifyOrderData.md)
- [ModifyOrderRequest](docs/ModifyOrderRequest.md)
- [ModifyOrderResponse](docs/ModifyOrderResponse.md)
Expand All @@ -468,6 +519,7 @@ This example demonstrates initializing the PortfolioDataStreamer, connecting it
- [OAuthClientExceptionCauseStackTrace](docs/OAuthClientExceptionCauseStackTrace.md)
- [OAuthClientExceptionCauseSuppressed](docs/OAuthClientExceptionCauseSuppressed.md)
- [Ohlc](docs/Ohlc.md)
- [OptionStrikeData](docs/OptionStrikeData.md)
- [OrderBookData](docs/OrderBookData.md)
- [OrderData](docs/OrderData.md)
- [OtherTaxes](docs/OtherTaxes.md)
Expand All @@ -483,6 +535,7 @@ This example demonstrates initializing the PortfolioDataStreamer, connecting it
- [ProfitAndLossMetaData](docs/ProfitAndLossMetaData.md)
- [ProfitAndLossMetaDataWrapper](docs/ProfitAndLossMetaDataWrapper.md)
- [ProfitAndLossOtherChargesTaxes](docs/ProfitAndLossOtherChargesTaxes.md)
- [PutCallOptionChainData](docs/PutCallOptionChainData.md)
- [TokenRequest](docs/TokenRequest.md)
- [TokenResponse](docs/TokenResponse.md)
- [TradeData](docs/TradeData.md)
Expand Down
11 changes: 11 additions & 0 deletions docs/ExchangeTimingData.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# ExchangeTimingData

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**exchange** | **str** | | [optional]
**start_time** | **int** | | [optional]
**end_time** | **int** | | [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)

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

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**status** | **str** | | [optional]
**data** | [**list[ExchangeTimingData]**](ExchangeTimingData.md) | Response data for exchange timing list | [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)

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

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**status** | **str** | | [optional]
**data** | [**list[HolidayData]**](HolidayData.md) | Response data for holiday list | [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)

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

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**status** | **str** | | [optional]
**data** | [**MarketStatusData**](MarketStatusData.md) | | [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)

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

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**status** | **str** | | [optional]
**data** | [**list[OptionStrikeData]**](OptionStrikeData.md) | Response data for option chain data | [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)

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

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**status** | **str** | | [optional]
**data** | [**list[InstrumentData]**](InstrumentData.md) | Response data for option contracts | [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)

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

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_date** | **datetime** | | [optional]
**description** | **str** | | [optional]
**holiday_type** | **str** | | [optional]
**closed_exchanges** | **list[str]** | | [optional]
**open_exchanges** | [**list[ExchangeTimingData]**](ExchangeTimingData.md) | | [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)

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

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | | [optional]
**segment** | **str** | | [optional]
**exchange** | **str** | | [optional]
**isin** | **str** | | [optional]
**expiry** | **datetime** | | [optional]
**country** | **str** | | [optional]
**latency** | **str** | | [optional]
**description** | **str** | | [optional]
**currency** | **str** | | [optional]
**weekly** | **bool** | | [optional]
**instrument_key** | **str** | | [optional]
**exchange_token** | **str** | | [optional]
**trading_symbol** | **str** | | [optional]
**short_name** | **str** | | [optional]
**tick_size** | **float** | | [optional]
**lot_size** | **int** | | [optional]
**instrument_type** | **str** | | [optional]
**freeze_quantity** | **float** | | [optional]
**underlying_key** | **str** | | [optional]
**underlying_type** | **str** | | [optional]
**underlying_symbol** | **str** | | [optional]
**last_trading_date** | **datetime** | | [optional]
**strike_price** | **float** | | [optional]
**price_quote_unit** | **str** | | [optional]
**qty_multiplier** | **int** | | [optional]
**minimum_lot** | **int** | | [optional]
**start_time** | **str** | | [optional]
**end_time** | **str** | | [optional]
**week_days** | **str** | | [optional]
**general_denominator** | **float** | | [optional]
**general_numerator** | **float** | | [optional]
**price_numerator** | **float** | | [optional]
**price_denominator** | **float** | | [optional]
**mtf_enabled** | **bool** | | [optional]
**mtf_bracket** | **float** | | [optional]
**security_type** | **str** | | [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)

Loading
Loading