diff --git a/robosystems_client/api/investor/__init__.py b/robosystems_client/api/investor/__init__.py new file mode 100644 index 0000000..2d7c0b2 --- /dev/null +++ b/robosystems_client/api/investor/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/robosystems_client/api/investor/create_portfolio.py b/robosystems_client/api/investor/create_portfolio.py new file mode 100644 index 0000000..bd8321a --- /dev/null +++ b/robosystems_client/api/investor/create_portfolio.py @@ -0,0 +1,182 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.create_portfolio_request import CreatePortfolioRequest +from ...models.http_validation_error import HTTPValidationError +from ...models.portfolio_response import PortfolioResponse +from ...types import Response + + +def _get_kwargs( + graph_id: str, + *, + body: CreatePortfolioRequest, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/v1/investor/{graph_id}/portfolios".format( + graph_id=quote(str(graph_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | PortfolioResponse | None: + if response.status_code == 201: + response_201 = PortfolioResponse.from_dict(response.json()) + + return response_201 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | PortfolioResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreatePortfolioRequest, +) -> Response[HTTPValidationError | PortfolioResponse]: + """Create Portfolio + + Args: + graph_id (str): + body (CreatePortfolioRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | PortfolioResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreatePortfolioRequest, +) -> HTTPValidationError | PortfolioResponse | None: + """Create Portfolio + + Args: + graph_id (str): + body (CreatePortfolioRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | PortfolioResponse + """ + + return sync_detailed( + graph_id=graph_id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreatePortfolioRequest, +) -> Response[HTTPValidationError | PortfolioResponse]: + """Create Portfolio + + Args: + graph_id (str): + body (CreatePortfolioRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | PortfolioResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreatePortfolioRequest, +) -> HTTPValidationError | PortfolioResponse | None: + """Create Portfolio + + Args: + graph_id (str): + body (CreatePortfolioRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | PortfolioResponse + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + client=client, + body=body, + ) + ).parsed diff --git a/robosystems_client/api/investor/create_position.py b/robosystems_client/api/investor/create_position.py new file mode 100644 index 0000000..72289f9 --- /dev/null +++ b/robosystems_client/api/investor/create_position.py @@ -0,0 +1,182 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.create_position_request import CreatePositionRequest +from ...models.http_validation_error import HTTPValidationError +from ...models.position_response import PositionResponse +from ...types import Response + + +def _get_kwargs( + graph_id: str, + *, + body: CreatePositionRequest, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/v1/investor/{graph_id}/positions".format( + graph_id=quote(str(graph_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | PositionResponse | None: + if response.status_code == 201: + response_201 = PositionResponse.from_dict(response.json()) + + return response_201 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | PositionResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreatePositionRequest, +) -> Response[HTTPValidationError | PositionResponse]: + """Create Position + + Args: + graph_id (str): + body (CreatePositionRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | PositionResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreatePositionRequest, +) -> HTTPValidationError | PositionResponse | None: + """Create Position + + Args: + graph_id (str): + body (CreatePositionRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | PositionResponse + """ + + return sync_detailed( + graph_id=graph_id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreatePositionRequest, +) -> Response[HTTPValidationError | PositionResponse]: + """Create Position + + Args: + graph_id (str): + body (CreatePositionRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | PositionResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreatePositionRequest, +) -> HTTPValidationError | PositionResponse | None: + """Create Position + + Args: + graph_id (str): + body (CreatePositionRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | PositionResponse + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + client=client, + body=body, + ) + ).parsed diff --git a/robosystems_client/api/investor/create_security.py b/robosystems_client/api/investor/create_security.py new file mode 100644 index 0000000..c13337d --- /dev/null +++ b/robosystems_client/api/investor/create_security.py @@ -0,0 +1,182 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.create_security_request import CreateSecurityRequest +from ...models.http_validation_error import HTTPValidationError +from ...models.security_response import SecurityResponse +from ...types import Response + + +def _get_kwargs( + graph_id: str, + *, + body: CreateSecurityRequest, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/v1/investor/{graph_id}/securities".format( + graph_id=quote(str(graph_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | SecurityResponse | None: + if response.status_code == 201: + response_201 = SecurityResponse.from_dict(response.json()) + + return response_201 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | SecurityResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreateSecurityRequest, +) -> Response[HTTPValidationError | SecurityResponse]: + """Create Security + + Args: + graph_id (str): + body (CreateSecurityRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SecurityResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreateSecurityRequest, +) -> HTTPValidationError | SecurityResponse | None: + """Create Security + + Args: + graph_id (str): + body (CreateSecurityRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SecurityResponse + """ + + return sync_detailed( + graph_id=graph_id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreateSecurityRequest, +) -> Response[HTTPValidationError | SecurityResponse]: + """Create Security + + Args: + graph_id (str): + body (CreateSecurityRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SecurityResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + *, + client: AuthenticatedClient, + body: CreateSecurityRequest, +) -> HTTPValidationError | SecurityResponse | None: + """Create Security + + Args: + graph_id (str): + body (CreateSecurityRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SecurityResponse + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + client=client, + body=body, + ) + ).parsed diff --git a/robosystems_client/api/investor/delete_portfolio.py b/robosystems_client/api/investor/delete_portfolio.py new file mode 100644 index 0000000..395fa8f --- /dev/null +++ b/robosystems_client/api/investor/delete_portfolio.py @@ -0,0 +1,172 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...types import Response + + +def _get_kwargs( + graph_id: str, + portfolio_id: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "delete", + "url": "/v1/investor/{graph_id}/portfolios/{portfolio_id}".format( + graph_id=quote(str(graph_id), safe=""), + portfolio_id=quote(str(portfolio_id), safe=""), + ), + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 204: + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + graph_id: str, + portfolio_id: str, + *, + client: AuthenticatedClient, +) -> Response[Any | HTTPValidationError]: + """Delete Portfolio + + Args: + graph_id (str): + portfolio_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + portfolio_id=portfolio_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + portfolio_id: str, + *, + client: AuthenticatedClient, +) -> Any | HTTPValidationError | None: + """Delete Portfolio + + Args: + graph_id (str): + portfolio_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + graph_id=graph_id, + portfolio_id=portfolio_id, + client=client, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + portfolio_id: str, + *, + client: AuthenticatedClient, +) -> Response[Any | HTTPValidationError]: + """Delete Portfolio + + Args: + graph_id (str): + portfolio_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + portfolio_id=portfolio_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + portfolio_id: str, + *, + client: AuthenticatedClient, +) -> Any | HTTPValidationError | None: + """Delete Portfolio + + Args: + graph_id (str): + portfolio_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + portfolio_id=portfolio_id, + client=client, + ) + ).parsed diff --git a/robosystems_client/api/investor/delete_position.py b/robosystems_client/api/investor/delete_position.py new file mode 100644 index 0000000..e682704 --- /dev/null +++ b/robosystems_client/api/investor/delete_position.py @@ -0,0 +1,172 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...types import Response + + +def _get_kwargs( + graph_id: str, + position_id: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "delete", + "url": "/v1/investor/{graph_id}/positions/{position_id}".format( + graph_id=quote(str(graph_id), safe=""), + position_id=quote(str(position_id), safe=""), + ), + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 204: + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + graph_id: str, + position_id: str, + *, + client: AuthenticatedClient, +) -> Response[Any | HTTPValidationError]: + """Delete Position + + Args: + graph_id (str): + position_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + position_id=position_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + position_id: str, + *, + client: AuthenticatedClient, +) -> Any | HTTPValidationError | None: + """Delete Position + + Args: + graph_id (str): + position_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + graph_id=graph_id, + position_id=position_id, + client=client, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + position_id: str, + *, + client: AuthenticatedClient, +) -> Response[Any | HTTPValidationError]: + """Delete Position + + Args: + graph_id (str): + position_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + position_id=position_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + position_id: str, + *, + client: AuthenticatedClient, +) -> Any | HTTPValidationError | None: + """Delete Position + + Args: + graph_id (str): + position_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + position_id=position_id, + client=client, + ) + ).parsed diff --git a/robosystems_client/api/investor/delete_security.py b/robosystems_client/api/investor/delete_security.py new file mode 100644 index 0000000..6560d87 --- /dev/null +++ b/robosystems_client/api/investor/delete_security.py @@ -0,0 +1,172 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...types import Response + + +def _get_kwargs( + graph_id: str, + security_id: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "delete", + "url": "/v1/investor/{graph_id}/securities/{security_id}".format( + graph_id=quote(str(graph_id), safe=""), + security_id=quote(str(security_id), safe=""), + ), + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 204: + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + graph_id: str, + security_id: str, + *, + client: AuthenticatedClient, +) -> Response[Any | HTTPValidationError]: + """Delete Security + + Args: + graph_id (str): + security_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + security_id=security_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + security_id: str, + *, + client: AuthenticatedClient, +) -> Any | HTTPValidationError | None: + """Delete Security + + Args: + graph_id (str): + security_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + graph_id=graph_id, + security_id=security_id, + client=client, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + security_id: str, + *, + client: AuthenticatedClient, +) -> Response[Any | HTTPValidationError]: + """Delete Security + + Args: + graph_id (str): + security_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + security_id=security_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + security_id: str, + *, + client: AuthenticatedClient, +) -> Any | HTTPValidationError | None: + """Delete Security + + Args: + graph_id (str): + security_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + security_id=security_id, + client=client, + ) + ).parsed diff --git a/robosystems_client/api/investor/get_portfolio.py b/robosystems_client/api/investor/get_portfolio.py new file mode 100644 index 0000000..811ac37 --- /dev/null +++ b/robosystems_client/api/investor/get_portfolio.py @@ -0,0 +1,174 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.portfolio_response import PortfolioResponse +from ...types import Response + + +def _get_kwargs( + graph_id: str, + portfolio_id: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/v1/investor/{graph_id}/portfolios/{portfolio_id}".format( + graph_id=quote(str(graph_id), safe=""), + portfolio_id=quote(str(portfolio_id), safe=""), + ), + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | PortfolioResponse | None: + if response.status_code == 200: + response_200 = PortfolioResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | PortfolioResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + graph_id: str, + portfolio_id: str, + *, + client: AuthenticatedClient, +) -> Response[HTTPValidationError | PortfolioResponse]: + """Get Portfolio + + Args: + graph_id (str): + portfolio_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | PortfolioResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + portfolio_id=portfolio_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + portfolio_id: str, + *, + client: AuthenticatedClient, +) -> HTTPValidationError | PortfolioResponse | None: + """Get Portfolio + + Args: + graph_id (str): + portfolio_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | PortfolioResponse + """ + + return sync_detailed( + graph_id=graph_id, + portfolio_id=portfolio_id, + client=client, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + portfolio_id: str, + *, + client: AuthenticatedClient, +) -> Response[HTTPValidationError | PortfolioResponse]: + """Get Portfolio + + Args: + graph_id (str): + portfolio_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | PortfolioResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + portfolio_id=portfolio_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + portfolio_id: str, + *, + client: AuthenticatedClient, +) -> HTTPValidationError | PortfolioResponse | None: + """Get Portfolio + + Args: + graph_id (str): + portfolio_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | PortfolioResponse + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + portfolio_id=portfolio_id, + client=client, + ) + ).parsed diff --git a/robosystems_client/api/investor/get_position.py b/robosystems_client/api/investor/get_position.py new file mode 100644 index 0000000..e634f1e --- /dev/null +++ b/robosystems_client/api/investor/get_position.py @@ -0,0 +1,174 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.position_response import PositionResponse +from ...types import Response + + +def _get_kwargs( + graph_id: str, + position_id: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/v1/investor/{graph_id}/positions/{position_id}".format( + graph_id=quote(str(graph_id), safe=""), + position_id=quote(str(position_id), safe=""), + ), + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | PositionResponse | None: + if response.status_code == 200: + response_200 = PositionResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | PositionResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + graph_id: str, + position_id: str, + *, + client: AuthenticatedClient, +) -> Response[HTTPValidationError | PositionResponse]: + """Get Position + + Args: + graph_id (str): + position_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | PositionResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + position_id=position_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + position_id: str, + *, + client: AuthenticatedClient, +) -> HTTPValidationError | PositionResponse | None: + """Get Position + + Args: + graph_id (str): + position_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | PositionResponse + """ + + return sync_detailed( + graph_id=graph_id, + position_id=position_id, + client=client, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + position_id: str, + *, + client: AuthenticatedClient, +) -> Response[HTTPValidationError | PositionResponse]: + """Get Position + + Args: + graph_id (str): + position_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | PositionResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + position_id=position_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + position_id: str, + *, + client: AuthenticatedClient, +) -> HTTPValidationError | PositionResponse | None: + """Get Position + + Args: + graph_id (str): + position_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | PositionResponse + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + position_id=position_id, + client=client, + ) + ).parsed diff --git a/robosystems_client/api/investor/get_security.py b/robosystems_client/api/investor/get_security.py new file mode 100644 index 0000000..02b58ce --- /dev/null +++ b/robosystems_client/api/investor/get_security.py @@ -0,0 +1,174 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.security_response import SecurityResponse +from ...types import Response + + +def _get_kwargs( + graph_id: str, + security_id: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/v1/investor/{graph_id}/securities/{security_id}".format( + graph_id=quote(str(graph_id), safe=""), + security_id=quote(str(security_id), safe=""), + ), + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | SecurityResponse | None: + if response.status_code == 200: + response_200 = SecurityResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | SecurityResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + graph_id: str, + security_id: str, + *, + client: AuthenticatedClient, +) -> Response[HTTPValidationError | SecurityResponse]: + """Get Security + + Args: + graph_id (str): + security_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SecurityResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + security_id=security_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + security_id: str, + *, + client: AuthenticatedClient, +) -> HTTPValidationError | SecurityResponse | None: + """Get Security + + Args: + graph_id (str): + security_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SecurityResponse + """ + + return sync_detailed( + graph_id=graph_id, + security_id=security_id, + client=client, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + security_id: str, + *, + client: AuthenticatedClient, +) -> Response[HTTPValidationError | SecurityResponse]: + """Get Security + + Args: + graph_id (str): + security_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SecurityResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + security_id=security_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + security_id: str, + *, + client: AuthenticatedClient, +) -> HTTPValidationError | SecurityResponse | None: + """Get Security + + Args: + graph_id (str): + security_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SecurityResponse + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + security_id=security_id, + client=client, + ) + ).parsed diff --git a/robosystems_client/api/investor/list_holdings.py b/robosystems_client/api/investor/list_holdings.py new file mode 100644 index 0000000..ca33dba --- /dev/null +++ b/robosystems_client/api/investor/list_holdings.py @@ -0,0 +1,174 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.holdings_list_response import HoldingsListResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import Response + + +def _get_kwargs( + graph_id: str, + portfolio_id: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/v1/investor/{graph_id}/portfolios/{portfolio_id}/holdings".format( + graph_id=quote(str(graph_id), safe=""), + portfolio_id=quote(str(portfolio_id), safe=""), + ), + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | HoldingsListResponse | None: + if response.status_code == 200: + response_200 = HoldingsListResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | HoldingsListResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + graph_id: str, + portfolio_id: str, + *, + client: AuthenticatedClient, +) -> Response[HTTPValidationError | HoldingsListResponse]: + """List Holdings (grouped by entity) + + Args: + graph_id (str): + portfolio_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | HoldingsListResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + portfolio_id=portfolio_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + portfolio_id: str, + *, + client: AuthenticatedClient, +) -> HTTPValidationError | HoldingsListResponse | None: + """List Holdings (grouped by entity) + + Args: + graph_id (str): + portfolio_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | HoldingsListResponse + """ + + return sync_detailed( + graph_id=graph_id, + portfolio_id=portfolio_id, + client=client, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + portfolio_id: str, + *, + client: AuthenticatedClient, +) -> Response[HTTPValidationError | HoldingsListResponse]: + """List Holdings (grouped by entity) + + Args: + graph_id (str): + portfolio_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | HoldingsListResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + portfolio_id=portfolio_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + portfolio_id: str, + *, + client: AuthenticatedClient, +) -> HTTPValidationError | HoldingsListResponse | None: + """List Holdings (grouped by entity) + + Args: + graph_id (str): + portfolio_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | HoldingsListResponse + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + portfolio_id=portfolio_id, + client=client, + ) + ).parsed diff --git a/robosystems_client/api/investor/list_portfolios.py b/robosystems_client/api/investor/list_portfolios.py new file mode 100644 index 0000000..91a711a --- /dev/null +++ b/robosystems_client/api/investor/list_portfolios.py @@ -0,0 +1,196 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.portfolio_list_response import PortfolioListResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + graph_id: str, + *, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["limit"] = limit + + params["offset"] = offset + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/v1/investor/{graph_id}/portfolios".format( + graph_id=quote(str(graph_id), safe=""), + ), + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | PortfolioListResponse | None: + if response.status_code == 200: + response_200 = PortfolioListResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | PortfolioListResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> Response[HTTPValidationError | PortfolioListResponse]: + """List Portfolios + + Args: + graph_id (str): + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | PortfolioListResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + limit=limit, + offset=offset, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + *, + client: AuthenticatedClient, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> HTTPValidationError | PortfolioListResponse | None: + """List Portfolios + + Args: + graph_id (str): + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | PortfolioListResponse + """ + + return sync_detailed( + graph_id=graph_id, + client=client, + limit=limit, + offset=offset, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> Response[HTTPValidationError | PortfolioListResponse]: + """List Portfolios + + Args: + graph_id (str): + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | PortfolioListResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + limit=limit, + offset=offset, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + *, + client: AuthenticatedClient, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> HTTPValidationError | PortfolioListResponse | None: + """List Portfolios + + Args: + graph_id (str): + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | PortfolioListResponse + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + client=client, + limit=limit, + offset=offset, + ) + ).parsed diff --git a/robosystems_client/api/investor/list_positions.py b/robosystems_client/api/investor/list_positions.py new file mode 100644 index 0000000..d13a464 --- /dev/null +++ b/robosystems_client/api/investor/list_positions.py @@ -0,0 +1,256 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.position_list_response import PositionListResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + graph_id: str, + *, + portfolio_id: None | str | Unset = UNSET, + security_id: None | str | Unset = UNSET, + status: None | str | Unset = UNSET, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + json_portfolio_id: None | str | Unset + if isinstance(portfolio_id, Unset): + json_portfolio_id = UNSET + else: + json_portfolio_id = portfolio_id + params["portfolio_id"] = json_portfolio_id + + json_security_id: None | str | Unset + if isinstance(security_id, Unset): + json_security_id = UNSET + else: + json_security_id = security_id + params["security_id"] = json_security_id + + json_status: None | str | Unset + if isinstance(status, Unset): + json_status = UNSET + else: + json_status = status + params["status"] = json_status + + params["limit"] = limit + + params["offset"] = offset + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/v1/investor/{graph_id}/positions".format( + graph_id=quote(str(graph_id), safe=""), + ), + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | PositionListResponse | None: + if response.status_code == 200: + response_200 = PositionListResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | PositionListResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + portfolio_id: None | str | Unset = UNSET, + security_id: None | str | Unset = UNSET, + status: None | str | Unset = UNSET, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> Response[HTTPValidationError | PositionListResponse]: + """List Positions + + Args: + graph_id (str): + portfolio_id (None | str | Unset): Filter by portfolio + security_id (None | str | Unset): Filter by security + status (None | str | Unset): Filter by status + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | PositionListResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + portfolio_id=portfolio_id, + security_id=security_id, + status=status, + limit=limit, + offset=offset, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + *, + client: AuthenticatedClient, + portfolio_id: None | str | Unset = UNSET, + security_id: None | str | Unset = UNSET, + status: None | str | Unset = UNSET, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> HTTPValidationError | PositionListResponse | None: + """List Positions + + Args: + graph_id (str): + portfolio_id (None | str | Unset): Filter by portfolio + security_id (None | str | Unset): Filter by security + status (None | str | Unset): Filter by status + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | PositionListResponse + """ + + return sync_detailed( + graph_id=graph_id, + client=client, + portfolio_id=portfolio_id, + security_id=security_id, + status=status, + limit=limit, + offset=offset, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + portfolio_id: None | str | Unset = UNSET, + security_id: None | str | Unset = UNSET, + status: None | str | Unset = UNSET, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> Response[HTTPValidationError | PositionListResponse]: + """List Positions + + Args: + graph_id (str): + portfolio_id (None | str | Unset): Filter by portfolio + security_id (None | str | Unset): Filter by security + status (None | str | Unset): Filter by status + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | PositionListResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + portfolio_id=portfolio_id, + security_id=security_id, + status=status, + limit=limit, + offset=offset, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + *, + client: AuthenticatedClient, + portfolio_id: None | str | Unset = UNSET, + security_id: None | str | Unset = UNSET, + status: None | str | Unset = UNSET, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> HTTPValidationError | PositionListResponse | None: + """List Positions + + Args: + graph_id (str): + portfolio_id (None | str | Unset): Filter by portfolio + security_id (None | str | Unset): Filter by security + status (None | str | Unset): Filter by status + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | PositionListResponse + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + client=client, + portfolio_id=portfolio_id, + security_id=security_id, + status=status, + limit=limit, + offset=offset, + ) + ).parsed diff --git a/robosystems_client/api/investor/list_securities.py b/robosystems_client/api/investor/list_securities.py new file mode 100644 index 0000000..ff0c1d7 --- /dev/null +++ b/robosystems_client/api/investor/list_securities.py @@ -0,0 +1,256 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.security_list_response import SecurityListResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + graph_id: str, + *, + entity_id: None | str | Unset = UNSET, + security_type: None | str | Unset = UNSET, + is_active: bool | None | Unset = UNSET, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + json_entity_id: None | str | Unset + if isinstance(entity_id, Unset): + json_entity_id = UNSET + else: + json_entity_id = entity_id + params["entity_id"] = json_entity_id + + json_security_type: None | str | Unset + if isinstance(security_type, Unset): + json_security_type = UNSET + else: + json_security_type = security_type + params["security_type"] = json_security_type + + json_is_active: bool | None | Unset + if isinstance(is_active, Unset): + json_is_active = UNSET + else: + json_is_active = is_active + params["is_active"] = json_is_active + + params["limit"] = limit + + params["offset"] = offset + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/v1/investor/{graph_id}/securities".format( + graph_id=quote(str(graph_id), safe=""), + ), + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | SecurityListResponse | None: + if response.status_code == 200: + response_200 = SecurityListResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | SecurityListResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + entity_id: None | str | Unset = UNSET, + security_type: None | str | Unset = UNSET, + is_active: bool | None | Unset = UNSET, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> Response[HTTPValidationError | SecurityListResponse]: + """List Securities + + Args: + graph_id (str): + entity_id (None | str | Unset): Filter by entity + security_type (None | str | Unset): Filter by security type + is_active (bool | None | Unset): Filter by active status + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SecurityListResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + entity_id=entity_id, + security_type=security_type, + is_active=is_active, + limit=limit, + offset=offset, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + *, + client: AuthenticatedClient, + entity_id: None | str | Unset = UNSET, + security_type: None | str | Unset = UNSET, + is_active: bool | None | Unset = UNSET, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> HTTPValidationError | SecurityListResponse | None: + """List Securities + + Args: + graph_id (str): + entity_id (None | str | Unset): Filter by entity + security_type (None | str | Unset): Filter by security type + is_active (bool | None | Unset): Filter by active status + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SecurityListResponse + """ + + return sync_detailed( + graph_id=graph_id, + client=client, + entity_id=entity_id, + security_type=security_type, + is_active=is_active, + limit=limit, + offset=offset, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + *, + client: AuthenticatedClient, + entity_id: None | str | Unset = UNSET, + security_type: None | str | Unset = UNSET, + is_active: bool | None | Unset = UNSET, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> Response[HTTPValidationError | SecurityListResponse]: + """List Securities + + Args: + graph_id (str): + entity_id (None | str | Unset): Filter by entity + security_type (None | str | Unset): Filter by security type + is_active (bool | None | Unset): Filter by active status + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SecurityListResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + entity_id=entity_id, + security_type=security_type, + is_active=is_active, + limit=limit, + offset=offset, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + *, + client: AuthenticatedClient, + entity_id: None | str | Unset = UNSET, + security_type: None | str | Unset = UNSET, + is_active: bool | None | Unset = UNSET, + limit: int | Unset = 100, + offset: int | Unset = 0, +) -> HTTPValidationError | SecurityListResponse | None: + """List Securities + + Args: + graph_id (str): + entity_id (None | str | Unset): Filter by entity + security_type (None | str | Unset): Filter by security type + is_active (bool | None | Unset): Filter by active status + limit (int | Unset): Default: 100. + offset (int | Unset): Default: 0. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SecurityListResponse + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + client=client, + entity_id=entity_id, + security_type=security_type, + is_active=is_active, + limit=limit, + offset=offset, + ) + ).parsed diff --git a/robosystems_client/api/investor/update_portfolio.py b/robosystems_client/api/investor/update_portfolio.py new file mode 100644 index 0000000..6778224 --- /dev/null +++ b/robosystems_client/api/investor/update_portfolio.py @@ -0,0 +1,196 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.portfolio_response import PortfolioResponse +from ...models.update_portfolio_request import UpdatePortfolioRequest +from ...types import Response + + +def _get_kwargs( + graph_id: str, + portfolio_id: str, + *, + body: UpdatePortfolioRequest, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "patch", + "url": "/v1/investor/{graph_id}/portfolios/{portfolio_id}".format( + graph_id=quote(str(graph_id), safe=""), + portfolio_id=quote(str(portfolio_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | PortfolioResponse | None: + if response.status_code == 200: + response_200 = PortfolioResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | PortfolioResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + graph_id: str, + portfolio_id: str, + *, + client: AuthenticatedClient, + body: UpdatePortfolioRequest, +) -> Response[HTTPValidationError | PortfolioResponse]: + """Update Portfolio + + Args: + graph_id (str): + portfolio_id (str): + body (UpdatePortfolioRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | PortfolioResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + portfolio_id=portfolio_id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + portfolio_id: str, + *, + client: AuthenticatedClient, + body: UpdatePortfolioRequest, +) -> HTTPValidationError | PortfolioResponse | None: + """Update Portfolio + + Args: + graph_id (str): + portfolio_id (str): + body (UpdatePortfolioRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | PortfolioResponse + """ + + return sync_detailed( + graph_id=graph_id, + portfolio_id=portfolio_id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + portfolio_id: str, + *, + client: AuthenticatedClient, + body: UpdatePortfolioRequest, +) -> Response[HTTPValidationError | PortfolioResponse]: + """Update Portfolio + + Args: + graph_id (str): + portfolio_id (str): + body (UpdatePortfolioRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | PortfolioResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + portfolio_id=portfolio_id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + portfolio_id: str, + *, + client: AuthenticatedClient, + body: UpdatePortfolioRequest, +) -> HTTPValidationError | PortfolioResponse | None: + """Update Portfolio + + Args: + graph_id (str): + portfolio_id (str): + body (UpdatePortfolioRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | PortfolioResponse + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + portfolio_id=portfolio_id, + client=client, + body=body, + ) + ).parsed diff --git a/robosystems_client/api/investor/update_position.py b/robosystems_client/api/investor/update_position.py new file mode 100644 index 0000000..910f294 --- /dev/null +++ b/robosystems_client/api/investor/update_position.py @@ -0,0 +1,196 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.position_response import PositionResponse +from ...models.update_position_request import UpdatePositionRequest +from ...types import Response + + +def _get_kwargs( + graph_id: str, + position_id: str, + *, + body: UpdatePositionRequest, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "patch", + "url": "/v1/investor/{graph_id}/positions/{position_id}".format( + graph_id=quote(str(graph_id), safe=""), + position_id=quote(str(position_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | PositionResponse | None: + if response.status_code == 200: + response_200 = PositionResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | PositionResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + graph_id: str, + position_id: str, + *, + client: AuthenticatedClient, + body: UpdatePositionRequest, +) -> Response[HTTPValidationError | PositionResponse]: + """Update Position + + Args: + graph_id (str): + position_id (str): + body (UpdatePositionRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | PositionResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + position_id=position_id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + position_id: str, + *, + client: AuthenticatedClient, + body: UpdatePositionRequest, +) -> HTTPValidationError | PositionResponse | None: + """Update Position + + Args: + graph_id (str): + position_id (str): + body (UpdatePositionRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | PositionResponse + """ + + return sync_detailed( + graph_id=graph_id, + position_id=position_id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + position_id: str, + *, + client: AuthenticatedClient, + body: UpdatePositionRequest, +) -> Response[HTTPValidationError | PositionResponse]: + """Update Position + + Args: + graph_id (str): + position_id (str): + body (UpdatePositionRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | PositionResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + position_id=position_id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + position_id: str, + *, + client: AuthenticatedClient, + body: UpdatePositionRequest, +) -> HTTPValidationError | PositionResponse | None: + """Update Position + + Args: + graph_id (str): + position_id (str): + body (UpdatePositionRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | PositionResponse + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + position_id=position_id, + client=client, + body=body, + ) + ).parsed diff --git a/robosystems_client/api/investor/update_security.py b/robosystems_client/api/investor/update_security.py new file mode 100644 index 0000000..d223dab --- /dev/null +++ b/robosystems_client/api/investor/update_security.py @@ -0,0 +1,196 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.security_response import SecurityResponse +from ...models.update_security_request import UpdateSecurityRequest +from ...types import Response + + +def _get_kwargs( + graph_id: str, + security_id: str, + *, + body: UpdateSecurityRequest, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "patch", + "url": "/v1/investor/{graph_id}/securities/{security_id}".format( + graph_id=quote(str(graph_id), safe=""), + security_id=quote(str(security_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | SecurityResponse | None: + if response.status_code == 200: + response_200 = SecurityResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | SecurityResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + graph_id: str, + security_id: str, + *, + client: AuthenticatedClient, + body: UpdateSecurityRequest, +) -> Response[HTTPValidationError | SecurityResponse]: + """Update Security + + Args: + graph_id (str): + security_id (str): + body (UpdateSecurityRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SecurityResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + security_id=security_id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + graph_id: str, + security_id: str, + *, + client: AuthenticatedClient, + body: UpdateSecurityRequest, +) -> HTTPValidationError | SecurityResponse | None: + """Update Security + + Args: + graph_id (str): + security_id (str): + body (UpdateSecurityRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SecurityResponse + """ + + return sync_detailed( + graph_id=graph_id, + security_id=security_id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + graph_id: str, + security_id: str, + *, + client: AuthenticatedClient, + body: UpdateSecurityRequest, +) -> Response[HTTPValidationError | SecurityResponse]: + """Update Security + + Args: + graph_id (str): + security_id (str): + body (UpdateSecurityRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SecurityResponse] + """ + + kwargs = _get_kwargs( + graph_id=graph_id, + security_id=security_id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + graph_id: str, + security_id: str, + *, + client: AuthenticatedClient, + body: UpdateSecurityRequest, +) -> HTTPValidationError | SecurityResponse | None: + """Update Security + + Args: + graph_id (str): + security_id (str): + body (UpdateSecurityRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SecurityResponse + """ + + return ( + await asyncio_detailed( + graph_id=graph_id, + security_id=security_id, + client=client, + body=body, + ) + ).parsed diff --git a/robosystems_client/api/subgraphs/create_subgraph.py b/robosystems_client/api/subgraphs/create_subgraph.py index 85c36bb..f164ef6 100644 --- a/robosystems_client/api/subgraphs/create_subgraph.py +++ b/robosystems_client/api/subgraphs/create_subgraph.py @@ -8,7 +8,6 @@ from ...client import AuthenticatedClient, Client from ...models.create_subgraph_request import CreateSubgraphRequest from ...models.http_validation_error import HTTPValidationError -from ...models.subgraph_response import SubgraphResponse from ...types import Response @@ -36,10 +35,9 @@ def _get_kwargs( def _parse_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> HTTPValidationError | SubgraphResponse | None: +) -> Any | HTTPValidationError | None: if response.status_code == 200: - response_200 = SubgraphResponse.from_dict(response.json()) - + response_200 = response.json() return response_200 if response.status_code == 422: @@ -55,7 +53,7 @@ def _parse_response( def _build_response( *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[HTTPValidationError | SubgraphResponse]: +) -> Response[Any | HTTPValidationError]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -69,7 +67,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: CreateSubgraphRequest, -) -> Response[HTTPValidationError | SubgraphResponse]: +) -> Response[Any | HTTPValidationError]: """Create Subgraph Create a new subgraph within a parent graph, with optional data forking. @@ -109,7 +107,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[HTTPValidationError | SubgraphResponse] + Response[Any | HTTPValidationError] """ kwargs = _get_kwargs( @@ -129,7 +127,7 @@ def sync( *, client: AuthenticatedClient, body: CreateSubgraphRequest, -) -> HTTPValidationError | SubgraphResponse | None: +) -> Any | HTTPValidationError | None: """Create Subgraph Create a new subgraph within a parent graph, with optional data forking. @@ -169,7 +167,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - HTTPValidationError | SubgraphResponse + Any | HTTPValidationError """ return sync_detailed( @@ -184,7 +182,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: CreateSubgraphRequest, -) -> Response[HTTPValidationError | SubgraphResponse]: +) -> Response[Any | HTTPValidationError]: """Create Subgraph Create a new subgraph within a parent graph, with optional data forking. @@ -224,7 +222,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[HTTPValidationError | SubgraphResponse] + Response[Any | HTTPValidationError] """ kwargs = _get_kwargs( @@ -242,7 +240,7 @@ async def asyncio( *, client: AuthenticatedClient, body: CreateSubgraphRequest, -) -> HTTPValidationError | SubgraphResponse | None: +) -> Any | HTTPValidationError | None: """Create Subgraph Create a new subgraph within a parent graph, with optional data forking. @@ -282,7 +280,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - HTTPValidationError | SubgraphResponse + Any | HTTPValidationError """ return ( diff --git a/robosystems_client/models/__init__.py b/robosystems_client/models/__init__.py index 2e0dffe..89c4c79 100644 --- a/robosystems_client/models/__init__.py +++ b/robosystems_client/models/__init__.py @@ -76,8 +76,12 @@ from .create_connection_request import CreateConnectionRequest from .create_connection_request_provider import CreateConnectionRequestProvider from .create_graph_request import CreateGraphRequest +from .create_portfolio_request import CreatePortfolioRequest +from .create_position_request import CreatePositionRequest from .create_report_request import CreateReportRequest from .create_repository_subscription_request import CreateRepositorySubscriptionRequest +from .create_security_request import CreateSecurityRequest +from .create_security_request_terms import CreateSecurityRequestTerms from .create_structure_request import CreateStructureRequest from .create_structure_request_structure_type import CreateStructureRequestStructureType from .create_subgraph_request import CreateSubgraphRequest @@ -170,6 +174,9 @@ from .graph_usage_response_recent_events_item import GraphUsageResponseRecentEventsItem from .health_status import HealthStatus from .health_status_details_type_0 import HealthStatusDetailsType0 +from .holding_response import HoldingResponse +from .holding_security_summary import HoldingSecuritySummary +from .holdings_list_response import HoldingsListResponse from .http_validation_error import HTTPValidationError from .initial_entity_data import InitialEntityData from .invite_member_request import InviteMemberRequest @@ -239,6 +246,10 @@ from .performance_insights_operation_stats import PerformanceInsightsOperationStats from .performance_insights_slow_queries_item import PerformanceInsightsSlowQueriesItem from .portal_session_response import PortalSessionResponse +from .portfolio_list_response import PortfolioListResponse +from .portfolio_response import PortfolioResponse +from .position_list_response import PositionListResponse +from .position_response import PositionResponse from .query_limits import QueryLimits from .quick_books_connection_config import QuickBooksConnectionConfig from .rate_limits import RateLimits @@ -274,6 +285,9 @@ from .search_request import SearchRequest from .search_response import SearchResponse from .sec_connection_config import SECConnectionConfig +from .security_list_response import SecurityListResponse +from .security_response import SecurityResponse +from .security_response_terms import SecurityResponseTerms from .selection_criteria import SelectionCriteria from .service_offering_summary import ServiceOfferingSummary from .service_offerings_response import ServiceOfferingsResponse @@ -325,6 +339,10 @@ from .update_member_role_request import UpdateMemberRoleRequest from .update_org_request import UpdateOrgRequest from .update_password_request import UpdatePasswordRequest +from .update_portfolio_request import UpdatePortfolioRequest +from .update_position_request import UpdatePositionRequest +from .update_security_request import UpdateSecurityRequest +from .update_security_request_terms_type_0 import UpdateSecurityRequestTermsType0 from .update_user_request import UpdateUserRequest from .upgrade_subscription_request import UpgradeSubscriptionRequest from .user_graphs_response import UserGraphsResponse @@ -402,8 +420,12 @@ "CreateConnectionRequest", "CreateConnectionRequestProvider", "CreateGraphRequest", + "CreatePortfolioRequest", + "CreatePositionRequest", "CreateReportRequest", "CreateRepositorySubscriptionRequest", + "CreateSecurityRequest", + "CreateSecurityRequestTerms", "CreateStructureRequest", "CreateStructureRequestStructureType", "CreateSubgraphRequest", @@ -478,6 +500,9 @@ "GraphUsageResponseRecentEventsItem", "HealthStatus", "HealthStatusDetailsType0", + "HoldingResponse", + "HoldingSecuritySummary", + "HoldingsListResponse", "HTTPValidationError", "InitialEntityData", "InviteMemberRequest", @@ -543,6 +568,10 @@ "PerformanceInsightsOperationStats", "PerformanceInsightsSlowQueriesItem", "PortalSessionResponse", + "PortfolioListResponse", + "PortfolioResponse", + "PositionListResponse", + "PositionResponse", "QueryLimits", "QuickBooksConnectionConfig", "RateLimits", @@ -570,6 +599,9 @@ "SearchRequest", "SearchResponse", "SECConnectionConfig", + "SecurityListResponse", + "SecurityResponse", + "SecurityResponseTerms", "SelectionCriteria", "ServiceOfferingsResponse", "ServiceOfferingSummary", @@ -617,6 +649,10 @@ "UpdateMemberRoleRequest", "UpdateOrgRequest", "UpdatePasswordRequest", + "UpdatePortfolioRequest", + "UpdatePositionRequest", + "UpdateSecurityRequest", + "UpdateSecurityRequestTermsType0", "UpdateUserRequest", "UpgradeSubscriptionRequest", "UserGraphsResponse", diff --git a/robosystems_client/models/create_portfolio_request.py b/robosystems_client/models/create_portfolio_request.py new file mode 100644 index 0000000..d0f94ac --- /dev/null +++ b/robosystems_client/models/create_portfolio_request.py @@ -0,0 +1,144 @@ +from __future__ import annotations + +import datetime +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="CreatePortfolioRequest") + + +@_attrs_define +class CreatePortfolioRequest: + """ + Attributes: + name (str): + description (None | str | Unset): + strategy (None | str | Unset): + inception_date (datetime.date | None | Unset): + base_currency (str | Unset): Default: 'USD'. + """ + + name: str + description: None | str | Unset = UNSET + strategy: None | str | Unset = UNSET + inception_date: datetime.date | None | Unset = UNSET + base_currency: str | Unset = "USD" + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + name = self.name + + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + strategy: None | str | Unset + if isinstance(self.strategy, Unset): + strategy = UNSET + else: + strategy = self.strategy + + inception_date: None | str | Unset + if isinstance(self.inception_date, Unset): + inception_date = UNSET + elif isinstance(self.inception_date, datetime.date): + inception_date = self.inception_date.isoformat() + else: + inception_date = self.inception_date + + base_currency = self.base_currency + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + } + ) + if description is not UNSET: + field_dict["description"] = description + if strategy is not UNSET: + field_dict["strategy"] = strategy + if inception_date is not UNSET: + field_dict["inception_date"] = inception_date + if base_currency is not UNSET: + field_dict["base_currency"] = base_currency + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + name = d.pop("name") + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + def _parse_strategy(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + strategy = _parse_strategy(d.pop("strategy", UNSET)) + + def _parse_inception_date(data: object) -> datetime.date | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + inception_date_type_0 = isoparse(data).date() + + return inception_date_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(datetime.date | None | Unset, data) + + inception_date = _parse_inception_date(d.pop("inception_date", UNSET)) + + base_currency = d.pop("base_currency", UNSET) + + create_portfolio_request = cls( + name=name, + description=description, + strategy=strategy, + inception_date=inception_date, + base_currency=base_currency, + ) + + create_portfolio_request.additional_properties = d + return create_portfolio_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/create_position_request.py b/robosystems_client/models/create_position_request.py new file mode 100644 index 0000000..ffb4791 --- /dev/null +++ b/robosystems_client/models/create_position_request.py @@ -0,0 +1,228 @@ +from __future__ import annotations + +import datetime +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="CreatePositionRequest") + + +@_attrs_define +class CreatePositionRequest: + """ + Attributes: + portfolio_id (str): + security_id (str): + quantity (float): + quantity_type (str | Unset): Default: 'shares'. + cost_basis (int | Unset): Default: 0. + currency (str | Unset): Default: 'USD'. + current_value (int | None | Unset): + valuation_date (datetime.date | None | Unset): + valuation_source (None | str | Unset): + acquisition_date (datetime.date | None | Unset): + notes (None | str | Unset): + """ + + portfolio_id: str + security_id: str + quantity: float + quantity_type: str | Unset = "shares" + cost_basis: int | Unset = 0 + currency: str | Unset = "USD" + current_value: int | None | Unset = UNSET + valuation_date: datetime.date | None | Unset = UNSET + valuation_source: None | str | Unset = UNSET + acquisition_date: datetime.date | None | Unset = UNSET + notes: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + portfolio_id = self.portfolio_id + + security_id = self.security_id + + quantity = self.quantity + + quantity_type = self.quantity_type + + cost_basis = self.cost_basis + + currency = self.currency + + current_value: int | None | Unset + if isinstance(self.current_value, Unset): + current_value = UNSET + else: + current_value = self.current_value + + valuation_date: None | str | Unset + if isinstance(self.valuation_date, Unset): + valuation_date = UNSET + elif isinstance(self.valuation_date, datetime.date): + valuation_date = self.valuation_date.isoformat() + else: + valuation_date = self.valuation_date + + valuation_source: None | str | Unset + if isinstance(self.valuation_source, Unset): + valuation_source = UNSET + else: + valuation_source = self.valuation_source + + acquisition_date: None | str | Unset + if isinstance(self.acquisition_date, Unset): + acquisition_date = UNSET + elif isinstance(self.acquisition_date, datetime.date): + acquisition_date = self.acquisition_date.isoformat() + else: + acquisition_date = self.acquisition_date + + notes: None | str | Unset + if isinstance(self.notes, Unset): + notes = UNSET + else: + notes = self.notes + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "portfolio_id": portfolio_id, + "security_id": security_id, + "quantity": quantity, + } + ) + if quantity_type is not UNSET: + field_dict["quantity_type"] = quantity_type + if cost_basis is not UNSET: + field_dict["cost_basis"] = cost_basis + if currency is not UNSET: + field_dict["currency"] = currency + if current_value is not UNSET: + field_dict["current_value"] = current_value + if valuation_date is not UNSET: + field_dict["valuation_date"] = valuation_date + if valuation_source is not UNSET: + field_dict["valuation_source"] = valuation_source + if acquisition_date is not UNSET: + field_dict["acquisition_date"] = acquisition_date + if notes is not UNSET: + field_dict["notes"] = notes + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + portfolio_id = d.pop("portfolio_id") + + security_id = d.pop("security_id") + + quantity = d.pop("quantity") + + quantity_type = d.pop("quantity_type", UNSET) + + cost_basis = d.pop("cost_basis", UNSET) + + currency = d.pop("currency", UNSET) + + def _parse_current_value(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + current_value = _parse_current_value(d.pop("current_value", UNSET)) + + def _parse_valuation_date(data: object) -> datetime.date | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + valuation_date_type_0 = isoparse(data).date() + + return valuation_date_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(datetime.date | None | Unset, data) + + valuation_date = _parse_valuation_date(d.pop("valuation_date", UNSET)) + + def _parse_valuation_source(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + valuation_source = _parse_valuation_source(d.pop("valuation_source", UNSET)) + + def _parse_acquisition_date(data: object) -> datetime.date | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + acquisition_date_type_0 = isoparse(data).date() + + return acquisition_date_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(datetime.date | None | Unset, data) + + acquisition_date = _parse_acquisition_date(d.pop("acquisition_date", UNSET)) + + def _parse_notes(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + notes = _parse_notes(d.pop("notes", UNSET)) + + create_position_request = cls( + portfolio_id=portfolio_id, + security_id=security_id, + quantity=quantity, + quantity_type=quantity_type, + cost_basis=cost_basis, + currency=currency, + current_value=current_value, + valuation_date=valuation_date, + valuation_source=valuation_source, + acquisition_date=acquisition_date, + notes=notes, + ) + + create_position_request.additional_properties = d + return create_position_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/create_security_request.py b/robosystems_client/models/create_security_request.py new file mode 100644 index 0000000..a4e6335 --- /dev/null +++ b/robosystems_client/models/create_security_request.py @@ -0,0 +1,193 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.create_security_request_terms import CreateSecurityRequestTerms + + +T = TypeVar("T", bound="CreateSecurityRequest") + + +@_attrs_define +class CreateSecurityRequest: + """ + Attributes: + name (str): + security_type (str): + entity_id (None | str | Unset): + source_graph_id (None | str | Unset): + security_subtype (None | str | Unset): + terms (CreateSecurityRequestTerms | Unset): + authorized_shares (int | None | Unset): + outstanding_shares (int | None | Unset): + """ + + name: str + security_type: str + entity_id: None | str | Unset = UNSET + source_graph_id: None | str | Unset = UNSET + security_subtype: None | str | Unset = UNSET + terms: CreateSecurityRequestTerms | Unset = UNSET + authorized_shares: int | None | Unset = UNSET + outstanding_shares: int | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + name = self.name + + security_type = self.security_type + + entity_id: None | str | Unset + if isinstance(self.entity_id, Unset): + entity_id = UNSET + else: + entity_id = self.entity_id + + source_graph_id: None | str | Unset + if isinstance(self.source_graph_id, Unset): + source_graph_id = UNSET + else: + source_graph_id = self.source_graph_id + + security_subtype: None | str | Unset + if isinstance(self.security_subtype, Unset): + security_subtype = UNSET + else: + security_subtype = self.security_subtype + + terms: dict[str, Any] | Unset = UNSET + if not isinstance(self.terms, Unset): + terms = self.terms.to_dict() + + authorized_shares: int | None | Unset + if isinstance(self.authorized_shares, Unset): + authorized_shares = UNSET + else: + authorized_shares = self.authorized_shares + + outstanding_shares: int | None | Unset + if isinstance(self.outstanding_shares, Unset): + outstanding_shares = UNSET + else: + outstanding_shares = self.outstanding_shares + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "security_type": security_type, + } + ) + if entity_id is not UNSET: + field_dict["entity_id"] = entity_id + if source_graph_id is not UNSET: + field_dict["source_graph_id"] = source_graph_id + if security_subtype is not UNSET: + field_dict["security_subtype"] = security_subtype + if terms is not UNSET: + field_dict["terms"] = terms + if authorized_shares is not UNSET: + field_dict["authorized_shares"] = authorized_shares + if outstanding_shares is not UNSET: + field_dict["outstanding_shares"] = outstanding_shares + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.create_security_request_terms import CreateSecurityRequestTerms + + d = dict(src_dict) + name = d.pop("name") + + security_type = d.pop("security_type") + + def _parse_entity_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + entity_id = _parse_entity_id(d.pop("entity_id", UNSET)) + + def _parse_source_graph_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + source_graph_id = _parse_source_graph_id(d.pop("source_graph_id", UNSET)) + + def _parse_security_subtype(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + security_subtype = _parse_security_subtype(d.pop("security_subtype", UNSET)) + + _terms = d.pop("terms", UNSET) + terms: CreateSecurityRequestTerms | Unset + if isinstance(_terms, Unset): + terms = UNSET + else: + terms = CreateSecurityRequestTerms.from_dict(_terms) + + def _parse_authorized_shares(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + authorized_shares = _parse_authorized_shares(d.pop("authorized_shares", UNSET)) + + def _parse_outstanding_shares(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + outstanding_shares = _parse_outstanding_shares(d.pop("outstanding_shares", UNSET)) + + create_security_request = cls( + name=name, + security_type=security_type, + entity_id=entity_id, + source_graph_id=source_graph_id, + security_subtype=security_subtype, + terms=terms, + authorized_shares=authorized_shares, + outstanding_shares=outstanding_shares, + ) + + create_security_request.additional_properties = d + return create_security_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/create_security_request_terms.py b/robosystems_client/models/create_security_request_terms.py new file mode 100644 index 0000000..ac549a0 --- /dev/null +++ b/robosystems_client/models/create_security_request_terms.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="CreateSecurityRequestTerms") + + +@_attrs_define +class CreateSecurityRequestTerms: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + create_security_request_terms = cls() + + create_security_request_terms.additional_properties = d + return create_security_request_terms + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/holding_response.py b/robosystems_client/models/holding_response.py new file mode 100644 index 0000000..1444d4b --- /dev/null +++ b/robosystems_client/models/holding_response.py @@ -0,0 +1,151 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.holding_security_summary import HoldingSecuritySummary + + +T = TypeVar("T", bound="HoldingResponse") + + +@_attrs_define +class HoldingResponse: + """ + Attributes: + entity_id (str): + entity_name (str): + securities (list[HoldingSecuritySummary]): + total_cost_basis_dollars (float): + position_count (int): + source_graph_id (None | str | Unset): + total_current_value_dollars (float | None | Unset): + """ + + entity_id: str + entity_name: str + securities: list[HoldingSecuritySummary] + total_cost_basis_dollars: float + position_count: int + source_graph_id: None | str | Unset = UNSET + total_current_value_dollars: float | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + entity_id = self.entity_id + + entity_name = self.entity_name + + securities = [] + for securities_item_data in self.securities: + securities_item = securities_item_data.to_dict() + securities.append(securities_item) + + total_cost_basis_dollars = self.total_cost_basis_dollars + + position_count = self.position_count + + source_graph_id: None | str | Unset + if isinstance(self.source_graph_id, Unset): + source_graph_id = UNSET + else: + source_graph_id = self.source_graph_id + + total_current_value_dollars: float | None | Unset + if isinstance(self.total_current_value_dollars, Unset): + total_current_value_dollars = UNSET + else: + total_current_value_dollars = self.total_current_value_dollars + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "entity_id": entity_id, + "entity_name": entity_name, + "securities": securities, + "total_cost_basis_dollars": total_cost_basis_dollars, + "position_count": position_count, + } + ) + if source_graph_id is not UNSET: + field_dict["source_graph_id"] = source_graph_id + if total_current_value_dollars is not UNSET: + field_dict["total_current_value_dollars"] = total_current_value_dollars + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.holding_security_summary import HoldingSecuritySummary + + d = dict(src_dict) + entity_id = d.pop("entity_id") + + entity_name = d.pop("entity_name") + + securities = [] + _securities = d.pop("securities") + for securities_item_data in _securities: + securities_item = HoldingSecuritySummary.from_dict(securities_item_data) + + securities.append(securities_item) + + total_cost_basis_dollars = d.pop("total_cost_basis_dollars") + + position_count = d.pop("position_count") + + def _parse_source_graph_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + source_graph_id = _parse_source_graph_id(d.pop("source_graph_id", UNSET)) + + def _parse_total_current_value_dollars(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + total_current_value_dollars = _parse_total_current_value_dollars( + d.pop("total_current_value_dollars", UNSET) + ) + + holding_response = cls( + entity_id=entity_id, + entity_name=entity_name, + securities=securities, + total_cost_basis_dollars=total_cost_basis_dollars, + position_count=position_count, + source_graph_id=source_graph_id, + total_current_value_dollars=total_current_value_dollars, + ) + + holding_response.additional_properties = d + return holding_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/holding_security_summary.py b/robosystems_client/models/holding_security_summary.py new file mode 100644 index 0000000..ddebef0 --- /dev/null +++ b/robosystems_client/models/holding_security_summary.py @@ -0,0 +1,125 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="HoldingSecuritySummary") + + +@_attrs_define +class HoldingSecuritySummary: + """ + Attributes: + security_id (str): + security_name (str): + security_type (str): + quantity (float): + quantity_type (str): + cost_basis_dollars (float): + current_value_dollars (float | None | Unset): + """ + + security_id: str + security_name: str + security_type: str + quantity: float + quantity_type: str + cost_basis_dollars: float + current_value_dollars: float | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + security_id = self.security_id + + security_name = self.security_name + + security_type = self.security_type + + quantity = self.quantity + + quantity_type = self.quantity_type + + cost_basis_dollars = self.cost_basis_dollars + + current_value_dollars: float | None | Unset + if isinstance(self.current_value_dollars, Unset): + current_value_dollars = UNSET + else: + current_value_dollars = self.current_value_dollars + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "security_id": security_id, + "security_name": security_name, + "security_type": security_type, + "quantity": quantity, + "quantity_type": quantity_type, + "cost_basis_dollars": cost_basis_dollars, + } + ) + if current_value_dollars is not UNSET: + field_dict["current_value_dollars"] = current_value_dollars + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + security_id = d.pop("security_id") + + security_name = d.pop("security_name") + + security_type = d.pop("security_type") + + quantity = d.pop("quantity") + + quantity_type = d.pop("quantity_type") + + cost_basis_dollars = d.pop("cost_basis_dollars") + + def _parse_current_value_dollars(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + current_value_dollars = _parse_current_value_dollars( + d.pop("current_value_dollars", UNSET) + ) + + holding_security_summary = cls( + security_id=security_id, + security_name=security_name, + security_type=security_type, + quantity=quantity, + quantity_type=quantity_type, + cost_basis_dollars=cost_basis_dollars, + current_value_dollars=current_value_dollars, + ) + + holding_security_summary.additional_properties = d + return holding_security_summary + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/holdings_list_response.py b/robosystems_client/models/holdings_list_response.py new file mode 100644 index 0000000..918861b --- /dev/null +++ b/robosystems_client/models/holdings_list_response.py @@ -0,0 +1,91 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.holding_response import HoldingResponse + + +T = TypeVar("T", bound="HoldingsListResponse") + + +@_attrs_define +class HoldingsListResponse: + """ + Attributes: + holdings (list[HoldingResponse]): + total_entities (int): + total_positions (int): + """ + + holdings: list[HoldingResponse] + total_entities: int + total_positions: int + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + holdings = [] + for holdings_item_data in self.holdings: + holdings_item = holdings_item_data.to_dict() + holdings.append(holdings_item) + + total_entities = self.total_entities + + total_positions = self.total_positions + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "holdings": holdings, + "total_entities": total_entities, + "total_positions": total_positions, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.holding_response import HoldingResponse + + d = dict(src_dict) + holdings = [] + _holdings = d.pop("holdings") + for holdings_item_data in _holdings: + holdings_item = HoldingResponse.from_dict(holdings_item_data) + + holdings.append(holdings_item) + + total_entities = d.pop("total_entities") + + total_positions = d.pop("total_positions") + + holdings_list_response = cls( + holdings=holdings, + total_entities=total_entities, + total_positions=total_positions, + ) + + holdings_list_response.additional_properties = d + return holdings_list_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/portfolio_list_response.py b/robosystems_client/models/portfolio_list_response.py new file mode 100644 index 0000000..77b1fe6 --- /dev/null +++ b/robosystems_client/models/portfolio_list_response.py @@ -0,0 +1,86 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.pagination_info import PaginationInfo + from ..models.portfolio_response import PortfolioResponse + + +T = TypeVar("T", bound="PortfolioListResponse") + + +@_attrs_define +class PortfolioListResponse: + """ + Attributes: + portfolios (list[PortfolioResponse]): + pagination (PaginationInfo): Pagination information for list responses. Example: {'has_more': True, 'limit': 20, + 'offset': 0, 'total': 100}. + """ + + portfolios: list[PortfolioResponse] + pagination: PaginationInfo + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + portfolios = [] + for portfolios_item_data in self.portfolios: + portfolios_item = portfolios_item_data.to_dict() + portfolios.append(portfolios_item) + + pagination = self.pagination.to_dict() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "portfolios": portfolios, + "pagination": pagination, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.pagination_info import PaginationInfo + from ..models.portfolio_response import PortfolioResponse + + d = dict(src_dict) + portfolios = [] + _portfolios = d.pop("portfolios") + for portfolios_item_data in _portfolios: + portfolios_item = PortfolioResponse.from_dict(portfolios_item_data) + + portfolios.append(portfolios_item) + + pagination = PaginationInfo.from_dict(d.pop("pagination")) + + portfolio_list_response = cls( + portfolios=portfolios, + pagination=pagination, + ) + + portfolio_list_response.additional_properties = d + return portfolio_list_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/portfolio_response.py b/robosystems_client/models/portfolio_response.py new file mode 100644 index 0000000..b06d72d --- /dev/null +++ b/robosystems_client/models/portfolio_response.py @@ -0,0 +1,167 @@ +from __future__ import annotations + +import datetime +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="PortfolioResponse") + + +@_attrs_define +class PortfolioResponse: + """ + Attributes: + id (str): + name (str): + base_currency (str): + created_at (datetime.datetime): + updated_at (datetime.datetime): + description (None | str | Unset): + strategy (None | str | Unset): + inception_date (datetime.date | None | Unset): + """ + + id: str + name: str + base_currency: str + created_at: datetime.datetime + updated_at: datetime.datetime + description: None | str | Unset = UNSET + strategy: None | str | Unset = UNSET + inception_date: datetime.date | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + id = self.id + + name = self.name + + base_currency = self.base_currency + + created_at = self.created_at.isoformat() + + updated_at = self.updated_at.isoformat() + + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + strategy: None | str | Unset + if isinstance(self.strategy, Unset): + strategy = UNSET + else: + strategy = self.strategy + + inception_date: None | str | Unset + if isinstance(self.inception_date, Unset): + inception_date = UNSET + elif isinstance(self.inception_date, datetime.date): + inception_date = self.inception_date.isoformat() + else: + inception_date = self.inception_date + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "id": id, + "name": name, + "base_currency": base_currency, + "created_at": created_at, + "updated_at": updated_at, + } + ) + if description is not UNSET: + field_dict["description"] = description + if strategy is not UNSET: + field_dict["strategy"] = strategy + if inception_date is not UNSET: + field_dict["inception_date"] = inception_date + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + id = d.pop("id") + + name = d.pop("name") + + base_currency = d.pop("base_currency") + + created_at = isoparse(d.pop("created_at")) + + updated_at = isoparse(d.pop("updated_at")) + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + def _parse_strategy(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + strategy = _parse_strategy(d.pop("strategy", UNSET)) + + def _parse_inception_date(data: object) -> datetime.date | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + inception_date_type_0 = isoparse(data).date() + + return inception_date_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(datetime.date | None | Unset, data) + + inception_date = _parse_inception_date(d.pop("inception_date", UNSET)) + + portfolio_response = cls( + id=id, + name=name, + base_currency=base_currency, + created_at=created_at, + updated_at=updated_at, + description=description, + strategy=strategy, + inception_date=inception_date, + ) + + portfolio_response.additional_properties = d + return portfolio_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/position_list_response.py b/robosystems_client/models/position_list_response.py new file mode 100644 index 0000000..b94b222 --- /dev/null +++ b/robosystems_client/models/position_list_response.py @@ -0,0 +1,86 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.pagination_info import PaginationInfo + from ..models.position_response import PositionResponse + + +T = TypeVar("T", bound="PositionListResponse") + + +@_attrs_define +class PositionListResponse: + """ + Attributes: + positions (list[PositionResponse]): + pagination (PaginationInfo): Pagination information for list responses. Example: {'has_more': True, 'limit': 20, + 'offset': 0, 'total': 100}. + """ + + positions: list[PositionResponse] + pagination: PaginationInfo + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + positions = [] + for positions_item_data in self.positions: + positions_item = positions_item_data.to_dict() + positions.append(positions_item) + + pagination = self.pagination.to_dict() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "positions": positions, + "pagination": pagination, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.pagination_info import PaginationInfo + from ..models.position_response import PositionResponse + + d = dict(src_dict) + positions = [] + _positions = d.pop("positions") + for positions_item_data in _positions: + positions_item = PositionResponse.from_dict(positions_item_data) + + positions.append(positions_item) + + pagination = PaginationInfo.from_dict(d.pop("pagination")) + + position_list_response = cls( + positions=positions, + pagination=pagination, + ) + + position_list_response.additional_properties = d + return position_list_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/position_response.py b/robosystems_client/models/position_response.py new file mode 100644 index 0000000..fcdf7d3 --- /dev/null +++ b/robosystems_client/models/position_response.py @@ -0,0 +1,357 @@ +from __future__ import annotations + +import datetime +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="PositionResponse") + + +@_attrs_define +class PositionResponse: + """ + Attributes: + id (str): + portfolio_id (str): + security_id (str): + quantity (float): + quantity_type (str): + cost_basis (int): + cost_basis_dollars (float): + currency (str): + status (str): + created_at (datetime.datetime): + updated_at (datetime.datetime): + security_name (None | str | Unset): + entity_name (None | str | Unset): + current_value (int | None | Unset): + current_value_dollars (float | None | Unset): + valuation_date (datetime.date | None | Unset): + valuation_source (None | str | Unset): + acquisition_date (datetime.date | None | Unset): + disposition_date (datetime.date | None | Unset): + notes (None | str | Unset): + """ + + id: str + portfolio_id: str + security_id: str + quantity: float + quantity_type: str + cost_basis: int + cost_basis_dollars: float + currency: str + status: str + created_at: datetime.datetime + updated_at: datetime.datetime + security_name: None | str | Unset = UNSET + entity_name: None | str | Unset = UNSET + current_value: int | None | Unset = UNSET + current_value_dollars: float | None | Unset = UNSET + valuation_date: datetime.date | None | Unset = UNSET + valuation_source: None | str | Unset = UNSET + acquisition_date: datetime.date | None | Unset = UNSET + disposition_date: datetime.date | None | Unset = UNSET + notes: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + id = self.id + + portfolio_id = self.portfolio_id + + security_id = self.security_id + + quantity = self.quantity + + quantity_type = self.quantity_type + + cost_basis = self.cost_basis + + cost_basis_dollars = self.cost_basis_dollars + + currency = self.currency + + status = self.status + + created_at = self.created_at.isoformat() + + updated_at = self.updated_at.isoformat() + + security_name: None | str | Unset + if isinstance(self.security_name, Unset): + security_name = UNSET + else: + security_name = self.security_name + + entity_name: None | str | Unset + if isinstance(self.entity_name, Unset): + entity_name = UNSET + else: + entity_name = self.entity_name + + current_value: int | None | Unset + if isinstance(self.current_value, Unset): + current_value = UNSET + else: + current_value = self.current_value + + current_value_dollars: float | None | Unset + if isinstance(self.current_value_dollars, Unset): + current_value_dollars = UNSET + else: + current_value_dollars = self.current_value_dollars + + valuation_date: None | str | Unset + if isinstance(self.valuation_date, Unset): + valuation_date = UNSET + elif isinstance(self.valuation_date, datetime.date): + valuation_date = self.valuation_date.isoformat() + else: + valuation_date = self.valuation_date + + valuation_source: None | str | Unset + if isinstance(self.valuation_source, Unset): + valuation_source = UNSET + else: + valuation_source = self.valuation_source + + acquisition_date: None | str | Unset + if isinstance(self.acquisition_date, Unset): + acquisition_date = UNSET + elif isinstance(self.acquisition_date, datetime.date): + acquisition_date = self.acquisition_date.isoformat() + else: + acquisition_date = self.acquisition_date + + disposition_date: None | str | Unset + if isinstance(self.disposition_date, Unset): + disposition_date = UNSET + elif isinstance(self.disposition_date, datetime.date): + disposition_date = self.disposition_date.isoformat() + else: + disposition_date = self.disposition_date + + notes: None | str | Unset + if isinstance(self.notes, Unset): + notes = UNSET + else: + notes = self.notes + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "id": id, + "portfolio_id": portfolio_id, + "security_id": security_id, + "quantity": quantity, + "quantity_type": quantity_type, + "cost_basis": cost_basis, + "cost_basis_dollars": cost_basis_dollars, + "currency": currency, + "status": status, + "created_at": created_at, + "updated_at": updated_at, + } + ) + if security_name is not UNSET: + field_dict["security_name"] = security_name + if entity_name is not UNSET: + field_dict["entity_name"] = entity_name + if current_value is not UNSET: + field_dict["current_value"] = current_value + if current_value_dollars is not UNSET: + field_dict["current_value_dollars"] = current_value_dollars + if valuation_date is not UNSET: + field_dict["valuation_date"] = valuation_date + if valuation_source is not UNSET: + field_dict["valuation_source"] = valuation_source + if acquisition_date is not UNSET: + field_dict["acquisition_date"] = acquisition_date + if disposition_date is not UNSET: + field_dict["disposition_date"] = disposition_date + if notes is not UNSET: + field_dict["notes"] = notes + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + id = d.pop("id") + + portfolio_id = d.pop("portfolio_id") + + security_id = d.pop("security_id") + + quantity = d.pop("quantity") + + quantity_type = d.pop("quantity_type") + + cost_basis = d.pop("cost_basis") + + cost_basis_dollars = d.pop("cost_basis_dollars") + + currency = d.pop("currency") + + status = d.pop("status") + + created_at = isoparse(d.pop("created_at")) + + updated_at = isoparse(d.pop("updated_at")) + + def _parse_security_name(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + security_name = _parse_security_name(d.pop("security_name", UNSET)) + + def _parse_entity_name(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + entity_name = _parse_entity_name(d.pop("entity_name", UNSET)) + + def _parse_current_value(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + current_value = _parse_current_value(d.pop("current_value", UNSET)) + + def _parse_current_value_dollars(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + current_value_dollars = _parse_current_value_dollars( + d.pop("current_value_dollars", UNSET) + ) + + def _parse_valuation_date(data: object) -> datetime.date | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + valuation_date_type_0 = isoparse(data).date() + + return valuation_date_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(datetime.date | None | Unset, data) + + valuation_date = _parse_valuation_date(d.pop("valuation_date", UNSET)) + + def _parse_valuation_source(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + valuation_source = _parse_valuation_source(d.pop("valuation_source", UNSET)) + + def _parse_acquisition_date(data: object) -> datetime.date | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + acquisition_date_type_0 = isoparse(data).date() + + return acquisition_date_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(datetime.date | None | Unset, data) + + acquisition_date = _parse_acquisition_date(d.pop("acquisition_date", UNSET)) + + def _parse_disposition_date(data: object) -> datetime.date | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + disposition_date_type_0 = isoparse(data).date() + + return disposition_date_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(datetime.date | None | Unset, data) + + disposition_date = _parse_disposition_date(d.pop("disposition_date", UNSET)) + + def _parse_notes(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + notes = _parse_notes(d.pop("notes", UNSET)) + + position_response = cls( + id=id, + portfolio_id=portfolio_id, + security_id=security_id, + quantity=quantity, + quantity_type=quantity_type, + cost_basis=cost_basis, + cost_basis_dollars=cost_basis_dollars, + currency=currency, + status=status, + created_at=created_at, + updated_at=updated_at, + security_name=security_name, + entity_name=entity_name, + current_value=current_value, + current_value_dollars=current_value_dollars, + valuation_date=valuation_date, + valuation_source=valuation_source, + acquisition_date=acquisition_date, + disposition_date=disposition_date, + notes=notes, + ) + + position_response.additional_properties = d + return position_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/security_list_response.py b/robosystems_client/models/security_list_response.py new file mode 100644 index 0000000..b5e829e --- /dev/null +++ b/robosystems_client/models/security_list_response.py @@ -0,0 +1,86 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.pagination_info import PaginationInfo + from ..models.security_response import SecurityResponse + + +T = TypeVar("T", bound="SecurityListResponse") + + +@_attrs_define +class SecurityListResponse: + """ + Attributes: + securities (list[SecurityResponse]): + pagination (PaginationInfo): Pagination information for list responses. Example: {'has_more': True, 'limit': 20, + 'offset': 0, 'total': 100}. + """ + + securities: list[SecurityResponse] + pagination: PaginationInfo + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + securities = [] + for securities_item_data in self.securities: + securities_item = securities_item_data.to_dict() + securities.append(securities_item) + + pagination = self.pagination.to_dict() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "securities": securities, + "pagination": pagination, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.pagination_info import PaginationInfo + from ..models.security_response import SecurityResponse + + d = dict(src_dict) + securities = [] + _securities = d.pop("securities") + for securities_item_data in _securities: + securities_item = SecurityResponse.from_dict(securities_item_data) + + securities.append(securities_item) + + pagination = PaginationInfo.from_dict(d.pop("pagination")) + + security_list_response = cls( + securities=securities, + pagination=pagination, + ) + + security_list_response.additional_properties = d + return security_list_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/security_response.py b/robosystems_client/models/security_response.py new file mode 100644 index 0000000..5a6c1fc --- /dev/null +++ b/robosystems_client/models/security_response.py @@ -0,0 +1,219 @@ +from __future__ import annotations + +import datetime +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.security_response_terms import SecurityResponseTerms + + +T = TypeVar("T", bound="SecurityResponse") + + +@_attrs_define +class SecurityResponse: + """ + Attributes: + id (str): + name (str): + security_type (str): + terms (SecurityResponseTerms): + is_active (bool): + created_at (datetime.datetime): + updated_at (datetime.datetime): + entity_id (None | str | Unset): + entity_name (None | str | Unset): + security_subtype (None | str | Unset): + authorized_shares (int | None | Unset): + outstanding_shares (int | None | Unset): + """ + + id: str + name: str + security_type: str + terms: SecurityResponseTerms + is_active: bool + created_at: datetime.datetime + updated_at: datetime.datetime + entity_id: None | str | Unset = UNSET + entity_name: None | str | Unset = UNSET + security_subtype: None | str | Unset = UNSET + authorized_shares: int | None | Unset = UNSET + outstanding_shares: int | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + id = self.id + + name = self.name + + security_type = self.security_type + + terms = self.terms.to_dict() + + is_active = self.is_active + + created_at = self.created_at.isoformat() + + updated_at = self.updated_at.isoformat() + + entity_id: None | str | Unset + if isinstance(self.entity_id, Unset): + entity_id = UNSET + else: + entity_id = self.entity_id + + entity_name: None | str | Unset + if isinstance(self.entity_name, Unset): + entity_name = UNSET + else: + entity_name = self.entity_name + + security_subtype: None | str | Unset + if isinstance(self.security_subtype, Unset): + security_subtype = UNSET + else: + security_subtype = self.security_subtype + + authorized_shares: int | None | Unset + if isinstance(self.authorized_shares, Unset): + authorized_shares = UNSET + else: + authorized_shares = self.authorized_shares + + outstanding_shares: int | None | Unset + if isinstance(self.outstanding_shares, Unset): + outstanding_shares = UNSET + else: + outstanding_shares = self.outstanding_shares + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "id": id, + "name": name, + "security_type": security_type, + "terms": terms, + "is_active": is_active, + "created_at": created_at, + "updated_at": updated_at, + } + ) + if entity_id is not UNSET: + field_dict["entity_id"] = entity_id + if entity_name is not UNSET: + field_dict["entity_name"] = entity_name + if security_subtype is not UNSET: + field_dict["security_subtype"] = security_subtype + if authorized_shares is not UNSET: + field_dict["authorized_shares"] = authorized_shares + if outstanding_shares is not UNSET: + field_dict["outstanding_shares"] = outstanding_shares + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.security_response_terms import SecurityResponseTerms + + d = dict(src_dict) + id = d.pop("id") + + name = d.pop("name") + + security_type = d.pop("security_type") + + terms = SecurityResponseTerms.from_dict(d.pop("terms")) + + is_active = d.pop("is_active") + + created_at = isoparse(d.pop("created_at")) + + updated_at = isoparse(d.pop("updated_at")) + + def _parse_entity_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + entity_id = _parse_entity_id(d.pop("entity_id", UNSET)) + + def _parse_entity_name(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + entity_name = _parse_entity_name(d.pop("entity_name", UNSET)) + + def _parse_security_subtype(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + security_subtype = _parse_security_subtype(d.pop("security_subtype", UNSET)) + + def _parse_authorized_shares(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + authorized_shares = _parse_authorized_shares(d.pop("authorized_shares", UNSET)) + + def _parse_outstanding_shares(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + outstanding_shares = _parse_outstanding_shares(d.pop("outstanding_shares", UNSET)) + + security_response = cls( + id=id, + name=name, + security_type=security_type, + terms=terms, + is_active=is_active, + created_at=created_at, + updated_at=updated_at, + entity_id=entity_id, + entity_name=entity_name, + security_subtype=security_subtype, + authorized_shares=authorized_shares, + outstanding_shares=outstanding_shares, + ) + + security_response.additional_properties = d + return security_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/security_response_terms.py b/robosystems_client/models/security_response_terms.py new file mode 100644 index 0000000..1bde994 --- /dev/null +++ b/robosystems_client/models/security_response_terms.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="SecurityResponseTerms") + + +@_attrs_define +class SecurityResponseTerms: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + security_response_terms = cls() + + security_response_terms.additional_properties = d + return security_response_terms + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/update_portfolio_request.py b/robosystems_client/models/update_portfolio_request.py new file mode 100644 index 0000000..b454964 --- /dev/null +++ b/robosystems_client/models/update_portfolio_request.py @@ -0,0 +1,165 @@ +from __future__ import annotations + +import datetime +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="UpdatePortfolioRequest") + + +@_attrs_define +class UpdatePortfolioRequest: + """ + Attributes: + name (None | str | Unset): + description (None | str | Unset): + strategy (None | str | Unset): + inception_date (datetime.date | None | Unset): + base_currency (None | str | Unset): + """ + + name: None | str | Unset = UNSET + description: None | str | Unset = UNSET + strategy: None | str | Unset = UNSET + inception_date: datetime.date | None | Unset = UNSET + base_currency: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + name: None | str | Unset + if isinstance(self.name, Unset): + name = UNSET + else: + name = self.name + + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + strategy: None | str | Unset + if isinstance(self.strategy, Unset): + strategy = UNSET + else: + strategy = self.strategy + + inception_date: None | str | Unset + if isinstance(self.inception_date, Unset): + inception_date = UNSET + elif isinstance(self.inception_date, datetime.date): + inception_date = self.inception_date.isoformat() + else: + inception_date = self.inception_date + + base_currency: None | str | Unset + if isinstance(self.base_currency, Unset): + base_currency = UNSET + else: + base_currency = self.base_currency + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if name is not UNSET: + field_dict["name"] = name + if description is not UNSET: + field_dict["description"] = description + if strategy is not UNSET: + field_dict["strategy"] = strategy + if inception_date is not UNSET: + field_dict["inception_date"] = inception_date + if base_currency is not UNSET: + field_dict["base_currency"] = base_currency + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + + def _parse_name(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + name = _parse_name(d.pop("name", UNSET)) + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + def _parse_strategy(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + strategy = _parse_strategy(d.pop("strategy", UNSET)) + + def _parse_inception_date(data: object) -> datetime.date | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + inception_date_type_0 = isoparse(data).date() + + return inception_date_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(datetime.date | None | Unset, data) + + inception_date = _parse_inception_date(d.pop("inception_date", UNSET)) + + def _parse_base_currency(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + base_currency = _parse_base_currency(d.pop("base_currency", UNSET)) + + update_portfolio_request = cls( + name=name, + description=description, + strategy=strategy, + inception_date=inception_date, + base_currency=base_currency, + ) + + update_portfolio_request.additional_properties = d + return update_portfolio_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/update_position_request.py b/robosystems_client/models/update_position_request.py new file mode 100644 index 0000000..6db5d07 --- /dev/null +++ b/robosystems_client/models/update_position_request.py @@ -0,0 +1,285 @@ +from __future__ import annotations + +import datetime +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="UpdatePositionRequest") + + +@_attrs_define +class UpdatePositionRequest: + """ + Attributes: + quantity (float | None | Unset): + quantity_type (None | str | Unset): + cost_basis (int | None | Unset): + current_value (int | None | Unset): + valuation_date (datetime.date | None | Unset): + valuation_source (None | str | Unset): + acquisition_date (datetime.date | None | Unset): + disposition_date (datetime.date | None | Unset): + status (None | str | Unset): + notes (None | str | Unset): + """ + + quantity: float | None | Unset = UNSET + quantity_type: None | str | Unset = UNSET + cost_basis: int | None | Unset = UNSET + current_value: int | None | Unset = UNSET + valuation_date: datetime.date | None | Unset = UNSET + valuation_source: None | str | Unset = UNSET + acquisition_date: datetime.date | None | Unset = UNSET + disposition_date: datetime.date | None | Unset = UNSET + status: None | str | Unset = UNSET + notes: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + quantity: float | None | Unset + if isinstance(self.quantity, Unset): + quantity = UNSET + else: + quantity = self.quantity + + quantity_type: None | str | Unset + if isinstance(self.quantity_type, Unset): + quantity_type = UNSET + else: + quantity_type = self.quantity_type + + cost_basis: int | None | Unset + if isinstance(self.cost_basis, Unset): + cost_basis = UNSET + else: + cost_basis = self.cost_basis + + current_value: int | None | Unset + if isinstance(self.current_value, Unset): + current_value = UNSET + else: + current_value = self.current_value + + valuation_date: None | str | Unset + if isinstance(self.valuation_date, Unset): + valuation_date = UNSET + elif isinstance(self.valuation_date, datetime.date): + valuation_date = self.valuation_date.isoformat() + else: + valuation_date = self.valuation_date + + valuation_source: None | str | Unset + if isinstance(self.valuation_source, Unset): + valuation_source = UNSET + else: + valuation_source = self.valuation_source + + acquisition_date: None | str | Unset + if isinstance(self.acquisition_date, Unset): + acquisition_date = UNSET + elif isinstance(self.acquisition_date, datetime.date): + acquisition_date = self.acquisition_date.isoformat() + else: + acquisition_date = self.acquisition_date + + disposition_date: None | str | Unset + if isinstance(self.disposition_date, Unset): + disposition_date = UNSET + elif isinstance(self.disposition_date, datetime.date): + disposition_date = self.disposition_date.isoformat() + else: + disposition_date = self.disposition_date + + status: None | str | Unset + if isinstance(self.status, Unset): + status = UNSET + else: + status = self.status + + notes: None | str | Unset + if isinstance(self.notes, Unset): + notes = UNSET + else: + notes = self.notes + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if quantity is not UNSET: + field_dict["quantity"] = quantity + if quantity_type is not UNSET: + field_dict["quantity_type"] = quantity_type + if cost_basis is not UNSET: + field_dict["cost_basis"] = cost_basis + if current_value is not UNSET: + field_dict["current_value"] = current_value + if valuation_date is not UNSET: + field_dict["valuation_date"] = valuation_date + if valuation_source is not UNSET: + field_dict["valuation_source"] = valuation_source + if acquisition_date is not UNSET: + field_dict["acquisition_date"] = acquisition_date + if disposition_date is not UNSET: + field_dict["disposition_date"] = disposition_date + if status is not UNSET: + field_dict["status"] = status + if notes is not UNSET: + field_dict["notes"] = notes + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + + def _parse_quantity(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + quantity = _parse_quantity(d.pop("quantity", UNSET)) + + def _parse_quantity_type(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + quantity_type = _parse_quantity_type(d.pop("quantity_type", UNSET)) + + def _parse_cost_basis(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + cost_basis = _parse_cost_basis(d.pop("cost_basis", UNSET)) + + def _parse_current_value(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + current_value = _parse_current_value(d.pop("current_value", UNSET)) + + def _parse_valuation_date(data: object) -> datetime.date | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + valuation_date_type_0 = isoparse(data).date() + + return valuation_date_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(datetime.date | None | Unset, data) + + valuation_date = _parse_valuation_date(d.pop("valuation_date", UNSET)) + + def _parse_valuation_source(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + valuation_source = _parse_valuation_source(d.pop("valuation_source", UNSET)) + + def _parse_acquisition_date(data: object) -> datetime.date | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + acquisition_date_type_0 = isoparse(data).date() + + return acquisition_date_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(datetime.date | None | Unset, data) + + acquisition_date = _parse_acquisition_date(d.pop("acquisition_date", UNSET)) + + def _parse_disposition_date(data: object) -> datetime.date | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + disposition_date_type_0 = isoparse(data).date() + + return disposition_date_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(datetime.date | None | Unset, data) + + disposition_date = _parse_disposition_date(d.pop("disposition_date", UNSET)) + + def _parse_status(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + status = _parse_status(d.pop("status", UNSET)) + + def _parse_notes(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + notes = _parse_notes(d.pop("notes", UNSET)) + + update_position_request = cls( + quantity=quantity, + quantity_type=quantity_type, + cost_basis=cost_basis, + current_value=current_value, + valuation_date=valuation_date, + valuation_source=valuation_source, + acquisition_date=acquisition_date, + disposition_date=disposition_date, + status=status, + notes=notes, + ) + + update_position_request.additional_properties = d + return update_position_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/update_security_request.py b/robosystems_client/models/update_security_request.py new file mode 100644 index 0000000..52369dd --- /dev/null +++ b/robosystems_client/models/update_security_request.py @@ -0,0 +1,217 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.update_security_request_terms_type_0 import ( + UpdateSecurityRequestTermsType0, + ) + + +T = TypeVar("T", bound="UpdateSecurityRequest") + + +@_attrs_define +class UpdateSecurityRequest: + """ + Attributes: + name (None | str | Unset): + security_type (None | str | Unset): + security_subtype (None | str | Unset): + terms (None | Unset | UpdateSecurityRequestTermsType0): + is_active (bool | None | Unset): + authorized_shares (int | None | Unset): + outstanding_shares (int | None | Unset): + """ + + name: None | str | Unset = UNSET + security_type: None | str | Unset = UNSET + security_subtype: None | str | Unset = UNSET + terms: None | Unset | UpdateSecurityRequestTermsType0 = UNSET + is_active: bool | None | Unset = UNSET + authorized_shares: int | None | Unset = UNSET + outstanding_shares: int | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.update_security_request_terms_type_0 import ( + UpdateSecurityRequestTermsType0, + ) + + name: None | str | Unset + if isinstance(self.name, Unset): + name = UNSET + else: + name = self.name + + security_type: None | str | Unset + if isinstance(self.security_type, Unset): + security_type = UNSET + else: + security_type = self.security_type + + security_subtype: None | str | Unset + if isinstance(self.security_subtype, Unset): + security_subtype = UNSET + else: + security_subtype = self.security_subtype + + terms: dict[str, Any] | None | Unset + if isinstance(self.terms, Unset): + terms = UNSET + elif isinstance(self.terms, UpdateSecurityRequestTermsType0): + terms = self.terms.to_dict() + else: + terms = self.terms + + is_active: bool | None | Unset + if isinstance(self.is_active, Unset): + is_active = UNSET + else: + is_active = self.is_active + + authorized_shares: int | None | Unset + if isinstance(self.authorized_shares, Unset): + authorized_shares = UNSET + else: + authorized_shares = self.authorized_shares + + outstanding_shares: int | None | Unset + if isinstance(self.outstanding_shares, Unset): + outstanding_shares = UNSET + else: + outstanding_shares = self.outstanding_shares + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if name is not UNSET: + field_dict["name"] = name + if security_type is not UNSET: + field_dict["security_type"] = security_type + if security_subtype is not UNSET: + field_dict["security_subtype"] = security_subtype + if terms is not UNSET: + field_dict["terms"] = terms + if is_active is not UNSET: + field_dict["is_active"] = is_active + if authorized_shares is not UNSET: + field_dict["authorized_shares"] = authorized_shares + if outstanding_shares is not UNSET: + field_dict["outstanding_shares"] = outstanding_shares + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.update_security_request_terms_type_0 import ( + UpdateSecurityRequestTermsType0, + ) + + d = dict(src_dict) + + def _parse_name(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + name = _parse_name(d.pop("name", UNSET)) + + def _parse_security_type(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + security_type = _parse_security_type(d.pop("security_type", UNSET)) + + def _parse_security_subtype(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + security_subtype = _parse_security_subtype(d.pop("security_subtype", UNSET)) + + def _parse_terms(data: object) -> None | Unset | UpdateSecurityRequestTermsType0: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + terms_type_0 = UpdateSecurityRequestTermsType0.from_dict(data) + + return terms_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | Unset | UpdateSecurityRequestTermsType0, data) + + terms = _parse_terms(d.pop("terms", UNSET)) + + def _parse_is_active(data: object) -> bool | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(bool | None | Unset, data) + + is_active = _parse_is_active(d.pop("is_active", UNSET)) + + def _parse_authorized_shares(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + authorized_shares = _parse_authorized_shares(d.pop("authorized_shares", UNSET)) + + def _parse_outstanding_shares(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + outstanding_shares = _parse_outstanding_shares(d.pop("outstanding_shares", UNSET)) + + update_security_request = cls( + name=name, + security_type=security_type, + security_subtype=security_subtype, + terms=terms, + is_active=is_active, + authorized_shares=authorized_shares, + outstanding_shares=outstanding_shares, + ) + + update_security_request.additional_properties = d + return update_security_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/robosystems_client/models/update_security_request_terms_type_0.py b/robosystems_client/models/update_security_request_terms_type_0.py new file mode 100644 index 0000000..1e7fe0a --- /dev/null +++ b/robosystems_client/models/update_security_request_terms_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="UpdateSecurityRequestTermsType0") + + +@_attrs_define +class UpdateSecurityRequestTermsType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + update_security_request_terms_type_0 = cls() + + update_security_request_terms_type_0.additional_properties = d + return update_security_request_terms_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties