Skip to content

Commit

Permalink
Merge pull request #55 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.12
  • Loading branch information
sonicxml authored Nov 1, 2024
2 parents f14d0e1 + b43ca2b commit 21ff020
Show file tree
Hide file tree
Showing 22 changed files with 419 additions and 22 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.11"
".": "0.1.0-alpha.12"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 29
configured_endpoints: 30
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/clear-street%2Fstudio-sdk-468b5da24bbf73b3a3861d44c5a8051fe6c55a6ec64c5c6f2d45f22c76bf35b2.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.12 (2024-10-25)

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

### Features

* **api:** enable inventories endpoint ([#54](https://github.com/clear-street/studio-sdk-python/issues/54)) ([8fc74d6](https://github.com/clear-street/studio-sdk-python/commit/8fc74d66d9b93ab77093788b9f29c56fcfff1478))

## 0.1.0-alpha.11 (2024-10-11)

Full Changelog: [v0.1.0-alpha.10...v0.1.0-alpha.11](https://github.com/clear-street/studio-sdk-python/compare/v0.1.0-alpha.10...v0.1.0-alpha.11)
Expand Down
12 changes: 12 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,18 @@ Methods:

- <code title="get /accounts/{account_id}/holdings">client.accounts.holdings.<a href="./src/studio_sdk/resources/accounts/holdings.py">list</a>(account_id, \*\*<a href="src/studio_sdk/types/accounts/holding_list_params.py">params</a>) -> <a href="./src/studio_sdk/types/accounts/holding_list_response.py">HoldingListResponse</a></code>

## Inventories

Types:

```python
from studio_sdk.types.accounts import InventoryRetrieveResponse
```

Methods:

- <code title="get /accounts/{account_id}/inventories/{symbol}">client.accounts.inventories.<a href="./src/studio_sdk/resources/accounts/inventories.py">retrieve</a>(symbol, \*, account_id) -> <a href="./src/studio_sdk/types/accounts/inventory_retrieve_response.py">InventoryRetrieveResponse</a></code>

# Instruments

Types:
Expand Down
10 changes: 3 additions & 7 deletions 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.11"
version = "0.1.0-alpha.12"
description = "The official Python library for the studio-sdk API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -63,11 +63,11 @@ format = { chain = [
"format:ruff",
"format:docs",
"fix:ruff",
# run formatting again to fix any inconsistencies when imports are stripped
"format:ruff",
]}
"format:black" = "black ."
"format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md"
"format:ruff" = "ruff format"
"format:isort" = "isort ."

"lint" = { chain = [
"check:ruff",
Expand Down Expand Up @@ -125,10 +125,6 @@ path = "README.md"
pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
replacement = '[\1](https://github.com/clear-street/studio-sdk-python/tree/main/\g<2>)'

[tool.black]
line-length = 120
target-version = ["py37"]

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--tb=short"
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pytz==2023.3.post1
# via dirty-equals
respx==0.20.2
rich==13.7.1
ruff==0.6.5
ruff==0.6.9
setuptools==68.2.2
# via nodeenv
six==1.16.0
Expand Down
11 changes: 9 additions & 2 deletions src/studio_sdk/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ def __init__(
self.url = url
self.params = params

@override
def __repr__(self) -> str:
if self.url:
return f"{self.__class__.__name__}(url={self.url})"
return f"{self.__class__.__name__}(params={self.params})"


class BasePage(GenericModel, Generic[_T]):
"""
Expand Down Expand Up @@ -689,7 +695,8 @@ def _calculate_retry_timeout(
if retry_after is not None and 0 < retry_after <= 60:
return retry_after

nb_retries = max_retries - remaining_retries
# Also cap retry count to 1000 to avoid any potential overflows with `pow`
nb_retries = min(max_retries - remaining_retries, 1000)

# Apply exponential backoff, but not more than the max.
sleep_seconds = min(INITIAL_RETRY_DELAY * pow(2.0, nb_retries), MAX_RETRY_DELAY)
Expand Down Expand Up @@ -1568,7 +1575,7 @@ async def _request(
except Exception as err:
log.debug("Encountered Exception", exc_info=True)

if retries_taken > 0:
if remaining_retries > 0:
return await self._retry_request(
input_options,
cast_to,
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.11" # x-release-please-version
__version__ = "0.1.0-alpha.12" # x-release-please-version
14 changes: 14 additions & 0 deletions src/studio_sdk/resources/accounts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@
BulkOrdersResourceWithStreamingResponse,
AsyncBulkOrdersResourceWithStreamingResponse,
)
from .inventories import (
InventoriesResource,
AsyncInventoriesResource,
InventoriesResourceWithRawResponse,
AsyncInventoriesResourceWithRawResponse,
InventoriesResourceWithStreamingResponse,
AsyncInventoriesResourceWithStreamingResponse,
)
from .pnl_details import (
PnlDetailsResource,
AsyncPnlDetailsResource,
Expand Down Expand Up @@ -150,6 +158,12 @@
"AsyncHoldingsResourceWithRawResponse",
"HoldingsResourceWithStreamingResponse",
"AsyncHoldingsResourceWithStreamingResponse",
"InventoriesResource",
"AsyncInventoriesResource",
"InventoriesResourceWithRawResponse",
"AsyncInventoriesResourceWithRawResponse",
"InventoriesResourceWithStreamingResponse",
"AsyncInventoriesResourceWithStreamingResponse",
"AccountsResource",
"AsyncAccountsResource",
"AccountsResourceWithRawResponse",
Expand Down
32 changes: 32 additions & 0 deletions src/studio_sdk/resources/accounts/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@
BulkOrdersResourceWithStreamingResponse,
AsyncBulkOrdersResourceWithStreamingResponse,
)
from .inventories import (
InventoriesResource,
AsyncInventoriesResource,
InventoriesResourceWithRawResponse,
AsyncInventoriesResourceWithRawResponse,
InventoriesResourceWithStreamingResponse,
AsyncInventoriesResourceWithStreamingResponse,
)
from .pnl_details import (
PnlDetailsResource,
AsyncPnlDetailsResource,
Expand Down Expand Up @@ -141,6 +149,10 @@ def pnl_sums(self) -> PnlSumsResource:
def holdings(self) -> HoldingsResource:
return HoldingsResource(self._client)

@cached_property
def inventories(self) -> InventoriesResource:
return InventoriesResource(self._client)

@cached_property
def with_raw_response(self) -> AccountsResourceWithRawResponse:
"""
Expand Down Expand Up @@ -256,6 +268,10 @@ def pnl_sums(self) -> AsyncPnlSumsResource:
def holdings(self) -> AsyncHoldingsResource:
return AsyncHoldingsResource(self._client)

@cached_property
def inventories(self) -> AsyncInventoriesResource:
return AsyncInventoriesResource(self._client)

@cached_property
def with_raw_response(self) -> AsyncAccountsResourceWithRawResponse:
"""
Expand Down Expand Up @@ -381,6 +397,10 @@ def pnl_sums(self) -> PnlSumsResourceWithRawResponse:
def holdings(self) -> HoldingsResourceWithRawResponse:
return HoldingsResourceWithRawResponse(self._accounts.holdings)

@cached_property
def inventories(self) -> InventoriesResourceWithRawResponse:
return InventoriesResourceWithRawResponse(self._accounts.inventories)


class AsyncAccountsResourceWithRawResponse:
def __init__(self, accounts: AsyncAccountsResource) -> None:
Expand Down Expand Up @@ -433,6 +453,10 @@ def pnl_sums(self) -> AsyncPnlSumsResourceWithRawResponse:
def holdings(self) -> AsyncHoldingsResourceWithRawResponse:
return AsyncHoldingsResourceWithRawResponse(self._accounts.holdings)

@cached_property
def inventories(self) -> AsyncInventoriesResourceWithRawResponse:
return AsyncInventoriesResourceWithRawResponse(self._accounts.inventories)


class AccountsResourceWithStreamingResponse:
def __init__(self, accounts: AccountsResource) -> None:
Expand Down Expand Up @@ -485,6 +509,10 @@ def pnl_sums(self) -> PnlSumsResourceWithStreamingResponse:
def holdings(self) -> HoldingsResourceWithStreamingResponse:
return HoldingsResourceWithStreamingResponse(self._accounts.holdings)

@cached_property
def inventories(self) -> InventoriesResourceWithStreamingResponse:
return InventoriesResourceWithStreamingResponse(self._accounts.inventories)


class AsyncAccountsResourceWithStreamingResponse:
def __init__(self, accounts: AsyncAccountsResource) -> None:
Expand Down Expand Up @@ -536,3 +564,7 @@ def pnl_sums(self) -> AsyncPnlSumsResourceWithStreamingResponse:
@cached_property
def holdings(self) -> AsyncHoldingsResourceWithStreamingResponse:
return AsyncHoldingsResourceWithStreamingResponse(self._accounts.holdings)

@cached_property
def inventories(self) -> AsyncInventoriesResourceWithStreamingResponse:
return AsyncInventoriesResourceWithStreamingResponse(self._accounts.inventories)
Loading

0 comments on commit 21ff020

Please sign in to comment.