diff --git a/examples/README.md b/examples/README.md index 7f3477a..a7c92e1 100644 --- a/examples/README.md +++ b/examples/README.md @@ -35,7 +35,7 @@ Samples are grouped by API area. Each `.md` file contains one or more Python sni | [**expired-instruments/**](expired-instruments/) | Expiries, expired future/option contracts, expired historical candle data. | | [**market-information/**](market-information/) | Exchange status, market timings, market holidays, OI, change in OI, PCR, max pain, FII, and DII. | | [**smartlist/**](smartlist/) | Analytics-enriched smartlists for options, futures, and MTF stocks. | -| [**ipo/**](ipo/) | IPO listing (by status/issue type) and IPO details by id. | +| [**ipo/**](ipo/) | IPO listing (by status/issue type), IPO details by id, and IPO orders — apply, list, fetch by order id and cancel. | | [**gtt-orders/**](gtt-orders/) | Place, modify, cancel, and get details for GTT (Good Till Triggered) orders. | | [**margins/**](margins/) | Margin details. | | [**charges/**](charges/) | Brokerage details. | diff --git a/examples/ipo/README.md b/examples/ipo/README.md index af3de16..a2665b9 100644 --- a/examples/ipo/README.md +++ b/examples/ipo/README.md @@ -10,3 +10,25 @@ Links to all IPO-related examples in the `code/` folder. ## 2. Get IPO Details - 2.1 [Get IPO details by id](code/get-ipo.md#get-ipo-details-by-id) + +## 3. Apply for IPO + +- 3.1 [Apply for an IPO](code/apply-for-ipo.md#apply-for-an-ipo) +- 3.2 [Apply for an IPO with multiple bids](code/apply-for-ipo.md#apply-for-an-ipo-with-multiple-bids) + +## 4. Get IPO Orders + +- 4.1 [Get IPO orders](code/get-ipo-orders.md#get-ipo-orders) +- 4.2 [Get IPO orders with pagination](code/get-ipo-orders.md#get-ipo-orders-with-pagination) +- 4.3 [Iterate over IPO orders and their bids](code/get-ipo-orders.md#iterate-over-ipo-orders-and-their-bids) + +## 5. Get IPO Order Details + +- 5.1 [Get IPO order details by order id](code/get-ipo-order-details.md#get-ipo-order-details-by-order-id) +- 5.2 [Read the order and payment status of an IPO order](code/get-ipo-order-details.md#read-the-order-and-payment-status-of-an-ipo-order) +- 5.3 [Look up the most recent IPO order](code/get-ipo-order-details.md#look-up-the-most-recent-ipo-order) + +## 6. Cancel IPO Order + +- 6.1 [Cancel an IPO order](code/cancel-ipo-order.md#cancel-an-ipo-order) +- 6.2 [Apply, then cancel the same IPO order](code/cancel-ipo-order.md#apply-then-cancel-the-same-ipo-order) diff --git a/examples/ipo/code/apply-for-ipo.md b/examples/ipo/code/apply-for-ipo.md new file mode 100644 index 0000000..ee4adb6 --- /dev/null +++ b/examples/ipo/code/apply-for-ipo.md @@ -0,0 +1,65 @@ +## Apply for an IPO + +```python +import upstox_client +from upstox_client.rest import ApiException + +configuration = upstox_client.Configuration() +configuration.access_token = '{your_access_token}' + +api_instance = upstox_client.IpoApi(upstox_client.ApiClient(configuration)) + +# `id` is the IPO slug id returned by get_ipo_listing +# `category`: IND (Individual) | HNI (High Net-worth Individual) +# `bids`: at least one bid, maximum of 3 +body = upstox_client.IpoApplyRequest( + id='{ipo_slug_id}', + upi='{your_upi_id}', + category='IND', + bids=[ + upstox_client.IpoBidRequest(quantity=10, price=150.0) + ] +) + +try: + api_response = api_instance.apply_for_ipo(body) + print(api_response) + print('IPO order id:', api_response.data.order_id) +except ApiException as e: + print("Exception when calling IpoApi->apply_for_ipo: %s\n" % e) +``` + +## Apply for an IPO with multiple bids + +```python +import upstox_client +from upstox_client.rest import ApiException + +configuration = upstox_client.Configuration() +configuration.access_token = '{your_access_token}' + +api_instance = upstox_client.IpoApi(upstox_client.ApiClient(configuration)) + +# Up to 3 bids may be submitted in a single application. +# Use the cut-off price / lot size from get_ipo_details to build valid bids. +body = upstox_client.IpoApplyRequest( + id='{ipo_slug_id}', + upi='{your_upi_id}', + category='HNI', + bids=[ + upstox_client.IpoBidRequest(quantity=10, price=150.0), + upstox_client.IpoBidRequest(quantity=20, price=155.0), + upstox_client.IpoBidRequest(quantity=30, price=160.0) + ] +) + +try: + api_response = api_instance.apply_for_ipo(body) + print(api_response) +except ApiException as e: + print("Exception when calling IpoApi->apply_for_ipo: %s\n" % e) +``` + +> Note: after a successful application, approve the UPI mandate request in your +> UPI app to block the funds. Until the mandate is approved, the order remains +> pending. diff --git a/examples/ipo/code/cancel-ipo-order.md b/examples/ipo/code/cancel-ipo-order.md new file mode 100644 index 0000000..cc492ea --- /dev/null +++ b/examples/ipo/code/cancel-ipo-order.md @@ -0,0 +1,57 @@ +## Cancel an IPO order + +```python +import upstox_client +from upstox_client.rest import ApiException + +configuration = upstox_client.Configuration() +configuration.access_token = '{your_access_token}' + +api_instance = upstox_client.IpoApi(upstox_client.ApiClient(configuration)) + +# `order_id` is returned by apply_for_ipo or get_ipo_orders +order_id = '{ipo_order_id}' + +try: + api_response = api_instance.cancel_ipo_order(order_id) + print(api_response) + print('cancelled order id:', api_response.data.order_id) + print('status:', api_response.data.status) +except ApiException as e: + print("Exception when calling IpoApi->cancel_ipo_order: %s\n" % e) +``` + +## Apply, then cancel the same IPO order + +```python +import upstox_client +from upstox_client.rest import ApiException + +configuration = upstox_client.Configuration() +configuration.access_token = '{your_access_token}' + +api_instance = upstox_client.IpoApi(upstox_client.ApiClient(configuration)) + +body = upstox_client.IpoApplyRequest( + id='{ipo_slug_id}', + upi='{your_upi_id}', + category='IND', + bids=[ + upstox_client.IpoBidRequest(quantity=10, price=150.0) + ] +) + +try: + apply_response = api_instance.apply_for_ipo(body) + order_id = apply_response.data.order_id + print('applied, order id:', order_id) + + cancel_response = api_instance.cancel_ipo_order(order_id) + print('cancelled:', cancel_response.data.status) +except ApiException as e: + print("Exception when calling IpoApi ipo order write ops: %s\n" % e) +``` + +> Note: cancellation is only accepted while the IPO bidding window is still +> open. Once the issue closes, the order can no longer be withdrawn — check +> `bidding_end_date` from get_ipo_details before cancelling. diff --git a/examples/ipo/code/get-ipo-order-details.md b/examples/ipo/code/get-ipo-order-details.md new file mode 100644 index 0000000..fb1b56e --- /dev/null +++ b/examples/ipo/code/get-ipo-order-details.md @@ -0,0 +1,70 @@ +## Get IPO order details by order id + +```python +import upstox_client +from upstox_client.rest import ApiException + +configuration = upstox_client.Configuration() +configuration.access_token = '{your_access_token}' + +api_instance = upstox_client.IpoApi(upstox_client.ApiClient(configuration)) + +# `order_id` is returned by apply_for_ipo or get_ipo_orders +order_id = '{ipo_order_id}' + +try: + api_response = api_instance.get_ipo_order_by_id(order_id) + print(api_response) +except ApiException as e: + print("Exception when calling IpoApi->get_ipo_order_by_id: %s\n" % e) +``` + +## Read the order and payment status of an IPO order + +```python +import upstox_client +from upstox_client.rest import ApiException + +configuration = upstox_client.Configuration() +configuration.access_token = '{your_access_token}' + +api_instance = upstox_client.IpoApi(upstox_client.ApiClient(configuration)) + +order_id = '{ipo_order_id}' + +try: + api_response = api_instance.get_ipo_order_by_id(order_id) + order = api_response.data + print('symbol: ', order.symbol) + print('exchange: ', order.exchange) + print('order status: ', order.order_status) + print('payment status: ', order.payment_status) + print('units allotted: ', order.units_allotted) + for bid in order.bids or []: + print(' bid:', bid['quantity'], '@', bid['price'], '=', bid['amount']) +except ApiException as e: + print("Exception when calling IpoApi->get_ipo_order_by_id: %s\n" % e) +``` + +## Look up the most recent IPO order + +```python +import upstox_client +from upstox_client.rest import ApiException + +configuration = upstox_client.Configuration() +configuration.access_token = '{your_access_token}' + +api_instance = upstox_client.IpoApi(upstox_client.ApiClient(configuration)) + +try: + orders = api_instance.get_ipo_orders(page_number=1, records=1) + if orders.data: + order_id = orders.data[0]['order_id'] + api_response = api_instance.get_ipo_order_by_id(order_id) + print(api_response) + else: + print('no IPO orders found') +except ApiException as e: + print("Exception when calling IpoApi->get_ipo_order_by_id: %s\n" % e) +``` diff --git a/examples/ipo/code/get-ipo-orders.md b/examples/ipo/code/get-ipo-orders.md new file mode 100644 index 0000000..c685291 --- /dev/null +++ b/examples/ipo/code/get-ipo-orders.md @@ -0,0 +1,60 @@ +## Get IPO orders + +```python +import upstox_client +from upstox_client.rest import ApiException + +configuration = upstox_client.Configuration() +configuration.access_token = '{your_access_token}' + +api_instance = upstox_client.IpoApi(upstox_client.ApiClient(configuration)) + +try: + api_response = api_instance.get_ipo_orders() + print(api_response) +except ApiException as e: + print("Exception when calling IpoApi->get_ipo_orders: %s\n" % e) +``` + +## Get IPO orders with pagination + +```python +import upstox_client +from upstox_client.rest import ApiException + +configuration = upstox_client.Configuration() +configuration.access_token = '{your_access_token}' + +api_instance = upstox_client.IpoApi(upstox_client.ApiClient(configuration)) + +try: + api_response = api_instance.get_ipo_orders( + page_number=1, + records=20 + ) + print(api_response) + print('page:', api_response.meta_data.page) +except ApiException as e: + print("Exception when calling IpoApi->get_ipo_orders: %s\n" % e) +``` + +## Iterate over IPO orders and their bids + +```python +import upstox_client +from upstox_client.rest import ApiException + +configuration = upstox_client.Configuration() +configuration.access_token = '{your_access_token}' + +api_instance = upstox_client.IpoApi(upstox_client.ApiClient(configuration)) + +try: + api_response = api_instance.get_ipo_orders(page_number=1, records=50) + for order in api_response.data or []: + print(order['order_id'], order['symbol'], order['order_status'], order['payment_status']) + for bid in order.get('bids') or []: + print(' bid:', bid['quantity'], '@', bid['price'], '=', bid['amount']) +except ApiException as e: + print("Exception when calling IpoApi->get_ipo_orders: %s\n" % e) +``` diff --git a/interactive_examples/README.md b/interactive_examples/README.md index d63664f..426611b 100644 --- a/interactive_examples/README.md +++ b/interactive_examples/README.md @@ -273,6 +273,28 @@ python market_information/pcr_data.py --token --expiry 2026-05-29 --buc --- +### IPO +*Uses the [Upstox IPO API](https://upstox.com/developer/api-documentation/). Read-only: these examples cover the GET endpoints only — applying for and cancelling an IPO are not included.* + +| Script | What it does | +|---|---| +| `ipo/ipo_listing.py` | Lists IPOs filtered by status (open / closed / listed / upcoming) and issue type | +| `ipo/ipo_details.py` | Full profile for one IPO — price band, timeline, registrar, investor categories | +| `ipo/ipo_orders.py` | Your IPO applications, or a single application by order ID | + +```bash +python ipo/ipo_listing.py --token --status open +python ipo/ipo_listing.py --token --status upcoming --issue-type sme --records 30 +python ipo/ipo_details.py --token +python ipo/ipo_details.py --token --id +python ipo/ipo_orders.py --token --records 5 +python ipo/ipo_orders.py --token --order-id +``` + +> `ipo/ipo_orders.py` reads **your own** applications, so it needs a full access token — a read-only analytics token will not work. The other two work with either. + +--- + ## 🌐 Deploy the Streamlit App @@ -310,7 +332,8 @@ interactive_examples/ ├── portfolio_screening/ # 3 scripts ├── market_data/ # 8 scripts ├── fundamentals/ # 8 scripts -└── market_information/ # 6 scripts +├── market_information/ # 6 scripts +└── ipo/ # 3 scripts ``` --- diff --git a/interactive_examples/ipo/ipo_details.py b/interactive_examples/ipo/ipo_details.py new file mode 100644 index 0000000..a50a28c --- /dev/null +++ b/interactive_examples/ipo/ipo_details.py @@ -0,0 +1,169 @@ +""" +IPO Details — full profile for a single IPO: price band, timeline, registrar and subscription. + +With no --id, the most recent IPO from the listing endpoint is used. + +Usage: + python ipo/ipo_details.py --token + python ipo/ipo_details.py --token --id + python ipo/ipo_details.py --token --status upcoming +""" + +import argparse +import sys +import os + +sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) +from utils import get_api_client, die +import upstox_client + +BOLD = "\033[1m" +CYAN = "\033[36m" +DIM = "\033[2m" +RESET = "\033[0m" + +# (attribute on IpoDetailsData, display label) +PROFILE_FIELDS = [ + ("name", "Name"), + ("symbol", "Symbol"), + ("isin", "ISIN"), + ("status", "Status"), + ("issue_type", "Issue type"), + ("industry", "Industry"), + ("issue_size", "Issue size"), + ("face_value", "Face value"), + ("tick_size", "Tick size"), + ("lot_size", "Lot size"), + ("minimum_quantity", "Min quantity"), + ("cut_off_price", "Cut-off price"), + ("listing_price", "Listing price"), + ("listing_exchange", "Listing exchange"), + ("total_subscription", "Total subscription"), +] + +TIMELINE_FIELDS = [ + ("pre_apply_start_date", "Pre-apply start"), + ("application_start_date", "Application start"), + ("application_end_date", "Application end"), + ("allotment_start_date", "Allotment start"), + ("allotment_date", "Allotment"), + ("refund_initiation_date", "Refund initiation"), + ("mandate_end_date", "Mandate end"), + ("listing_date", "Listing"), +] + +REGISTRAR_FIELDS = [ + ("name", "Registrar"), + ("registrar", "Registrar code"), + ("contact_name", "Contact"), + ("contact_number", "Phone"), + ("email", "Email"), + ("website", "Website"), +] + + +def _get(obj, key): + """Attribute or key lookup that tolerates None, models and plain dicts.""" + if obj is None: + return None + if isinstance(obj, dict): + return obj.get(key) + return getattr(obj, key, None) + + +def _show(obj, fields, heading): + rows = [(label, _get(obj, attr)) for attr, label in fields] + rows = [(label, v) for label, v in rows if v is not None and v != ""] + if not rows: + return + print(f"{CYAN}{BOLD}{heading}{RESET}") + for label, value in rows: + print(f" {label:<22} {value}") + print() + + +def _resolve_id(api, status): + """Pick an IPO slug from the listing endpoint when the user did not supply one.""" + kwargs = {"page_number": 1, "records": 1} + if status: + kwargs["status"] = status + try: + listing = api.get_ipo_listing(**kwargs) + except Exception as e: + die(f"API error while resolving an IPO id: {e}") + + rows = listing.data or [] + if not rows: + die("No IPOs available to resolve an id from. Pass --id explicitly.") + + row = rows[0] + ipo_id = row.get("id") if isinstance(row, dict) else getattr(row, "id", None) + if not ipo_id: + die("Listing returned an IPO without an id. Pass --id explicitly.") + return ipo_id + + +def main(): + parser = argparse.ArgumentParser(description="Full details for a single Upstox IPO") + parser.add_argument("--token", required=True, help="Upstox access token or analytics token") + parser.add_argument("--id", help="IPO slug ID (default: first IPO from the listing)") + parser.add_argument("--status", choices=["open", "closed", "listed", "upcoming"], + help="When --id is omitted, resolve the id from this status") + args = parser.parse_args() + + client = get_api_client(args.token) + api = upstox_client.IpoApi(client) + + ipo_id = args.id or _resolve_id(api, args.status) + if not args.id: + print(f"{DIM}No --id given; using '{ipo_id}' from the listing.{RESET}") + + try: + response = api.get_ipo_details(ipo_id) + except Exception as e: + die(f"API error: {e}") + + data = response.data + if data is None: + die(f"No IPO found with id '{ipo_id}'.") + + print(f"\n{BOLD}IPO Details — {ipo_id}{RESET}\n") + + _show(data, PROFILE_FIELDS, "Profile") + + lo, hi = _get(data, "minimum_price"), _get(data, "maximum_price") + if lo is not None or hi is not None: + band = f"{lo} – {hi}" if lo != hi and hi is not None else f"{lo if lo is not None else hi}" + print(f"{CYAN}{BOLD}Price band{RESET}\n {band}\n") + + bid_start, bid_end = _get(data, "bidding_start_date"), _get(data, "bidding_end_date") + if bid_start or bid_end: + print(f"{CYAN}{BOLD}Bidding window{RESET}") + print(f" {'Start':<22} {bid_start or '—'}") + print(f" {'End':<22} {bid_end or '—'}") + daily_start, daily_end = _get(data, "daily_start_time"), _get(data, "daily_end_time") + if daily_start or daily_end: + print(f" {'Daily window':<22} {daily_start or '—'} – {daily_end or '—'}") + print() + + _show(_get(data, "timeline"), TIMELINE_FIELDS, "Timeline") + _show(_get(data, "registrar_info"), REGISTRAR_FIELDS, "Registrar") + + investors = _get(data, "investors") or [] + if investors: + print(f"{CYAN}{BOLD}Investor categories{RESET}") + for inv in investors: + category = _get(inv, "category") or "—" + description = _get(inv, "description") or "" + print(f" {str(category):<22} {description}") + print() + + for attr, label in (("rhp_url", "RHP"), ("drhp_url", "DRHP")): + url = _get(data, attr) + if url: + print(f"{DIM}{label}: {url}{RESET}") + print() + + +if __name__ == "__main__": + main() diff --git a/interactive_examples/ipo/ipo_listing.py b/interactive_examples/ipo/ipo_listing.py new file mode 100644 index 0000000..6f50221 --- /dev/null +++ b/interactive_examples/ipo/ipo_listing.py @@ -0,0 +1,114 @@ +""" +IPO Listing — list IPOs by status and issue type. + +Usage: + python ipo/ipo_listing.py --token + python ipo/ipo_listing.py --token --status open + python ipo/ipo_listing.py --token --status upcoming --issue-type sme --records 30 +""" + +import argparse +import sys +import os + +sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) +from utils import get_api_client, die +import upstox_client + +BOLD = "\033[1m" +DIM = "\033[2m" +RESET = "\033[0m" + +STATUSES = ["open", "closed", "listed", "upcoming"] +ISSUE_TYPES = ["regular", "sme"] + + +def _as_dict(o): + if o is None: + return {} + if isinstance(o, dict): + return o + if hasattr(o, "to_dict"): + return o.to_dict() + return vars(o) if hasattr(o, "__dict__") else {} + + +def _val(o, key): + d = _as_dict(o) + v = d.get(key) + return "—" if v is None or v == "" else v + + +def _band(row): + """Render the price band as 'min – max', collapsing to a single value when equal.""" + lo, hi = _as_dict(row).get("minimum_price"), _as_dict(row).get("maximum_price") + if lo is None and hi is None: + return "—" + if lo == hi or hi is None: + return f"{lo}" + if lo is None: + return f"{hi}" + return f"{lo} – {hi}" + + +def main(): + parser = argparse.ArgumentParser(description="List Upstox IPOs by status and issue type") + parser.add_argument("--token", required=True, help="Upstox access token or analytics token") + parser.add_argument("--status", choices=STATUSES, help="Filter by IPO status") + parser.add_argument("--issue-type", choices=ISSUE_TYPES, dest="issue_type", + help="Filter by issue type") + parser.add_argument("--page-number", type=int, default=1, dest="page_number", + help="Page number (default: 1)") + parser.add_argument("--records", type=int, default=20, + help="Records per page (default: 20, max: 30)") + args = parser.parse_args() + + client = get_api_client(args.token) + api = upstox_client.IpoApi(client) + + kwargs = {"page_number": args.page_number, "records": args.records} + if args.status: + kwargs["status"] = args.status + if args.issue_type: + kwargs["issue_type"] = args.issue_type + + try: + response = api.get_ipo_listing(**kwargs) + except Exception as e: + die(f"API error: {e}") + + rows = response.data or [] + if not rows: + print("No IPOs found for the given filters.") + return + + label = args.status or "all" + print(f"\n{BOLD}IPO Listing — {label}{RESET}\n") + print(f"{'Symbol':<14} {'Name':<30} {'Status':<10} {'Type':<9} " + f"{'Price Band':>16} {'Bid End':>12} {'Subs':>8}") + print("─" * 104) + + for row in rows: + print( + f"{str(_val(row, 'symbol')):<14.13} " + f"{str(_val(row, 'name')):<30.29} " + f"{str(_val(row, 'status')):<10.9} " + f"{str(_val(row, 'issue_type')):<9.8} " + f"{_band(row):>16} " + f"{str(_val(row, 'bidding_end_date')):>12.11} " + f"{str(_val(row, 'total_subscription')):>8.7}" + ) + + meta = getattr(response, "meta_data", None) + page = getattr(meta, "page", None) if meta else None + if page: + print( + f"\n{DIM}Page {getattr(page, 'page_number', '?')} of " + f"{getattr(page, 'total_pages', '?')} | " + f"{len(rows)} of {getattr(page, 'total_records', '?')} total{RESET}" + ) + print() + + +if __name__ == "__main__": + main() diff --git a/interactive_examples/ipo/ipo_orders.py b/interactive_examples/ipo/ipo_orders.py new file mode 100644 index 0000000..cbe6ba6 --- /dev/null +++ b/interactive_examples/ipo/ipo_orders.py @@ -0,0 +1,159 @@ +""" +IPO Orders — list your IPO applications, or fetch one by order ID. + +Requires a full access token (read-only analytics tokens cannot read your order book). + +Usage: + python ipo/ipo_orders.py --token + python ipo/ipo_orders.py --token --records 30 + python ipo/ipo_orders.py --token --order-id +""" + +import argparse +import sys +import os + +sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) +from utils import get_api_client, die +import upstox_client + +BOLD = "\033[1m" +CYAN = "\033[36m" +DIM = "\033[2m" +RESET = "\033[0m" + +DETAIL_FIELDS = [ + ("symbol", "Symbol"), + ("exchange", "Exchange"), + ("order_id", "Order ID"), + ("request_id", "Request ID"), + ("status", "Status"), + ("order_status", "Order status"), + ("payment_status", "Payment status"), + ("category", "Category"), + ("issue_type", "Issue type"), + ("upi", "UPI"), + ("upi_amount_blocked", "Amount blocked"), + ("units_allotted", "Units allotted"), + ("reason", "Reason"), + ("nse_submitted_date", "NSE submitted"), + ("bse_submitted_date", "BSE submitted"), + ("mandate_approved_date", "Mandate approved"), + ("mandate_rejection_date", "Mandate rejected"), + ("rejection_date", "Rejected"), + ("cancel_requested_date", "Cancel requested"), + ("cancel_accepted_date", "Cancel accepted"), + ("created_at", "Created"), + ("last_updated_at", "Last updated"), +] + + +def _as_dict(o): + if o is None: + return {} + if isinstance(o, dict): + return o + if hasattr(o, "to_dict"): + return o.to_dict() + return vars(o) if hasattr(o, "__dict__") else {} + + +def _val(o, key): + v = _as_dict(o).get(key) + return "—" if v is None or v == "" else v + + +def _print_bids(order): + bids = _as_dict(order).get("bids") or [] + if not bids: + return + print(f"{CYAN}{BOLD}Bids{RESET}") + print(f" {'Quantity':>10} {'Price':>12} {'Amount':>14} Message") + for bid in bids: + b = _as_dict(bid) + print( + f" {str(b.get('quantity', '—')):>10} " + f"{str(b.get('price', '—')):>12} " + f"{str(b.get('amount', '—')):>14} " + f"{b.get('message', '') or ''}" + ) + print() + + +def _print_one(order): + print(f"{CYAN}{BOLD}Order{RESET}") + for attr, label in DETAIL_FIELDS: + value = _as_dict(order).get(attr) + if value is None or value == "": + continue + print(f" {label:<22} {value}") + print() + _print_bids(order) + + +def main(): + parser = argparse.ArgumentParser(description="List Upstox IPO orders, or fetch one by ID") + parser.add_argument("--token", required=True, help="Upstox access token (not analytics)") + parser.add_argument("--order-id", dest="order_id", + help="Fetch a single order by ID instead of listing") + parser.add_argument("--page-number", type=int, default=1, dest="page_number", + help="Page number (default: 1)") + parser.add_argument("--records", type=int, default=20, + help="Records per page (default: 20)") + args = parser.parse_args() + + client = get_api_client(args.token) + api = upstox_client.IpoApi(client) + + if args.order_id: + try: + response = api.get_ipo_order_by_id(args.order_id) + except Exception as e: + die(f"API error: {e}") + + order = response.data + if order is None: + die(f"No IPO order found with ID '{args.order_id}'.") + + print(f"\n{BOLD}IPO Order — {args.order_id}{RESET}\n") + _print_one(order) + return + + try: + response = api.get_ipo_orders(page_number=args.page_number, records=args.records) + except Exception as e: + die(f"API error: {e}") + + orders = response.data or [] + if not orders: + print("No IPO orders found.") + return + + print(f"\n{BOLD}IPO Orders{RESET}\n") + print(f"{'Symbol':<14} {'Order ID':<22} {'Status':<12} {'Payment':<12} " + f"{'Blocked':>14} {'Allotted':>10}") + print("─" * 90) + + for order in orders: + print( + f"{str(_val(order, 'symbol')):<14.13} " + f"{str(_val(order, 'order_id')):<22.21} " + f"{str(_val(order, 'order_status')):<12.11} " + f"{str(_val(order, 'payment_status')):<12.11} " + f"{str(_val(order, 'upi_amount_blocked')):>14} " + f"{str(_val(order, 'units_allotted')):>10}" + ) + + meta = getattr(response, "meta_data", None) + page = getattr(meta, "page", None) if meta else None + if page: + print( + f"\n{DIM}Page {getattr(page, 'page_number', '?')} of " + f"{getattr(page, 'total_pages', '?')} | " + f"{len(orders)} of {getattr(page, 'total_records', '?')} total{RESET}" + ) + print() + + +if __name__ == "__main__": + main() diff --git a/interactive_examples/streamlit_app.py b/interactive_examples/streamlit_app.py index 1a0ffaa..9b37d86 100644 --- a/interactive_examples/streamlit_app.py +++ b/interactive_examples/streamlit_app.py @@ -120,6 +120,11 @@ "Max Pain", "PCR", ], + "🏛️ IPO": [ + "IPO Listing", + "IPO Details", + "IPO Orders", + ], "🔬 Fundamentals Analysis": [ "Company Profile", "Key Ratios", @@ -4365,5 +4370,289 @@ def _as_dict(o): }) +# ═════════════════════════════════════════════════════════════════════════════ +# 🏛️ IPO +# ═════════════════════════════════════════════════════════════════════════════ + +elif example == "IPO Listing": + client = require_client() + + c1, c2, c3 = st.columns([1, 1, 1]) + status = c1.selectbox("Status", ["all", "open", "closed", "listed", "upcoming"]) + issue_type = c2.selectbox("Issue type", ["all", "regular", "sme"]) + records = c3.number_input("Records", 1, 30, 20) + + clicked, link_slot = action_row("🏛️ Fetch IPOs") + if clicked: + kwargs = {"page_number": 1, "records": int(records)} + if status != "all": + kwargs["status"] = status + if issue_type != "all": + kwargs["issue_type"] = issue_type + + with st.spinner("Fetching IPOs…"): + api = upstox_client.IpoApi(client) + resp = api.get_ipo_listing(**kwargs) + + rows = resp.data or [] + if not rows: + st.warning("No IPOs found for the selected filters.") + st.stop() + + curl_jump_link(link_slot) + + def _d(o): + if isinstance(o, dict): + return o + return o.to_dict() if hasattr(o, "to_dict") else vars(o) + + recs = [_d(r) for r in rows] + + m1, m2, m3 = st.columns(3) + m1.metric("IPOs found", len(recs)) + m2.metric("Open", sum(1 for r in recs if str(r.get("status", "")).lower() == "open")) + m3.metric("SME", sum(1 for r in recs if str(r.get("issue_type", "")).lower() == "sme")) + st.divider() + + df = pd.DataFrame([{ + "Symbol": r.get("symbol"), + "Name": r.get("name"), + "Status": r.get("status"), + "Type": r.get("issue_type"), + "Min Price": r.get("minimum_price"), + "Max Price": r.get("maximum_price"), + "Issue Size": r.get("issue_size"), + "Industry": r.get("industry"), + "Bid Start": r.get("bidding_start_date"), + "Bid End": r.get("bidding_end_date"), + "Subscription": r.get("total_subscription"), + "ID": r.get("id"), + } for r in recs]) + st.dataframe(df, use_container_width=True, hide_index=True) + + sub = df[["Symbol", "Subscription"]].copy() + sub["Subscription"] = pd.to_numeric(sub["Subscription"], errors="coerce") + sub = sub.dropna(subset=["Subscription"]).sort_values("Subscription", ascending=False) + if not sub.empty: + fig = go.Figure() + fig.add_trace(go.Bar(x=sub["Symbol"], y=sub["Subscription"], + marker_color="#3498db", name="Subscription")) + fig.update_layout(title="Total subscription (times)", template="plotly_dark", + height=420, xaxis_title="Symbol", + yaxis=dict(title="Times subscribed")) + st.plotly_chart(fig, use_container_width=True) + + st.caption("Copy an **ID** from the table into **IPO Details** for the full profile.") + + show_curl("GET", "/v2/ipos", kwargs) + + +elif example == "IPO Details": + client = require_client() + + c1, c2 = st.columns([3, 1]) + ipo_id = c1.text_input("IPO slug ID", value="", + placeholder="e.g. the ID column from IPO Listing") + + clicked, link_slot = action_row("🔎 Fetch details") + if clicked: + if not ipo_id.strip(): + st.warning("Enter an IPO slug ID. You can copy one from the **IPO Listing** page.") + st.stop() + + with st.spinner("Fetching IPO details…"): + api = upstox_client.IpoApi(client) + resp = api.get_ipo_details(ipo_id.strip()) + + d = resp.data + if d is None: + st.warning(f"No IPO found with ID '{ipo_id}'.") + st.stop() + + curl_jump_link(link_slot) + + def _g(obj, key): + if obj is None: + return None + if isinstance(obj, dict): + return obj.get(key) + return getattr(obj, key, None) + + st.subheader(f"{_g(d, 'name') or ipo_id} · {_g(d, 'symbol') or '—'}") + + m1, m2, m3, m4 = st.columns(4) + lo, hi = _g(d, "minimum_price"), _g(d, "maximum_price") + band = f"{lo} – {hi}" if lo is not None and hi is not None and lo != hi else str( + lo if lo is not None else hi if hi is not None else "—") + m1.metric("Price band", band) + m2.metric("Lot size", str(_g(d, "lot_size") or "—")) + m3.metric("Status", str(_g(d, "status") or "—")) + m4.metric("Subscription", str(_g(d, "total_subscription") or "—")) + st.divider() + + profile = [ + ("ISIN", _g(d, "isin")), ("Issue type", _g(d, "issue_type")), + ("Industry", _g(d, "industry")), ("Issue size", _g(d, "issue_size")), + ("Face value", _g(d, "face_value")), ("Tick size", _g(d, "tick_size")), + ("Min quantity", _g(d, "minimum_quantity")), ("Cut-off price", _g(d, "cut_off_price")), + ("Listing price", _g(d, "listing_price")), + ("Listing exchange", _g(d, "listing_exchange")), + ("Bidding start", _g(d, "bidding_start_date")), + ("Bidding end", _g(d, "bidding_end_date")), + ("Daily start", _g(d, "daily_start_time")), + ("Daily end", _g(d, "daily_end_time")), + ] + # Values are a mix of strings and numbers; cast to str so Arrow can serialize + # the single "Value" column without falling back to type coercion. + prof_df = pd.DataFrame( + [{"Field": k, "Value": str(v)} for k, v in profile if v is not None and v != ""]) + if not prof_df.empty: + st.markdown("**Profile**") + st.dataframe(prof_df, use_container_width=True, hide_index=True) + + tl = _g(d, "timeline") + tl_rows = [ + ("Pre-apply start", _g(tl, "pre_apply_start_date")), + ("Application start", _g(tl, "application_start_date")), + ("Application end", _g(tl, "application_end_date")), + ("Allotment start", _g(tl, "allotment_start_date")), + ("Allotment", _g(tl, "allotment_date")), + ("Refund initiation", _g(tl, "refund_initiation_date")), + ("Mandate end", _g(tl, "mandate_end_date")), + ("Listing", _g(tl, "listing_date")), + ] + tl_df = pd.DataFrame( + [{"Milestone": k, "Date": str(v)} for k, v in tl_rows if v is not None and v != ""]) + if not tl_df.empty: + st.markdown("**Timeline**") + st.dataframe(tl_df, use_container_width=True, hide_index=True) + + reg = _g(d, "registrar_info") + reg_rows = [ + ("Registrar", _g(reg, "name")), ("Registrar code", _g(reg, "registrar")), + ("Contact", _g(reg, "contact_name")), ("Phone", _g(reg, "contact_number")), + ("Email", _g(reg, "email")), ("Website", _g(reg, "website")), + ] + reg_df = pd.DataFrame( + [{"Field": k, "Value": str(v)} for k, v in reg_rows if v is not None and v != ""]) + if not reg_df.empty: + st.markdown("**Registrar**") + st.dataframe(reg_df, use_container_width=True, hide_index=True) + + investors = _g(d, "investors") or [] + if investors: + inv_df = pd.DataFrame([{ + "Category": _g(i, "category"), "Description": _g(i, "description"), + } for i in investors]) + st.markdown("**Investor categories**") + st.dataframe(inv_df, use_container_width=True, hide_index=True) + + links = [(lbl, _g(d, a)) for a, lbl in (("rhp_url", "RHP"), ("drhp_url", "DRHP"))] + links = [(lbl, u) for lbl, u in links if u] + if links: + st.markdown(" · ".join(f"[{lbl}]({u})" for lbl, u in links)) + + st.caption("Prospectus links and registrar contact come straight from the IPO record.") + + show_curl("GET", f"/v2/ipos/{ipo_id.strip()}") + + +elif example == "IPO Orders": + client = require_client() + + st.info( + "This reads **your own** IPO applications, so it needs a full access token — " + "a read-only analytics token will not work here." + ) + + c1, c2 = st.columns([3, 1]) + order_id = c1.text_input("Order ID (optional)", value="", + placeholder="leave blank to list all your IPO orders") + records = c2.number_input("Records", 1, 30, 20) + + clicked, link_slot = action_row("📄 Fetch orders") + if clicked: + api = upstox_client.IpoApi(client) + + def _d(o): + if o is None: + return {} + if isinstance(o, dict): + return o + return o.to_dict() if hasattr(o, "to_dict") else vars(o) + + if order_id.strip(): + with st.spinner("Fetching IPO order…"): + resp = api.get_ipo_order_by_id(order_id.strip()) + + order = _d(resp.data) + if not order: + st.warning(f"No IPO order found with ID '{order_id}'.") + st.stop() + + curl_jump_link(link_slot) + + m1, m2, m3 = st.columns(3) + m1.metric("Status", str(order.get("order_status") or order.get("status") or "—")) + m2.metric("Payment", str(order.get("payment_status") or "—")) + m3.metric("Units allotted", str(order.get("units_allotted") or "—")) + st.divider() + + detail = [(k.replace("_", " ").title(), v) for k, v in order.items() + if k != "bids" and v is not None and v != ""] + st.dataframe(pd.DataFrame([{"Field": k, "Value": str(v)} for k, v in detail]), + use_container_width=True, hide_index=True) + + bids = order.get("bids") or [] + if bids: + st.markdown("**Bids**") + st.dataframe(pd.DataFrame([{ + "Quantity": _d(b).get("quantity"), "Price": _d(b).get("price"), + "Amount": _d(b).get("amount"), "Message": _d(b).get("message"), + } for b in bids]), use_container_width=True, hide_index=True) + + st.caption("Single IPO order fetched by its order ID.") + + show_curl("GET", f"/v2/ipos/orders/{order_id.strip()}") + else: + with st.spinner("Fetching IPO orders…"): + resp = api.get_ipo_orders(page_number=1, records=int(records)) + + rows = [_d(r) for r in (resp.data or [])] + if not rows: + st.warning("No IPO orders found for this account.") + st.stop() + + curl_jump_link(link_slot) + + blocked = pd.to_numeric( + pd.Series([r.get("upi_amount_blocked") for r in rows]), errors="coerce") + m1, m2, m3 = st.columns(3) + m1.metric("Orders", len(rows)) + m2.metric("Total blocked", f"{blocked.sum():,.2f}" if blocked.notna().any() else "—") + m3.metric("Allotted", sum( + 1 for r in rows if pd.to_numeric( + pd.Series([r.get("units_allotted")]), errors="coerce").fillna(0).iloc[0] > 0)) + st.divider() + + df = pd.DataFrame([{ + "Symbol": r.get("symbol"), + "Exchange": r.get("exchange"), + "Order ID": r.get("order_id"), + "Status": r.get("order_status") or r.get("status"), + "Payment": r.get("payment_status"), + "Category": r.get("category"), + "Type": r.get("issue_type"), + "Blocked": r.get("upi_amount_blocked"), + "Allotted": r.get("units_allotted"), + "Created": r.get("created_at"), + } for r in rows]) + st.dataframe(df, use_container_width=True, hide_index=True) + + st.caption("Paste an **Order ID** above to drill into a single application's bids.") + + show_curl("GET", "/v2/ipos/orders", {"page_number": 1, "records": int(records)}) + + else: st.info(f"Example **{example}** — coming soon.") \ No newline at end of file diff --git a/interactive_examples/test_runner.py b/interactive_examples/test_runner.py index 1228044..ec9949b 100644 --- a/interactive_examples/test_runner.py +++ b/interactive_examples/test_runner.py @@ -142,6 +142,11 @@ def _find_python(): ("Market Information", "market_information/change_oi.py", ["--expiry", NEXT_THU, "--interval", "5"]), ("Market Information", "market_information/max_pain.py", ["--expiry", NEXT_THU, "--bucket-interval", "60"]), ("Market Information", "market_information/pcr_data.py", ["--expiry", NEXT_THU, "--bucket-interval", "60"]), + + ("IPO", "ipo/ipo_listing.py", ["--records", "5"]), + ("IPO", "ipo/ipo_details.py", []), + # Reads your own IPO applications — needs a full access token, not an analytics token. + ("IPO", "ipo/ipo_orders.py", ["--records", "5"]), ] # Scripts that run indefinitely — killed after this many seconds and counted as PASS diff --git a/setup.py b/setup.py index 1877d84..a816610 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.28.0" +VERSION = "2.29.0" # To install the library, run the following # # python setup.py install diff --git a/test/sdk_tests/sanity.py b/test/sdk_tests/sanity.py index 435c69a..4ea8e2b 100644 --- a/test/sdk_tests/sanity.py +++ b/test/sdk_tests/sanity.py @@ -1322,6 +1322,44 @@ def is_within_market_hours(): except ApiException as e: print("Exception when calling IpoApi->get_ipo_details: %s\n" % e) +try: + # Get IPO Orders (read-only) + api_response = ipo_api_instance.get_ipo_orders() + if api_response.status != "success": + print("error in get_ipo_orders API") +except ApiException as e: + print("Exception when calling IpoApi->get_ipo_orders: %s\n" % e) + +try: + # Get IPO Order by id (in real usage, pass an order id returned by get_ipo_orders) + api_response = ipo_api_instance.get_ipo_order_by_id("sample-ipo-order-id") + if api_response.status != "success": + print("error in get_ipo_order_by_id API") +except ApiException as e: + print("Exception when calling IpoApi->get_ipo_order_by_id: %s\n" % e) + +# apply_for_ipo/cancel_ipo_order place and withdraw a real IPO application and +# block funds via the UPI mandate. Disabled by default; set +# RUN_DESTRUCTIVE_IPO_TESTS = True to exercise them against a real account. +RUN_DESTRUCTIVE_IPO_TESTS = False +if RUN_DESTRUCTIVE_IPO_TESTS: + try: + # Apply for IPO — id/upi/category/bids are all required, max 3 bids + body = upstox_client.IpoApplyRequest( + id="sample-ipo-slug", + upi="someone@upi", + category="IND", + bids=[upstox_client.IpoBidRequest(quantity=10, price=150.0)] + ) + api_response = ipo_api_instance.apply_for_ipo(body) + ipo_order_id = api_response.data.order_id + + # Cancel IPO Order + api_response = ipo_api_instance.cancel_ipo_order(ipo_order_id) + print("ipo apply/cancel cycle:", api_response.status) + except ApiException as e: + print("Exception when calling IpoApi ipo order write ops: %s\n" % e) + # ---------------------------------------------------------------------------- # Smartlist APIs (MarketApi) # ---------------------------------------------------------------------------- @@ -1423,6 +1461,58 @@ def is_within_market_hours(): if ipo_details_response.status != "success": print("error: IpoDetailsResponse status field not set correctly") +ipo_investor_type = upstox_client.IpoInvestorType(category="IND", description="Individual Investor") +if ipo_investor_type.category != "IND": + print("error: IpoInvestorType fields not set correctly") + +ipo_details_data_with_investors = upstox_client.IpoDetailsData(id="abc", investors=[ipo_investor_type]) +if ipo_details_data_with_investors.investors[0].category != "IND": + print("error: IpoDetailsData investors field not set correctly") + +ipo_listing_data_with_investors = upstox_client.IpoListingData(symbol="XYZ", investors=[ipo_investor_type]) +if ipo_listing_data_with_investors.investors[0].description != "Individual Investor": + print("error: IpoListingData investors field not set correctly") + +ipo_bid_request = upstox_client.IpoBidRequest(quantity=10, price=150.5) +if ipo_bid_request.quantity != 10 or ipo_bid_request.price != 150.5: + print("error: IpoBidRequest fields not set correctly") + +ipo_apply_request = upstox_client.IpoApplyRequest(id="sample-ipo-slug", upi="someone@upi", category="IND", bids=[ipo_bid_request]) +if ipo_apply_request.upi != "someone@upi" or len(ipo_apply_request.bids) != 1: + print("error: IpoApplyRequest fields not set correctly") + +ipo_apply_data = upstox_client.IpoApplyData(order_id="O1") +if ipo_apply_data.order_id != "O1": + print("error: IpoApplyData fields not set correctly") + +ipo_apply_response = upstox_client.IpoApplyResponse(status="success", data=ipo_apply_data) +if ipo_apply_response.status != "success": + print("error: IpoApplyResponse status field not set correctly") + +ipo_order_bid = upstox_client.IpoOrderBid(quantity=10, price=150.5, amount=1505.0, message="accepted") +if ipo_order_bid.amount != 1505.0: + print("error: IpoOrderBid fields not set correctly") + +ipo_order_data = upstox_client.IpoOrderData(id="abc", symbol="XYZ", exchange="NSE", order_id="O1", order_status="COMPLETE", category="IND", issue_type="regular", units_allotted=10, bids=[ipo_order_bid]) +if ipo_order_data.order_id != "O1" or ipo_order_data.units_allotted != 10: + print("error: IpoOrderData fields not set correctly") + +ipo_order_response = upstox_client.IpoOrderResponse(status="success", data=[ipo_order_data], meta_data=ipo_meta_data) +if ipo_order_response.status != "success": + print("error: IpoOrderResponse status field not set correctly") + +ipo_order_detail_response = upstox_client.IpoOrderDetailResponse(status="success", data=ipo_order_data) +if ipo_order_detail_response.data.symbol != "XYZ": + print("error: IpoOrderDetailResponse fields not set correctly") + +ipo_cancel_data = upstox_client.IpoCancelData(order_id="O1", status="CANCELLED") +if ipo_cancel_data.status != "CANCELLED": + print("error: IpoCancelData fields not set correctly") + +ipo_cancel_response = upstox_client.IpoCancelResponse(status="success", data=ipo_cancel_data) +if ipo_cancel_response.data.order_id != "O1": + print("error: IpoCancelResponse fields not set correctly") + initiate_payout_request = upstox_client.InitiatePayoutRequest(mode="IMPS", amount=500.0) if initiate_payout_request.amount != 500.0: print("error: InitiatePayoutRequest fields not set correctly") diff --git a/test/sdk_tests/test_ipo_api.py b/test/sdk_tests/test_ipo_api.py index 9fa9e71..0261156 100644 --- a/test/sdk_tests/test_ipo_api.py +++ b/test/sdk_tests/test_ipo_api.py @@ -31,6 +31,44 @@ except ApiException as e: print("Exception when calling IpoApi->get_ipo_details: %s\n" % e) +# Get IPO orders (read-only) +try: + api_response = api_instance.get_ipo_orders() + if api_response.status != "success": + print("error in IpoApi->get_ipo_orders") +except ApiException as e: + print("Exception when calling IpoApi->get_ipo_orders: %s\n" % e) + +# Get IPO order by id (in real usage, pass an order id from get_ipo_orders) +try: + api_response = api_instance.get_ipo_order_by_id("sample-ipo-order-id") + if api_response.status != "success": + print("error in IpoApi->get_ipo_order_by_id") +except ApiException as e: + print("Exception when calling IpoApi->get_ipo_order_by_id: %s\n" % e) + +# apply_for_ipo/cancel_ipo_order place and withdraw a real IPO application and +# block funds via the UPI mandate. Disabled by default; set +# RUN_DESTRUCTIVE_IPO_TESTS = True to exercise them against a real account. +RUN_DESTRUCTIVE_IPO_TESTS = False +if RUN_DESTRUCTIVE_IPO_TESTS: + try: + # Apply for IPO — id/upi/category/bids are all required, max 3 bids + body = upstox_client.IpoApplyRequest( + id="sample-ipo-slug", + upi="someone@upi", + category="IND", + bids=[upstox_client.IpoBidRequest(quantity=10, price=150.0)] + ) + api_response = api_instance.apply_for_ipo(body) + ipo_order_id = api_response.data.order_id + + # Cancel IPO order + api_response = api_instance.cancel_ipo_order(ipo_order_id) + print("ipo apply/cancel cycle:", api_response.status) + except ApiException as e: + print("Exception when calling IpoApi ipo order write ops: %s\n" % e) + # Model instantiation tests ipo_listing_data = upstox_client.IpoListingData(symbol="XYZ", status="open") if ipo_listing_data.symbol != "XYZ": @@ -59,3 +97,58 @@ ipo_details_response = upstox_client.IpoDetailsResponse(status="success", data=ipo_details_data) if ipo_details_response.status != "success": print("error: IpoDetailsResponse status field not set correctly") + +# Model instantiation tests — IPO orders + +ipo_investor_type = upstox_client.IpoInvestorType(category="IND", description="Individual Investor") +if ipo_investor_type.category != "IND": + print("error: IpoInvestorType fields not set correctly") + +# investors is a typed list on both IpoDetailsData and IpoListingData +ipo_details_data_with_investors = upstox_client.IpoDetailsData(id="abc", investors=[ipo_investor_type]) +if ipo_details_data_with_investors.investors[0].category != "IND": + print("error: IpoDetailsData investors field not set correctly") + +ipo_listing_data_with_investors = upstox_client.IpoListingData(symbol="XYZ", investors=[ipo_investor_type]) +if ipo_listing_data_with_investors.investors[0].description != "Individual Investor": + print("error: IpoListingData investors field not set correctly") + +ipo_bid_request = upstox_client.IpoBidRequest(quantity=10, price=150.5) +if ipo_bid_request.quantity != 10 or ipo_bid_request.price != 150.5: + print("error: IpoBidRequest fields not set correctly") + +ipo_apply_request = upstox_client.IpoApplyRequest(id="sample-ipo-slug", upi="someone@upi", category="IND", bids=[ipo_bid_request]) +if ipo_apply_request.upi != "someone@upi" or len(ipo_apply_request.bids) != 1: + print("error: IpoApplyRequest fields not set correctly") + +ipo_apply_data = upstox_client.IpoApplyData(order_id="O1") +if ipo_apply_data.order_id != "O1": + print("error: IpoApplyData fields not set correctly") + +ipo_apply_response = upstox_client.IpoApplyResponse(status="success", data=ipo_apply_data) +if ipo_apply_response.status != "success": + print("error: IpoApplyResponse status field not set correctly") + +ipo_order_bid = upstox_client.IpoOrderBid(quantity=10, price=150.5, amount=1505.0, message="accepted") +if ipo_order_bid.amount != 1505.0: + print("error: IpoOrderBid fields not set correctly") + +ipo_order_data = upstox_client.IpoOrderData(id="abc", symbol="XYZ", exchange="NSE", order_id="O1", order_status="COMPLETE", category="IND", issue_type="regular", units_allotted=10, bids=[ipo_order_bid]) +if ipo_order_data.order_id != "O1" or ipo_order_data.units_allotted != 10: + print("error: IpoOrderData fields not set correctly") + +ipo_order_response = upstox_client.IpoOrderResponse(status="success", data=[ipo_order_data], meta_data=ipo_meta_data) +if ipo_order_response.status != "success": + print("error: IpoOrderResponse status field not set correctly") + +ipo_order_detail_response = upstox_client.IpoOrderDetailResponse(status="success", data=ipo_order_data) +if ipo_order_detail_response.data.symbol != "XYZ": + print("error: IpoOrderDetailResponse fields not set correctly") + +ipo_cancel_data = upstox_client.IpoCancelData(order_id="O1", status="CANCELLED") +if ipo_cancel_data.status != "CANCELLED": + print("error: IpoCancelData fields not set correctly") + +ipo_cancel_response = upstox_client.IpoCancelResponse(status="success", data=ipo_cancel_data) +if ipo_cancel_response.data.order_id != "O1": + print("error: IpoCancelResponse fields not set correctly") diff --git a/upstox_client/__init__.py b/upstox_client/__init__.py index 3cb26ba..958ed18 100644 --- a/upstox_client/__init__.py +++ b/upstox_client/__init__.py @@ -144,11 +144,22 @@ from upstox_client.models.search_meta_data import SearchMetaData from upstox_client.models.search_page import SearchPage from upstox_client.models.intra_day_candle_data import IntraDayCandleData +from upstox_client.models.ipo_apply_data import IpoApplyData +from upstox_client.models.ipo_apply_request import IpoApplyRequest +from upstox_client.models.ipo_apply_response import IpoApplyResponse +from upstox_client.models.ipo_bid_request import IpoBidRequest +from upstox_client.models.ipo_cancel_data import IpoCancelData +from upstox_client.models.ipo_cancel_response import IpoCancelResponse from upstox_client.models.ipo_details_data import IpoDetailsData from upstox_client.models.ipo_details_response import IpoDetailsResponse +from upstox_client.models.ipo_investor_type import IpoInvestorType from upstox_client.models.ipo_listing_data import IpoListingData from upstox_client.models.ipo_listing_response import IpoListingResponse from upstox_client.models.ipo_meta_data import IpoMetaData +from upstox_client.models.ipo_order_bid import IpoOrderBid +from upstox_client.models.ipo_order_data import IpoOrderData +from upstox_client.models.ipo_order_detail_response import IpoOrderDetailResponse +from upstox_client.models.ipo_order_response import IpoOrderResponse from upstox_client.models.ipo_registrar_info import IpoRegistrarInfo from upstox_client.models.ipo_timeline import IpoTimeline from upstox_client.models.key_ratio_data import KeyRatioData diff --git a/upstox_client/api/ipo_api.py b/upstox_client/api/ipo_api.py index 2316c54..7bd127d 100644 --- a/upstox_client/api/ipo_api.py +++ b/upstox_client/api/ipo_api.py @@ -229,3 +229,387 @@ def get_ipo_listing_with_http_info(self, **kwargs): # noqa: E501 _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) + + def apply_for_ipo(self, body, **kwargs): # noqa: E501 + """Apply for IPO # noqa: E501 + + Places an IPO application for the authenticated user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.apply_for_ipo(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param IpoApplyRequest body: (required) + :return: IpoApplyResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.apply_for_ipo_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.apply_for_ipo_with_http_info(body, **kwargs) # noqa: E501 + return data + + def apply_for_ipo_with_http_info(self, body, **kwargs): # noqa: E501 + """Apply for IPO # noqa: E501 + + Places an IPO application for the authenticated user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.apply_for_ipo_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param IpoApplyRequest body: (required) + :return: IpoApplyResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # 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 apply_for_ipo" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `apply_for_ipo`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*', 'application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['OAUTH2'] # noqa: E501 + + return self.api_client.call_api( + '/v2/ipos/orders', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='IpoApplyResponse', # 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 cancel_ipo_order(self, order_id, **kwargs): # noqa: E501 + """Cancel IPO Order # noqa: E501 + + Cancels/deletes an IPO order of the authenticated user by order id. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.cancel_ipo_order(order_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param object order_id: IPO application id, as returned in `order_id` by the apply and orders APIs (required) + :return: IpoCancelResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.cancel_ipo_order_with_http_info(order_id, **kwargs) # noqa: E501 + else: + (data) = self.cancel_ipo_order_with_http_info(order_id, **kwargs) # noqa: E501 + return data + + def cancel_ipo_order_with_http_info(self, order_id, **kwargs): # noqa: E501 + """Cancel IPO Order # noqa: E501 + + Cancels/deletes an IPO order of the authenticated user by order id. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.cancel_ipo_order_with_http_info(order_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param object order_id: IPO application id, as returned in `order_id` by the apply and orders APIs (required) + :return: IpoCancelResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['order_id'] # 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 cancel_ipo_order" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'order_id' is set + if ('order_id' not in params or + params['order_id'] is None): + raise ValueError("Missing the required parameter `order_id` when calling `cancel_ipo_order`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'order_id' in params: + path_params['order_id'] = params['order_id'] # 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/ipos/orders/{order_id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='IpoCancelResponse', # 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_ipo_order_by_id(self, order_id, **kwargs): # noqa: E501 + """Get IPO Order # noqa: E501 + + Fetches a single IPO order of the authenticated user by order id. # 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_ipo_order_by_id(order_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param object order_id: IPO application id, as returned in `order_id` by the apply and orders APIs (required) + :return: IpoOrderDetailResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_ipo_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501 + else: + (data) = self.get_ipo_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501 + return data + + def get_ipo_order_by_id_with_http_info(self, order_id, **kwargs): # noqa: E501 + """Get IPO Order # noqa: E501 + + Fetches a single IPO order of the authenticated user by order id. # 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_ipo_order_by_id_with_http_info(order_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param object order_id: IPO application id, as returned in `order_id` by the apply and orders APIs (required) + :return: IpoOrderDetailResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['order_id'] # 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_ipo_order_by_id" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'order_id' is set + if ('order_id' not in params or + params['order_id'] is None): + raise ValueError("Missing the required parameter `order_id` when calling `get_ipo_order_by_id`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'order_id' in params: + path_params['order_id'] = params['order_id'] # 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/ipos/orders/{order_id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='IpoOrderDetailResponse', # 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_ipo_orders(self, **kwargs): # noqa: E501 + """Get IPO Orders # noqa: E501 + + Fetches the authenticated user's IPO orders/applications. # 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_ipo_orders(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param object page_number: Page number, starting at 1 + :param object records: Number of records per page + :return: IpoOrderResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_ipo_orders_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_ipo_orders_with_http_info(**kwargs) # noqa: E501 + return data + + def get_ipo_orders_with_http_info(self, **kwargs): # noqa: E501 + """Get IPO Orders # noqa: E501 + + Fetches the authenticated user's IPO orders/applications. # 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_ipo_orders_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param object page_number: Page number, starting at 1 + :param object records: Number of records per page + :return: IpoOrderResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_number', 'records'] # 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_ipo_orders" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_number' in params: + query_params.append(('page_number', params['page_number'])) # noqa: E501 + if 'records' in params: + query_params.append(('records', params['records'])) # 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/ipos/orders', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='IpoOrderResponse', # 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_client.py b/upstox_client/api_client.py index 3ced975..414a45c 100644 --- a/upstox_client/api_client.py +++ b/upstox_client/api_client.py @@ -74,7 +74,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None, # Set default User-Agent. self.user_agent = 'Swagger-Codegen/1.0.0/python' self.default_headers["X-Upstox-SDK-Language"] = "python" - self.default_headers["X-Upstox-SDK-Version"] = "2.28.0" + self.default_headers["X-Upstox-SDK-Version"] = "2.29.0" def __del__(self): try: diff --git a/upstox_client/models/__init__.py b/upstox_client/models/__init__.py index 01612d7..4bef9bf 100644 --- a/upstox_client/models/__init__.py +++ b/upstox_client/models/__init__.py @@ -111,11 +111,22 @@ from upstox_client.models.instrument import Instrument from upstox_client.models.instrument_data import InstrumentData from upstox_client.models.intra_day_candle_data import IntraDayCandleData +from upstox_client.models.ipo_apply_data import IpoApplyData +from upstox_client.models.ipo_apply_request import IpoApplyRequest +from upstox_client.models.ipo_apply_response import IpoApplyResponse +from upstox_client.models.ipo_bid_request import IpoBidRequest +from upstox_client.models.ipo_cancel_data import IpoCancelData +from upstox_client.models.ipo_cancel_response import IpoCancelResponse from upstox_client.models.ipo_details_data import IpoDetailsData from upstox_client.models.ipo_details_response import IpoDetailsResponse +from upstox_client.models.ipo_investor_type import IpoInvestorType from upstox_client.models.ipo_listing_data import IpoListingData from upstox_client.models.ipo_listing_response import IpoListingResponse from upstox_client.models.ipo_meta_data import IpoMetaData +from upstox_client.models.ipo_order_bid import IpoOrderBid +from upstox_client.models.ipo_order_data import IpoOrderData +from upstox_client.models.ipo_order_detail_response import IpoOrderDetailResponse +from upstox_client.models.ipo_order_response import IpoOrderResponse from upstox_client.models.ipo_registrar_info import IpoRegistrarInfo from upstox_client.models.ipo_timeline import IpoTimeline from upstox_client.models.key_ratio_data import KeyRatioData diff --git a/upstox_client/models/ipo_apply_data.py b/upstox_client/models/ipo_apply_data.py new file mode 100644 index 0000000..fa6b9cb --- /dev/null +++ b/upstox_client/models/ipo_apply_data.py @@ -0,0 +1,112 @@ +# 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 IpoApplyData(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 = { + 'order_id': 'object' + } + + attribute_map = { + 'order_id': 'order_id' + } + + def __init__(self, order_id=None): # noqa: E501 + """IpoApplyData - a model defined in Swagger""" # noqa: E501 + self._order_id = None + self.discriminator = None + if order_id is not None: + self.order_id = order_id + + @property + def order_id(self): + """Gets the order_id of this IpoApplyData. # noqa: E501 + + Application id created for this IPO application. Pass this as order_id to the get-order and cancel-order APIs # noqa: E501 + + :return: The order_id of this IpoApplyData. # noqa: E501 + :rtype: object + """ + return self._order_id + + @order_id.setter + def order_id(self, order_id): + """Sets the order_id of this IpoApplyData. + + Application id created for this IPO application. Pass this as order_id to the get-order and cancel-order APIs # noqa: E501 + + :param order_id: The order_id of this IpoApplyData. # noqa: E501 + :type: object + """ + + self._order_id = order_id + + 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(IpoApplyData, 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, IpoApplyData): + 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/ipo_apply_request.py b/upstox_client/models/ipo_apply_request.py new file mode 100644 index 0000000..7dec6bf --- /dev/null +++ b/upstox_client/models/ipo_apply_request.py @@ -0,0 +1,200 @@ +# 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 IpoApplyRequest(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 = { + 'id': 'object', + 'upi': 'object', + 'category': 'object', + 'bids': 'object' + } + + attribute_map = { + 'id': 'id', + 'upi': 'upi', + 'category': 'category', + 'bids': 'bids' + } + + def __init__(self, id=None, upi=None, category=None, bids=None): # noqa: E501 + """IpoApplyRequest - a model defined in Swagger""" # noqa: E501 + self._id = None + self._upi = None + self._category = None + self._bids = None + self.discriminator = None + self.id = id + self.upi = upi + self.category = category + self.bids = bids + + @property + def id(self): + """Gets the id of this IpoApplyRequest. # noqa: E501 + + IPO id (slug) to apply for, as returned in `id` by the IPO listing and details APIs # noqa: E501 + + :return: The id of this IpoApplyRequest. # noqa: E501 + :rtype: object + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this IpoApplyRequest. + + IPO id (slug) to apply for, as returned in `id` by the IPO listing and details APIs # noqa: E501 + + :param id: The id of this IpoApplyRequest. # noqa: E501 + :type: object + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def upi(self): + """Gets the upi of this IpoApplyRequest. # noqa: E501 + + UPI id used to block the application amount # noqa: E501 + + :return: The upi of this IpoApplyRequest. # noqa: E501 + :rtype: object + """ + return self._upi + + @upi.setter + def upi(self, upi): + """Sets the upi of this IpoApplyRequest. + + UPI id used to block the application amount # noqa: E501 + + :param upi: The upi of this IpoApplyRequest. # noqa: E501 + :type: object + """ + if upi is None: + raise ValueError("Invalid value for `upi`, must not be `None`") # noqa: E501 + + self._upi = upi + + @property + def category(self): + """Gets the category of this IpoApplyRequest. # noqa: E501 + + Investor category to apply under. Must be one the issue accepts — see `investors[].category` in the IPO details API # noqa: E501 + + :return: The category of this IpoApplyRequest. # noqa: E501 + :rtype: object + """ + return self._category + + @category.setter + def category(self, category): + """Sets the category of this IpoApplyRequest. + + Investor category to apply under. Must be one the issue accepts — see `investors[].category` in the IPO details API # noqa: E501 + + :param category: The category of this IpoApplyRequest. # noqa: E501 + :type: object + """ + if category is None: + raise ValueError("Invalid value for `category`, must not be `None`") # noqa: E501 + + self._category = category + + @property + def bids(self): + """Gets the bids of this IpoApplyRequest. # noqa: E501 + + List of bids for the application (1 to 3 bids) # noqa: E501 + + :return: The bids of this IpoApplyRequest. # noqa: E501 + :rtype: object + """ + return self._bids + + @bids.setter + def bids(self, bids): + """Sets the bids of this IpoApplyRequest. + + List of bids for the application (1 to 3 bids) # noqa: E501 + + :param bids: The bids of this IpoApplyRequest. # noqa: E501 + :type: object + """ + if bids is None: + raise ValueError("Invalid value for `bids`, must not be `None`") # noqa: E501 + + self._bids = bids + + 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(IpoApplyRequest, 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, IpoApplyRequest): + 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/ipo_apply_response.py b/upstox_client/models/ipo_apply_response.py new file mode 100644 index 0000000..8c29f90 --- /dev/null +++ b/upstox_client/models/ipo_apply_response.py @@ -0,0 +1,136 @@ +# 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 IpoApplyResponse(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': 'object', + 'data': 'IpoApplyData' + } + + attribute_map = { + 'status': 'status', + 'data': 'data' + } + + def __init__(self, status=None, data=None): # noqa: E501 + """IpoApplyResponse - 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 IpoApplyResponse. # noqa: E501 + + + :return: The status of this IpoApplyResponse. # noqa: E501 + :rtype: object + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this IpoApplyResponse. + + + :param status: The status of this IpoApplyResponse. # noqa: E501 + :type: object + """ + + self._status = status + + @property + def data(self): + """Gets the data of this IpoApplyResponse. # noqa: E501 + + + :return: The data of this IpoApplyResponse. # noqa: E501 + :rtype: IpoApplyData + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this IpoApplyResponse. + + + :param data: The data of this IpoApplyResponse. # noqa: E501 + :type: IpoApplyData + """ + + 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(IpoApplyResponse, 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, IpoApplyResponse): + 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/ipo_bid_request.py b/upstox_client/models/ipo_bid_request.py new file mode 100644 index 0000000..1b5e6e9 --- /dev/null +++ b/upstox_client/models/ipo_bid_request.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 IpoBidRequest(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 = { + 'quantity': 'object', + 'price': 'object' + } + + attribute_map = { + 'quantity': 'quantity', + 'price': 'price' + } + + def __init__(self, quantity=None, price=None): # noqa: E501 + """IpoBidRequest - a model defined in Swagger""" # noqa: E501 + self._quantity = None + self._price = None + self.discriminator = None + self.quantity = quantity + self.price = price + + @property + def quantity(self): + """Gets the quantity of this IpoBidRequest. # noqa: E501 + + Number of shares bid for. Must be a multiple of the IPO's `lot_size` and at least its `minimum_quantity` # noqa: E501 + + :return: The quantity of this IpoBidRequest. # noqa: E501 + :rtype: object + """ + return self._quantity + + @quantity.setter + def quantity(self, quantity): + """Sets the quantity of this IpoBidRequest. + + Number of shares bid for. Must be a multiple of the IPO's `lot_size` and at least its `minimum_quantity` # noqa: E501 + + :param quantity: The quantity of this IpoBidRequest. # noqa: E501 + :type: object + """ + if quantity is None: + raise ValueError("Invalid value for `quantity`, must not be `None`") # noqa: E501 + + self._quantity = quantity + + @property + def price(self): + """Gets the price of this IpoBidRequest. # noqa: E501 + + Bid price per share, in whole rupees — decimals are not accepted. Must sit within the IPO's price band, or equal its `cut_off_price` # noqa: E501 + + :return: The price of this IpoBidRequest. # noqa: E501 + :rtype: object + """ + return self._price + + @price.setter + def price(self, price): + """Sets the price of this IpoBidRequest. + + Bid price per share, in whole rupees — decimals are not accepted. Must sit within the IPO's price band, or equal its `cut_off_price` # noqa: E501 + + :param price: The price of this IpoBidRequest. # noqa: E501 + :type: object + """ + if price is None: + raise ValueError("Invalid value for `price`, must not be `None`") # noqa: E501 + + self._price = price + + 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(IpoBidRequest, 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, IpoBidRequest): + 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/ipo_cancel_data.py b/upstox_client/models/ipo_cancel_data.py new file mode 100644 index 0000000..7fa1497 --- /dev/null +++ b/upstox_client/models/ipo_cancel_data.py @@ -0,0 +1,140 @@ +# 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 IpoCancelData(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 = { + 'order_id': 'object', + 'status': 'object' + } + + attribute_map = { + 'order_id': 'order_id', + 'status': 'status' + } + + def __init__(self, order_id=None, status=None): # noqa: E501 + """IpoCancelData - a model defined in Swagger""" # noqa: E501 + self._order_id = None + self._status = None + self.discriminator = None + if order_id is not None: + self.order_id = order_id + if status is not None: + self.status = status + + @property + def order_id(self): + """Gets the order_id of this IpoCancelData. # noqa: E501 + + Application id that was cancelled # noqa: E501 + + :return: The order_id of this IpoCancelData. # noqa: E501 + :rtype: object + """ + return self._order_id + + @order_id.setter + def order_id(self, order_id): + """Sets the order_id of this IpoCancelData. + + Application id that was cancelled # noqa: E501 + + :param order_id: The order_id of this IpoCancelData. # noqa: E501 + :type: object + """ + + self._order_id = order_id + + @property + def status(self): + """Gets the status of this IpoCancelData. # noqa: E501 + + Free-text message returned by the IPO service for the cancellation request # noqa: E501 + + :return: The status of this IpoCancelData. # noqa: E501 + :rtype: object + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this IpoCancelData. + + Free-text message returned by the IPO service for the cancellation request # noqa: E501 + + :param status: The status of this IpoCancelData. # noqa: E501 + :type: object + """ + + self._status = status + + 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(IpoCancelData, 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, IpoCancelData): + 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/ipo_cancel_response.py b/upstox_client/models/ipo_cancel_response.py new file mode 100644 index 0000000..034c5d5 --- /dev/null +++ b/upstox_client/models/ipo_cancel_response.py @@ -0,0 +1,136 @@ +# 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 IpoCancelResponse(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': 'object', + 'data': 'IpoCancelData' + } + + attribute_map = { + 'status': 'status', + 'data': 'data' + } + + def __init__(self, status=None, data=None): # noqa: E501 + """IpoCancelResponse - 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 IpoCancelResponse. # noqa: E501 + + + :return: The status of this IpoCancelResponse. # noqa: E501 + :rtype: object + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this IpoCancelResponse. + + + :param status: The status of this IpoCancelResponse. # noqa: E501 + :type: object + """ + + self._status = status + + @property + def data(self): + """Gets the data of this IpoCancelResponse. # noqa: E501 + + + :return: The data of this IpoCancelResponse. # noqa: E501 + :rtype: IpoCancelData + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this IpoCancelResponse. + + + :param data: The data of this IpoCancelResponse. # noqa: E501 + :type: IpoCancelData + """ + + 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(IpoCancelResponse, 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, IpoCancelResponse): + 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/ipo_details_data.py b/upstox_client/models/ipo_details_data.py index 5b0c1af..746d569 100644 --- a/upstox_client/models/ipo_details_data.py +++ b/upstox_client/models/ipo_details_data.py @@ -53,7 +53,8 @@ class IpoDetailsData(object): 'drhp_url': 'object', 'timeline': 'IpoTimeline', 'registrar_info': 'IpoRegistrarInfo', - 'total_subscription': 'object' + 'total_subscription': 'object', + 'investors': 'list[IpoInvestorType]' } attribute_map = { @@ -82,10 +83,11 @@ class IpoDetailsData(object): 'drhp_url': 'drhp_url', 'timeline': 'timeline', 'registrar_info': 'registrar_info', - 'total_subscription': 'total_subscription' + 'total_subscription': 'total_subscription', + 'investors': 'investors' } - def __init__(self, id=None, symbol=None, name=None, status=None, isin=None, issue_type=None, issue_size=None, industry=None, minimum_price=None, maximum_price=None, bidding_start_date=None, bidding_end_date=None, daily_start_time=None, daily_end_time=None, face_value=None, tick_size=None, lot_size=None, minimum_quantity=None, cut_off_price=None, listing_price=None, listing_exchange=None, rhp_url=None, drhp_url=None, timeline=None, registrar_info=None, total_subscription=None): # noqa: E501 + def __init__(self, id=None, symbol=None, name=None, status=None, isin=None, issue_type=None, issue_size=None, industry=None, minimum_price=None, maximum_price=None, bidding_start_date=None, bidding_end_date=None, daily_start_time=None, daily_end_time=None, face_value=None, tick_size=None, lot_size=None, minimum_quantity=None, cut_off_price=None, listing_price=None, listing_exchange=None, rhp_url=None, drhp_url=None, timeline=None, registrar_info=None, total_subscription=None, investors=None): # noqa: E501 """IpoDetailsData - a model defined in Swagger""" # noqa: E501 self._id = None self._symbol = None @@ -113,6 +115,7 @@ def __init__(self, id=None, symbol=None, name=None, status=None, isin=None, issu self._timeline = None self._registrar_info = None self._total_subscription = None + self._investors = None self.discriminator = None if id is not None: self.id = id @@ -166,6 +169,8 @@ def __init__(self, id=None, symbol=None, name=None, status=None, isin=None, issu self.registrar_info = registrar_info if total_subscription is not None: self.total_subscription = total_subscription + if investors is not None: + self.investors = investors @property def id(self): @@ -713,6 +718,27 @@ def total_subscription(self, total_subscription): self._total_subscription = total_subscription + @property + def investors(self): + """Gets the investors of this IpoDetailsData. # noqa: E501 + + + :return: The investors of this IpoDetailsData. # noqa: E501 + :rtype: list[IpoInvestorType] + """ + return self._investors + + @investors.setter + def investors(self, investors): + """Sets the investors of this IpoDetailsData. + + + :param investors: The investors of this IpoDetailsData. # noqa: E501 + :type: list[IpoInvestorType] + """ + + self._investors = investors + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/upstox_client/models/ipo_investor_type.py b/upstox_client/models/ipo_investor_type.py new file mode 100644 index 0000000..e91d99e --- /dev/null +++ b/upstox_client/models/ipo_investor_type.py @@ -0,0 +1,140 @@ +# 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 IpoInvestorType(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 = { + 'category': 'object', + 'description': 'object' + } + + attribute_map = { + 'category': 'category', + 'description': 'description' + } + + def __init__(self, category=None, description=None): # noqa: E501 + """IpoInvestorType - a model defined in Swagger""" # noqa: E501 + self._category = None + self._description = None + self.discriminator = None + if category is not None: + self.category = category + if description is not None: + self.description = description + + @property + def category(self): + """Gets the category of this IpoInvestorType. # noqa: E501 + + Investor category the issue accepts. Pass this value as category when applying # noqa: E501 + + :return: The category of this IpoInvestorType. # noqa: E501 + :rtype: object + """ + return self._category + + @category.setter + def category(self, category): + """Sets the category of this IpoInvestorType. + + Investor category the issue accepts. Pass this value as category when applying # noqa: E501 + + :param category: The category of this IpoInvestorType. # noqa: E501 + :type: object + """ + + self._category = category + + @property + def description(self): + """Gets the description of this IpoInvestorType. # noqa: E501 + + Human-readable name of the category; null when the IPO service does not provide one # noqa: E501 + + :return: The description of this IpoInvestorType. # noqa: E501 + :rtype: object + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this IpoInvestorType. + + Human-readable name of the category; null when the IPO service does not provide one # noqa: E501 + + :param description: The description of this IpoInvestorType. # noqa: E501 + :type: object + """ + + self._description = description + + 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(IpoInvestorType, 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, IpoInvestorType): + 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/ipo_listing_data.py b/upstox_client/models/ipo_listing_data.py index cec6e18..f28142f 100644 --- a/upstox_client/models/ipo_listing_data.py +++ b/upstox_client/models/ipo_listing_data.py @@ -40,7 +40,8 @@ class IpoListingData(object): 'maximum_price': 'object', 'bidding_start_date': 'object', 'bidding_end_date': 'object', - 'total_subscription': 'object' + 'total_subscription': 'object', + 'investors': 'list[IpoInvestorType]' } attribute_map = { @@ -56,10 +57,11 @@ class IpoListingData(object): 'maximum_price': 'maximum_price', 'bidding_start_date': 'bidding_start_date', 'bidding_end_date': 'bidding_end_date', - 'total_subscription': 'total_subscription' + 'total_subscription': 'total_subscription', + 'investors': 'investors' } - def __init__(self, id=None, symbol=None, name=None, status=None, isin=None, issue_type=None, issue_size=None, industry=None, minimum_price=None, maximum_price=None, bidding_start_date=None, bidding_end_date=None, total_subscription=None): # noqa: E501 + def __init__(self, id=None, symbol=None, name=None, status=None, isin=None, issue_type=None, issue_size=None, industry=None, minimum_price=None, maximum_price=None, bidding_start_date=None, bidding_end_date=None, total_subscription=None, investors=None): # noqa: E501 """IpoListingData - a model defined in Swagger""" # noqa: E501 self._id = None self._symbol = None @@ -74,6 +76,7 @@ def __init__(self, id=None, symbol=None, name=None, status=None, isin=None, issu self._bidding_start_date = None self._bidding_end_date = None self._total_subscription = None + self._investors = None self.discriminator = None if id is not None: self.id = id @@ -101,6 +104,8 @@ def __init__(self, id=None, symbol=None, name=None, status=None, isin=None, issu self.bidding_end_date = bidding_end_date if total_subscription is not None: self.total_subscription = total_subscription + if investors is not None: + self.investors = investors @property def id(self): @@ -375,6 +380,27 @@ def total_subscription(self, total_subscription): self._total_subscription = total_subscription + @property + def investors(self): + """Gets the investors of this IpoListingData. # noqa: E501 + + + :return: The investors of this IpoListingData. # noqa: E501 + :rtype: list[IpoInvestorType] + """ + return self._investors + + @investors.setter + def investors(self, investors): + """Sets the investors of this IpoListingData. + + + :param investors: The investors of this IpoListingData. # noqa: E501 + :type: list[IpoInvestorType] + """ + + self._investors = investors + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/upstox_client/models/ipo_order_bid.py b/upstox_client/models/ipo_order_bid.py new file mode 100644 index 0000000..dc2649a --- /dev/null +++ b/upstox_client/models/ipo_order_bid.py @@ -0,0 +1,196 @@ +# 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 IpoOrderBid(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 = { + 'quantity': 'object', + 'price': 'object', + 'amount': 'object', + 'message': 'object' + } + + attribute_map = { + 'quantity': 'quantity', + 'price': 'price', + 'amount': 'amount', + 'message': 'message' + } + + def __init__(self, quantity=None, price=None, amount=None, message=None): # noqa: E501 + """IpoOrderBid - a model defined in Swagger""" # noqa: E501 + self._quantity = None + self._price = None + self._amount = None + self._message = None + self.discriminator = None + if quantity is not None: + self.quantity = quantity + if price is not None: + self.price = price + if amount is not None: + self.amount = amount + if message is not None: + self.message = message + + @property + def quantity(self): + """Gets the quantity of this IpoOrderBid. # noqa: E501 + + Number of shares bid for # noqa: E501 + + :return: The quantity of this IpoOrderBid. # noqa: E501 + :rtype: object + """ + return self._quantity + + @quantity.setter + def quantity(self, quantity): + """Sets the quantity of this IpoOrderBid. + + Number of shares bid for # noqa: E501 + + :param quantity: The quantity of this IpoOrderBid. # noqa: E501 + :type: object + """ + + self._quantity = quantity + + @property + def price(self): + """Gets the price of this IpoOrderBid. # noqa: E501 + + Bid price per share # noqa: E501 + + :return: The price of this IpoOrderBid. # noqa: E501 + :rtype: object + """ + return self._price + + @price.setter + def price(self, price): + """Sets the price of this IpoOrderBid. + + Bid price per share # noqa: E501 + + :param price: The price of this IpoOrderBid. # noqa: E501 + :type: object + """ + + self._price = price + + @property + def amount(self): + """Gets the amount of this IpoOrderBid. # noqa: E501 + + Value of the bid, quantity x price # noqa: E501 + + :return: The amount of this IpoOrderBid. # noqa: E501 + :rtype: object + """ + return self._amount + + @amount.setter + def amount(self, amount): + """Sets the amount of this IpoOrderBid. + + Value of the bid, quantity x price # noqa: E501 + + :param amount: The amount of this IpoOrderBid. # noqa: E501 + :type: object + """ + + self._amount = amount + + @property + def message(self): + """Gets the message of this IpoOrderBid. # noqa: E501 + + Message from the exchange for this bid, when one was returned # noqa: E501 + + :return: The message of this IpoOrderBid. # noqa: E501 + :rtype: object + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this IpoOrderBid. + + Message from the exchange for this bid, when one was returned # noqa: E501 + + :param message: The message of this IpoOrderBid. # noqa: E501 + :type: object + """ + + self._message = message + + 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(IpoOrderBid, 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, IpoOrderBid): + 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/ipo_order_data.py b/upstox_client/models/ipo_order_data.py new file mode 100644 index 0000000..bcce716 --- /dev/null +++ b/upstox_client/models/ipo_order_data.py @@ -0,0 +1,756 @@ +# 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 IpoOrderData(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 = { + 'id': 'object', + 'symbol': 'object', + 'exchange': 'object', + 'request_id': 'object', + 'order_id': 'object', + 'status': 'object', + 'order_status': 'object', + 'payment_status': 'object', + 'category': 'object', + 'issue_type': 'object', + 'reason': 'object', + 'upi': 'object', + 'upi_amount_blocked': 'object', + 'nse_submitted_date': 'object', + 'bse_submitted_date': 'object', + 'mandate_approved_date': 'object', + 'rejection_date': 'object', + 'mandate_rejection_date': 'object', + 'cancel_requested_date': 'object', + 'cancel_accepted_date': 'object', + 'units_allotted': 'object', + 'bids': 'object', + 'created_at': 'object', + 'last_updated_at': 'object' + } + + attribute_map = { + 'id': 'id', + 'symbol': 'symbol', + 'exchange': 'exchange', + 'request_id': 'request_id', + 'order_id': 'order_id', + 'status': 'status', + 'order_status': 'order_status', + 'payment_status': 'payment_status', + 'category': 'category', + 'issue_type': 'issue_type', + 'reason': 'reason', + 'upi': 'upi', + 'upi_amount_blocked': 'upi_amount_blocked', + 'nse_submitted_date': 'nse_submitted_date', + 'bse_submitted_date': 'bse_submitted_date', + 'mandate_approved_date': 'mandate_approved_date', + 'rejection_date': 'rejection_date', + 'mandate_rejection_date': 'mandate_rejection_date', + 'cancel_requested_date': 'cancel_requested_date', + 'cancel_accepted_date': 'cancel_accepted_date', + 'units_allotted': 'units_allotted', + 'bids': 'bids', + 'created_at': 'created_at', + 'last_updated_at': 'last_updated_at' + } + + def __init__(self, id=None, symbol=None, exchange=None, request_id=None, order_id=None, status=None, order_status=None, payment_status=None, category=None, issue_type=None, reason=None, upi=None, upi_amount_blocked=None, nse_submitted_date=None, bse_submitted_date=None, mandate_approved_date=None, rejection_date=None, mandate_rejection_date=None, cancel_requested_date=None, cancel_accepted_date=None, units_allotted=None, bids=None, created_at=None, last_updated_at=None): # noqa: E501 + """IpoOrderData - a model defined in Swagger""" # noqa: E501 + self._id = None + self._symbol = None + self._exchange = None + self._request_id = None + self._order_id = None + self._status = None + self._order_status = None + self._payment_status = None + self._category = None + self._issue_type = None + self._reason = None + self._upi = None + self._upi_amount_blocked = None + self._nse_submitted_date = None + self._bse_submitted_date = None + self._mandate_approved_date = None + self._rejection_date = None + self._mandate_rejection_date = None + self._cancel_requested_date = None + self._cancel_accepted_date = None + self._units_allotted = None + self._bids = None + self._created_at = None + self._last_updated_at = None + self.discriminator = None + if id is not None: + self.id = id + if symbol is not None: + self.symbol = symbol + if exchange is not None: + self.exchange = exchange + if request_id is not None: + self.request_id = request_id + if order_id is not None: + self.order_id = order_id + if status is not None: + self.status = status + if order_status is not None: + self.order_status = order_status + if payment_status is not None: + self.payment_status = payment_status + if category is not None: + self.category = category + if issue_type is not None: + self.issue_type = issue_type + if reason is not None: + self.reason = reason + if upi is not None: + self.upi = upi + if upi_amount_blocked is not None: + self.upi_amount_blocked = upi_amount_blocked + if nse_submitted_date is not None: + self.nse_submitted_date = nse_submitted_date + if bse_submitted_date is not None: + self.bse_submitted_date = bse_submitted_date + if mandate_approved_date is not None: + self.mandate_approved_date = mandate_approved_date + if rejection_date is not None: + self.rejection_date = rejection_date + if mandate_rejection_date is not None: + self.mandate_rejection_date = mandate_rejection_date + if cancel_requested_date is not None: + self.cancel_requested_date = cancel_requested_date + if cancel_accepted_date is not None: + self.cancel_accepted_date = cancel_accepted_date + if units_allotted is not None: + self.units_allotted = units_allotted + if bids is not None: + self.bids = bids + if created_at is not None: + self.created_at = created_at + if last_updated_at is not None: + self.last_updated_at = last_updated_at + + @property + def id(self): + """Gets the id of this IpoOrderData. # noqa: E501 + + Reference id of the IPO the application was placed against # noqa: E501 + + :return: The id of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this IpoOrderData. + + Reference id of the IPO the application was placed against # noqa: E501 + + :param id: The id of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._id = id + + @property + def symbol(self): + """Gets the symbol of this IpoOrderData. # noqa: E501 + + Trading symbol of the issuer # noqa: E501 + + :return: The symbol of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._symbol + + @symbol.setter + def symbol(self, symbol): + """Sets the symbol of this IpoOrderData. + + Trading symbol of the issuer # noqa: E501 + + :param symbol: The symbol of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._symbol = symbol + + @property + def exchange(self): + """Gets the exchange of this IpoOrderData. # noqa: E501 + + Exchange the application was submitted to. Casing follows the exchange feed and may vary # noqa: E501 + + :return: The exchange of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._exchange + + @exchange.setter + def exchange(self, exchange): + """Sets the exchange of this IpoOrderData. + + Exchange the application was submitted to. Casing follows the exchange feed and may vary # noqa: E501 + + :param exchange: The exchange of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._exchange = exchange + + @property + def request_id(self): + """Gets the request_id of this IpoOrderData. # noqa: E501 + + Id of the request that created the application # noqa: E501 + + :return: The request_id of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._request_id + + @request_id.setter + def request_id(self, request_id): + """Sets the request_id of this IpoOrderData. + + Id of the request that created the application # noqa: E501 + + :param request_id: The request_id of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._request_id = request_id + + @property + def order_id(self): + """Gets the order_id of this IpoOrderData. # noqa: E501 + + Application id. Pass this as order_id to the get-order and cancel-order APIs # noqa: E501 + + :return: The order_id of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._order_id + + @order_id.setter + def order_id(self, order_id): + """Sets the order_id of this IpoOrderData. + + Application id. Pass this as order_id to the get-order and cancel-order APIs # noqa: E501 + + :param order_id: The order_id of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._order_id = order_id + + @property + def status(self): + """Gets the status of this IpoOrderData. # noqa: E501 + + Lifecycle stage of the application. Known values: awaiting_mandate, ipo_allotted, ipo_not_allotted, application_deleted # noqa: E501 + + :return: The status of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this IpoOrderData. + + Lifecycle stage of the application. Known values: awaiting_mandate, ipo_allotted, ipo_not_allotted, application_deleted # noqa: E501 + + :param status: The status of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._status = status + + @property + def order_status(self): + """Gets the order_status of this IpoOrderData. # noqa: E501 + + Outcome of the application. Known values: success, allotted, not_allotted # noqa: E501 + + :return: The order_status of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._order_status + + @order_status.setter + def order_status(self, order_status): + """Sets the order_status of this IpoOrderData. + + Outcome of the application. Known values: success, allotted, not_allotted # noqa: E501 + + :param order_status: The order_status of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._order_status = order_status + + @property + def payment_status(self): + """Gets the payment_status of this IpoOrderData. # noqa: E501 + + State of the UPI mandate backing the application. Known values: pending, mandate_accepted # noqa: E501 + + :return: The payment_status of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._payment_status + + @payment_status.setter + def payment_status(self, payment_status): + """Sets the payment_status of this IpoOrderData. + + State of the UPI mandate backing the application. Known values: pending, mandate_accepted # noqa: E501 + + :param payment_status: The payment_status of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._payment_status = payment_status + + @property + def category(self): + """Gets the category of this IpoOrderData. # noqa: E501 + + Investor category the application was placed under. IND (individual) and HNI can be applied for; EMP appears on employee-quota applications # noqa: E501 + + :return: The category of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._category + + @category.setter + def category(self, category): + """Sets the category of this IpoOrderData. + + Investor category the application was placed under. IND (individual) and HNI can be applied for; EMP appears on employee-quota applications # noqa: E501 + + :param category: The category of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._category = category + + @property + def issue_type(self): + """Gets the issue_type of this IpoOrderData. # noqa: E501 + + Issue type of the IPO. `regular` is a mainboard issue # noqa: E501 + + :return: The issue_type of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._issue_type + + @issue_type.setter + def issue_type(self, issue_type): + """Sets the issue_type of this IpoOrderData. + + Issue type of the IPO. `regular` is a mainboard issue # noqa: E501 + + :param issue_type: The issue_type of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._issue_type = issue_type + + @property + def reason(self): + """Gets the reason of this IpoOrderData. # noqa: E501 + + Free-text reason from the exchange or registrar explaining the current status # noqa: E501 + + :return: The reason of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._reason + + @reason.setter + def reason(self, reason): + """Sets the reason of this IpoOrderData. + + Free-text reason from the exchange or registrar explaining the current status # noqa: E501 + + :param reason: The reason of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._reason = reason + + @property + def upi(self): + """Gets the upi of this IpoOrderData. # noqa: E501 + + UPI id the mandate was raised against # noqa: E501 + + :return: The upi of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._upi + + @upi.setter + def upi(self, upi): + """Sets the upi of this IpoOrderData. + + UPI id the mandate was raised against # noqa: E501 + + :param upi: The upi of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._upi = upi + + @property + def upi_amount_blocked(self): + """Gets the upi_amount_blocked of this IpoOrderData. # noqa: E501 + + Amount blocked in the applicant's bank account for this application, as a decimal string. Absent until the mandate is accepted # noqa: E501 + + :return: The upi_amount_blocked of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._upi_amount_blocked + + @upi_amount_blocked.setter + def upi_amount_blocked(self, upi_amount_blocked): + """Sets the upi_amount_blocked of this IpoOrderData. + + Amount blocked in the applicant's bank account for this application, as a decimal string. Absent until the mandate is accepted # noqa: E501 + + :param upi_amount_blocked: The upi_amount_blocked of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._upi_amount_blocked = upi_amount_blocked + + @property + def nse_submitted_date(self): + """Gets the nse_submitted_date of this IpoOrderData. # noqa: E501 + + When the application was submitted to NSE, in yyyy-MM-dd'T'HH:mm:ss; null if not submitted there # noqa: E501 + + :return: The nse_submitted_date of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._nse_submitted_date + + @nse_submitted_date.setter + def nse_submitted_date(self, nse_submitted_date): + """Sets the nse_submitted_date of this IpoOrderData. + + When the application was submitted to NSE, in yyyy-MM-dd'T'HH:mm:ss; null if not submitted there # noqa: E501 + + :param nse_submitted_date: The nse_submitted_date of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._nse_submitted_date = nse_submitted_date + + @property + def bse_submitted_date(self): + """Gets the bse_submitted_date of this IpoOrderData. # noqa: E501 + + When the application was submitted to BSE, in yyyy-MM-dd'T'HH:mm:ss; null if not submitted there # noqa: E501 + + :return: The bse_submitted_date of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._bse_submitted_date + + @bse_submitted_date.setter + def bse_submitted_date(self, bse_submitted_date): + """Sets the bse_submitted_date of this IpoOrderData. + + When the application was submitted to BSE, in yyyy-MM-dd'T'HH:mm:ss; null if not submitted there # noqa: E501 + + :param bse_submitted_date: The bse_submitted_date of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._bse_submitted_date = bse_submitted_date + + @property + def mandate_approved_date(self): + """Gets the mandate_approved_date of this IpoOrderData. # noqa: E501 + + When the UPI mandate was approved; null until approved # noqa: E501 + + :return: The mandate_approved_date of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._mandate_approved_date + + @mandate_approved_date.setter + def mandate_approved_date(self, mandate_approved_date): + """Sets the mandate_approved_date of this IpoOrderData. + + When the UPI mandate was approved; null until approved # noqa: E501 + + :param mandate_approved_date: The mandate_approved_date of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._mandate_approved_date = mandate_approved_date + + @property + def rejection_date(self): + """Gets the rejection_date of this IpoOrderData. # noqa: E501 + + When the application was rejected; null unless rejected # noqa: E501 + + :return: The rejection_date of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._rejection_date + + @rejection_date.setter + def rejection_date(self, rejection_date): + """Sets the rejection_date of this IpoOrderData. + + When the application was rejected; null unless rejected # noqa: E501 + + :param rejection_date: The rejection_date of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._rejection_date = rejection_date + + @property + def mandate_rejection_date(self): + """Gets the mandate_rejection_date of this IpoOrderData. # noqa: E501 + + When the UPI mandate was rejected; null unless rejected # noqa: E501 + + :return: The mandate_rejection_date of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._mandate_rejection_date + + @mandate_rejection_date.setter + def mandate_rejection_date(self, mandate_rejection_date): + """Sets the mandate_rejection_date of this IpoOrderData. + + When the UPI mandate was rejected; null unless rejected # noqa: E501 + + :param mandate_rejection_date: The mandate_rejection_date of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._mandate_rejection_date = mandate_rejection_date + + @property + def cancel_requested_date(self): + """Gets the cancel_requested_date of this IpoOrderData. # noqa: E501 + + When cancellation was requested; null unless a cancellation was raised # noqa: E501 + + :return: The cancel_requested_date of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._cancel_requested_date + + @cancel_requested_date.setter + def cancel_requested_date(self, cancel_requested_date): + """Sets the cancel_requested_date of this IpoOrderData. + + When cancellation was requested; null unless a cancellation was raised # noqa: E501 + + :param cancel_requested_date: The cancel_requested_date of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._cancel_requested_date = cancel_requested_date + + @property + def cancel_accepted_date(self): + """Gets the cancel_accepted_date of this IpoOrderData. # noqa: E501 + + When cancellation was accepted; null unless the cancellation completed # noqa: E501 + + :return: The cancel_accepted_date of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._cancel_accepted_date + + @cancel_accepted_date.setter + def cancel_accepted_date(self, cancel_accepted_date): + """Sets the cancel_accepted_date of this IpoOrderData. + + When cancellation was accepted; null unless the cancellation completed # noqa: E501 + + :param cancel_accepted_date: The cancel_accepted_date of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._cancel_accepted_date = cancel_accepted_date + + @property + def units_allotted(self): + """Gets the units_allotted of this IpoOrderData. # noqa: E501 + + Shares allotted. 0 until allotment completes, and on applications that were not allotted # noqa: E501 + + :return: The units_allotted of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._units_allotted + + @units_allotted.setter + def units_allotted(self, units_allotted): + """Sets the units_allotted of this IpoOrderData. + + Shares allotted. 0 until allotment completes, and on applications that were not allotted # noqa: E501 + + :param units_allotted: The units_allotted of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._units_allotted = units_allotted + + @property + def bids(self): + """Gets the bids of this IpoOrderData. # noqa: E501 + + Bids placed in this application # noqa: E501 + + :return: The bids of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._bids + + @bids.setter + def bids(self, bids): + """Sets the bids of this IpoOrderData. + + Bids placed in this application # noqa: E501 + + :param bids: The bids of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._bids = bids + + @property + def created_at(self): + """Gets the created_at of this IpoOrderData. # noqa: E501 + + When the application was created, in yyyy-MM-dd'T'HH:mm:ss # noqa: E501 + + :return: The created_at of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._created_at + + @created_at.setter + def created_at(self, created_at): + """Sets the created_at of this IpoOrderData. + + When the application was created, in yyyy-MM-dd'T'HH:mm:ss # noqa: E501 + + :param created_at: The created_at of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._created_at = created_at + + @property + def last_updated_at(self): + """Gets the last_updated_at of this IpoOrderData. # noqa: E501 + + When the application was last updated, in yyyy-MM-dd'T'HH:mm:ss # noqa: E501 + + :return: The last_updated_at of this IpoOrderData. # noqa: E501 + :rtype: object + """ + return self._last_updated_at + + @last_updated_at.setter + def last_updated_at(self, last_updated_at): + """Sets the last_updated_at of this IpoOrderData. + + When the application was last updated, in yyyy-MM-dd'T'HH:mm:ss # noqa: E501 + + :param last_updated_at: The last_updated_at of this IpoOrderData. # noqa: E501 + :type: object + """ + + self._last_updated_at = last_updated_at + + 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(IpoOrderData, 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, IpoOrderData): + 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/ipo_order_detail_response.py b/upstox_client/models/ipo_order_detail_response.py new file mode 100644 index 0000000..726584d --- /dev/null +++ b/upstox_client/models/ipo_order_detail_response.py @@ -0,0 +1,136 @@ +# 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 IpoOrderDetailResponse(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': 'object', + 'data': 'IpoOrderData' + } + + attribute_map = { + 'status': 'status', + 'data': 'data' + } + + def __init__(self, status=None, data=None): # noqa: E501 + """IpoOrderDetailResponse - 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 IpoOrderDetailResponse. # noqa: E501 + + + :return: The status of this IpoOrderDetailResponse. # noqa: E501 + :rtype: object + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this IpoOrderDetailResponse. + + + :param status: The status of this IpoOrderDetailResponse. # noqa: E501 + :type: object + """ + + self._status = status + + @property + def data(self): + """Gets the data of this IpoOrderDetailResponse. # noqa: E501 + + + :return: The data of this IpoOrderDetailResponse. # noqa: E501 + :rtype: IpoOrderData + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this IpoOrderDetailResponse. + + + :param data: The data of this IpoOrderDetailResponse. # noqa: E501 + :type: IpoOrderData + """ + + 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(IpoOrderDetailResponse, 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, IpoOrderDetailResponse): + 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/ipo_order_response.py b/upstox_client/models/ipo_order_response.py new file mode 100644 index 0000000..46ef3bf --- /dev/null +++ b/upstox_client/models/ipo_order_response.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 IpoOrderResponse(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': 'object', + 'data': 'object', + 'meta_data': 'IpoMetaData' + } + + attribute_map = { + 'status': 'status', + 'data': 'data', + 'meta_data': 'meta_data' + } + + def __init__(self, status=None, data=None, meta_data=None): # noqa: E501 + """IpoOrderResponse - a model defined in Swagger""" # noqa: E501 + self._status = None + self._data = None + self._meta_data = None + self.discriminator = None + if status is not None: + self.status = status + if data is not None: + self.data = data + if meta_data is not None: + self.meta_data = meta_data + + @property + def status(self): + """Gets the status of this IpoOrderResponse. # noqa: E501 + + + :return: The status of this IpoOrderResponse. # noqa: E501 + :rtype: object + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this IpoOrderResponse. + + + :param status: The status of this IpoOrderResponse. # noqa: E501 + :type: object + """ + + self._status = status + + @property + def data(self): + """Gets the data of this IpoOrderResponse. # noqa: E501 + + + :return: The data of this IpoOrderResponse. # noqa: E501 + :rtype: object + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this IpoOrderResponse. + + + :param data: The data of this IpoOrderResponse. # noqa: E501 + :type: object + """ + + self._data = data + + @property + def meta_data(self): + """Gets the meta_data of this IpoOrderResponse. # noqa: E501 + + + :return: The meta_data of this IpoOrderResponse. # noqa: E501 + :rtype: IpoMetaData + """ + return self._meta_data + + @meta_data.setter + def meta_data(self, meta_data): + """Sets the meta_data of this IpoOrderResponse. + + + :param meta_data: The meta_data of this IpoOrderResponse. # noqa: E501 + :type: IpoMetaData + """ + + self._meta_data = meta_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(IpoOrderResponse, 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, IpoOrderResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other