Skip to content

Commit

Permalink
Merge pull request #69 from clear-street/release-please--branches--ma…
Browse files Browse the repository at this point in the history
…in--changes--next

release: 0.1.0-alpha.14
  • Loading branch information
sonicxml authored Nov 29, 2024
2 parents 929f6de + e957d19 commit 834d9b6
Show file tree
Hide file tree
Showing 12 changed files with 303 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.13"
".": "0.1.0-alpha.14"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 30
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/clear-street%2Fstudio-sdk-468b5da24bbf73b3a3861d44c5a8051fe6c55a6ec64c5c6f2d45f22c76bf35b2.yml
configured_endpoints: 31
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/clear-street%2Fstudio-sdk-5efb317738842339f6e8bd32592691a65d19a54adc34bfa319d6bac2404404a7.yml
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.1.0-alpha.14 (2024-11-29)

Full Changelog: [v0.1.0-alpha.13...v0.1.0-alpha.14](https://github.com/clear-street/studio-sdk-python/compare/v0.1.0-alpha.13...v0.1.0-alpha.14)

### Features

* **api:** add modify orders endpoint ([#68](https://github.com/clear-street/studio-sdk-python/issues/68)) ([f02195a](https://github.com/clear-street/studio-sdk-python/commit/f02195a6256c88d28b4cd967d3a5b411ac86654a))

## 0.1.0-alpha.13 (2024-11-28)

Full Changelog: [v0.1.0-alpha.12...v0.1.0-alpha.13](https://github.com/clear-street/studio-sdk-python/compare/v0.1.0-alpha.12...v0.1.0-alpha.13)
Expand Down
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Methods:
- <code title="get /accounts/{account_id}/orders">client.accounts.orders.<a href="./src/studio_sdk/resources/accounts/orders.py">list</a>(account_id, \*\*<a href="src/studio_sdk/types/accounts/order_list_params.py">params</a>) -> <a href="./src/studio_sdk/types/accounts/order_list_response.py">OrderListResponse</a></code>
- <code title="delete /accounts/{account_id}/orders">client.accounts.orders.<a href="./src/studio_sdk/resources/accounts/orders.py">delete</a>(account_id, \*\*<a href="src/studio_sdk/types/accounts/order_delete_params.py">params</a>) -> <a href="./src/studio_sdk/types/accounts/order_delete_response.py">OrderDeleteResponse</a></code>
- <code title="delete /accounts/{account_id}/orders/{order_id}">client.accounts.orders.<a href="./src/studio_sdk/resources/accounts/orders.py">cancel</a>(order_id, \*, account_id) -> None</code>
- <code title="patch /accounts/{account_id}/orders/{order_id}">client.accounts.orders.<a href="./src/studio_sdk/resources/accounts/orders.py">patch</a>(order_id, \*, account_id, \*\*<a href="src/studio_sdk/types/accounts/order_patch_params.py">params</a>) -> None</code>

## Trades

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "clear-street-studio-sdk"
version = "0.1.0-alpha.13"
version = "0.1.0-alpha.14"
description = "The official Python library for the studio-sdk API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/studio_sdk/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "studio_sdk"
__version__ = "0.1.0-alpha.13" # x-release-please-version
__version__ = "0.1.0-alpha.14" # x-release-please-version
134 changes: 133 additions & 1 deletion src/studio_sdk/resources/accounts/orders.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
async_to_streamed_response_wrapper,
)
from ..._base_client import make_request_options
from ...types.accounts import order_list_params, order_create_params, order_delete_params
from ...types.accounts import order_list_params, order_patch_params, order_create_params, order_delete_params
from ...types.shared_params.strategy import Strategy
from ...types.accounts.order_list_response import OrderListResponse
from ...types.accounts.order_create_response import OrderCreateResponse
Expand Down Expand Up @@ -359,6 +359,66 @@ def cancel(
cast_to=NoneType,
)

def patch(
self,
order_id: str,
*,
account_id: str,
quantity: str,
price: str | NotGiven = NOT_GIVEN,
stop_price: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
"""Attempts to update an existing order.
This can be used to update a subset of an
order's attributes, for example price and quantity.
Args:
account_id: Account ID for the account.
order_id: Unique order ID assigned by us.
quantity: The maximum quantity to be executed.
price: The price to execute at-or-better for limit orders.
stop_price: The price at which stop orders become marketable.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not order_id:
raise ValueError(f"Expected a non-empty value for `order_id` but received {order_id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return self._patch(
f"/accounts/{account_id}/orders/{order_id}",
body=maybe_transform(
{
"quantity": quantity,
"price": price,
"stop_price": stop_price,
},
order_patch_params.OrderPatchParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=NoneType,
)


class AsyncOrdersResource(AsyncAPIResource):
@cached_property
Expand Down Expand Up @@ -689,6 +749,66 @@ async def cancel(
cast_to=NoneType,
)

async def patch(
self,
order_id: str,
*,
account_id: str,
quantity: str,
price: str | NotGiven = NOT_GIVEN,
stop_price: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
"""Attempts to update an existing order.
This can be used to update a subset of an
order's attributes, for example price and quantity.
Args:
account_id: Account ID for the account.
order_id: Unique order ID assigned by us.
quantity: The maximum quantity to be executed.
price: The price to execute at-or-better for limit orders.
stop_price: The price at which stop orders become marketable.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not order_id:
raise ValueError(f"Expected a non-empty value for `order_id` but received {order_id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return await self._patch(
f"/accounts/{account_id}/orders/{order_id}",
body=await async_maybe_transform(
{
"quantity": quantity,
"price": price,
"stop_price": stop_price,
},
order_patch_params.OrderPatchParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=NoneType,
)


class OrdersResourceWithRawResponse:
def __init__(self, orders: OrdersResource) -> None:
Expand All @@ -709,6 +829,9 @@ def __init__(self, orders: OrdersResource) -> None:
self.cancel = to_raw_response_wrapper(
orders.cancel,
)
self.patch = to_raw_response_wrapper(
orders.patch,
)


class AsyncOrdersResourceWithRawResponse:
Expand All @@ -730,6 +853,9 @@ def __init__(self, orders: AsyncOrdersResource) -> None:
self.cancel = async_to_raw_response_wrapper(
orders.cancel,
)
self.patch = async_to_raw_response_wrapper(
orders.patch,
)


class OrdersResourceWithStreamingResponse:
Expand All @@ -751,6 +877,9 @@ def __init__(self, orders: OrdersResource) -> None:
self.cancel = to_streamed_response_wrapper(
orders.cancel,
)
self.patch = to_streamed_response_wrapper(
orders.patch,
)


class AsyncOrdersResourceWithStreamingResponse:
Expand All @@ -772,3 +901,6 @@ def __init__(self, orders: AsyncOrdersResource) -> None:
self.cancel = async_to_streamed_response_wrapper(
orders.cancel,
)
self.patch = async_to_streamed_response_wrapper(
orders.patch,
)
1 change: 1 addition & 0 deletions src/studio_sdk/types/accounts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from .order_list_params import OrderListParams as OrderListParams
from .trade_list_params import TradeListParams as TradeListParams
from .order_patch_params import OrderPatchParams as OrderPatchParams
from .holding_list_params import HoldingListParams as HoldingListParams
from .order_create_params import OrderCreateParams as OrderCreateParams
from .order_delete_params import OrderDeleteParams as OrderDeleteParams
Expand Down
21 changes: 21 additions & 0 deletions src/studio_sdk/types/accounts/order_patch_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing_extensions import Required, TypedDict

__all__ = ["OrderPatchParams"]


class OrderPatchParams(TypedDict, total=False):
account_id: Required[str]
"""Account ID for the account."""

quantity: Required[str]
"""The maximum quantity to be executed."""

price: str
"""The price to execute at-or-better for limit orders."""

stop_price: str
"""The price at which stop orders become marketable."""
3 changes: 3 additions & 0 deletions src/studio_sdk/types/shared/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class Order(BaseModel):
quantity: str
"""The requested quantity on this order."""

running_position: str
"""The position quantity at the time of this order."""

side: Literal["buy", "sell", "sell-short"]
"""Buy, sell, sell-short indicator."""

Expand Down
3 changes: 3 additions & 0 deletions src/studio_sdk/types/shared/trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class Trade(BaseModel):
quantity: str
"""The amount that was traded."""

running_position: str
"""The position quantity at the time of this trade."""

side: Literal["buy", "sell", "sell-short"]
"""The side this trade occurred on."""

Expand Down
Loading

0 comments on commit 834d9b6

Please sign in to comment.