diff --git a/README.md b/README.md index 0868354..7112685 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,7 @@ def main(): configuration.access_token = access_token streamer = upstox_client.MarketDataStreamer( - upstox_client.ApiClient(configuration), ["NSE_INDEX|Nifty 50", "NSE_INDEX|Bank Nifty"], "full") + upstox_client.ApiClient(configuration), ["NSE_INDEX|Nifty 50", "NSE_INDEX|Nifty Bank"], "full") streamer.on("message", on_message) diff --git a/setup.py b/setup.py index d765437..6c35de2 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ long_description = (this_directory / "README.md").read_text() NAME = "upstox-python-sdk" -VERSION = "2.4.1" +VERSION = "2.4.3" # To install the library, run the following # # python setup.py install diff --git a/test/order/cancel_order.py b/test/order/cancel_order.py deleted file mode 100644 index 776eb2c..0000000 --- a/test/order/cancel_order.py +++ /dev/null @@ -1,15 +0,0 @@ -import upstox_client -from upstox_client.rest import ApiException - -configuration = upstox_client.Configuration() -configuration.access_token = "your_access_token" -api_instance = upstox_client.OrderApi(upstox_client.ApiClient(configuration)) -order_id = '231221011081579' -api_version = '2.0' - -try: - # Cancel order - api_response = api_instance.cancel_order(order_id, api_version) - print(api_response) -except ApiException as e: - print("Exception when calling OrderApi->cancel_order: %s\n" % e) diff --git a/test/order/modify_order.py b/test/order/modify_order.py deleted file mode 100644 index 4050e75..0000000 --- a/test/order/modify_order.py +++ /dev/null @@ -1,16 +0,0 @@ -import upstox_client -from upstox_client.rest import ApiException - -configuration = upstox_client.Configuration() -configuration.access_token = "your_access_token" - -api_instance = upstox_client.OrderApi(upstox_client.ApiClient(configuration)) -body = upstox_client.ModifyOrderRequest(2, "DAY", 0, "231222010275930", "MARKET", 0, 0) -api_version = '2.0' # str | API Version Header - -try: - # Modify order - api_response = api_instance.modify_order(body, api_version) - print(api_response) -except ApiException as e: - print("Exception when calling OrderApi->modify_order: %s\n" % e) diff --git a/test/order/place_order.py b/test/order/place_order.py deleted file mode 100644 index 3007624..0000000 --- a/test/order/place_order.py +++ /dev/null @@ -1,12 +0,0 @@ -import upstox_client -from upstox_client.rest import ApiException -configuration = upstox_client.Configuration() -configuration.access_token = "your_access_token" -api_instance = upstox_client.OrderApi(upstox_client.ApiClient(configuration)) -body = upstox_client.PlaceOrderRequest(1, "D", "DAY", 0.0, "string", "NSE_EQ|INE528G01035", "MARKET", "BUY", 0, 0.0, True) -api_version = '2.0' -try: - api_response = api_instance.place_order(body, api_version) - print(api_response) -except ApiException as e: - print("Exception when calling OrderApi->place_order: %s\n" % e) diff --git a/test/sdk_tests/data_token.py b/test/sdk_tests/data_token.py new file mode 100644 index 0000000..6495f7e --- /dev/null +++ b/test/sdk_tests/data_token.py @@ -0,0 +1 @@ +access_token = "your_access_token" diff --git a/test/websocket-tests/market-websocket/basic.py b/test/sdk_tests/market_basic.py similarity index 90% rename from test/websocket-tests/market-websocket/basic.py rename to test/sdk_tests/market_basic.py index 365a178..d300e2b 100644 --- a/test/websocket-tests/market-websocket/basic.py +++ b/test/sdk_tests/market_basic.py @@ -1,8 +1,8 @@ import upstox_client +import data_token configuration = upstox_client.Configuration() -access_token = "your_access_token" -configuration.access_token = access_token +configuration.access_token = data_token.access_token streamer = upstox_client.MarketDataStreamer( upstox_client.ApiClient(configuration), instrumentKeys=["MCX_FO|426302", "NSE_EQ|INE528G01035"], mode="full") diff --git a/test/sdk_tests/portfolio_basic.py b/test/sdk_tests/portfolio_basic.py new file mode 100644 index 0000000..fa5387b --- /dev/null +++ b/test/sdk_tests/portfolio_basic.py @@ -0,0 +1,26 @@ +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 = data_token.access_token + + streamer = upstox_client.PortfolioDataStreamer( + upstox_client.ApiClient(configuration)) + + streamer.on("message", on_message) + streamer.on("open", on_open) + streamer.connect() + + +if __name__ == "__main__": + main() diff --git a/test/sdk_tests/sanity.py b/test/sdk_tests/sanity.py new file mode 100644 index 0000000..0ab87b7 --- /dev/null +++ b/test/sdk_tests/sanity.py @@ -0,0 +1,352 @@ +import upstox_client +import data_token +from upstox_client.rest import ApiException +from datetime import datetime, time +import json + + +def is_within_market_hours(): + # Get the current time + now = datetime.now().time() + + # Define market opening and closing times + market_open = time(9, 0) # 9:00 AM + market_close = time(15, 30) # 3:30 PM + + # Check if the current time is within market hours + return market_open <= now <= market_close + + +configuration = upstox_client.Configuration() +configuration.access_token = data_token.access_token +api_version = '2.0' + +api_instance = upstox_client.UserApi(upstox_client.ApiClient(configuration)) + +try: + # Get User Fund And Margin + api_response = api_instance.get_profile(api_version) + if api_response.data.user_id != "7PBC6D": + print("get profile returned wrong response") + +except ApiException as e: + print("Exception when calling UserApi->get_user_fund_margin: %s\n" % e) + +api_instance = upstox_client.UserApi(upstox_client.ApiClient(configuration)) + +try: + # Get User Fund And Margin + api_response = api_instance.get_user_fund_margin(api_version) + if api_response.data is None: + print("Wrong response from get funds and margin") +except ApiException as e: + print("Exception when calling UserApi->get_user_fund_margin: %s\n" % e) + +api_instance = upstox_client.ChargeApi(upstox_client.ApiClient(configuration)) +instrument_token = 'NSE_EQ|INE669E01016' +quantity = 10 +product = 'D' +transaction_type = 'BUY' +price = 13.4 + +try: + # Brokerage details + api_response = api_instance.get_brokerage(instrument_token, quantity, product, transaction_type, price, api_version) + if api_response.data.charges is None: + print("Brokerage giving wrong response") +except ApiException as e: + print("Exception when calling ChargeApi->get_brokerage: %s\n" % e) + +api_instance = upstox_client.OrderApi(upstox_client.ApiClient(configuration)) +body = upstox_client.PlaceOrderRequest(1, "D", "DAY", 0.0, "string", "NSE_EQ|INE528G01035", "MARKET", "BUY", 0, 0.0, + True) +api_version = '2.0' +try: + api_response = api_instance.place_order(body, api_version) + if is_within_market_hours(): + if api_response.status != "success": + print("error in place order") +except ApiException as e: + if e.status == 400: + if not is_within_market_hours(): + print("exception in place order: ", e) + else: + print("exception in place order: ", e) + +api_instance = upstox_client.OrderApi(upstox_client.ApiClient(configuration)) +body = upstox_client.ModifyOrderRequest(2, "DAY", 0, "231222010275930", "MARKET", 0, 0) +api_version = '2.0' # str | API Version Header + +try: + # Modify order + api_response = api_instance.modify_order(body, api_version) + print(api_response) +except ApiException as e: + json_string = e.body.decode('utf-8') + data_dict = json.loads(json_string) + if data_dict.get('errors')[0].get('errorCode') != "UDAPI100010": + print("modify order giving wrong response") + +api_instance = upstox_client.OrderApi(upstox_client.ApiClient(configuration)) +order_id = '231221011081579' +api_version = '2.0' + +try: + # Cancel order + api_response = api_instance.cancel_order(order_id, api_version) + print(api_response) +except ApiException as e: + json_string = e.body.decode('utf-8') + data_dict = json.loads(json_string) + if data_dict.get('errors')[0].get('errorCode') != "UDAPI100010": + print("cancel order giving wrong response") + +api_instance = upstox_client.OrderApi(upstox_client.ApiClient(configuration)) +api_version = '2.0' +try: + # Get order book + api_response = api_instance.get_order_book(api_version) + if api_response.status != "success": + print("get order book giving invalid data") +except ApiException as e: + print("Exception when calling OrderApi->get_order_book: %s\n" % e) + +api_instance = upstox_client.OrderApi(upstox_client.ApiClient(configuration)) +api_version = '2.0' +order_id = '240112010371054' + +try: + api_response = api_instance.get_order_details(api_version, order_id=order_id) + print(api_response) +except ApiException as e: + json_string = e.body.decode('utf-8') + data_dict = json.loads(json_string) + if data_dict.get('errors')[0].get('errorCode') != "UDAPI100010": + print("get order details giving wrong response") + +api_instance = upstox_client.OrderApi(upstox_client.ApiClient(configuration)) +api_version = '2.0' + +try: + # Get trades + api_response = api_instance.get_trade_history(api_version) + if api_response.status != "success": + print("get order book giving invalid data") +except ApiException as e: + print("Exception when calling OrderApi->get_trade_history: %s\n" % e) + +api_instance = upstox_client.OrderApi(upstox_client.ApiClient(configuration)) +order_id = '240112010371054' +api_version = '2.0' + +try: + # Get trades for order + api_response = api_instance.get_trades_by_order(order_id, api_version) + if api_response.status != "success": + print("get order book giving invalid data") +except ApiException as e: + print("Exception when calling OrderApi->get_trades_by_order: %s\n" % e) + +api_instance = upstox_client.PortfolioApi(upstox_client.ApiClient(configuration)) +body = upstox_client.ConvertPositionRequest(instrument_token="NSE_EQ|INE528G01035", quantity=1, new_product="D", + old_product="I", transaction_type="BUY") +api_version = '2.0' + +try: + # Convert Positions + api_response = api_instance.convert_positions(body, api_version) +except ApiException as e: + json_string = e.body.decode('utf-8') + data_dict = json.loads(json_string) + if data_dict.get('errors')[0].get('errorCode') != "UDAPI1035": + print("convert position giving error") + +api_instance = upstox_client.PortfolioApi(upstox_client.ApiClient(configuration)) + +try: + api_response = api_instance.get_holdings(api_version) + if api_response.status != "success": + print("get holding giving wrong response") +except ApiException as e: + print("Exception when holding api %s\n" % e) + +api_instance = upstox_client.PortfolioApi(upstox_client.ApiClient(configuration)) + +try: + api_response = api_instance.get_positions(api_version) + if api_response.status != "success": + print("get position giving wrong response") +except ApiException as e: + print("Exception when calling position: %s\n" % e) + +api_instance = upstox_client.TradeProfitAndLossApi(upstox_client.ApiClient(configuration)) +segment = 'EQ' +financial_year = '2324' # str | Financial year for which data has been requested. Concatenation of last 2 digits of from year and to year Sample:for 2021-2022, financial_year will be 2122 +api_version = '2.0' # str | API Version Header +from_date = '02-04-2023' # str | Date from which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) +to_date = '20-03-2024' # str | Date till which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) + +try: + # Get Trade-wise Profit and Loss Report Data + api_response = api_instance.get_trade_wise_profit_and_loss_meta_data(segment, financial_year, api_version, + from_date=from_date, to_date=to_date) + if api_response.status != "success": + print("get report meta data giving wrong response") +except ApiException as e: + print("Exception when calling TradeProfitAndLossApi->get_trade_wise_profit_and_loss_data: %s\n" % e) +segment = 'EQ' +financial_year = '2324' # str | Financial year for which data has been requested. Concatenation of last 2 digits of from year and to year Sample:for 2021-2022, financial_year will be 2122 +page_number = 1 +page_size = 4 +api_version = '2.0' # str | API Version Header +from_date = '02-04-2023' # str | Date from which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) +to_date = '20-03-2024' # str | Date till which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format (optional) + +try: + # Get Trade-wise Profit and Loss Report Data + api_response = api_instance.get_trade_wise_profit_and_loss_data(segment, financial_year, page_number, page_size, + api_version, from_date=from_date, to_date=to_date) + if api_response.status != "success": + print("get profit loss report data giving wrong response") +except ApiException as e: + print("Exception when calling TradeProfitAndLossApi->get_trade_wise_profit_and_loss_data: %s\n" % e) + +try: + # Get Trade-wise Profit and Loss Report Data + api_response = api_instance.get_profit_and_loss_charges(segment, financial_year, api_version, from_date=from_date, + to_date=to_date) + if api_response.status != "success": + print("get trade charges giving wrong response") +except ApiException as e: + print("Exception when calling TradeProfitAndLossApi->get_trade_wise_profit_and_loss_data: %s\n" % e) + +api_instance = upstox_client.HistoryApi() +instrument_key = 'NSE_EQ|INE669E01016' +interval = '1minute' +to_date = '2023-11-13' +from_date = '2023-11-12' +try: + api_response = api_instance.get_historical_candle_data1(instrument_key, interval, to_date, from_date, api_version) + if api_response.status != "success": + print("historical api not giving success") +except ApiException as e: + print("Exception when calling HistoryApi->get_historical_candle_data: %s\n" % e) + +api_instance = upstox_client.HistoryApi() +instrument_key = 'NSE_EQ|INE669E01016' +interval = '1minute' +try: + + api_response = api_instance.get_intra_day_candle_data(instrument_key, interval, api_version) + if api_response.status != "success": + print("historical intraday api not giving success") +except ApiException as e: + print("Exception when calling HistoryApi->get_historical_candle_data: %s\n" % e) + +symbol = 'NSE_EQ|INE669E01016' +api_instance = upstox_client.MarketQuoteApi(upstox_client.ApiClient(configuration)) + +try: + api_response = api_instance.get_full_market_quote(symbol, api_version) + if api_response.status != "success": + print("market quotes full api not giving success") +except ApiException as e: + print("Exception when calling MarketQuoteApi->get_full_market_quote: %s\n" % e) + +symbol = 'NSE_EQ|INE669E01016' +api_instance = upstox_client.MarketQuoteApi(upstox_client.ApiClient(configuration)) + +try: + api_response = api_instance.ltp(symbol, api_version) + if api_response.status != "success": + print("market quotes ltp api not giving success") +except ApiException as e: + print("Exception when calling MarketQuoteApi->get_full_market_quote: %s\n" % e) + +symbol = 'NSE_EQ|INE669E01016' +api_instance = upstox_client.MarketQuoteApi(upstox_client.ApiClient(configuration)) +interval = '1d' + +try: + api_response = api_instance.get_market_quote_ohlc(symbol, interval, api_version) + if api_response.status != "success": + print("market quotes ohlc api not giving success") +except ApiException as e: + print("Exception when calling MarketQuoteApi->get_full_market_quote: %s\n" % e) + +api_instance = upstox_client.MarketHolidaysAndTimingsApi(upstox_client.ApiClient(configuration)) + +try: + api_response = api_instance.get_holidays() + if api_response.status != "success": + print("error in get holidays") +except ApiException as e: + print("Exception when calling MarketHolidaysAndTimingsApi: %s\n" % e) + +try: + api_response = api_instance.get_holiday("2024-01-22") + if api_response.status != "success": + print("error in get holiday on a date") +except ApiException as e: + print("Exception when calling MarketHolidaysAndTimingsApi: %s\n" % e) + +try: + api_response = api_instance.get_exchange_timings("2024-01-22") + if api_response.status != "success": + print("error get exchange timings") +except ApiException as e: + print("Exception when calling MarketHolidaysAndTimingsApi: %s\n" % e) + +try: + api_response = api_instance.get_market_status("NSE") + if api_response.status != "success": + print("error get market status") +except ApiException as e: + print("Exception when calling MarketHolidaysAndTimingsApi: %s\n" % e) + +api_instance = upstox_client.OptionsApi(upstox_client.ApiClient(configuration)) + +try: + api_response = api_instance.get_option_contracts("NSE_INDEX|Nifty 50") + if api_response.status != "success": + print("get_option_contracts giving error") +except ApiException as e: + print("Exception when calling MarketHolidaysAndTimingsApi: %s\n" % e) + +try: + api_response = api_instance.get_put_call_option_chain("NSE_INDEX|Nifty 50", "2024-03-21") + if api_response.status != "success": + print("get_put_call_option_chain giving error") +except ApiException as e: + print("Exception when calling MarketHolidaysAndTimingsApi: %s\n" % e) + +api_instance = upstox_client.LoginApi() +api_version = '2.0' +code = '{your_auth_code}' +client_id = '{your_client_id}' +client_secret = '{your_client_secret}' +redirect_uri = '{your_redirect_url}' +grant_type = 'grant_type_example' + +try: + # Get token API + api_response = api_instance.token(api_version, code=code, client_id=client_id, client_secret=client_secret, + redirect_uri=redirect_uri, grant_type=grant_type) + print(api_response) +except ApiException as e: + json_string = e.body.decode('utf-8') + data_dict = json.loads(json_string) + if data_dict.get('errors')[0].get('errorCode') != "UDAPI100069": + print("convert position giving error") + + +api_instance = upstox_client.LoginApi(upstox_client.ApiClient(configuration)) +api_version = '2.0' + +try: + # Logout + api_response = api_instance.logout(api_version) + print(api_response) + print("successfully logged out") +except ApiException as e: + print("Exception when calling LoginApi->logout: %s\n" % e) diff --git a/test/websocket-tests/market-websocket/disconnect.py b/test/websocket-tests/market-websocket/disconnect.py deleted file mode 100644 index c49ecf6..0000000 --- a/test/websocket-tests/market-websocket/disconnect.py +++ /dev/null @@ -1,60 +0,0 @@ - -import time -import threading -import upstox_client - -logging.basicConfig(level=logging.DEBUG) -configuration = upstox_client.Configuration() -access_token = "your_access_token" -configuration.access_token = access_token -streamer = upstox_client.MarketDataStreamer( - upstox_client.ApiClient(configuration), instrumentKeys=["MCX_FO|426302"], mode="full") - - -streamer.auto_reconnect(True, 5, 10) -def on_open(): - print("on open message") - -def close(a, b): - print(f"on close message {a}") - - -def message(data): - print(f"on message message{data}") - - -def error(er): - print(f"on error message= {er}") - -def add_subsriptions(): - time.sleep(5) - streamer.subscribe(["NSE_EQ|INE528G01035"], "full") - -def disconnection(): - time.sleep(10) - streamer.disconnect() - -def f_disconnection(): - time.sleep(15) - streamer.disconnect() - -def reconnecting(data): - print(f"reconnecting event= {data}") - -streamer.on("open", on_open) -streamer.on("message", message) -streamer.on("close", close) -streamer.on("reconnecting", reconnecting) -streamer.on("error", error) -# streamer.connect() -print("hello") - -t1 = threading.Thread(target=streamer.connect) -t2 = threading.Thread(target=add_subsriptions) -t3 = threading.Thread(target=disconnection) -t4 = threading.Thread(target=f_disconnection) -t1.start() -t2.start() -t3.start() -t4.start() - diff --git a/test/websocket-tests/market-websocket/subscribe.py b/test/websocket-tests/market-websocket/subscribe.py deleted file mode 100644 index e69de29..0000000 diff --git a/upstox_client/__init__.py b/upstox_client/__init__.py index f6743a2..f7f043a 100644 --- a/upstox_client/__init__.py +++ b/upstox_client/__init__.py @@ -18,7 +18,9 @@ from upstox_client.api.charge_api import ChargeApi from upstox_client.api.history_api import HistoryApi from upstox_client.api.login_api import LoginApi +from upstox_client.api.market_holidays_and_timings_api import MarketHolidaysAndTimingsApi from upstox_client.api.market_quote_api import MarketQuoteApi +from upstox_client.api.options_api import OptionsApi from upstox_client.api.order_api import OrderApi from upstox_client.api.portfolio_api import PortfolioApi from upstox_client.api.trade_profit_and_loss_api import TradeProfitAndLossApi @@ -31,6 +33,7 @@ from upstox_client.api_client import ApiClient from upstox_client.configuration import Configuration # import models into sdk package +from upstox_client.models.analytics_data import AnalyticsData from upstox_client.models.api_gateway_error_response import ApiGatewayErrorResponse from upstox_client.models.brokerage_data import BrokerageData from upstox_client.models.brokerage_taxes import BrokerageTaxes @@ -43,13 +46,19 @@ from upstox_client.models.depth import Depth from upstox_client.models.depth_map import DepthMap from upstox_client.models.dp_plan import DpPlan +from upstox_client.models.exchange_timing_data import ExchangeTimingData from upstox_client.models.get_brokerage_response import GetBrokerageResponse +from upstox_client.models.get_exchange_timing_response import GetExchangeTimingResponse from upstox_client.models.get_full_market_quote_response import GetFullMarketQuoteResponse from upstox_client.models.get_historical_candle_response import GetHistoricalCandleResponse from upstox_client.models.get_holdings_response import GetHoldingsResponse +from upstox_client.models.get_holiday_response import GetHolidayResponse from upstox_client.models.get_intra_day_candle_response import GetIntraDayCandleResponse from upstox_client.models.get_market_quote_last_traded_price_response import GetMarketQuoteLastTradedPriceResponse from upstox_client.models.get_market_quote_ohlc_response import GetMarketQuoteOHLCResponse +from upstox_client.models.get_market_status_response import GetMarketStatusResponse +from upstox_client.models.get_option_chain_response import GetOptionChainResponse +from upstox_client.models.get_option_contract_response import GetOptionContractResponse from upstox_client.models.get_order_book_response import GetOrderBookResponse from upstox_client.models.get_order_response import GetOrderResponse from upstox_client.models.get_position_response import GetPositionResponse @@ -61,11 +70,15 @@ from upstox_client.models.get_user_fund_margin_response import GetUserFundMarginResponse from upstox_client.models.historical_candle_data import HistoricalCandleData from upstox_client.models.holdings_data import HoldingsData +from upstox_client.models.holiday_data import HolidayData +from upstox_client.models.instrument_data import InstrumentData from upstox_client.models.intra_day_candle_data import IntraDayCandleData from upstox_client.models.logout_response import LogoutResponse +from upstox_client.models.market_data import MarketData from upstox_client.models.market_quote_ohlc import MarketQuoteOHLC from upstox_client.models.market_quote_symbol import MarketQuoteSymbol from upstox_client.models.market_quote_symbol_ltp import MarketQuoteSymbolLtp +from upstox_client.models.market_status_data import MarketStatusData from upstox_client.models.modify_order_data import ModifyOrderData from upstox_client.models.modify_order_request import ModifyOrderRequest from upstox_client.models.modify_order_response import ModifyOrderResponse @@ -74,6 +87,7 @@ from upstox_client.models.o_auth_client_exception_cause_stack_trace import OAuthClientExceptionCauseStackTrace from upstox_client.models.o_auth_client_exception_cause_suppressed import OAuthClientExceptionCauseSuppressed from upstox_client.models.ohlc import Ohlc +from upstox_client.models.option_strike_data import OptionStrikeData from upstox_client.models.order_book_data import OrderBookData from upstox_client.models.order_data import OrderData from upstox_client.models.other_taxes import OtherTaxes @@ -89,6 +103,7 @@ from upstox_client.models.profit_and_loss_meta_data import ProfitAndLossMetaData from upstox_client.models.profit_and_loss_meta_data_wrapper import ProfitAndLossMetaDataWrapper from upstox_client.models.profit_and_loss_other_charges_taxes import ProfitAndLossOtherChargesTaxes +from upstox_client.models.put_call_option_chain_data import PutCallOptionChainData from upstox_client.models.token_request import TokenRequest from upstox_client.models.token_response import TokenResponse from upstox_client.models.trade_data import TradeData diff --git a/upstox_client/api/charge_api.py b/upstox_client/api/charge_api.py index d1062a3..2234a94 100644 --- a/upstox_client/api/charge_api.py +++ b/upstox_client/api/charge_api.py @@ -152,7 +152,7 @@ def get_brokerage_with_http_info(self, instrument_token, quantity, product, tran auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/charges/brokerage', 'GET', + '/v2/charges/brokerage', 'GET', path_params, query_params, header_params, diff --git a/upstox_client/api/history_api.py b/upstox_client/api/history_api.py index e2fa546..6c8f83e 100644 --- a/upstox_client/api/history_api.py +++ b/upstox_client/api/history_api.py @@ -136,7 +136,7 @@ def get_historical_candle_data_with_http_info(self, instrument_key, interval, to auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/historical-candle/{instrumentKey}/{interval}/{to_date}', 'GET', + '/v2/historical-candle/{instrumentKey}/{interval}/{to_date}', 'GET', path_params, query_params, header_params, @@ -263,7 +263,7 @@ def get_historical_candle_data1_with_http_info(self, instrument_key, interval, t auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/historical-candle/{instrumentKey}/{interval}/{to_date}/{from_date}', 'GET', + '/v2/historical-candle/{instrumentKey}/{interval}/{to_date}/{from_date}', 'GET', path_params, query_params, header_params, @@ -374,7 +374,7 @@ def get_intra_day_candle_data_with_http_info(self, instrument_key, interval, api auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/historical-candle/intraday/{instrumentKey}/{interval}', 'GET', + '/v2/historical-candle/intraday/{instrumentKey}/{interval}', 'GET', path_params, query_params, header_params, diff --git a/upstox_client/api/login_api.py b/upstox_client/api/login_api.py index 3eba369..31a01c8 100644 --- a/upstox_client/api/login_api.py +++ b/upstox_client/api/login_api.py @@ -136,7 +136,7 @@ def authorize_with_http_info(self, client_id, redirect_uri, api_version, **kwarg auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/login/authorization/dialog', 'GET', + '/v2/login/authorization/dialog', 'GET', path_params, query_params, header_params, @@ -231,7 +231,7 @@ def logout_with_http_info(self, api_version, **kwargs): # noqa: E501 auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/logout', 'DELETE', + '/v2/logout', 'DELETE', path_params, query_params, header_params, @@ -350,7 +350,7 @@ def token_with_http_info(self, api_version, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/login/authorization/token', 'POST', + '/v2/login/authorization/token', 'POST', path_params, query_params, header_params, diff --git a/upstox_client/api/market_holidays_and_timings_api.py b/upstox_client/api/market_holidays_and_timings_api.py new file mode 100644 index 0000000..fd0c97b --- /dev/null +++ b/upstox_client/api/market_holidays_and_timings_api.py @@ -0,0 +1,405 @@ +# coding: utf-8 + +""" + OpenAPI definition + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: v0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from upstox_client.api_client import ApiClient + + +class MarketHolidaysAndTimingsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_exchange_timings(self, _date, **kwargs): # noqa: E501 + """Get Exchange Timings on particular date # noqa: E501 + + This API provides the functionality to retrieve the exchange timings on particular date # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_exchange_timings(_date, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str _date: (required) + :return: GetExchangeTimingResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_exchange_timings_with_http_info(_date, **kwargs) # noqa: E501 + else: + (data) = self.get_exchange_timings_with_http_info(_date, **kwargs) # noqa: E501 + return data + + def get_exchange_timings_with_http_info(self, _date, **kwargs): # noqa: E501 + """Get Exchange Timings on particular date # noqa: E501 + + This API provides the functionality to retrieve the exchange timings on particular date # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_exchange_timings_with_http_info(_date, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str _date: (required) + :return: GetExchangeTimingResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['_date'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_exchange_timings" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter '_date' is set + if ('_date' not in params or + params['_date'] is None): + raise ValueError("Missing the required parameter `_date` when calling `get_exchange_timings`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if '_date' in params: + path_params['date'] = params['_date'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json', '*/*']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/v2/market/timings/{date}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='GetExchangeTimingResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_holiday(self, _date, **kwargs): # noqa: E501 + """Get Holiday on particular date # noqa: E501 + + This API provides the functionality to retrieve the holiday on particular date # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_holiday(_date, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str _date: (required) + :return: GetHolidayResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_holiday_with_http_info(_date, **kwargs) # noqa: E501 + else: + (data) = self.get_holiday_with_http_info(_date, **kwargs) # noqa: E501 + return data + + def get_holiday_with_http_info(self, _date, **kwargs): # noqa: E501 + """Get Holiday on particular date # noqa: E501 + + This API provides the functionality to retrieve the holiday on particular date # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_holiday_with_http_info(_date, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str _date: (required) + :return: GetHolidayResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['_date'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_holiday" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter '_date' is set + if ('_date' not in params or + params['_date'] is None): + raise ValueError("Missing the required parameter `_date` when calling `get_holiday`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if '_date' in params: + path_params['date'] = params['_date'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json', '*/*']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/v2/market/holidays/{date}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='GetHolidayResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_holidays(self, **kwargs): # noqa: E501 + """Get Holiday list of current year # noqa: E501 + + This API provides the functionality to retrieve the holiday list of current year # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_holidays(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: GetHolidayResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_holidays_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_holidays_with_http_info(**kwargs) # noqa: E501 + return data + + def get_holidays_with_http_info(self, **kwargs): # noqa: E501 + """Get Holiday list of current year # noqa: E501 + + This API provides the functionality to retrieve the holiday list of current year # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_holidays_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: GetHolidayResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_holidays" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json', '*/*']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/v2/market/holidays', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='GetHolidayResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_market_status(self, exchange, **kwargs): # noqa: E501 + """Get Market status for particular exchange # noqa: E501 + + This API provides the functionality to retrieve the market status for particular exchange # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_market_status(exchange, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str exchange: (required) + :return: GetMarketStatusResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_market_status_with_http_info(exchange, **kwargs) # noqa: E501 + else: + (data) = self.get_market_status_with_http_info(exchange, **kwargs) # noqa: E501 + return data + + def get_market_status_with_http_info(self, exchange, **kwargs): # noqa: E501 + """Get Market status for particular exchange # noqa: E501 + + This API provides the functionality to retrieve the market status for particular exchange # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_market_status_with_http_info(exchange, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str exchange: (required) + :return: GetMarketStatusResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['exchange'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_market_status" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'exchange' is set + if ('exchange' not in params or + params['exchange'] is None): + raise ValueError("Missing the required parameter `exchange` when calling `get_market_status`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'exchange' in params: + path_params['exchange'] = params['exchange'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json', '*/*']) # noqa: E501 + + # Authentication setting + auth_settings = ['OAUTH2'] # noqa: E501 + + return self.api_client.call_api( + '/v2/market/status/{exchange}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='GetMarketStatusResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/upstox_client/api/market_quote_api.py b/upstox_client/api/market_quote_api.py index 9b7ba00..ce9b646 100644 --- a/upstox_client/api/market_quote_api.py +++ b/upstox_client/api/market_quote_api.py @@ -120,7 +120,7 @@ def get_full_market_quote_with_http_info(self, symbol, api_version, **kwargs): auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/market-quote/quotes', 'GET', + '/v2/market-quote/quotes', 'GET', path_params, query_params, header_params, @@ -231,7 +231,7 @@ def get_market_quote_ohlc_with_http_info(self, symbol, interval, api_version, ** auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/market-quote/ohlc', 'GET', + '/v2/market-quote/ohlc', 'GET', path_params, query_params, header_params, @@ -334,7 +334,7 @@ def ltp_with_http_info(self, symbol, api_version, **kwargs): # noqa: E501 auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/market-quote/ltp', 'GET', + '/v2/market-quote/ltp', 'GET', path_params, query_params, header_params, diff --git a/upstox_client/api/options_api.py b/upstox_client/api/options_api.py new file mode 100644 index 0000000..42b77e6 --- /dev/null +++ b/upstox_client/api/options_api.py @@ -0,0 +1,235 @@ +# coding: utf-8 + +""" + OpenAPI definition + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: v0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from upstox_client.api_client import ApiClient + + +class OptionsApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_option_contracts(self, instrument_key, **kwargs): # noqa: E501 + """Get option contracts # noqa: E501 + + This API provides the functionality to retrieve the option contracts # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_option_contracts(instrument_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str instrument_key: Instrument key for an underlying symbol (required) + :param str expiry_date: Expiry date in format: YYYY-mm-dd + :return: GetOptionContractResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_option_contracts_with_http_info(instrument_key, **kwargs) # noqa: E501 + else: + (data) = self.get_option_contracts_with_http_info(instrument_key, **kwargs) # noqa: E501 + return data + + def get_option_contracts_with_http_info(self, instrument_key, **kwargs): # noqa: E501 + """Get option contracts # noqa: E501 + + This API provides the functionality to retrieve the option contracts # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_option_contracts_with_http_info(instrument_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str instrument_key: Instrument key for an underlying symbol (required) + :param str expiry_date: Expiry date in format: YYYY-mm-dd + :return: GetOptionContractResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['instrument_key', 'expiry_date'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_option_contracts" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'instrument_key' is set + if ('instrument_key' not in params or + params['instrument_key'] is None): + raise ValueError("Missing the required parameter `instrument_key` when calling `get_option_contracts`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'instrument_key' in params: + query_params.append(('instrument_key', params['instrument_key'])) # noqa: E501 + if 'expiry_date' in params: + query_params.append(('expiry_date', params['expiry_date'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json', '*/*']) # noqa: E501 + + # Authentication setting + auth_settings = ['OAUTH2'] # noqa: E501 + + return self.api_client.call_api( + '/v2/option/contract', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='GetOptionContractResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_put_call_option_chain(self, instrument_key, expiry_date, **kwargs): # noqa: E501 + """Get option chain # noqa: E501 + + This API provides the functionality to retrieve the option chain # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_put_call_option_chain(instrument_key, expiry_date, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str instrument_key: Instrument key for an underlying symbol (required) + :param str expiry_date: Expiry date in format: YYYY-mm-dd (required) + :return: GetOptionChainResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_put_call_option_chain_with_http_info(instrument_key, expiry_date, **kwargs) # noqa: E501 + else: + (data) = self.get_put_call_option_chain_with_http_info(instrument_key, expiry_date, **kwargs) # noqa: E501 + return data + + def get_put_call_option_chain_with_http_info(self, instrument_key, expiry_date, **kwargs): # noqa: E501 + """Get option chain # noqa: E501 + + This API provides the functionality to retrieve the option chain # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_put_call_option_chain_with_http_info(instrument_key, expiry_date, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str instrument_key: Instrument key for an underlying symbol (required) + :param str expiry_date: Expiry date in format: YYYY-mm-dd (required) + :return: GetOptionChainResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['instrument_key', 'expiry_date'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_put_call_option_chain" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'instrument_key' is set + if ('instrument_key' not in params or + params['instrument_key'] is None): + raise ValueError("Missing the required parameter `instrument_key` when calling `get_put_call_option_chain`") # noqa: E501 + # verify the required parameter 'expiry_date' is set + if ('expiry_date' not in params or + params['expiry_date'] is None): + raise ValueError("Missing the required parameter `expiry_date` when calling `get_put_call_option_chain`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'instrument_key' in params: + query_params.append(('instrument_key', params['instrument_key'])) # noqa: E501 + if 'expiry_date' in params: + query_params.append(('expiry_date', params['expiry_date'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json', '*/*']) # noqa: E501 + + # Authentication setting + auth_settings = ['OAUTH2'] # noqa: E501 + + return self.api_client.call_api( + '/v2/option/chain', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='GetOptionChainResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/upstox_client/api/order_api.py b/upstox_client/api/order_api.py index d125c3d..e5703eb 100644 --- a/upstox_client/api/order_api.py +++ b/upstox_client/api/order_api.py @@ -120,7 +120,7 @@ def cancel_order_with_http_info(self, order_id, api_version, **kwargs): # noqa: auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/order/cancel', 'DELETE', + '/v2/order/cancel', 'DELETE', path_params, query_params, header_params, @@ -215,7 +215,7 @@ def get_order_book_with_http_info(self, api_version, **kwargs): # noqa: E501 auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/order/retrieve-all', 'GET', + '/v2/order/retrieve-all', 'GET', path_params, query_params, header_params, @@ -318,7 +318,7 @@ def get_order_details_with_http_info(self, api_version, **kwargs): # noqa: E501 auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/order/history', 'GET', + '/v2/order/history', 'GET', path_params, query_params, header_params, @@ -413,7 +413,7 @@ def get_trade_history_with_http_info(self, api_version, **kwargs): # noqa: E501 auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/order/trades/get-trades-for-day', 'GET', + '/v2/order/trades/get-trades-for-day', 'GET', path_params, query_params, header_params, @@ -516,7 +516,7 @@ def get_trades_by_order_with_http_info(self, order_id, api_version, **kwargs): auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/order/trades', 'GET', + '/v2/order/trades', 'GET', path_params, query_params, header_params, @@ -623,7 +623,7 @@ def modify_order_with_http_info(self, body, api_version, **kwargs): # noqa: E50 auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/order/modify', 'PUT', + '/v2/order/modify', 'PUT', path_params, query_params, header_params, @@ -730,7 +730,7 @@ def place_order_with_http_info(self, body, api_version, **kwargs): # noqa: E501 auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/order/place', 'POST', + '/v2/order/place', 'POST', path_params, query_params, header_params, diff --git a/upstox_client/api/portfolio_api.py b/upstox_client/api/portfolio_api.py index f20bd0e..467a7a5 100644 --- a/upstox_client/api/portfolio_api.py +++ b/upstox_client/api/portfolio_api.py @@ -124,7 +124,7 @@ def convert_positions_with_http_info(self, body, api_version, **kwargs): # noqa auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/portfolio/convert-position', 'PUT', + '/v2/portfolio/convert-position', 'PUT', path_params, query_params, header_params, @@ -219,7 +219,7 @@ def get_holdings_with_http_info(self, api_version, **kwargs): # noqa: E501 auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/portfolio/long-term-holdings', 'GET', + '/v2/portfolio/long-term-holdings', 'GET', path_params, query_params, header_params, @@ -314,7 +314,7 @@ def get_positions_with_http_info(self, api_version, **kwargs): # noqa: E501 auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/portfolio/short-term-positions', 'GET', + '/v2/portfolio/short-term-positions', 'GET', path_params, query_params, header_params, diff --git a/upstox_client/api/trade_profit_and_loss_api.py b/upstox_client/api/trade_profit_and_loss_api.py index ec26302..3d42912 100644 --- a/upstox_client/api/trade_profit_and_loss_api.py +++ b/upstox_client/api/trade_profit_and_loss_api.py @@ -136,7 +136,7 @@ def get_profit_and_loss_charges_with_http_info(self, segment, financial_year, ap auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/trade/profit-loss/charges', 'GET', + '/v2/trade/profit-loss/charges', 'GET', path_params, query_params, header_params, @@ -271,7 +271,7 @@ def get_trade_wise_profit_and_loss_data_with_http_info(self, segment, financial_ auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/trade/profit-loss/data', 'GET', + '/v2/trade/profit-loss/data', 'GET', path_params, query_params, header_params, @@ -390,7 +390,7 @@ def get_trade_wise_profit_and_loss_meta_data_with_http_info(self, segment, finan auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/trade/profit-loss/metadata', 'GET', + '/v2/trade/profit-loss/metadata', 'GET', path_params, query_params, header_params, diff --git a/upstox_client/api/user_api.py b/upstox_client/api/user_api.py index 3ef5e7f..8b85d6e 100644 --- a/upstox_client/api/user_api.py +++ b/upstox_client/api/user_api.py @@ -112,7 +112,7 @@ def get_profile_with_http_info(self, api_version, **kwargs): # noqa: E501 auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/user/profile', 'GET', + '/v2/user/profile', 'GET', path_params, query_params, header_params, @@ -211,7 +211,7 @@ def get_user_fund_margin_with_http_info(self, api_version, **kwargs): # noqa: E auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/user/get-funds-and-margin', 'GET', + '/v2/user/get-funds-and-margin', 'GET', path_params, query_params, header_params, diff --git a/upstox_client/api/websocket_api.py b/upstox_client/api/websocket_api.py index e4773e7..fcce4e8 100644 --- a/upstox_client/api/websocket_api.py +++ b/upstox_client/api/websocket_api.py @@ -112,7 +112,7 @@ def get_market_data_feed_with_http_info(self, api_version, **kwargs): # noqa: E auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/feed/market-data-feed', 'GET', + '/v2/feed/market-data-feed', 'GET', path_params, query_params, header_params, @@ -207,7 +207,7 @@ def get_market_data_feed_authorize_with_http_info(self, api_version, **kwargs): auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/feed/market-data-feed/authorize', 'GET', + '/v2/feed/market-data-feed/authorize', 'GET', path_params, query_params, header_params, @@ -302,7 +302,7 @@ def get_portfolio_stream_feed_with_http_info(self, api_version, **kwargs): # no auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/feed/portfolio-stream-feed', 'GET', + '/v2/feed/portfolio-stream-feed', 'GET', path_params, query_params, header_params, @@ -397,7 +397,7 @@ def get_portfolio_stream_feed_authorize_with_http_info(self, api_version, **kwar auth_settings = ['OAUTH2'] # noqa: E501 return self.api_client.call_api( - '/feed/portfolio-stream-feed/authorize', 'GET', + '/v2/feed/portfolio-stream-feed/authorize', 'GET', path_params, query_params, header_params, diff --git a/upstox_client/configuration.py b/upstox_client/configuration.py index 380278c..325403d 100644 --- a/upstox_client/configuration.py +++ b/upstox_client/configuration.py @@ -46,10 +46,10 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)): def __init__(self): """Constructor""" # Default Base url - self.host = "https://api.upstox.com/v2" + self.host = "https://api.upstox.com" # Low latency order host - self.order_host = "https://api-hft.upstox.com/v2" + self.order_host = "https://api-hft.upstox.com" # Temp file folder for downloading files self.temp_folder_path = None diff --git a/upstox_client/models/__init__.py b/upstox_client/models/__init__.py index 3474361..867b5ef 100644 --- a/upstox_client/models/__init__.py +++ b/upstox_client/models/__init__.py @@ -14,6 +14,7 @@ from __future__ import absolute_import # import models into model package +from upstox_client.models.analytics_data import AnalyticsData from upstox_client.models.api_gateway_error_response import ApiGatewayErrorResponse from upstox_client.models.brokerage_data import BrokerageData from upstox_client.models.brokerage_taxes import BrokerageTaxes @@ -26,13 +27,19 @@ from upstox_client.models.depth import Depth from upstox_client.models.depth_map import DepthMap from upstox_client.models.dp_plan import DpPlan +from upstox_client.models.exchange_timing_data import ExchangeTimingData from upstox_client.models.get_brokerage_response import GetBrokerageResponse +from upstox_client.models.get_exchange_timing_response import GetExchangeTimingResponse from upstox_client.models.get_full_market_quote_response import GetFullMarketQuoteResponse from upstox_client.models.get_historical_candle_response import GetHistoricalCandleResponse from upstox_client.models.get_holdings_response import GetHoldingsResponse +from upstox_client.models.get_holiday_response import GetHolidayResponse from upstox_client.models.get_intra_day_candle_response import GetIntraDayCandleResponse from upstox_client.models.get_market_quote_last_traded_price_response import GetMarketQuoteLastTradedPriceResponse from upstox_client.models.get_market_quote_ohlc_response import GetMarketQuoteOHLCResponse +from upstox_client.models.get_market_status_response import GetMarketStatusResponse +from upstox_client.models.get_option_chain_response import GetOptionChainResponse +from upstox_client.models.get_option_contract_response import GetOptionContractResponse from upstox_client.models.get_order_book_response import GetOrderBookResponse from upstox_client.models.get_order_response import GetOrderResponse from upstox_client.models.get_position_response import GetPositionResponse @@ -44,11 +51,15 @@ from upstox_client.models.get_user_fund_margin_response import GetUserFundMarginResponse from upstox_client.models.historical_candle_data import HistoricalCandleData from upstox_client.models.holdings_data import HoldingsData +from upstox_client.models.holiday_data import HolidayData +from upstox_client.models.instrument_data import InstrumentData from upstox_client.models.intra_day_candle_data import IntraDayCandleData from upstox_client.models.logout_response import LogoutResponse +from upstox_client.models.market_data import MarketData from upstox_client.models.market_quote_ohlc import MarketQuoteOHLC from upstox_client.models.market_quote_symbol import MarketQuoteSymbol from upstox_client.models.market_quote_symbol_ltp import MarketQuoteSymbolLtp +from upstox_client.models.market_status_data import MarketStatusData from upstox_client.models.modify_order_data import ModifyOrderData from upstox_client.models.modify_order_request import ModifyOrderRequest from upstox_client.models.modify_order_response import ModifyOrderResponse @@ -57,6 +68,7 @@ from upstox_client.models.o_auth_client_exception_cause_stack_trace import OAuthClientExceptionCauseStackTrace from upstox_client.models.o_auth_client_exception_cause_suppressed import OAuthClientExceptionCauseSuppressed from upstox_client.models.ohlc import Ohlc +from upstox_client.models.option_strike_data import OptionStrikeData from upstox_client.models.order_book_data import OrderBookData from upstox_client.models.order_data import OrderData from upstox_client.models.other_taxes import OtherTaxes @@ -72,6 +84,7 @@ from upstox_client.models.profit_and_loss_meta_data import ProfitAndLossMetaData from upstox_client.models.profit_and_loss_meta_data_wrapper import ProfitAndLossMetaDataWrapper from upstox_client.models.profit_and_loss_other_charges_taxes import ProfitAndLossOtherChargesTaxes +from upstox_client.models.put_call_option_chain_data import PutCallOptionChainData from upstox_client.models.token_request import TokenRequest from upstox_client.models.token_response import TokenResponse from upstox_client.models.trade_data import TradeData diff --git a/upstox_client/models/analytics_data.py b/upstox_client/models/analytics_data.py new file mode 100644 index 0000000..306aaf9 --- /dev/null +++ b/upstox_client/models/analytics_data.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + OpenAPI definition + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: v0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class AnalyticsData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'vega': 'float', + 'theta': 'float', + 'gamma': 'float', + 'delta': 'float', + 'iv': 'float', + 'pop': 'float' + } + + attribute_map = { + 'vega': 'vega', + 'theta': 'theta', + 'gamma': 'gamma', + 'delta': 'delta', + 'iv': 'iv', + 'pop': 'pop' + } + + def __init__(self, vega=None, theta=None, gamma=None, delta=None, iv=None, pop=None): # noqa: E501 + """AnalyticsData - a model defined in Swagger""" # noqa: E501 + self._vega = None + self._theta = None + self._gamma = None + self._delta = None + self._iv = None + self._pop = None + self.discriminator = None + if vega is not None: + self.vega = vega + if theta is not None: + self.theta = theta + if gamma is not None: + self.gamma = gamma + if delta is not None: + self.delta = delta + if iv is not None: + self.iv = iv + if pop is not None: + self.pop = pop + + @property + def vega(self): + """Gets the vega of this AnalyticsData. # noqa: E501 + + + :return: The vega of this AnalyticsData. # noqa: E501 + :rtype: float + """ + return self._vega + + @vega.setter + def vega(self, vega): + """Sets the vega of this AnalyticsData. + + + :param vega: The vega of this AnalyticsData. # noqa: E501 + :type: float + """ + + self._vega = vega + + @property + def theta(self): + """Gets the theta of this AnalyticsData. # noqa: E501 + + + :return: The theta of this AnalyticsData. # noqa: E501 + :rtype: float + """ + return self._theta + + @theta.setter + def theta(self, theta): + """Sets the theta of this AnalyticsData. + + + :param theta: The theta of this AnalyticsData. # noqa: E501 + :type: float + """ + + self._theta = theta + + @property + def gamma(self): + """Gets the gamma of this AnalyticsData. # noqa: E501 + + + :return: The gamma of this AnalyticsData. # noqa: E501 + :rtype: float + """ + return self._gamma + + @gamma.setter + def gamma(self, gamma): + """Sets the gamma of this AnalyticsData. + + + :param gamma: The gamma of this AnalyticsData. # noqa: E501 + :type: float + """ + + self._gamma = gamma + + @property + def delta(self): + """Gets the delta of this AnalyticsData. # noqa: E501 + + + :return: The delta of this AnalyticsData. # noqa: E501 + :rtype: float + """ + return self._delta + + @delta.setter + def delta(self, delta): + """Sets the delta of this AnalyticsData. + + + :param delta: The delta of this AnalyticsData. # noqa: E501 + :type: float + """ + + self._delta = delta + + @property + def iv(self): + """Gets the iv of this AnalyticsData. # noqa: E501 + + + :return: The iv of this AnalyticsData. # noqa: E501 + :rtype: float + """ + return self._iv + + @iv.setter + def iv(self, iv): + """Sets the iv of this AnalyticsData. + + + :param iv: The iv of this AnalyticsData. # noqa: E501 + :type: float + """ + + self._iv = iv + + @property + def pop(self): + """Gets the pop of this AnalyticsData. # noqa: E501 + + + :return: The pop of this AnalyticsData. # noqa: E501 + :rtype: float + """ + return self._pop + + @pop.setter + def pop(self, pop): + """Sets the pop of this AnalyticsData. + + + :param pop: The pop of this AnalyticsData. # noqa: E501 + :type: float + """ + + self._pop = pop + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AnalyticsData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AnalyticsData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/upstox_client/models/exchange_timing_data.py b/upstox_client/models/exchange_timing_data.py new file mode 100644 index 0000000..8c0154f --- /dev/null +++ b/upstox_client/models/exchange_timing_data.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + OpenAPI definition + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: v0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class ExchangeTimingData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'exchange': 'str', + 'start_time': 'int', + 'end_time': 'int' + } + + attribute_map = { + 'exchange': 'exchange', + 'start_time': 'start_time', + 'end_time': 'end_time' + } + + def __init__(self, exchange=None, start_time=None, end_time=None): # noqa: E501 + """ExchangeTimingData - a model defined in Swagger""" # noqa: E501 + self._exchange = None + self._start_time = None + self._end_time = None + self.discriminator = None + if exchange is not None: + self.exchange = exchange + if start_time is not None: + self.start_time = start_time + if end_time is not None: + self.end_time = end_time + + @property + def exchange(self): + """Gets the exchange of this ExchangeTimingData. # noqa: E501 + + + :return: The exchange of this ExchangeTimingData. # noqa: E501 + :rtype: str + """ + return self._exchange + + @exchange.setter + def exchange(self, exchange): + """Sets the exchange of this ExchangeTimingData. + + + :param exchange: The exchange of this ExchangeTimingData. # noqa: E501 + :type: str + """ + + self._exchange = exchange + + @property + def start_time(self): + """Gets the start_time of this ExchangeTimingData. # noqa: E501 + + + :return: The start_time of this ExchangeTimingData. # noqa: E501 + :rtype: int + """ + return self._start_time + + @start_time.setter + def start_time(self, start_time): + """Sets the start_time of this ExchangeTimingData. + + + :param start_time: The start_time of this ExchangeTimingData. # noqa: E501 + :type: int + """ + + self._start_time = start_time + + @property + def end_time(self): + """Gets the end_time of this ExchangeTimingData. # noqa: E501 + + + :return: The end_time of this ExchangeTimingData. # noqa: E501 + :rtype: int + """ + return self._end_time + + @end_time.setter + def end_time(self, end_time): + """Sets the end_time of this ExchangeTimingData. + + + :param end_time: The end_time of this ExchangeTimingData. # noqa: E501 + :type: int + """ + + self._end_time = end_time + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ExchangeTimingData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ExchangeTimingData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/upstox_client/models/get_exchange_timing_response.py b/upstox_client/models/get_exchange_timing_response.py new file mode 100644 index 0000000..abd510e --- /dev/null +++ b/upstox_client/models/get_exchange_timing_response.py @@ -0,0 +1,144 @@ +# coding: utf-8 + +""" + OpenAPI definition + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: v0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class GetExchangeTimingResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'status': 'str', + 'data': 'list[ExchangeTimingData]' + } + + attribute_map = { + 'status': 'status', + 'data': 'data' + } + + def __init__(self, status=None, data=None): # noqa: E501 + """GetExchangeTimingResponse - a model defined in Swagger""" # noqa: E501 + self._status = None + self._data = None + self.discriminator = None + if status is not None: + self.status = status + if data is not None: + self.data = data + + @property + def status(self): + """Gets the status of this GetExchangeTimingResponse. # noqa: E501 + + + :return: The status of this GetExchangeTimingResponse. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this GetExchangeTimingResponse. + + + :param status: The status of this GetExchangeTimingResponse. # noqa: E501 + :type: str + """ + allowed_values = ["success", "error"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def data(self): + """Gets the data of this GetExchangeTimingResponse. # noqa: E501 + + Response data for exchange timing list # noqa: E501 + + :return: The data of this GetExchangeTimingResponse. # noqa: E501 + :rtype: list[ExchangeTimingData] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this GetExchangeTimingResponse. + + Response data for exchange timing list # noqa: E501 + + :param data: The data of this GetExchangeTimingResponse. # noqa: E501 + :type: list[ExchangeTimingData] + """ + + self._data = data + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(GetExchangeTimingResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, GetExchangeTimingResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/upstox_client/models/get_holiday_response.py b/upstox_client/models/get_holiday_response.py new file mode 100644 index 0000000..0361e4d --- /dev/null +++ b/upstox_client/models/get_holiday_response.py @@ -0,0 +1,144 @@ +# coding: utf-8 + +""" + OpenAPI definition + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: v0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class GetHolidayResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'status': 'str', + 'data': 'list[HolidayData]' + } + + attribute_map = { + 'status': 'status', + 'data': 'data' + } + + def __init__(self, status=None, data=None): # noqa: E501 + """GetHolidayResponse - a model defined in Swagger""" # noqa: E501 + self._status = None + self._data = None + self.discriminator = None + if status is not None: + self.status = status + if data is not None: + self.data = data + + @property + def status(self): + """Gets the status of this GetHolidayResponse. # noqa: E501 + + + :return: The status of this GetHolidayResponse. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this GetHolidayResponse. + + + :param status: The status of this GetHolidayResponse. # noqa: E501 + :type: str + """ + allowed_values = ["success", "error"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def data(self): + """Gets the data of this GetHolidayResponse. # noqa: E501 + + Response data for holiday list # noqa: E501 + + :return: The data of this GetHolidayResponse. # noqa: E501 + :rtype: list[HolidayData] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this GetHolidayResponse. + + Response data for holiday list # noqa: E501 + + :param data: The data of this GetHolidayResponse. # noqa: E501 + :type: list[HolidayData] + """ + + self._data = data + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(GetHolidayResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, GetHolidayResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/upstox_client/models/get_market_status_response.py b/upstox_client/models/get_market_status_response.py new file mode 100644 index 0000000..696968b --- /dev/null +++ b/upstox_client/models/get_market_status_response.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + OpenAPI definition + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: v0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class GetMarketStatusResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'status': 'str', + 'data': 'MarketStatusData' + } + + attribute_map = { + 'status': 'status', + 'data': 'data' + } + + def __init__(self, status=None, data=None): # noqa: E501 + """GetMarketStatusResponse - a model defined in Swagger""" # noqa: E501 + self._status = None + self._data = None + self.discriminator = None + if status is not None: + self.status = status + if data is not None: + self.data = data + + @property + def status(self): + """Gets the status of this GetMarketStatusResponse. # noqa: E501 + + + :return: The status of this GetMarketStatusResponse. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this GetMarketStatusResponse. + + + :param status: The status of this GetMarketStatusResponse. # noqa: E501 + :type: str + """ + allowed_values = ["success", "error"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def data(self): + """Gets the data of this GetMarketStatusResponse. # noqa: E501 + + + :return: The data of this GetMarketStatusResponse. # noqa: E501 + :rtype: MarketStatusData + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this GetMarketStatusResponse. + + + :param data: The data of this GetMarketStatusResponse. # noqa: E501 + :type: MarketStatusData + """ + + self._data = data + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(GetMarketStatusResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, GetMarketStatusResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/upstox_client/models/get_option_chain_response.py b/upstox_client/models/get_option_chain_response.py new file mode 100644 index 0000000..3175e2e --- /dev/null +++ b/upstox_client/models/get_option_chain_response.py @@ -0,0 +1,144 @@ +# coding: utf-8 + +""" + OpenAPI definition + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: v0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class GetOptionChainResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'status': 'str', + 'data': 'list[OptionStrikeData]' + } + + attribute_map = { + 'status': 'status', + 'data': 'data' + } + + def __init__(self, status=None, data=None): # noqa: E501 + """GetOptionChainResponse - a model defined in Swagger""" # noqa: E501 + self._status = None + self._data = None + self.discriminator = None + if status is not None: + self.status = status + if data is not None: + self.data = data + + @property + def status(self): + """Gets the status of this GetOptionChainResponse. # noqa: E501 + + + :return: The status of this GetOptionChainResponse. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this GetOptionChainResponse. + + + :param status: The status of this GetOptionChainResponse. # noqa: E501 + :type: str + """ + allowed_values = ["success", "error"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def data(self): + """Gets the data of this GetOptionChainResponse. # noqa: E501 + + Response data for option chain data # noqa: E501 + + :return: The data of this GetOptionChainResponse. # noqa: E501 + :rtype: list[OptionStrikeData] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this GetOptionChainResponse. + + Response data for option chain data # noqa: E501 + + :param data: The data of this GetOptionChainResponse. # noqa: E501 + :type: list[OptionStrikeData] + """ + + self._data = data + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(GetOptionChainResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, GetOptionChainResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/upstox_client/models/get_option_contract_response.py b/upstox_client/models/get_option_contract_response.py new file mode 100644 index 0000000..09139fd --- /dev/null +++ b/upstox_client/models/get_option_contract_response.py @@ -0,0 +1,144 @@ +# coding: utf-8 + +""" + OpenAPI definition + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: v0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class GetOptionContractResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'status': 'str', + 'data': 'list[InstrumentData]' + } + + attribute_map = { + 'status': 'status', + 'data': 'data' + } + + def __init__(self, status=None, data=None): # noqa: E501 + """GetOptionContractResponse - a model defined in Swagger""" # noqa: E501 + self._status = None + self._data = None + self.discriminator = None + if status is not None: + self.status = status + if data is not None: + self.data = data + + @property + def status(self): + """Gets the status of this GetOptionContractResponse. # noqa: E501 + + + :return: The status of this GetOptionContractResponse. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this GetOptionContractResponse. + + + :param status: The status of this GetOptionContractResponse. # noqa: E501 + :type: str + """ + allowed_values = ["success", "error"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def data(self): + """Gets the data of this GetOptionContractResponse. # noqa: E501 + + Response data for option contracts # noqa: E501 + + :return: The data of this GetOptionContractResponse. # noqa: E501 + :rtype: list[InstrumentData] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this GetOptionContractResponse. + + Response data for option contracts # noqa: E501 + + :param data: The data of this GetOptionContractResponse. # noqa: E501 + :type: list[InstrumentData] + """ + + self._data = data + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(GetOptionContractResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, GetOptionContractResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/upstox_client/models/holiday_data.py b/upstox_client/models/holiday_data.py new file mode 100644 index 0000000..5160d04 --- /dev/null +++ b/upstox_client/models/holiday_data.py @@ -0,0 +1,220 @@ +# coding: utf-8 + +""" + OpenAPI definition + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: v0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class HolidayData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + '_date': 'datetime', + 'description': 'str', + 'holiday_type': 'str', + 'closed_exchanges': 'list[str]', + 'open_exchanges': 'list[ExchangeTimingData]' + } + + attribute_map = { + '_date': 'date', + 'description': 'description', + 'holiday_type': 'holiday_type', + 'closed_exchanges': 'closed_exchanges', + 'open_exchanges': 'open_exchanges' + } + + def __init__(self, _date=None, description=None, holiday_type=None, closed_exchanges=None, open_exchanges=None): # noqa: E501 + """HolidayData - a model defined in Swagger""" # noqa: E501 + self.__date = None + self._description = None + self._holiday_type = None + self._closed_exchanges = None + self._open_exchanges = None + self.discriminator = None + if _date is not None: + self._date = _date + if description is not None: + self.description = description + if holiday_type is not None: + self.holiday_type = holiday_type + if closed_exchanges is not None: + self.closed_exchanges = closed_exchanges + if open_exchanges is not None: + self.open_exchanges = open_exchanges + + @property + def _date(self): + """Gets the _date of this HolidayData. # noqa: E501 + + + :return: The _date of this HolidayData. # noqa: E501 + :rtype: datetime + """ + return self.__date + + @_date.setter + def _date(self, _date): + """Sets the _date of this HolidayData. + + + :param _date: The _date of this HolidayData. # noqa: E501 + :type: datetime + """ + + self.__date = _date + + @property + def description(self): + """Gets the description of this HolidayData. # noqa: E501 + + + :return: The description of this HolidayData. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this HolidayData. + + + :param description: The description of this HolidayData. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def holiday_type(self): + """Gets the holiday_type of this HolidayData. # noqa: E501 + + + :return: The holiday_type of this HolidayData. # noqa: E501 + :rtype: str + """ + return self._holiday_type + + @holiday_type.setter + def holiday_type(self, holiday_type): + """Sets the holiday_type of this HolidayData. + + + :param holiday_type: The holiday_type of this HolidayData. # noqa: E501 + :type: str + """ + allowed_values = ["ALL", "SETTLEMENT_HOLIDAY", "TRADING_HOLIDAY", "SPECIAL_TIMING"] # noqa: E501 + if holiday_type not in allowed_values: + raise ValueError( + "Invalid value for `holiday_type` ({0}), must be one of {1}" # noqa: E501 + .format(holiday_type, allowed_values) + ) + + self._holiday_type = holiday_type + + @property + def closed_exchanges(self): + """Gets the closed_exchanges of this HolidayData. # noqa: E501 + + + :return: The closed_exchanges of this HolidayData. # noqa: E501 + :rtype: list[str] + """ + return self._closed_exchanges + + @closed_exchanges.setter + def closed_exchanges(self, closed_exchanges): + """Sets the closed_exchanges of this HolidayData. + + + :param closed_exchanges: The closed_exchanges of this HolidayData. # noqa: E501 + :type: list[str] + """ + + self._closed_exchanges = closed_exchanges + + @property + def open_exchanges(self): + """Gets the open_exchanges of this HolidayData. # noqa: E501 + + + :return: The open_exchanges of this HolidayData. # noqa: E501 + :rtype: list[ExchangeTimingData] + """ + return self._open_exchanges + + @open_exchanges.setter + def open_exchanges(self, open_exchanges): + """Sets the open_exchanges of this HolidayData. + + + :param open_exchanges: The open_exchanges of this HolidayData. # noqa: E501 + :type: list[ExchangeTimingData] + """ + + self._open_exchanges = open_exchanges + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(HolidayData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, HolidayData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/upstox_client/models/instrument_data.py b/upstox_client/models/instrument_data.py new file mode 100644 index 0000000..b4e35bb --- /dev/null +++ b/upstox_client/models/instrument_data.py @@ -0,0 +1,1020 @@ +# coding: utf-8 + +""" + OpenAPI definition + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: v0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class InstrumentData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'str', + 'segment': 'str', + 'exchange': 'str', + 'isin': 'str', + 'expiry': 'datetime', + 'country': 'str', + 'latency': 'str', + 'description': 'str', + 'currency': 'str', + 'weekly': 'bool', + 'instrument_key': 'str', + 'exchange_token': 'str', + 'trading_symbol': 'str', + 'short_name': 'str', + 'tick_size': 'float', + 'lot_size': 'int', + 'instrument_type': 'str', + 'freeze_quantity': 'float', + 'underlying_key': 'str', + 'underlying_type': 'str', + 'underlying_symbol': 'str', + 'last_trading_date': 'datetime', + 'strike_price': 'float', + 'price_quote_unit': 'str', + 'qty_multiplier': 'int', + 'minimum_lot': 'int', + 'start_time': 'str', + 'end_time': 'str', + 'week_days': 'str', + 'general_denominator': 'float', + 'general_numerator': 'float', + 'price_numerator': 'float', + 'price_denominator': 'float', + 'mtf_enabled': 'bool', + 'mtf_bracket': 'float', + 'security_type': 'str' + } + + attribute_map = { + 'name': 'name', + 'segment': 'segment', + 'exchange': 'exchange', + 'isin': 'isin', + 'expiry': 'expiry', + 'country': 'country', + 'latency': 'latency', + 'description': 'description', + 'currency': 'currency', + 'weekly': 'weekly', + 'instrument_key': 'instrument_key', + 'exchange_token': 'exchange_token', + 'trading_symbol': 'trading_symbol', + 'short_name': 'short_name', + 'tick_size': 'tick_size', + 'lot_size': 'lot_size', + 'instrument_type': 'instrument_type', + 'freeze_quantity': 'freeze_quantity', + 'underlying_key': 'underlying_key', + 'underlying_type': 'underlying_type', + 'underlying_symbol': 'underlying_symbol', + 'last_trading_date': 'last_trading_date', + 'strike_price': 'strike_price', + 'price_quote_unit': 'price_quote_unit', + 'qty_multiplier': 'qty_multiplier', + 'minimum_lot': 'minimum_lot', + 'start_time': 'start_time', + 'end_time': 'end_time', + 'week_days': 'week_days', + 'general_denominator': 'general_denominator', + 'general_numerator': 'general_numerator', + 'price_numerator': 'price_numerator', + 'price_denominator': 'price_denominator', + 'mtf_enabled': 'mtf_enabled', + 'mtf_bracket': 'mtf_bracket', + 'security_type': 'security_type' + } + + def __init__(self, name=None, segment=None, exchange=None, isin=None, expiry=None, country=None, latency=None, description=None, currency=None, weekly=None, instrument_key=None, exchange_token=None, trading_symbol=None, short_name=None, tick_size=None, lot_size=None, instrument_type=None, freeze_quantity=None, underlying_key=None, underlying_type=None, underlying_symbol=None, last_trading_date=None, strike_price=None, price_quote_unit=None, qty_multiplier=None, minimum_lot=None, start_time=None, end_time=None, week_days=None, general_denominator=None, general_numerator=None, price_numerator=None, price_denominator=None, mtf_enabled=None, mtf_bracket=None, security_type=None): # noqa: E501 + """InstrumentData - a model defined in Swagger""" # noqa: E501 + self._name = None + self._segment = None + self._exchange = None + self._isin = None + self._expiry = None + self._country = None + self._latency = None + self._description = None + self._currency = None + self._weekly = None + self._instrument_key = None + self._exchange_token = None + self._trading_symbol = None + self._short_name = None + self._tick_size = None + self._lot_size = None + self._instrument_type = None + self._freeze_quantity = None + self._underlying_key = None + self._underlying_type = None + self._underlying_symbol = None + self._last_trading_date = None + self._strike_price = None + self._price_quote_unit = None + self._qty_multiplier = None + self._minimum_lot = None + self._start_time = None + self._end_time = None + self._week_days = None + self._general_denominator = None + self._general_numerator = None + self._price_numerator = None + self._price_denominator = None + self._mtf_enabled = None + self._mtf_bracket = None + self._security_type = None + self.discriminator = None + if name is not None: + self.name = name + if segment is not None: + self.segment = segment + if exchange is not None: + self.exchange = exchange + if isin is not None: + self.isin = isin + if expiry is not None: + self.expiry = expiry + if country is not None: + self.country = country + if latency is not None: + self.latency = latency + if description is not None: + self.description = description + if currency is not None: + self.currency = currency + if weekly is not None: + self.weekly = weekly + if instrument_key is not None: + self.instrument_key = instrument_key + if exchange_token is not None: + self.exchange_token = exchange_token + if trading_symbol is not None: + self.trading_symbol = trading_symbol + if short_name is not None: + self.short_name = short_name + if tick_size is not None: + self.tick_size = tick_size + if lot_size is not None: + self.lot_size = lot_size + if instrument_type is not None: + self.instrument_type = instrument_type + if freeze_quantity is not None: + self.freeze_quantity = freeze_quantity + if underlying_key is not None: + self.underlying_key = underlying_key + if underlying_type is not None: + self.underlying_type = underlying_type + if underlying_symbol is not None: + self.underlying_symbol = underlying_symbol + if last_trading_date is not None: + self.last_trading_date = last_trading_date + if strike_price is not None: + self.strike_price = strike_price + if price_quote_unit is not None: + self.price_quote_unit = price_quote_unit + if qty_multiplier is not None: + self.qty_multiplier = qty_multiplier + if minimum_lot is not None: + self.minimum_lot = minimum_lot + if start_time is not None: + self.start_time = start_time + if end_time is not None: + self.end_time = end_time + if week_days is not None: + self.week_days = week_days + if general_denominator is not None: + self.general_denominator = general_denominator + if general_numerator is not None: + self.general_numerator = general_numerator + if price_numerator is not None: + self.price_numerator = price_numerator + if price_denominator is not None: + self.price_denominator = price_denominator + if mtf_enabled is not None: + self.mtf_enabled = mtf_enabled + if mtf_bracket is not None: + self.mtf_bracket = mtf_bracket + if security_type is not None: + self.security_type = security_type + + @property + def name(self): + """Gets the name of this InstrumentData. # noqa: E501 + + + :return: The name of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this InstrumentData. + + + :param name: The name of this InstrumentData. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def segment(self): + """Gets the segment of this InstrumentData. # noqa: E501 + + + :return: The segment of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._segment + + @segment.setter + def segment(self, segment): + """Sets the segment of this InstrumentData. + + + :param segment: The segment of this InstrumentData. # noqa: E501 + :type: str + """ + + self._segment = segment + + @property + def exchange(self): + """Gets the exchange of this InstrumentData. # noqa: E501 + + + :return: The exchange of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._exchange + + @exchange.setter + def exchange(self, exchange): + """Sets the exchange of this InstrumentData. + + + :param exchange: The exchange of this InstrumentData. # noqa: E501 + :type: str + """ + + self._exchange = exchange + + @property + def isin(self): + """Gets the isin of this InstrumentData. # noqa: E501 + + + :return: The isin of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._isin + + @isin.setter + def isin(self, isin): + """Sets the isin of this InstrumentData. + + + :param isin: The isin of this InstrumentData. # noqa: E501 + :type: str + """ + + self._isin = isin + + @property + def expiry(self): + """Gets the expiry of this InstrumentData. # noqa: E501 + + + :return: The expiry of this InstrumentData. # noqa: E501 + :rtype: datetime + """ + return self._expiry + + @expiry.setter + def expiry(self, expiry): + """Sets the expiry of this InstrumentData. + + + :param expiry: The expiry of this InstrumentData. # noqa: E501 + :type: datetime + """ + + self._expiry = expiry + + @property + def country(self): + """Gets the country of this InstrumentData. # noqa: E501 + + + :return: The country of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._country + + @country.setter + def country(self, country): + """Sets the country of this InstrumentData. + + + :param country: The country of this InstrumentData. # noqa: E501 + :type: str + """ + + self._country = country + + @property + def latency(self): + """Gets the latency of this InstrumentData. # noqa: E501 + + + :return: The latency of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._latency + + @latency.setter + def latency(self, latency): + """Sets the latency of this InstrumentData. + + + :param latency: The latency of this InstrumentData. # noqa: E501 + :type: str + """ + + self._latency = latency + + @property + def description(self): + """Gets the description of this InstrumentData. # noqa: E501 + + + :return: The description of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this InstrumentData. + + + :param description: The description of this InstrumentData. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def currency(self): + """Gets the currency of this InstrumentData. # noqa: E501 + + + :return: The currency of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._currency + + @currency.setter + def currency(self, currency): + """Sets the currency of this InstrumentData. + + + :param currency: The currency of this InstrumentData. # noqa: E501 + :type: str + """ + + self._currency = currency + + @property + def weekly(self): + """Gets the weekly of this InstrumentData. # noqa: E501 + + + :return: The weekly of this InstrumentData. # noqa: E501 + :rtype: bool + """ + return self._weekly + + @weekly.setter + def weekly(self, weekly): + """Sets the weekly of this InstrumentData. + + + :param weekly: The weekly of this InstrumentData. # noqa: E501 + :type: bool + """ + + self._weekly = weekly + + @property + def instrument_key(self): + """Gets the instrument_key of this InstrumentData. # noqa: E501 + + + :return: The instrument_key of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._instrument_key + + @instrument_key.setter + def instrument_key(self, instrument_key): + """Sets the instrument_key of this InstrumentData. + + + :param instrument_key: The instrument_key of this InstrumentData. # noqa: E501 + :type: str + """ + + self._instrument_key = instrument_key + + @property + def exchange_token(self): + """Gets the exchange_token of this InstrumentData. # noqa: E501 + + + :return: The exchange_token of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._exchange_token + + @exchange_token.setter + def exchange_token(self, exchange_token): + """Sets the exchange_token of this InstrumentData. + + + :param exchange_token: The exchange_token of this InstrumentData. # noqa: E501 + :type: str + """ + + self._exchange_token = exchange_token + + @property + def trading_symbol(self): + """Gets the trading_symbol of this InstrumentData. # noqa: E501 + + + :return: The trading_symbol of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._trading_symbol + + @trading_symbol.setter + def trading_symbol(self, trading_symbol): + """Sets the trading_symbol of this InstrumentData. + + + :param trading_symbol: The trading_symbol of this InstrumentData. # noqa: E501 + :type: str + """ + + self._trading_symbol = trading_symbol + + @property + def short_name(self): + """Gets the short_name of this InstrumentData. # noqa: E501 + + + :return: The short_name of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._short_name + + @short_name.setter + def short_name(self, short_name): + """Sets the short_name of this InstrumentData. + + + :param short_name: The short_name of this InstrumentData. # noqa: E501 + :type: str + """ + + self._short_name = short_name + + @property + def tick_size(self): + """Gets the tick_size of this InstrumentData. # noqa: E501 + + + :return: The tick_size of this InstrumentData. # noqa: E501 + :rtype: float + """ + return self._tick_size + + @tick_size.setter + def tick_size(self, tick_size): + """Sets the tick_size of this InstrumentData. + + + :param tick_size: The tick_size of this InstrumentData. # noqa: E501 + :type: float + """ + + self._tick_size = tick_size + + @property + def lot_size(self): + """Gets the lot_size of this InstrumentData. # noqa: E501 + + + :return: The lot_size of this InstrumentData. # noqa: E501 + :rtype: int + """ + return self._lot_size + + @lot_size.setter + def lot_size(self, lot_size): + """Sets the lot_size of this InstrumentData. + + + :param lot_size: The lot_size of this InstrumentData. # noqa: E501 + :type: int + """ + + self._lot_size = lot_size + + @property + def instrument_type(self): + """Gets the instrument_type of this InstrumentData. # noqa: E501 + + + :return: The instrument_type of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._instrument_type + + @instrument_type.setter + def instrument_type(self, instrument_type): + """Sets the instrument_type of this InstrumentData. + + + :param instrument_type: The instrument_type of this InstrumentData. # noqa: E501 + :type: str + """ + + self._instrument_type = instrument_type + + @property + def freeze_quantity(self): + """Gets the freeze_quantity of this InstrumentData. # noqa: E501 + + + :return: The freeze_quantity of this InstrumentData. # noqa: E501 + :rtype: float + """ + return self._freeze_quantity + + @freeze_quantity.setter + def freeze_quantity(self, freeze_quantity): + """Sets the freeze_quantity of this InstrumentData. + + + :param freeze_quantity: The freeze_quantity of this InstrumentData. # noqa: E501 + :type: float + """ + + self._freeze_quantity = freeze_quantity + + @property + def underlying_key(self): + """Gets the underlying_key of this InstrumentData. # noqa: E501 + + + :return: The underlying_key of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._underlying_key + + @underlying_key.setter + def underlying_key(self, underlying_key): + """Sets the underlying_key of this InstrumentData. + + + :param underlying_key: The underlying_key of this InstrumentData. # noqa: E501 + :type: str + """ + + self._underlying_key = underlying_key + + @property + def underlying_type(self): + """Gets the underlying_type of this InstrumentData. # noqa: E501 + + + :return: The underlying_type of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._underlying_type + + @underlying_type.setter + def underlying_type(self, underlying_type): + """Sets the underlying_type of this InstrumentData. + + + :param underlying_type: The underlying_type of this InstrumentData. # noqa: E501 + :type: str + """ + + self._underlying_type = underlying_type + + @property + def underlying_symbol(self): + """Gets the underlying_symbol of this InstrumentData. # noqa: E501 + + + :return: The underlying_symbol of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._underlying_symbol + + @underlying_symbol.setter + def underlying_symbol(self, underlying_symbol): + """Sets the underlying_symbol of this InstrumentData. + + + :param underlying_symbol: The underlying_symbol of this InstrumentData. # noqa: E501 + :type: str + """ + + self._underlying_symbol = underlying_symbol + + @property + def last_trading_date(self): + """Gets the last_trading_date of this InstrumentData. # noqa: E501 + + + :return: The last_trading_date of this InstrumentData. # noqa: E501 + :rtype: datetime + """ + return self._last_trading_date + + @last_trading_date.setter + def last_trading_date(self, last_trading_date): + """Sets the last_trading_date of this InstrumentData. + + + :param last_trading_date: The last_trading_date of this InstrumentData. # noqa: E501 + :type: datetime + """ + + self._last_trading_date = last_trading_date + + @property + def strike_price(self): + """Gets the strike_price of this InstrumentData. # noqa: E501 + + + :return: The strike_price of this InstrumentData. # noqa: E501 + :rtype: float + """ + return self._strike_price + + @strike_price.setter + def strike_price(self, strike_price): + """Sets the strike_price of this InstrumentData. + + + :param strike_price: The strike_price of this InstrumentData. # noqa: E501 + :type: float + """ + + self._strike_price = strike_price + + @property + def price_quote_unit(self): + """Gets the price_quote_unit of this InstrumentData. # noqa: E501 + + + :return: The price_quote_unit of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._price_quote_unit + + @price_quote_unit.setter + def price_quote_unit(self, price_quote_unit): + """Sets the price_quote_unit of this InstrumentData. + + + :param price_quote_unit: The price_quote_unit of this InstrumentData. # noqa: E501 + :type: str + """ + + self._price_quote_unit = price_quote_unit + + @property + def qty_multiplier(self): + """Gets the qty_multiplier of this InstrumentData. # noqa: E501 + + + :return: The qty_multiplier of this InstrumentData. # noqa: E501 + :rtype: int + """ + return self._qty_multiplier + + @qty_multiplier.setter + def qty_multiplier(self, qty_multiplier): + """Sets the qty_multiplier of this InstrumentData. + + + :param qty_multiplier: The qty_multiplier of this InstrumentData. # noqa: E501 + :type: int + """ + + self._qty_multiplier = qty_multiplier + + @property + def minimum_lot(self): + """Gets the minimum_lot of this InstrumentData. # noqa: E501 + + + :return: The minimum_lot of this InstrumentData. # noqa: E501 + :rtype: int + """ + return self._minimum_lot + + @minimum_lot.setter + def minimum_lot(self, minimum_lot): + """Sets the minimum_lot of this InstrumentData. + + + :param minimum_lot: The minimum_lot of this InstrumentData. # noqa: E501 + :type: int + """ + + self._minimum_lot = minimum_lot + + @property + def start_time(self): + """Gets the start_time of this InstrumentData. # noqa: E501 + + + :return: The start_time of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._start_time + + @start_time.setter + def start_time(self, start_time): + """Sets the start_time of this InstrumentData. + + + :param start_time: The start_time of this InstrumentData. # noqa: E501 + :type: str + """ + + self._start_time = start_time + + @property + def end_time(self): + """Gets the end_time of this InstrumentData. # noqa: E501 + + + :return: The end_time of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._end_time + + @end_time.setter + def end_time(self, end_time): + """Sets the end_time of this InstrumentData. + + + :param end_time: The end_time of this InstrumentData. # noqa: E501 + :type: str + """ + + self._end_time = end_time + + @property + def week_days(self): + """Gets the week_days of this InstrumentData. # noqa: E501 + + + :return: The week_days of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._week_days + + @week_days.setter + def week_days(self, week_days): + """Sets the week_days of this InstrumentData. + + + :param week_days: The week_days of this InstrumentData. # noqa: E501 + :type: str + """ + + self._week_days = week_days + + @property + def general_denominator(self): + """Gets the general_denominator of this InstrumentData. # noqa: E501 + + + :return: The general_denominator of this InstrumentData. # noqa: E501 + :rtype: float + """ + return self._general_denominator + + @general_denominator.setter + def general_denominator(self, general_denominator): + """Sets the general_denominator of this InstrumentData. + + + :param general_denominator: The general_denominator of this InstrumentData. # noqa: E501 + :type: float + """ + + self._general_denominator = general_denominator + + @property + def general_numerator(self): + """Gets the general_numerator of this InstrumentData. # noqa: E501 + + + :return: The general_numerator of this InstrumentData. # noqa: E501 + :rtype: float + """ + return self._general_numerator + + @general_numerator.setter + def general_numerator(self, general_numerator): + """Sets the general_numerator of this InstrumentData. + + + :param general_numerator: The general_numerator of this InstrumentData. # noqa: E501 + :type: float + """ + + self._general_numerator = general_numerator + + @property + def price_numerator(self): + """Gets the price_numerator of this InstrumentData. # noqa: E501 + + + :return: The price_numerator of this InstrumentData. # noqa: E501 + :rtype: float + """ + return self._price_numerator + + @price_numerator.setter + def price_numerator(self, price_numerator): + """Sets the price_numerator of this InstrumentData. + + + :param price_numerator: The price_numerator of this InstrumentData. # noqa: E501 + :type: float + """ + + self._price_numerator = price_numerator + + @property + def price_denominator(self): + """Gets the price_denominator of this InstrumentData. # noqa: E501 + + + :return: The price_denominator of this InstrumentData. # noqa: E501 + :rtype: float + """ + return self._price_denominator + + @price_denominator.setter + def price_denominator(self, price_denominator): + """Sets the price_denominator of this InstrumentData. + + + :param price_denominator: The price_denominator of this InstrumentData. # noqa: E501 + :type: float + """ + + self._price_denominator = price_denominator + + @property + def mtf_enabled(self): + """Gets the mtf_enabled of this InstrumentData. # noqa: E501 + + + :return: The mtf_enabled of this InstrumentData. # noqa: E501 + :rtype: bool + """ + return self._mtf_enabled + + @mtf_enabled.setter + def mtf_enabled(self, mtf_enabled): + """Sets the mtf_enabled of this InstrumentData. + + + :param mtf_enabled: The mtf_enabled of this InstrumentData. # noqa: E501 + :type: bool + """ + + self._mtf_enabled = mtf_enabled + + @property + def mtf_bracket(self): + """Gets the mtf_bracket of this InstrumentData. # noqa: E501 + + + :return: The mtf_bracket of this InstrumentData. # noqa: E501 + :rtype: float + """ + return self._mtf_bracket + + @mtf_bracket.setter + def mtf_bracket(self, mtf_bracket): + """Sets the mtf_bracket of this InstrumentData. + + + :param mtf_bracket: The mtf_bracket of this InstrumentData. # noqa: E501 + :type: float + """ + + self._mtf_bracket = mtf_bracket + + @property + def security_type(self): + """Gets the security_type of this InstrumentData. # noqa: E501 + + + :return: The security_type of this InstrumentData. # noqa: E501 + :rtype: str + """ + return self._security_type + + @security_type.setter + def security_type(self, security_type): + """Sets the security_type of this InstrumentData. + + + :param security_type: The security_type of this InstrumentData. # noqa: E501 + :type: str + """ + + self._security_type = security_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(InstrumentData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, InstrumentData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/upstox_client/models/market_data.py b/upstox_client/models/market_data.py new file mode 100644 index 0000000..1bc1932 --- /dev/null +++ b/upstox_client/models/market_data.py @@ -0,0 +1,318 @@ +# coding: utf-8 + +""" + OpenAPI definition + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: v0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class MarketData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'ltp': 'float', + 'volume': 'int', + 'oi': 'float', + 'close_price': 'float', + 'bid_price': 'float', + 'bid_qty': 'int', + 'ask_price': 'float', + 'ask_qty': 'int', + 'prev_oi': 'float' + } + + attribute_map = { + 'ltp': 'ltp', + 'volume': 'volume', + 'oi': 'oi', + 'close_price': 'close_price', + 'bid_price': 'bid_price', + 'bid_qty': 'bid_qty', + 'ask_price': 'ask_price', + 'ask_qty': 'ask_qty', + 'prev_oi': 'prev_oi' + } + + def __init__(self, ltp=None, volume=None, oi=None, close_price=None, bid_price=None, bid_qty=None, ask_price=None, ask_qty=None, prev_oi=None): # noqa: E501 + """MarketData - a model defined in Swagger""" # noqa: E501 + self._ltp = None + self._volume = None + self._oi = None + self._close_price = None + self._bid_price = None + self._bid_qty = None + self._ask_price = None + self._ask_qty = None + self._prev_oi = None + self.discriminator = None + if ltp is not None: + self.ltp = ltp + if volume is not None: + self.volume = volume + if oi is not None: + self.oi = oi + if close_price is not None: + self.close_price = close_price + if bid_price is not None: + self.bid_price = bid_price + if bid_qty is not None: + self.bid_qty = bid_qty + if ask_price is not None: + self.ask_price = ask_price + if ask_qty is not None: + self.ask_qty = ask_qty + if prev_oi is not None: + self.prev_oi = prev_oi + + @property + def ltp(self): + """Gets the ltp of this MarketData. # noqa: E501 + + + :return: The ltp of this MarketData. # noqa: E501 + :rtype: float + """ + return self._ltp + + @ltp.setter + def ltp(self, ltp): + """Sets the ltp of this MarketData. + + + :param ltp: The ltp of this MarketData. # noqa: E501 + :type: float + """ + + self._ltp = ltp + + @property + def volume(self): + """Gets the volume of this MarketData. # noqa: E501 + + + :return: The volume of this MarketData. # noqa: E501 + :rtype: int + """ + return self._volume + + @volume.setter + def volume(self, volume): + """Sets the volume of this MarketData. + + + :param volume: The volume of this MarketData. # noqa: E501 + :type: int + """ + + self._volume = volume + + @property + def oi(self): + """Gets the oi of this MarketData. # noqa: E501 + + + :return: The oi of this MarketData. # noqa: E501 + :rtype: float + """ + return self._oi + + @oi.setter + def oi(self, oi): + """Sets the oi of this MarketData. + + + :param oi: The oi of this MarketData. # noqa: E501 + :type: float + """ + + self._oi = oi + + @property + def close_price(self): + """Gets the close_price of this MarketData. # noqa: E501 + + + :return: The close_price of this MarketData. # noqa: E501 + :rtype: float + """ + return self._close_price + + @close_price.setter + def close_price(self, close_price): + """Sets the close_price of this MarketData. + + + :param close_price: The close_price of this MarketData. # noqa: E501 + :type: float + """ + + self._close_price = close_price + + @property + def bid_price(self): + """Gets the bid_price of this MarketData. # noqa: E501 + + + :return: The bid_price of this MarketData. # noqa: E501 + :rtype: float + """ + return self._bid_price + + @bid_price.setter + def bid_price(self, bid_price): + """Sets the bid_price of this MarketData. + + + :param bid_price: The bid_price of this MarketData. # noqa: E501 + :type: float + """ + + self._bid_price = bid_price + + @property + def bid_qty(self): + """Gets the bid_qty of this MarketData. # noqa: E501 + + + :return: The bid_qty of this MarketData. # noqa: E501 + :rtype: int + """ + return self._bid_qty + + @bid_qty.setter + def bid_qty(self, bid_qty): + """Sets the bid_qty of this MarketData. + + + :param bid_qty: The bid_qty of this MarketData. # noqa: E501 + :type: int + """ + + self._bid_qty = bid_qty + + @property + def ask_price(self): + """Gets the ask_price of this MarketData. # noqa: E501 + + + :return: The ask_price of this MarketData. # noqa: E501 + :rtype: float + """ + return self._ask_price + + @ask_price.setter + def ask_price(self, ask_price): + """Sets the ask_price of this MarketData. + + + :param ask_price: The ask_price of this MarketData. # noqa: E501 + :type: float + """ + + self._ask_price = ask_price + + @property + def ask_qty(self): + """Gets the ask_qty of this MarketData. # noqa: E501 + + + :return: The ask_qty of this MarketData. # noqa: E501 + :rtype: int + """ + return self._ask_qty + + @ask_qty.setter + def ask_qty(self, ask_qty): + """Sets the ask_qty of this MarketData. + + + :param ask_qty: The ask_qty of this MarketData. # noqa: E501 + :type: int + """ + + self._ask_qty = ask_qty + + @property + def prev_oi(self): + """Gets the prev_oi of this MarketData. # noqa: E501 + + + :return: The prev_oi of this MarketData. # noqa: E501 + :rtype: float + """ + return self._prev_oi + + @prev_oi.setter + def prev_oi(self, prev_oi): + """Sets the prev_oi of this MarketData. + + + :param prev_oi: The prev_oi of this MarketData. # noqa: E501 + :type: float + """ + + self._prev_oi = prev_oi + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(MarketData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, MarketData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/upstox_client/models/market_status_data.py b/upstox_client/models/market_status_data.py new file mode 100644 index 0000000..c73d61f --- /dev/null +++ b/upstox_client/models/market_status_data.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + OpenAPI definition + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: v0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class MarketStatusData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'exchange': 'str', + 'status': 'str', + 'last_updated': 'int' + } + + attribute_map = { + 'exchange': 'exchange', + 'status': 'status', + 'last_updated': 'last_updated' + } + + def __init__(self, exchange=None, status=None, last_updated=None): # noqa: E501 + """MarketStatusData - a model defined in Swagger""" # noqa: E501 + self._exchange = None + self._status = None + self._last_updated = None + self.discriminator = None + if exchange is not None: + self.exchange = exchange + if status is not None: + self.status = status + if last_updated is not None: + self.last_updated = last_updated + + @property + def exchange(self): + """Gets the exchange of this MarketStatusData. # noqa: E501 + + + :return: The exchange of this MarketStatusData. # noqa: E501 + :rtype: str + """ + return self._exchange + + @exchange.setter + def exchange(self, exchange): + """Sets the exchange of this MarketStatusData. + + + :param exchange: The exchange of this MarketStatusData. # noqa: E501 + :type: str + """ + + self._exchange = exchange + + @property + def status(self): + """Gets the status of this MarketStatusData. # noqa: E501 + + + :return: The status of this MarketStatusData. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this MarketStatusData. + + + :param status: The status of this MarketStatusData. # noqa: E501 + :type: str + """ + + self._status = status + + @property + def last_updated(self): + """Gets the last_updated of this MarketStatusData. # noqa: E501 + + + :return: The last_updated of this MarketStatusData. # noqa: E501 + :rtype: int + """ + return self._last_updated + + @last_updated.setter + def last_updated(self, last_updated): + """Sets the last_updated of this MarketStatusData. + + + :param last_updated: The last_updated of this MarketStatusData. # noqa: E501 + :type: int + """ + + self._last_updated = last_updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(MarketStatusData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, MarketStatusData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/upstox_client/models/option_strike_data.py b/upstox_client/models/option_strike_data.py new file mode 100644 index 0000000..55116ae --- /dev/null +++ b/upstox_client/models/option_strike_data.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + OpenAPI definition + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: v0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class OptionStrikeData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'expiry': 'datetime', + 'pcr': 'float', + 'strike_price': 'float', + 'underlying_key': 'str', + 'underlying_spot_price': 'float', + 'call_options': 'PutCallOptionChainData', + 'put_options': 'PutCallOptionChainData' + } + + attribute_map = { + 'expiry': 'expiry', + 'pcr': 'pcr', + 'strike_price': 'strike_price', + 'underlying_key': 'underlying_key', + 'underlying_spot_price': 'underlying_spot_price', + 'call_options': 'call_options', + 'put_options': 'put_options' + } + + def __init__(self, expiry=None, pcr=None, strike_price=None, underlying_key=None, underlying_spot_price=None, call_options=None, put_options=None): # noqa: E501 + """OptionStrikeData - a model defined in Swagger""" # noqa: E501 + self._expiry = None + self._pcr = None + self._strike_price = None + self._underlying_key = None + self._underlying_spot_price = None + self._call_options = None + self._put_options = None + self.discriminator = None + if expiry is not None: + self.expiry = expiry + if pcr is not None: + self.pcr = pcr + if strike_price is not None: + self.strike_price = strike_price + if underlying_key is not None: + self.underlying_key = underlying_key + if underlying_spot_price is not None: + self.underlying_spot_price = underlying_spot_price + if call_options is not None: + self.call_options = call_options + if put_options is not None: + self.put_options = put_options + + @property + def expiry(self): + """Gets the expiry of this OptionStrikeData. # noqa: E501 + + + :return: The expiry of this OptionStrikeData. # noqa: E501 + :rtype: datetime + """ + return self._expiry + + @expiry.setter + def expiry(self, expiry): + """Sets the expiry of this OptionStrikeData. + + + :param expiry: The expiry of this OptionStrikeData. # noqa: E501 + :type: datetime + """ + + self._expiry = expiry + + @property + def pcr(self): + """Gets the pcr of this OptionStrikeData. # noqa: E501 + + + :return: The pcr of this OptionStrikeData. # noqa: E501 + :rtype: float + """ + return self._pcr + + @pcr.setter + def pcr(self, pcr): + """Sets the pcr of this OptionStrikeData. + + + :param pcr: The pcr of this OptionStrikeData. # noqa: E501 + :type: float + """ + + self._pcr = pcr + + @property + def strike_price(self): + """Gets the strike_price of this OptionStrikeData. # noqa: E501 + + + :return: The strike_price of this OptionStrikeData. # noqa: E501 + :rtype: float + """ + return self._strike_price + + @strike_price.setter + def strike_price(self, strike_price): + """Sets the strike_price of this OptionStrikeData. + + + :param strike_price: The strike_price of this OptionStrikeData. # noqa: E501 + :type: float + """ + + self._strike_price = strike_price + + @property + def underlying_key(self): + """Gets the underlying_key of this OptionStrikeData. # noqa: E501 + + + :return: The underlying_key of this OptionStrikeData. # noqa: E501 + :rtype: str + """ + return self._underlying_key + + @underlying_key.setter + def underlying_key(self, underlying_key): + """Sets the underlying_key of this OptionStrikeData. + + + :param underlying_key: The underlying_key of this OptionStrikeData. # noqa: E501 + :type: str + """ + + self._underlying_key = underlying_key + + @property + def underlying_spot_price(self): + """Gets the underlying_spot_price of this OptionStrikeData. # noqa: E501 + + + :return: The underlying_spot_price of this OptionStrikeData. # noqa: E501 + :rtype: float + """ + return self._underlying_spot_price + + @underlying_spot_price.setter + def underlying_spot_price(self, underlying_spot_price): + """Sets the underlying_spot_price of this OptionStrikeData. + + + :param underlying_spot_price: The underlying_spot_price of this OptionStrikeData. # noqa: E501 + :type: float + """ + + self._underlying_spot_price = underlying_spot_price + + @property + def call_options(self): + """Gets the call_options of this OptionStrikeData. # noqa: E501 + + + :return: The call_options of this OptionStrikeData. # noqa: E501 + :rtype: PutCallOptionChainData + """ + return self._call_options + + @call_options.setter + def call_options(self, call_options): + """Sets the call_options of this OptionStrikeData. + + + :param call_options: The call_options of this OptionStrikeData. # noqa: E501 + :type: PutCallOptionChainData + """ + + self._call_options = call_options + + @property + def put_options(self): + """Gets the put_options of this OptionStrikeData. # noqa: E501 + + + :return: The put_options of this OptionStrikeData. # noqa: E501 + :rtype: PutCallOptionChainData + """ + return self._put_options + + @put_options.setter + def put_options(self, put_options): + """Sets the put_options of this OptionStrikeData. + + + :param put_options: The put_options of this OptionStrikeData. # noqa: E501 + :type: PutCallOptionChainData + """ + + self._put_options = put_options + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OptionStrikeData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OptionStrikeData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/upstox_client/models/put_call_option_chain_data.py b/upstox_client/models/put_call_option_chain_data.py new file mode 100644 index 0000000..4815585 --- /dev/null +++ b/upstox_client/models/put_call_option_chain_data.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + OpenAPI definition + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 + + OpenAPI spec version: v0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class PutCallOptionChainData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'instrument_key': 'str', + 'market_data': 'MarketData', + 'option_greeks': 'AnalyticsData' + } + + attribute_map = { + 'instrument_key': 'instrument_key', + 'market_data': 'market_data', + 'option_greeks': 'option_greeks' + } + + def __init__(self, instrument_key=None, market_data=None, option_greeks=None): # noqa: E501 + """PutCallOptionChainData - a model defined in Swagger""" # noqa: E501 + self._instrument_key = None + self._market_data = None + self._option_greeks = None + self.discriminator = None + if instrument_key is not None: + self.instrument_key = instrument_key + if market_data is not None: + self.market_data = market_data + if option_greeks is not None: + self.option_greeks = option_greeks + + @property + def instrument_key(self): + """Gets the instrument_key of this PutCallOptionChainData. # noqa: E501 + + + :return: The instrument_key of this PutCallOptionChainData. # noqa: E501 + :rtype: str + """ + return self._instrument_key + + @instrument_key.setter + def instrument_key(self, instrument_key): + """Sets the instrument_key of this PutCallOptionChainData. + + + :param instrument_key: The instrument_key of this PutCallOptionChainData. # noqa: E501 + :type: str + """ + + self._instrument_key = instrument_key + + @property + def market_data(self): + """Gets the market_data of this PutCallOptionChainData. # noqa: E501 + + + :return: The market_data of this PutCallOptionChainData. # noqa: E501 + :rtype: MarketData + """ + return self._market_data + + @market_data.setter + def market_data(self, market_data): + """Sets the market_data of this PutCallOptionChainData. + + + :param market_data: The market_data of this PutCallOptionChainData. # noqa: E501 + :type: MarketData + """ + + self._market_data = market_data + + @property + def option_greeks(self): + """Gets the option_greeks of this PutCallOptionChainData. # noqa: E501 + + + :return: The option_greeks of this PutCallOptionChainData. # noqa: E501 + :rtype: AnalyticsData + """ + return self._option_greeks + + @option_greeks.setter + def option_greeks(self, option_greeks): + """Sets the option_greeks of this PutCallOptionChainData. + + + :param option_greeks: The option_greeks of this PutCallOptionChainData. # noqa: E501 + :type: AnalyticsData + """ + + self._option_greeks = option_greeks + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PutCallOptionChainData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PutCallOptionChainData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other