Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Update urls.py - Options Orders #317

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ Changelog

.. towncrier release notes start

Pyrh 2.1.3 (2024-08-07)
=======================

Features
--------

- Added Option orders support for build and execution (#317)


Pyrh 2.1.2 (2023-03-04)
=======================

Expand Down
1 change: 1 addition & 0 deletions newsfragments/317.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Added Option orders support for build and execution (#317)
16 changes: 16 additions & 0 deletions pyrh/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
OPTIONS_BASE = API_BASE / "options/"
OPTIONS_CHAIN_BASE = OPTIONS_BASE / "chains/"
OPTIONS_INSTRUMENTS_BASE = OPTIONS_BASE / "instruments/"
OPTIONS_ORDERS_BASE = OPTIONS_BASE / "orders/"

# User
USER = API_BASE / "user/"
Expand Down Expand Up @@ -117,6 +118,21 @@ def build_orders(order_id: Optional[str] = None) -> URL:
else:
return ORDERS_BASE

def build_options_orders(order_id: Optional[str] = None) -> URL:
"""Build endpoint to place options orders."

Args:
order_id: the id of the order

Returns:
A constructed URL for a particular order or the base URL for options orders.

"""
if order_id is not None:
return OPTIONS_ORDERS_BASE / f"{order_id}/"
else:
return OPTIONS_ORDERS_BASE


def build_news(stock: str) -> URL:
"""Build news endpoint for a particular stock
Expand Down
Loading