Skip to content

Portfolio API Reference

Endpoints

Amend Order

Synchronous API Call

kalshi_py.api.portfolio.amend_order.sync(order_id: str, *, client: Union[AuthenticatedClient, Client], body: ModelAmendOrderRequest) -> Optional[ModelAmendOrderResponse]

Amend Order

Endpoint for amending the max number of fillable contracts and/or price in an existing order. Max fillable contracts is remaining_count + fill_count.

Parameters:

Name Type Description Default
order_id str

Order ID

required
body ModelAmendOrderRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelAmendOrderResponse]

ModelAmendOrderResponse

Source code in kalshi_py/api/portfolio/amend_order.py
def sync(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelAmendOrderRequest,
) -> Optional[ModelAmendOrderResponse]:
    """Amend Order

      Endpoint for amending the max number of fillable contracts and/or price in an existing order. Max
    fillable contracts is `remaining_count` + `fill_count`.

    Args:
        order_id (str): Order ID
        body (ModelAmendOrderRequest):

    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:
        ModelAmendOrderResponse
    """

    return sync_detailed(
        order_id=order_id,
        client=client,
        body=body,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.amend_order.asyncio(order_id: str, *, client: Union[AuthenticatedClient, Client], body: ModelAmendOrderRequest) -> Optional[ModelAmendOrderResponse] async

Amend Order

Endpoint for amending the max number of fillable contracts and/or price in an existing order. Max fillable contracts is remaining_count + fill_count.

Parameters:

Name Type Description Default
order_id str

Order ID

required
body ModelAmendOrderRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelAmendOrderResponse]

ModelAmendOrderResponse

Source code in kalshi_py/api/portfolio/amend_order.py
async def asyncio(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelAmendOrderRequest,
) -> Optional[ModelAmendOrderResponse]:
    """Amend Order

      Endpoint for amending the max number of fillable contracts and/or price in an existing order. Max
    fillable contracts is `remaining_count` + `fill_count`.

    Args:
        order_id (str): Order ID
        body (ModelAmendOrderRequest):

    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:
        ModelAmendOrderResponse
    """

    return (
        await asyncio_detailed(
            order_id=order_id,
            client=client,
            body=body,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.amend_order.sync_detailed(order_id: str, *, client: Union[AuthenticatedClient, Client], body: ModelAmendOrderRequest) -> Response[ModelAmendOrderResponse]

Amend Order

Endpoint for amending the max number of fillable contracts and/or price in an existing order. Max fillable contracts is remaining_count + fill_count.

Parameters:

Name Type Description Default
order_id str

Order ID

required
body ModelAmendOrderRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelAmendOrderResponse]

Response[ModelAmendOrderResponse]

Source code in kalshi_py/api/portfolio/amend_order.py
def sync_detailed(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelAmendOrderRequest,
) -> Response[ModelAmendOrderResponse]:
    """Amend Order

      Endpoint for amending the max number of fillable contracts and/or price in an existing order. Max
    fillable contracts is `remaining_count` + `fill_count`.

    Args:
        order_id (str): Order ID
        body (ModelAmendOrderRequest):

    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[ModelAmendOrderResponse]
    """

    kwargs = _get_kwargs(
        order_id=order_id,
        body=body,
    )

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.amend_order.asyncio_detailed(order_id: str, *, client: Union[AuthenticatedClient, Client], body: ModelAmendOrderRequest) -> Response[ModelAmendOrderResponse] async

Amend Order

Endpoint for amending the max number of fillable contracts and/or price in an existing order. Max fillable contracts is remaining_count + fill_count.

Parameters:

Name Type Description Default
order_id str

Order ID

required
body ModelAmendOrderRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelAmendOrderResponse]

Response[ModelAmendOrderResponse]

Source code in kalshi_py/api/portfolio/amend_order.py
async def asyncio_detailed(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelAmendOrderRequest,
) -> Response[ModelAmendOrderResponse]:
    """Amend Order

      Endpoint for amending the max number of fillable contracts and/or price in an existing order. Max
    fillable contracts is `remaining_count` + `fill_count`.

    Args:
        order_id (str): Order ID
        body (ModelAmendOrderRequest):

    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[ModelAmendOrderResponse]
    """

    kwargs = _get_kwargs(
        order_id=order_id,
        body=body,
    )

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

Batch Cancel Orders

Synchronous API Call

kalshi_py.api.portfolio.batch_cancel_orders.sync(*, client: Union[AuthenticatedClient, Client], body: ModelBatchCancelOrdersRequest) -> Optional[ModelBatchCancelOrdersResponse]

Batch Cancel Orders

Endpoint for cancelling up to 20 orders at once. Available to members with advanced access only.

Parameters:

Name Type Description Default
body ModelBatchCancelOrdersRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelBatchCancelOrdersResponse]

ModelBatchCancelOrdersResponse

Source code in kalshi_py/api/portfolio/batch_cancel_orders.py
def sync(
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelBatchCancelOrdersRequest,
) -> Optional[ModelBatchCancelOrdersResponse]:
    """Batch Cancel Orders

      Endpoint for cancelling up to 20 orders at once. Available to members with advanced access only.

    Args:
        body (ModelBatchCancelOrdersRequest):

    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:
        ModelBatchCancelOrdersResponse
    """

    return sync_detailed(
        client=client,
        body=body,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.batch_cancel_orders.asyncio(*, client: Union[AuthenticatedClient, Client], body: ModelBatchCancelOrdersRequest) -> Optional[ModelBatchCancelOrdersResponse] async

Batch Cancel Orders

Endpoint for cancelling up to 20 orders at once. Available to members with advanced access only.

Parameters:

Name Type Description Default
body ModelBatchCancelOrdersRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelBatchCancelOrdersResponse]

ModelBatchCancelOrdersResponse

Source code in kalshi_py/api/portfolio/batch_cancel_orders.py
async def asyncio(
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelBatchCancelOrdersRequest,
) -> Optional[ModelBatchCancelOrdersResponse]:
    """Batch Cancel Orders

      Endpoint for cancelling up to 20 orders at once. Available to members with advanced access only.

    Args:
        body (ModelBatchCancelOrdersRequest):

    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:
        ModelBatchCancelOrdersResponse
    """

    return (
        await asyncio_detailed(
            client=client,
            body=body,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.batch_cancel_orders.sync_detailed(*, client: Union[AuthenticatedClient, Client], body: ModelBatchCancelOrdersRequest) -> Response[ModelBatchCancelOrdersResponse]

Batch Cancel Orders

Endpoint for cancelling up to 20 orders at once. Available to members with advanced access only.

Parameters:

Name Type Description Default
body ModelBatchCancelOrdersRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelBatchCancelOrdersResponse]

Response[ModelBatchCancelOrdersResponse]

Source code in kalshi_py/api/portfolio/batch_cancel_orders.py
def sync_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelBatchCancelOrdersRequest,
) -> Response[ModelBatchCancelOrdersResponse]:
    """Batch Cancel Orders

      Endpoint for cancelling up to 20 orders at once. Available to members with advanced access only.

    Args:
        body (ModelBatchCancelOrdersRequest):

    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[ModelBatchCancelOrdersResponse]
    """

    kwargs = _get_kwargs(
        body=body,
    )

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.batch_cancel_orders.asyncio_detailed(*, client: Union[AuthenticatedClient, Client], body: ModelBatchCancelOrdersRequest) -> Response[ModelBatchCancelOrdersResponse] async

Batch Cancel Orders

Endpoint for cancelling up to 20 orders at once. Available to members with advanced access only.

Parameters:

Name Type Description Default
body ModelBatchCancelOrdersRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelBatchCancelOrdersResponse]

Response[ModelBatchCancelOrdersResponse]

Source code in kalshi_py/api/portfolio/batch_cancel_orders.py
async def asyncio_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelBatchCancelOrdersRequest,
) -> Response[ModelBatchCancelOrdersResponse]:
    """Batch Cancel Orders

      Endpoint for cancelling up to 20 orders at once. Available to members with advanced access only.

    Args:
        body (ModelBatchCancelOrdersRequest):

    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[ModelBatchCancelOrdersResponse]
    """

    kwargs = _get_kwargs(
        body=body,
    )

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

Batch Create Orders

Synchronous API Call

kalshi_py.api.portfolio.batch_create_orders.sync(*, client: Union[AuthenticatedClient, Client], body: ModelBatchCreateOrdersRequest) -> Optional[ModelBatchCreateOrdersResponse]

Batch Create Orders

Endpoint for submitting a batch of orders. Each order in the batch is counted against the total rate limit for order operations. Consequently, the size of the batch is capped by the current per- second rate-limit configuration applicable to the user. At the moment of writing, the limit is 20 orders per batch. Available to members with advanced access only.

Parameters:

Name Type Description Default
body ModelBatchCreateOrdersRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelBatchCreateOrdersResponse]

ModelBatchCreateOrdersResponse

Source code in kalshi_py/api/portfolio/batch_create_orders.py
def sync(
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelBatchCreateOrdersRequest,
) -> Optional[ModelBatchCreateOrdersResponse]:
    """Batch Create Orders

      Endpoint for submitting a batch of orders. Each order in the batch is counted against the total
    rate limit for order operations. Consequently, the size of the batch is capped by the current per-
    second rate-limit configuration applicable to the user. At the moment of writing, the limit is 20
    orders per batch. Available to members with advanced access only.

    Args:
        body (ModelBatchCreateOrdersRequest):

    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:
        ModelBatchCreateOrdersResponse
    """

    return sync_detailed(
        client=client,
        body=body,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.batch_create_orders.asyncio(*, client: Union[AuthenticatedClient, Client], body: ModelBatchCreateOrdersRequest) -> Optional[ModelBatchCreateOrdersResponse] async

Batch Create Orders

Endpoint for submitting a batch of orders. Each order in the batch is counted against the total rate limit for order operations. Consequently, the size of the batch is capped by the current per- second rate-limit configuration applicable to the user. At the moment of writing, the limit is 20 orders per batch. Available to members with advanced access only.

Parameters:

Name Type Description Default
body ModelBatchCreateOrdersRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelBatchCreateOrdersResponse]

ModelBatchCreateOrdersResponse

Source code in kalshi_py/api/portfolio/batch_create_orders.py
async def asyncio(
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelBatchCreateOrdersRequest,
) -> Optional[ModelBatchCreateOrdersResponse]:
    """Batch Create Orders

      Endpoint for submitting a batch of orders. Each order in the batch is counted against the total
    rate limit for order operations. Consequently, the size of the batch is capped by the current per-
    second rate-limit configuration applicable to the user. At the moment of writing, the limit is 20
    orders per batch. Available to members with advanced access only.

    Args:
        body (ModelBatchCreateOrdersRequest):

    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:
        ModelBatchCreateOrdersResponse
    """

    return (
        await asyncio_detailed(
            client=client,
            body=body,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.batch_create_orders.sync_detailed(*, client: Union[AuthenticatedClient, Client], body: ModelBatchCreateOrdersRequest) -> Response[ModelBatchCreateOrdersResponse]

Batch Create Orders

Endpoint for submitting a batch of orders. Each order in the batch is counted against the total rate limit for order operations. Consequently, the size of the batch is capped by the current per- second rate-limit configuration applicable to the user. At the moment of writing, the limit is 20 orders per batch. Available to members with advanced access only.

Parameters:

Name Type Description Default
body ModelBatchCreateOrdersRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelBatchCreateOrdersResponse]

Response[ModelBatchCreateOrdersResponse]

Source code in kalshi_py/api/portfolio/batch_create_orders.py
def sync_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelBatchCreateOrdersRequest,
) -> Response[ModelBatchCreateOrdersResponse]:
    """Batch Create Orders

      Endpoint for submitting a batch of orders. Each order in the batch is counted against the total
    rate limit for order operations. Consequently, the size of the batch is capped by the current per-
    second rate-limit configuration applicable to the user. At the moment of writing, the limit is 20
    orders per batch. Available to members with advanced access only.

    Args:
        body (ModelBatchCreateOrdersRequest):

    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[ModelBatchCreateOrdersResponse]
    """

    kwargs = _get_kwargs(
        body=body,
    )

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.batch_create_orders.asyncio_detailed(*, client: Union[AuthenticatedClient, Client], body: ModelBatchCreateOrdersRequest) -> Response[ModelBatchCreateOrdersResponse] async

Batch Create Orders

Endpoint for submitting a batch of orders. Each order in the batch is counted against the total rate limit for order operations. Consequently, the size of the batch is capped by the current per- second rate-limit configuration applicable to the user. At the moment of writing, the limit is 20 orders per batch. Available to members with advanced access only.

Parameters:

Name Type Description Default
body ModelBatchCreateOrdersRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelBatchCreateOrdersResponse]

Response[ModelBatchCreateOrdersResponse]

Source code in kalshi_py/api/portfolio/batch_create_orders.py
async def asyncio_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelBatchCreateOrdersRequest,
) -> Response[ModelBatchCreateOrdersResponse]:
    """Batch Create Orders

      Endpoint for submitting a batch of orders. Each order in the batch is counted against the total
    rate limit for order operations. Consequently, the size of the batch is capped by the current per-
    second rate-limit configuration applicable to the user. At the moment of writing, the limit is 20
    orders per batch. Available to members with advanced access only.

    Args:
        body (ModelBatchCreateOrdersRequest):

    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[ModelBatchCreateOrdersResponse]
    """

    kwargs = _get_kwargs(
        body=body,
    )

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

Cancel Order

Synchronous API Call

kalshi_py.api.portfolio.cancel_order.sync(order_id: str, *, client: Union[AuthenticatedClient, Client]) -> Optional[ModelCancelOrderResponse]

Cancel Order

Endpoint for canceling orders. The value for the orderId should match the id field of the order you want to decrease. Commonly, DELETE-type endpoints return 204 status with no body content on success. But we can't completely delete the order, as it may be partially filled already. Instead, the DeleteOrder endpoint reduce the order completely, essentially zeroing the remaining resting contracts on it. The zeroed order is returned on the response payload as a form of validation for the client.

Parameters:

Name Type Description Default
order_id str

Order ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelCancelOrderResponse]

ModelCancelOrderResponse

Source code in kalshi_py/api/portfolio/cancel_order.py
def sync(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Optional[ModelCancelOrderResponse]:
    """Cancel Order

      Endpoint for canceling orders. The value for the orderId should match the id field of the order you
    want to decrease. Commonly, DELETE-type endpoints return 204 status with no body content on success.
    But we can't completely delete the order, as it may be partially filled already. Instead, the
    DeleteOrder endpoint reduce the order completely, essentially zeroing the remaining resting
    contracts on it. The zeroed order is returned on the response payload as a form of validation for
    the client.

    Args:
        order_id (str): Order ID

    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:
        ModelCancelOrderResponse
    """

    return sync_detailed(
        order_id=order_id,
        client=client,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.cancel_order.asyncio(order_id: str, *, client: Union[AuthenticatedClient, Client]) -> Optional[ModelCancelOrderResponse] async

Cancel Order

Endpoint for canceling orders. The value for the orderId should match the id field of the order you want to decrease. Commonly, DELETE-type endpoints return 204 status with no body content on success. But we can't completely delete the order, as it may be partially filled already. Instead, the DeleteOrder endpoint reduce the order completely, essentially zeroing the remaining resting contracts on it. The zeroed order is returned on the response payload as a form of validation for the client.

Parameters:

Name Type Description Default
order_id str

Order ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelCancelOrderResponse]

ModelCancelOrderResponse

Source code in kalshi_py/api/portfolio/cancel_order.py
async def asyncio(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Optional[ModelCancelOrderResponse]:
    """Cancel Order

      Endpoint for canceling orders. The value for the orderId should match the id field of the order you
    want to decrease. Commonly, DELETE-type endpoints return 204 status with no body content on success.
    But we can't completely delete the order, as it may be partially filled already. Instead, the
    DeleteOrder endpoint reduce the order completely, essentially zeroing the remaining resting
    contracts on it. The zeroed order is returned on the response payload as a form of validation for
    the client.

    Args:
        order_id (str): Order ID

    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:
        ModelCancelOrderResponse
    """

    return (
        await asyncio_detailed(
            order_id=order_id,
            client=client,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.cancel_order.sync_detailed(order_id: str, *, client: Union[AuthenticatedClient, Client]) -> Response[ModelCancelOrderResponse]

Cancel Order

Endpoint for canceling orders. The value for the orderId should match the id field of the order you want to decrease. Commonly, DELETE-type endpoints return 204 status with no body content on success. But we can't completely delete the order, as it may be partially filled already. Instead, the DeleteOrder endpoint reduce the order completely, essentially zeroing the remaining resting contracts on it. The zeroed order is returned on the response payload as a form of validation for the client.

Parameters:

Name Type Description Default
order_id str

Order ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelCancelOrderResponse]

Response[ModelCancelOrderResponse]

Source code in kalshi_py/api/portfolio/cancel_order.py
def sync_detailed(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Response[ModelCancelOrderResponse]:
    """Cancel Order

      Endpoint for canceling orders. The value for the orderId should match the id field of the order you
    want to decrease. Commonly, DELETE-type endpoints return 204 status with no body content on success.
    But we can't completely delete the order, as it may be partially filled already. Instead, the
    DeleteOrder endpoint reduce the order completely, essentially zeroing the remaining resting
    contracts on it. The zeroed order is returned on the response payload as a form of validation for
    the client.

    Args:
        order_id (str): Order ID

    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[ModelCancelOrderResponse]
    """

    kwargs = _get_kwargs(
        order_id=order_id,
    )

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.cancel_order.asyncio_detailed(order_id: str, *, client: Union[AuthenticatedClient, Client]) -> Response[ModelCancelOrderResponse] async

Cancel Order

Endpoint for canceling orders. The value for the orderId should match the id field of the order you want to decrease. Commonly, DELETE-type endpoints return 204 status with no body content on success. But we can't completely delete the order, as it may be partially filled already. Instead, the DeleteOrder endpoint reduce the order completely, essentially zeroing the remaining resting contracts on it. The zeroed order is returned on the response payload as a form of validation for the client.

Parameters:

Name Type Description Default
order_id str

Order ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelCancelOrderResponse]

Response[ModelCancelOrderResponse]

Source code in kalshi_py/api/portfolio/cancel_order.py
async def asyncio_detailed(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Response[ModelCancelOrderResponse]:
    """Cancel Order

      Endpoint for canceling orders. The value for the orderId should match the id field of the order you
    want to decrease. Commonly, DELETE-type endpoints return 204 status with no body content on success.
    But we can't completely delete the order, as it may be partially filled already. Instead, the
    DeleteOrder endpoint reduce the order completely, essentially zeroing the remaining resting
    contracts on it. The zeroed order is returned on the response payload as a form of validation for
    the client.

    Args:
        order_id (str): Order ID

    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[ModelCancelOrderResponse]
    """

    kwargs = _get_kwargs(
        order_id=order_id,
    )

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

Create Order

Synchronous API Call

kalshi_py.api.portfolio.create_order.sync(*, client: Union[AuthenticatedClient, Client], body: ModelCreateOrderRequest) -> Optional[ModelCreateOrderResponse]

Create Order

Endpoint for submitting orders in a market.

Parameters:

Name Type Description Default
body ModelCreateOrderRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelCreateOrderResponse]

ModelCreateOrderResponse

Source code in kalshi_py/api/portfolio/create_order.py
def sync(
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelCreateOrderRequest,
) -> Optional[ModelCreateOrderResponse]:
    """Create Order

      Endpoint for submitting orders in a market.

    Args:
        body (ModelCreateOrderRequest):

    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:
        ModelCreateOrderResponse
    """

    return sync_detailed(
        client=client,
        body=body,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.create_order.asyncio(*, client: Union[AuthenticatedClient, Client], body: ModelCreateOrderRequest) -> Optional[ModelCreateOrderResponse] async

Create Order

Endpoint for submitting orders in a market.

Parameters:

Name Type Description Default
body ModelCreateOrderRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelCreateOrderResponse]

ModelCreateOrderResponse

Source code in kalshi_py/api/portfolio/create_order.py
async def asyncio(
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelCreateOrderRequest,
) -> Optional[ModelCreateOrderResponse]:
    """Create Order

      Endpoint for submitting orders in a market.

    Args:
        body (ModelCreateOrderRequest):

    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:
        ModelCreateOrderResponse
    """

    return (
        await asyncio_detailed(
            client=client,
            body=body,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.create_order.sync_detailed(*, client: Union[AuthenticatedClient, Client], body: ModelCreateOrderRequest) -> Response[ModelCreateOrderResponse]

Create Order

Endpoint for submitting orders in a market.

Parameters:

Name Type Description Default
body ModelCreateOrderRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelCreateOrderResponse]

Response[ModelCreateOrderResponse]

Source code in kalshi_py/api/portfolio/create_order.py
def sync_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelCreateOrderRequest,
) -> Response[ModelCreateOrderResponse]:
    """Create Order

      Endpoint for submitting orders in a market.

    Args:
        body (ModelCreateOrderRequest):

    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[ModelCreateOrderResponse]
    """

    kwargs = _get_kwargs(
        body=body,
    )

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.create_order.asyncio_detailed(*, client: Union[AuthenticatedClient, Client], body: ModelCreateOrderRequest) -> Response[ModelCreateOrderResponse] async

Create Order

Endpoint for submitting orders in a market.

Parameters:

Name Type Description Default
body ModelCreateOrderRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelCreateOrderResponse]

Response[ModelCreateOrderResponse]

Source code in kalshi_py/api/portfolio/create_order.py
async def asyncio_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelCreateOrderRequest,
) -> Response[ModelCreateOrderResponse]:
    """Create Order

      Endpoint for submitting orders in a market.

    Args:
        body (ModelCreateOrderRequest):

    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[ModelCreateOrderResponse]
    """

    kwargs = _get_kwargs(
        body=body,
    )

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

Create Order Group

Synchronous API Call

kalshi_py.api.portfolio.create_order_group.sync(*, client: Union[AuthenticatedClient, Client], body: ModelCreateOrderGroupRequest) -> Optional[ModelCreateOrderGroupResponse]

Create Order Group

Creates a new order group with a contracts limit. When the limit is hit, all orders in the group are cancelled and no new orders can be placed until reset.

Parameters:

Name Type Description Default
body ModelCreateOrderGroupRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelCreateOrderGroupResponse]

ModelCreateOrderGroupResponse

Source code in kalshi_py/api/portfolio/create_order_group.py
def sync(
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelCreateOrderGroupRequest,
) -> Optional[ModelCreateOrderGroupResponse]:
    """Create Order Group

      Creates a new order group with a contracts limit. When the limit is hit, all orders in the group
    are cancelled and no new orders can be placed until reset.

    Args:
        body (ModelCreateOrderGroupRequest):

    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:
        ModelCreateOrderGroupResponse
    """

    return sync_detailed(
        client=client,
        body=body,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.create_order_group.asyncio(*, client: Union[AuthenticatedClient, Client], body: ModelCreateOrderGroupRequest) -> Optional[ModelCreateOrderGroupResponse] async

Create Order Group

Creates a new order group with a contracts limit. When the limit is hit, all orders in the group are cancelled and no new orders can be placed until reset.

Parameters:

Name Type Description Default
body ModelCreateOrderGroupRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelCreateOrderGroupResponse]

ModelCreateOrderGroupResponse

Source code in kalshi_py/api/portfolio/create_order_group.py
async def asyncio(
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelCreateOrderGroupRequest,
) -> Optional[ModelCreateOrderGroupResponse]:
    """Create Order Group

      Creates a new order group with a contracts limit. When the limit is hit, all orders in the group
    are cancelled and no new orders can be placed until reset.

    Args:
        body (ModelCreateOrderGroupRequest):

    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:
        ModelCreateOrderGroupResponse
    """

    return (
        await asyncio_detailed(
            client=client,
            body=body,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.create_order_group.sync_detailed(*, client: Union[AuthenticatedClient, Client], body: ModelCreateOrderGroupRequest) -> Response[ModelCreateOrderGroupResponse]

Create Order Group

Creates a new order group with a contracts limit. When the limit is hit, all orders in the group are cancelled and no new orders can be placed until reset.

Parameters:

Name Type Description Default
body ModelCreateOrderGroupRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelCreateOrderGroupResponse]

Response[ModelCreateOrderGroupResponse]

Source code in kalshi_py/api/portfolio/create_order_group.py
def sync_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelCreateOrderGroupRequest,
) -> Response[ModelCreateOrderGroupResponse]:
    """Create Order Group

      Creates a new order group with a contracts limit. When the limit is hit, all orders in the group
    are cancelled and no new orders can be placed until reset.

    Args:
        body (ModelCreateOrderGroupRequest):

    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[ModelCreateOrderGroupResponse]
    """

    kwargs = _get_kwargs(
        body=body,
    )

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.create_order_group.asyncio_detailed(*, client: Union[AuthenticatedClient, Client], body: ModelCreateOrderGroupRequest) -> Response[ModelCreateOrderGroupResponse] async

Create Order Group

Creates a new order group with a contracts limit. When the limit is hit, all orders in the group are cancelled and no new orders can be placed until reset.

Parameters:

Name Type Description Default
body ModelCreateOrderGroupRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelCreateOrderGroupResponse]

Response[ModelCreateOrderGroupResponse]

Source code in kalshi_py/api/portfolio/create_order_group.py
async def asyncio_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelCreateOrderGroupRequest,
) -> Response[ModelCreateOrderGroupResponse]:
    """Create Order Group

      Creates a new order group with a contracts limit. When the limit is hit, all orders in the group
    are cancelled and no new orders can be placed until reset.

    Args:
        body (ModelCreateOrderGroupRequest):

    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[ModelCreateOrderGroupResponse]
    """

    kwargs = _get_kwargs(
        body=body,
    )

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

Decrease Order

Synchronous API Call

kalshi_py.api.portfolio.decrease_order.sync(order_id: str, *, client: Union[AuthenticatedClient, Client], body: ModelDecreaseOrderRequest) -> Optional[ModelDecreaseOrderResponse]

Decrease Order

Endpoint for decreasing the number of contracts in an existing order. This is the only kind of edit available on order quantity. Cancelling an order is equivalent to decreasing an order amount to zero.

Parameters:

Name Type Description Default
order_id str

Order ID

required
body ModelDecreaseOrderRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelDecreaseOrderResponse]

ModelDecreaseOrderResponse

Source code in kalshi_py/api/portfolio/decrease_order.py
def sync(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelDecreaseOrderRequest,
) -> Optional[ModelDecreaseOrderResponse]:
    """Decrease Order

      Endpoint for decreasing the number of contracts in an existing order. This is the only kind of edit
    available on order quantity. Cancelling an order is equivalent to decreasing an order amount to
    zero.

    Args:
        order_id (str): Order ID
        body (ModelDecreaseOrderRequest):

    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:
        ModelDecreaseOrderResponse
    """

    return sync_detailed(
        order_id=order_id,
        client=client,
        body=body,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.decrease_order.asyncio(order_id: str, *, client: Union[AuthenticatedClient, Client], body: ModelDecreaseOrderRequest) -> Optional[ModelDecreaseOrderResponse] async

Decrease Order

Endpoint for decreasing the number of contracts in an existing order. This is the only kind of edit available on order quantity. Cancelling an order is equivalent to decreasing an order amount to zero.

Parameters:

Name Type Description Default
order_id str

Order ID

required
body ModelDecreaseOrderRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelDecreaseOrderResponse]

ModelDecreaseOrderResponse

Source code in kalshi_py/api/portfolio/decrease_order.py
async def asyncio(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelDecreaseOrderRequest,
) -> Optional[ModelDecreaseOrderResponse]:
    """Decrease Order

      Endpoint for decreasing the number of contracts in an existing order. This is the only kind of edit
    available on order quantity. Cancelling an order is equivalent to decreasing an order amount to
    zero.

    Args:
        order_id (str): Order ID
        body (ModelDecreaseOrderRequest):

    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:
        ModelDecreaseOrderResponse
    """

    return (
        await asyncio_detailed(
            order_id=order_id,
            client=client,
            body=body,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.decrease_order.sync_detailed(order_id: str, *, client: Union[AuthenticatedClient, Client], body: ModelDecreaseOrderRequest) -> Response[ModelDecreaseOrderResponse]

Decrease Order

Endpoint for decreasing the number of contracts in an existing order. This is the only kind of edit available on order quantity. Cancelling an order is equivalent to decreasing an order amount to zero.

Parameters:

Name Type Description Default
order_id str

Order ID

required
body ModelDecreaseOrderRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelDecreaseOrderResponse]

Response[ModelDecreaseOrderResponse]

Source code in kalshi_py/api/portfolio/decrease_order.py
def sync_detailed(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelDecreaseOrderRequest,
) -> Response[ModelDecreaseOrderResponse]:
    """Decrease Order

      Endpoint for decreasing the number of contracts in an existing order. This is the only kind of edit
    available on order quantity. Cancelling an order is equivalent to decreasing an order amount to
    zero.

    Args:
        order_id (str): Order ID
        body (ModelDecreaseOrderRequest):

    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[ModelDecreaseOrderResponse]
    """

    kwargs = _get_kwargs(
        order_id=order_id,
        body=body,
    )

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.decrease_order.asyncio_detailed(order_id: str, *, client: Union[AuthenticatedClient, Client], body: ModelDecreaseOrderRequest) -> Response[ModelDecreaseOrderResponse] async

Decrease Order

Endpoint for decreasing the number of contracts in an existing order. This is the only kind of edit available on order quantity. Cancelling an order is equivalent to decreasing an order amount to zero.

Parameters:

Name Type Description Default
order_id str

Order ID

required
body ModelDecreaseOrderRequest
required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelDecreaseOrderResponse]

Response[ModelDecreaseOrderResponse]

Source code in kalshi_py/api/portfolio/decrease_order.py
async def asyncio_detailed(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
    body: ModelDecreaseOrderRequest,
) -> Response[ModelDecreaseOrderResponse]:
    """Decrease Order

      Endpoint for decreasing the number of contracts in an existing order. This is the only kind of edit
    available on order quantity. Cancelling an order is equivalent to decreasing an order amount to
    zero.

    Args:
        order_id (str): Order ID
        body (ModelDecreaseOrderRequest):

    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[ModelDecreaseOrderResponse]
    """

    kwargs = _get_kwargs(
        order_id=order_id,
        body=body,
    )

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

Delete Order Group

Synchronous API Call

kalshi_py.api.portfolio.delete_order_group.sync(order_group_id: str, *, client: Union[AuthenticatedClient, Client]) -> Optional[ModelEmptyResponse]

Delete Order Group

Deletes an order group and cancels all orders within it. This permanently removes the group.

Parameters:

Name Type Description Default
order_group_id str

Order group ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelEmptyResponse]

ModelEmptyResponse

Source code in kalshi_py/api/portfolio/delete_order_group.py
def sync(
    order_group_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Optional[ModelEmptyResponse]:
    """Delete Order Group

      Deletes an order group and cancels all orders within it. This permanently removes the group.

    Args:
        order_group_id (str): Order group ID

    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:
        ModelEmptyResponse
    """

    return sync_detailed(
        order_group_id=order_group_id,
        client=client,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.delete_order_group.asyncio(order_group_id: str, *, client: Union[AuthenticatedClient, Client]) -> Optional[ModelEmptyResponse] async

Delete Order Group

Deletes an order group and cancels all orders within it. This permanently removes the group.

Parameters:

Name Type Description Default
order_group_id str

Order group ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelEmptyResponse]

ModelEmptyResponse

Source code in kalshi_py/api/portfolio/delete_order_group.py
async def asyncio(
    order_group_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Optional[ModelEmptyResponse]:
    """Delete Order Group

      Deletes an order group and cancels all orders within it. This permanently removes the group.

    Args:
        order_group_id (str): Order group ID

    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:
        ModelEmptyResponse
    """

    return (
        await asyncio_detailed(
            order_group_id=order_group_id,
            client=client,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.delete_order_group.sync_detailed(order_group_id: str, *, client: Union[AuthenticatedClient, Client]) -> Response[ModelEmptyResponse]

Delete Order Group

Deletes an order group and cancels all orders within it. This permanently removes the group.

Parameters:

Name Type Description Default
order_group_id str

Order group ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelEmptyResponse]

Response[ModelEmptyResponse]

Source code in kalshi_py/api/portfolio/delete_order_group.py
def sync_detailed(
    order_group_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Response[ModelEmptyResponse]:
    """Delete Order Group

      Deletes an order group and cancels all orders within it. This permanently removes the group.

    Args:
        order_group_id (str): Order group ID

    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[ModelEmptyResponse]
    """

    kwargs = _get_kwargs(
        order_group_id=order_group_id,
    )

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.delete_order_group.asyncio_detailed(order_group_id: str, *, client: Union[AuthenticatedClient, Client]) -> Response[ModelEmptyResponse] async

Delete Order Group

Deletes an order group and cancels all orders within it. This permanently removes the group.

Parameters:

Name Type Description Default
order_group_id str

Order group ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelEmptyResponse]

Response[ModelEmptyResponse]

Source code in kalshi_py/api/portfolio/delete_order_group.py
async def asyncio_detailed(
    order_group_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Response[ModelEmptyResponse]:
    """Delete Order Group

      Deletes an order group and cancels all orders within it. This permanently removes the group.

    Args:
        order_group_id (str): Order group ID

    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[ModelEmptyResponse]
    """

    kwargs = _get_kwargs(
        order_group_id=order_group_id,
    )

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

Get Balance

Synchronous API Call

kalshi_py.api.portfolio.get_balance.sync(*, client: Union[AuthenticatedClient, Client]) -> Optional[ModelGetBalanceResponse]

Get Balance

Endpoint for getting the balance of a member. The balance value is returned in cents.

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetBalanceResponse]

ModelGetBalanceResponse

Source code in kalshi_py/api/portfolio/get_balance.py
def sync(
    *,
    client: Union[AuthenticatedClient, Client],
) -> Optional[ModelGetBalanceResponse]:
    """Get Balance

      Endpoint for getting the balance of a member. The balance value is returned in cents.

    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:
        ModelGetBalanceResponse
    """

    return sync_detailed(
        client=client,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.get_balance.asyncio(*, client: Union[AuthenticatedClient, Client]) -> Optional[ModelGetBalanceResponse] async

Get Balance

Endpoint for getting the balance of a member. The balance value is returned in cents.

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetBalanceResponse]

ModelGetBalanceResponse

Source code in kalshi_py/api/portfolio/get_balance.py
async def asyncio(
    *,
    client: Union[AuthenticatedClient, Client],
) -> Optional[ModelGetBalanceResponse]:
    """Get Balance

      Endpoint for getting the balance of a member. The balance value is returned in cents.

    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:
        ModelGetBalanceResponse
    """

    return (
        await asyncio_detailed(
            client=client,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.get_balance.sync_detailed(*, client: Union[AuthenticatedClient, Client]) -> Response[ModelGetBalanceResponse]

Get Balance

Endpoint for getting the balance of a member. The balance value is returned in cents.

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetBalanceResponse]

Response[ModelGetBalanceResponse]

Source code in kalshi_py/api/portfolio/get_balance.py
def sync_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
) -> Response[ModelGetBalanceResponse]:
    """Get Balance

      Endpoint for getting the balance of a member. The balance value is returned in cents.

    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[ModelGetBalanceResponse]
    """

    kwargs = _get_kwargs()

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.get_balance.asyncio_detailed(*, client: Union[AuthenticatedClient, Client]) -> Response[ModelGetBalanceResponse] async

Get Balance

Endpoint for getting the balance of a member. The balance value is returned in cents.

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetBalanceResponse]

Response[ModelGetBalanceResponse]

Source code in kalshi_py/api/portfolio/get_balance.py
async def asyncio_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
) -> Response[ModelGetBalanceResponse]:
    """Get Balance

      Endpoint for getting the balance of a member. The balance value is returned in cents.

    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[ModelGetBalanceResponse]
    """

    kwargs = _get_kwargs()

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

Get Fills

Synchronous API Call

kalshi_py.api.portfolio.get_fills.sync(*, client: Union[AuthenticatedClient, Client], ticker: Union[Unset, str] = UNSET, order_id: Union[Unset, str] = UNSET, min_ts: Union[Unset, int] = UNSET, max_ts: Union[Unset, int] = UNSET, limit: Union[Unset, int] = UNSET, cursor: Union[Unset, str] = UNSET, use_dollars: Union[Unset, bool] = UNSET) -> Optional[ModelGetFillsResponse]

Get Fills

Endpoint for getting all fills for the member. A fill is when a trade you have is matched.

Parameters:

Name Type Description Default
ticker Union[Unset, str]

Restricts the response to trades in a specific market.

UNSET
order_id Union[Unset, str]

Restricts the response to trades related to a specific order.

UNSET
min_ts Union[Unset, int]

Restricts the response to trades after a timestamp.

UNSET
max_ts Union[Unset, int]

Restricts the response to trades before a timestamp.

UNSET
limit Union[Unset, int]

Parameter to specify the number of results per page. Defaults to 100.

UNSET
cursor Union[Unset, str]

The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.

UNSET
use_dollars Union[Unset, bool]

Whether to return prices in centi-cent format (0.0001) instead of cent format (0.01).

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetFillsResponse]

ModelGetFillsResponse

Source code in kalshi_py/api/portfolio/get_fills.py
def sync(
    *,
    client: Union[AuthenticatedClient, Client],
    ticker: Union[Unset, str] = UNSET,
    order_id: Union[Unset, str] = UNSET,
    min_ts: Union[Unset, int] = UNSET,
    max_ts: Union[Unset, int] = UNSET,
    limit: Union[Unset, int] = UNSET,
    cursor: Union[Unset, str] = UNSET,
    use_dollars: Union[Unset, bool] = UNSET,
) -> Optional[ModelGetFillsResponse]:
    """Get Fills

      Endpoint for getting all fills for the member. A fill is when a trade you have is matched.

    Args:
        ticker (Union[Unset, str]): Restricts the response to trades in a specific market.
        order_id (Union[Unset, str]): Restricts the response to trades related to a specific
            order.
        min_ts (Union[Unset, int]): Restricts the response to trades after a timestamp.
        max_ts (Union[Unset, int]): Restricts the response to trades before a timestamp.
        limit (Union[Unset, int]): Parameter to specify the number of results per page. Defaults
            to 100.
        cursor (Union[Unset, str]): The Cursor represents a pointer to the next page of records in
            the pagination. Use the value returned from the previous response to get the next page.
        use_dollars (Union[Unset, bool]): Whether to return prices in centi-cent format (0.0001)
            instead of cent format (0.01).

    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:
        ModelGetFillsResponse
    """

    return sync_detailed(
        client=client,
        ticker=ticker,
        order_id=order_id,
        min_ts=min_ts,
        max_ts=max_ts,
        limit=limit,
        cursor=cursor,
        use_dollars=use_dollars,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.get_fills.asyncio(*, client: Union[AuthenticatedClient, Client], ticker: Union[Unset, str] = UNSET, order_id: Union[Unset, str] = UNSET, min_ts: Union[Unset, int] = UNSET, max_ts: Union[Unset, int] = UNSET, limit: Union[Unset, int] = UNSET, cursor: Union[Unset, str] = UNSET, use_dollars: Union[Unset, bool] = UNSET) -> Optional[ModelGetFillsResponse] async

Get Fills

Endpoint for getting all fills for the member. A fill is when a trade you have is matched.

Parameters:

Name Type Description Default
ticker Union[Unset, str]

Restricts the response to trades in a specific market.

UNSET
order_id Union[Unset, str]

Restricts the response to trades related to a specific order.

UNSET
min_ts Union[Unset, int]

Restricts the response to trades after a timestamp.

UNSET
max_ts Union[Unset, int]

Restricts the response to trades before a timestamp.

UNSET
limit Union[Unset, int]

Parameter to specify the number of results per page. Defaults to 100.

UNSET
cursor Union[Unset, str]

The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.

UNSET
use_dollars Union[Unset, bool]

Whether to return prices in centi-cent format (0.0001) instead of cent format (0.01).

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetFillsResponse]

ModelGetFillsResponse

Source code in kalshi_py/api/portfolio/get_fills.py
async def asyncio(
    *,
    client: Union[AuthenticatedClient, Client],
    ticker: Union[Unset, str] = UNSET,
    order_id: Union[Unset, str] = UNSET,
    min_ts: Union[Unset, int] = UNSET,
    max_ts: Union[Unset, int] = UNSET,
    limit: Union[Unset, int] = UNSET,
    cursor: Union[Unset, str] = UNSET,
    use_dollars: Union[Unset, bool] = UNSET,
) -> Optional[ModelGetFillsResponse]:
    """Get Fills

      Endpoint for getting all fills for the member. A fill is when a trade you have is matched.

    Args:
        ticker (Union[Unset, str]): Restricts the response to trades in a specific market.
        order_id (Union[Unset, str]): Restricts the response to trades related to a specific
            order.
        min_ts (Union[Unset, int]): Restricts the response to trades after a timestamp.
        max_ts (Union[Unset, int]): Restricts the response to trades before a timestamp.
        limit (Union[Unset, int]): Parameter to specify the number of results per page. Defaults
            to 100.
        cursor (Union[Unset, str]): The Cursor represents a pointer to the next page of records in
            the pagination. Use the value returned from the previous response to get the next page.
        use_dollars (Union[Unset, bool]): Whether to return prices in centi-cent format (0.0001)
            instead of cent format (0.01).

    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:
        ModelGetFillsResponse
    """

    return (
        await asyncio_detailed(
            client=client,
            ticker=ticker,
            order_id=order_id,
            min_ts=min_ts,
            max_ts=max_ts,
            limit=limit,
            cursor=cursor,
            use_dollars=use_dollars,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.get_fills.sync_detailed(*, client: Union[AuthenticatedClient, Client], ticker: Union[Unset, str] = UNSET, order_id: Union[Unset, str] = UNSET, min_ts: Union[Unset, int] = UNSET, max_ts: Union[Unset, int] = UNSET, limit: Union[Unset, int] = UNSET, cursor: Union[Unset, str] = UNSET, use_dollars: Union[Unset, bool] = UNSET) -> Response[ModelGetFillsResponse]

Get Fills

Endpoint for getting all fills for the member. A fill is when a trade you have is matched.

Parameters:

Name Type Description Default
ticker Union[Unset, str]

Restricts the response to trades in a specific market.

UNSET
order_id Union[Unset, str]

Restricts the response to trades related to a specific order.

UNSET
min_ts Union[Unset, int]

Restricts the response to trades after a timestamp.

UNSET
max_ts Union[Unset, int]

Restricts the response to trades before a timestamp.

UNSET
limit Union[Unset, int]

Parameter to specify the number of results per page. Defaults to 100.

UNSET
cursor Union[Unset, str]

The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.

UNSET
use_dollars Union[Unset, bool]

Whether to return prices in centi-cent format (0.0001) instead of cent format (0.01).

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetFillsResponse]

Response[ModelGetFillsResponse]

Source code in kalshi_py/api/portfolio/get_fills.py
def sync_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    ticker: Union[Unset, str] = UNSET,
    order_id: Union[Unset, str] = UNSET,
    min_ts: Union[Unset, int] = UNSET,
    max_ts: Union[Unset, int] = UNSET,
    limit: Union[Unset, int] = UNSET,
    cursor: Union[Unset, str] = UNSET,
    use_dollars: Union[Unset, bool] = UNSET,
) -> Response[ModelGetFillsResponse]:
    """Get Fills

      Endpoint for getting all fills for the member. A fill is when a trade you have is matched.

    Args:
        ticker (Union[Unset, str]): Restricts the response to trades in a specific market.
        order_id (Union[Unset, str]): Restricts the response to trades related to a specific
            order.
        min_ts (Union[Unset, int]): Restricts the response to trades after a timestamp.
        max_ts (Union[Unset, int]): Restricts the response to trades before a timestamp.
        limit (Union[Unset, int]): Parameter to specify the number of results per page. Defaults
            to 100.
        cursor (Union[Unset, str]): The Cursor represents a pointer to the next page of records in
            the pagination. Use the value returned from the previous response to get the next page.
        use_dollars (Union[Unset, bool]): Whether to return prices in centi-cent format (0.0001)
            instead of cent format (0.01).

    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[ModelGetFillsResponse]
    """

    kwargs = _get_kwargs(
        ticker=ticker,
        order_id=order_id,
        min_ts=min_ts,
        max_ts=max_ts,
        limit=limit,
        cursor=cursor,
        use_dollars=use_dollars,
    )

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.get_fills.asyncio_detailed(*, client: Union[AuthenticatedClient, Client], ticker: Union[Unset, str] = UNSET, order_id: Union[Unset, str] = UNSET, min_ts: Union[Unset, int] = UNSET, max_ts: Union[Unset, int] = UNSET, limit: Union[Unset, int] = UNSET, cursor: Union[Unset, str] = UNSET, use_dollars: Union[Unset, bool] = UNSET) -> Response[ModelGetFillsResponse] async

Get Fills

Endpoint for getting all fills for the member. A fill is when a trade you have is matched.

Parameters:

Name Type Description Default
ticker Union[Unset, str]

Restricts the response to trades in a specific market.

UNSET
order_id Union[Unset, str]

Restricts the response to trades related to a specific order.

UNSET
min_ts Union[Unset, int]

Restricts the response to trades after a timestamp.

UNSET
max_ts Union[Unset, int]

Restricts the response to trades before a timestamp.

UNSET
limit Union[Unset, int]

Parameter to specify the number of results per page. Defaults to 100.

UNSET
cursor Union[Unset, str]

The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.

UNSET
use_dollars Union[Unset, bool]

Whether to return prices in centi-cent format (0.0001) instead of cent format (0.01).

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetFillsResponse]

Response[ModelGetFillsResponse]

Source code in kalshi_py/api/portfolio/get_fills.py
async def asyncio_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    ticker: Union[Unset, str] = UNSET,
    order_id: Union[Unset, str] = UNSET,
    min_ts: Union[Unset, int] = UNSET,
    max_ts: Union[Unset, int] = UNSET,
    limit: Union[Unset, int] = UNSET,
    cursor: Union[Unset, str] = UNSET,
    use_dollars: Union[Unset, bool] = UNSET,
) -> Response[ModelGetFillsResponse]:
    """Get Fills

      Endpoint for getting all fills for the member. A fill is when a trade you have is matched.

    Args:
        ticker (Union[Unset, str]): Restricts the response to trades in a specific market.
        order_id (Union[Unset, str]): Restricts the response to trades related to a specific
            order.
        min_ts (Union[Unset, int]): Restricts the response to trades after a timestamp.
        max_ts (Union[Unset, int]): Restricts the response to trades before a timestamp.
        limit (Union[Unset, int]): Parameter to specify the number of results per page. Defaults
            to 100.
        cursor (Union[Unset, str]): The Cursor represents a pointer to the next page of records in
            the pagination. Use the value returned from the previous response to get the next page.
        use_dollars (Union[Unset, bool]): Whether to return prices in centi-cent format (0.0001)
            instead of cent format (0.01).

    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[ModelGetFillsResponse]
    """

    kwargs = _get_kwargs(
        ticker=ticker,
        order_id=order_id,
        min_ts=min_ts,
        max_ts=max_ts,
        limit=limit,
        cursor=cursor,
        use_dollars=use_dollars,
    )

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

Get Order

Synchronous API Call

kalshi_py.api.portfolio.get_order.sync(order_id: str, *, client: Union[AuthenticatedClient, Client]) -> Optional[ModelGetOrderResponse]

Get Order

Endpoint for getting a single order.

Parameters:

Name Type Description Default
order_id str

Order ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetOrderResponse]

ModelGetOrderResponse

Source code in kalshi_py/api/portfolio/get_order.py
def sync(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Optional[ModelGetOrderResponse]:
    """Get Order

      Endpoint for getting a single order.

    Args:
        order_id (str): Order ID

    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:
        ModelGetOrderResponse
    """

    return sync_detailed(
        order_id=order_id,
        client=client,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.get_order.asyncio(order_id: str, *, client: Union[AuthenticatedClient, Client]) -> Optional[ModelGetOrderResponse] async

Get Order

Endpoint for getting a single order.

Parameters:

Name Type Description Default
order_id str

Order ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetOrderResponse]

ModelGetOrderResponse

Source code in kalshi_py/api/portfolio/get_order.py
async def asyncio(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Optional[ModelGetOrderResponse]:
    """Get Order

      Endpoint for getting a single order.

    Args:
        order_id (str): Order ID

    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:
        ModelGetOrderResponse
    """

    return (
        await asyncio_detailed(
            order_id=order_id,
            client=client,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.get_order.sync_detailed(order_id: str, *, client: Union[AuthenticatedClient, Client]) -> Response[ModelGetOrderResponse]

Get Order

Endpoint for getting a single order.

Parameters:

Name Type Description Default
order_id str

Order ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetOrderResponse]

Response[ModelGetOrderResponse]

Source code in kalshi_py/api/portfolio/get_order.py
def sync_detailed(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Response[ModelGetOrderResponse]:
    """Get Order

      Endpoint for getting a single order.

    Args:
        order_id (str): Order ID

    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[ModelGetOrderResponse]
    """

    kwargs = _get_kwargs(
        order_id=order_id,
    )

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.get_order.asyncio_detailed(order_id: str, *, client: Union[AuthenticatedClient, Client]) -> Response[ModelGetOrderResponse] async

Get Order

Endpoint for getting a single order.

Parameters:

Name Type Description Default
order_id str

Order ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetOrderResponse]

Response[ModelGetOrderResponse]

Source code in kalshi_py/api/portfolio/get_order.py
async def asyncio_detailed(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Response[ModelGetOrderResponse]:
    """Get Order

      Endpoint for getting a single order.

    Args:
        order_id (str): Order ID

    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[ModelGetOrderResponse]
    """

    kwargs = _get_kwargs(
        order_id=order_id,
    )

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

Get Order Group

Synchronous API Call

kalshi_py.api.portfolio.get_order_group.sync(order_group_id: str, *, client: Union[AuthenticatedClient, Client]) -> Optional[ModelGetOrderGroupResponse]

Get Order Group

Retrieves details for a single order group including all order IDs and auto-cancel status.

Parameters:

Name Type Description Default
order_group_id str

Order group ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetOrderGroupResponse]

ModelGetOrderGroupResponse

Source code in kalshi_py/api/portfolio/get_order_group.py
def sync(
    order_group_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Optional[ModelGetOrderGroupResponse]:
    """Get Order Group

      Retrieves details for a single order group including all order IDs and auto-cancel status.

    Args:
        order_group_id (str): Order group ID

    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:
        ModelGetOrderGroupResponse
    """

    return sync_detailed(
        order_group_id=order_group_id,
        client=client,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.get_order_group.asyncio(order_group_id: str, *, client: Union[AuthenticatedClient, Client]) -> Optional[ModelGetOrderGroupResponse] async

Get Order Group

Retrieves details for a single order group including all order IDs and auto-cancel status.

Parameters:

Name Type Description Default
order_group_id str

Order group ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetOrderGroupResponse]

ModelGetOrderGroupResponse

Source code in kalshi_py/api/portfolio/get_order_group.py
async def asyncio(
    order_group_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Optional[ModelGetOrderGroupResponse]:
    """Get Order Group

      Retrieves details for a single order group including all order IDs and auto-cancel status.

    Args:
        order_group_id (str): Order group ID

    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:
        ModelGetOrderGroupResponse
    """

    return (
        await asyncio_detailed(
            order_group_id=order_group_id,
            client=client,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.get_order_group.sync_detailed(order_group_id: str, *, client: Union[AuthenticatedClient, Client]) -> Response[ModelGetOrderGroupResponse]

Get Order Group

Retrieves details for a single order group including all order IDs and auto-cancel status.

Parameters:

Name Type Description Default
order_group_id str

Order group ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetOrderGroupResponse]

Response[ModelGetOrderGroupResponse]

Source code in kalshi_py/api/portfolio/get_order_group.py
def sync_detailed(
    order_group_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Response[ModelGetOrderGroupResponse]:
    """Get Order Group

      Retrieves details for a single order group including all order IDs and auto-cancel status.

    Args:
        order_group_id (str): Order group ID

    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[ModelGetOrderGroupResponse]
    """

    kwargs = _get_kwargs(
        order_group_id=order_group_id,
    )

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.get_order_group.asyncio_detailed(order_group_id: str, *, client: Union[AuthenticatedClient, Client]) -> Response[ModelGetOrderGroupResponse] async

Get Order Group

Retrieves details for a single order group including all order IDs and auto-cancel status.

Parameters:

Name Type Description Default
order_group_id str

Order group ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetOrderGroupResponse]

Response[ModelGetOrderGroupResponse]

Source code in kalshi_py/api/portfolio/get_order_group.py
async def asyncio_detailed(
    order_group_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Response[ModelGetOrderGroupResponse]:
    """Get Order Group

      Retrieves details for a single order group including all order IDs and auto-cancel status.

    Args:
        order_group_id (str): Order group ID

    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[ModelGetOrderGroupResponse]
    """

    kwargs = _get_kwargs(
        order_group_id=order_group_id,
    )

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

Get Order Groups

Synchronous API Call

kalshi_py.api.portfolio.get_order_groups.sync(*, client: Union[AuthenticatedClient, Client]) -> Optional[ModelGetOrderGroupsResponse]

Get Order Groups

Retrieves all order groups for the authenticated user.

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetOrderGroupsResponse]

ModelGetOrderGroupsResponse

Source code in kalshi_py/api/portfolio/get_order_groups.py
def sync(
    *,
    client: Union[AuthenticatedClient, Client],
) -> Optional[ModelGetOrderGroupsResponse]:
    """Get Order Groups

      Retrieves all order groups for the authenticated user.

    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:
        ModelGetOrderGroupsResponse
    """

    return sync_detailed(
        client=client,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.get_order_groups.asyncio(*, client: Union[AuthenticatedClient, Client]) -> Optional[ModelGetOrderGroupsResponse] async

Get Order Groups

Retrieves all order groups for the authenticated user.

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetOrderGroupsResponse]

ModelGetOrderGroupsResponse

Source code in kalshi_py/api/portfolio/get_order_groups.py
async def asyncio(
    *,
    client: Union[AuthenticatedClient, Client],
) -> Optional[ModelGetOrderGroupsResponse]:
    """Get Order Groups

      Retrieves all order groups for the authenticated user.

    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:
        ModelGetOrderGroupsResponse
    """

    return (
        await asyncio_detailed(
            client=client,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.get_order_groups.sync_detailed(*, client: Union[AuthenticatedClient, Client]) -> Response[ModelGetOrderGroupsResponse]

Get Order Groups

Retrieves all order groups for the authenticated user.

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetOrderGroupsResponse]

Response[ModelGetOrderGroupsResponse]

Source code in kalshi_py/api/portfolio/get_order_groups.py
def sync_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
) -> Response[ModelGetOrderGroupsResponse]:
    """Get Order Groups

      Retrieves all order groups for the authenticated user.

    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[ModelGetOrderGroupsResponse]
    """

    kwargs = _get_kwargs()

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.get_order_groups.asyncio_detailed(*, client: Union[AuthenticatedClient, Client]) -> Response[ModelGetOrderGroupsResponse] async

Get Order Groups

Retrieves all order groups for the authenticated user.

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetOrderGroupsResponse]

Response[ModelGetOrderGroupsResponse]

Source code in kalshi_py/api/portfolio/get_order_groups.py
async def asyncio_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
) -> Response[ModelGetOrderGroupsResponse]:
    """Get Order Groups

      Retrieves all order groups for the authenticated user.

    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[ModelGetOrderGroupsResponse]
    """

    kwargs = _get_kwargs()

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

Get Order Queue Position

Synchronous API Call

kalshi_py.api.portfolio.get_order_queue_position.sync(order_id: str, *, client: Union[AuthenticatedClient, Client]) -> Optional[ModelGetOrderQueuePositionResponse]

Get Queue Position for Order

Endpoint for getting an order's queue position in the order book. This represents the amount of orders that need to be matched before this order receives a partial or full match. Queue position is determined using a price-time priority.

Parameters:

Name Type Description Default
order_id str

Order ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetOrderQueuePositionResponse]

ModelGetOrderQueuePositionResponse

Source code in kalshi_py/api/portfolio/get_order_queue_position.py
def sync(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Optional[ModelGetOrderQueuePositionResponse]:
    """Get Queue Position for Order

      Endpoint for getting an order's queue position in the order book. This represents the amount of
    orders that need to be matched before this order receives a partial or full match. Queue position is
    determined using a price-time priority.

    Args:
        order_id (str): Order ID

    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:
        ModelGetOrderQueuePositionResponse
    """

    return sync_detailed(
        order_id=order_id,
        client=client,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.get_order_queue_position.asyncio(order_id: str, *, client: Union[AuthenticatedClient, Client]) -> Optional[ModelGetOrderQueuePositionResponse] async

Get Queue Position for Order

Endpoint for getting an order's queue position in the order book. This represents the amount of orders that need to be matched before this order receives a partial or full match. Queue position is determined using a price-time priority.

Parameters:

Name Type Description Default
order_id str

Order ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetOrderQueuePositionResponse]

ModelGetOrderQueuePositionResponse

Source code in kalshi_py/api/portfolio/get_order_queue_position.py
async def asyncio(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Optional[ModelGetOrderQueuePositionResponse]:
    """Get Queue Position for Order

      Endpoint for getting an order's queue position in the order book. This represents the amount of
    orders that need to be matched before this order receives a partial or full match. Queue position is
    determined using a price-time priority.

    Args:
        order_id (str): Order ID

    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:
        ModelGetOrderQueuePositionResponse
    """

    return (
        await asyncio_detailed(
            order_id=order_id,
            client=client,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.get_order_queue_position.sync_detailed(order_id: str, *, client: Union[AuthenticatedClient, Client]) -> Response[ModelGetOrderQueuePositionResponse]

Get Queue Position for Order

Endpoint for getting an order's queue position in the order book. This represents the amount of orders that need to be matched before this order receives a partial or full match. Queue position is determined using a price-time priority.

Parameters:

Name Type Description Default
order_id str

Order ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetOrderQueuePositionResponse]

Response[ModelGetOrderQueuePositionResponse]

Source code in kalshi_py/api/portfolio/get_order_queue_position.py
def sync_detailed(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Response[ModelGetOrderQueuePositionResponse]:
    """Get Queue Position for Order

      Endpoint for getting an order's queue position in the order book. This represents the amount of
    orders that need to be matched before this order receives a partial or full match. Queue position is
    determined using a price-time priority.

    Args:
        order_id (str): Order ID

    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[ModelGetOrderQueuePositionResponse]
    """

    kwargs = _get_kwargs(
        order_id=order_id,
    )

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.get_order_queue_position.asyncio_detailed(order_id: str, *, client: Union[AuthenticatedClient, Client]) -> Response[ModelGetOrderQueuePositionResponse] async

Get Queue Position for Order

Endpoint for getting an order's queue position in the order book. This represents the amount of orders that need to be matched before this order receives a partial or full match. Queue position is determined using a price-time priority.

Parameters:

Name Type Description Default
order_id str

Order ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetOrderQueuePositionResponse]

Response[ModelGetOrderQueuePositionResponse]

Source code in kalshi_py/api/portfolio/get_order_queue_position.py
async def asyncio_detailed(
    order_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Response[ModelGetOrderQueuePositionResponse]:
    """Get Queue Position for Order

      Endpoint for getting an order's queue position in the order book. This represents the amount of
    orders that need to be matched before this order receives a partial or full match. Queue position is
    determined using a price-time priority.

    Args:
        order_id (str): Order ID

    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[ModelGetOrderQueuePositionResponse]
    """

    kwargs = _get_kwargs(
        order_id=order_id,
    )

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

Get Order Queue Positions

Synchronous API Call

kalshi_py.api.portfolio.get_order_queue_positions.sync(*, client: Union[AuthenticatedClient, Client], market_tickers: Union[Unset, str] = UNSET, event_ticker: Union[Unset, str] = UNSET) -> Optional[ModelGetOrderQueuePositionsResponse]

Get Queue Positions for Orders

Endpoint for getting queue positions for all resting orders. Queue position represents the number of contracts that need to be matched before an order receives a partial or full match, determined using price-time priority.

Parameters:

Name Type Description Default
market_tickers Union[Unset, str]

Comma-separated list of market tickers to filter by

UNSET
event_ticker Union[Unset, str]

Event ticker to filter by

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetOrderQueuePositionsResponse]

ModelGetOrderQueuePositionsResponse

Source code in kalshi_py/api/portfolio/get_order_queue_positions.py
def sync(
    *,
    client: Union[AuthenticatedClient, Client],
    market_tickers: Union[Unset, str] = UNSET,
    event_ticker: Union[Unset, str] = UNSET,
) -> Optional[ModelGetOrderQueuePositionsResponse]:
    """Get Queue Positions for Orders

      Endpoint for getting queue positions for all resting orders. Queue position represents the number
    of contracts that need to be matched before an order receives a partial or full match, determined
    using price-time priority.

    Args:
        market_tickers (Union[Unset, str]): Comma-separated list of market tickers to filter by
        event_ticker (Union[Unset, str]): Event ticker to filter by

    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:
        ModelGetOrderQueuePositionsResponse
    """

    return sync_detailed(
        client=client,
        market_tickers=market_tickers,
        event_ticker=event_ticker,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.get_order_queue_positions.asyncio(*, client: Union[AuthenticatedClient, Client], market_tickers: Union[Unset, str] = UNSET, event_ticker: Union[Unset, str] = UNSET) -> Optional[ModelGetOrderQueuePositionsResponse] async

Get Queue Positions for Orders

Endpoint for getting queue positions for all resting orders. Queue position represents the number of contracts that need to be matched before an order receives a partial or full match, determined using price-time priority.

Parameters:

Name Type Description Default
market_tickers Union[Unset, str]

Comma-separated list of market tickers to filter by

UNSET
event_ticker Union[Unset, str]

Event ticker to filter by

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetOrderQueuePositionsResponse]

ModelGetOrderQueuePositionsResponse

Source code in kalshi_py/api/portfolio/get_order_queue_positions.py
async def asyncio(
    *,
    client: Union[AuthenticatedClient, Client],
    market_tickers: Union[Unset, str] = UNSET,
    event_ticker: Union[Unset, str] = UNSET,
) -> Optional[ModelGetOrderQueuePositionsResponse]:
    """Get Queue Positions for Orders

      Endpoint for getting queue positions for all resting orders. Queue position represents the number
    of contracts that need to be matched before an order receives a partial or full match, determined
    using price-time priority.

    Args:
        market_tickers (Union[Unset, str]): Comma-separated list of market tickers to filter by
        event_ticker (Union[Unset, str]): Event ticker to filter by

    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:
        ModelGetOrderQueuePositionsResponse
    """

    return (
        await asyncio_detailed(
            client=client,
            market_tickers=market_tickers,
            event_ticker=event_ticker,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.get_order_queue_positions.sync_detailed(*, client: Union[AuthenticatedClient, Client], market_tickers: Union[Unset, str] = UNSET, event_ticker: Union[Unset, str] = UNSET) -> Response[ModelGetOrderQueuePositionsResponse]

Get Queue Positions for Orders

Endpoint for getting queue positions for all resting orders. Queue position represents the number of contracts that need to be matched before an order receives a partial or full match, determined using price-time priority.

Parameters:

Name Type Description Default
market_tickers Union[Unset, str]

Comma-separated list of market tickers to filter by

UNSET
event_ticker Union[Unset, str]

Event ticker to filter by

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetOrderQueuePositionsResponse]

Response[ModelGetOrderQueuePositionsResponse]

Source code in kalshi_py/api/portfolio/get_order_queue_positions.py
def sync_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    market_tickers: Union[Unset, str] = UNSET,
    event_ticker: Union[Unset, str] = UNSET,
) -> Response[ModelGetOrderQueuePositionsResponse]:
    """Get Queue Positions for Orders

      Endpoint for getting queue positions for all resting orders. Queue position represents the number
    of contracts that need to be matched before an order receives a partial or full match, determined
    using price-time priority.

    Args:
        market_tickers (Union[Unset, str]): Comma-separated list of market tickers to filter by
        event_ticker (Union[Unset, str]): Event ticker to filter by

    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[ModelGetOrderQueuePositionsResponse]
    """

    kwargs = _get_kwargs(
        market_tickers=market_tickers,
        event_ticker=event_ticker,
    )

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.get_order_queue_positions.asyncio_detailed(*, client: Union[AuthenticatedClient, Client], market_tickers: Union[Unset, str] = UNSET, event_ticker: Union[Unset, str] = UNSET) -> Response[ModelGetOrderQueuePositionsResponse] async

Get Queue Positions for Orders

Endpoint for getting queue positions for all resting orders. Queue position represents the number of contracts that need to be matched before an order receives a partial or full match, determined using price-time priority.

Parameters:

Name Type Description Default
market_tickers Union[Unset, str]

Comma-separated list of market tickers to filter by

UNSET
event_ticker Union[Unset, str]

Event ticker to filter by

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetOrderQueuePositionsResponse]

Response[ModelGetOrderQueuePositionsResponse]

Source code in kalshi_py/api/portfolio/get_order_queue_positions.py
async def asyncio_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    market_tickers: Union[Unset, str] = UNSET,
    event_ticker: Union[Unset, str] = UNSET,
) -> Response[ModelGetOrderQueuePositionsResponse]:
    """Get Queue Positions for Orders

      Endpoint for getting queue positions for all resting orders. Queue position represents the number
    of contracts that need to be matched before an order receives a partial or full match, determined
    using price-time priority.

    Args:
        market_tickers (Union[Unset, str]): Comma-separated list of market tickers to filter by
        event_ticker (Union[Unset, str]): Event ticker to filter by

    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[ModelGetOrderQueuePositionsResponse]
    """

    kwargs = _get_kwargs(
        market_tickers=market_tickers,
        event_ticker=event_ticker,
    )

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

Get Orders

Synchronous API Call

kalshi_py.api.portfolio.get_orders.sync(*, client: Union[AuthenticatedClient, Client], ticker: Union[Unset, str] = UNSET, event_ticker: Union[Unset, str] = UNSET, min_ts: Union[Unset, int] = UNSET, max_ts: Union[Unset, int] = UNSET, status: Union[Unset, str] = UNSET, cursor: Union[Unset, str] = UNSET, limit: Union[Unset, int] = UNSET) -> Optional[ModelGetOrdersResponse]

Get Orders

Endpoint for getting all orders for the member.

Parameters:

Name Type Description Default
ticker Union[Unset, str]

Restricts the response to orders in a single market.

UNSET
event_ticker Union[Unset, str]

Restricts the response to orders in a single event.

UNSET
min_ts Union[Unset, int]

Restricts the response to orders after a timestamp, formatted as a Unix Timestamp.

UNSET
max_ts Union[Unset, int]

Restricts the response to orders before a timestamp, formatted as a Unix Timestamp.

UNSET
status Union[Unset, str]

Restricts the response to orders that have a certain status: resting, canceled, or executed.

UNSET
cursor Union[Unset, str]

The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.

UNSET
limit Union[Unset, int]

Parameter to specify the number of results per page. Defaults to 100.

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetOrdersResponse]

ModelGetOrdersResponse

Source code in kalshi_py/api/portfolio/get_orders.py
def sync(
    *,
    client: Union[AuthenticatedClient, Client],
    ticker: Union[Unset, str] = UNSET,
    event_ticker: Union[Unset, str] = UNSET,
    min_ts: Union[Unset, int] = UNSET,
    max_ts: Union[Unset, int] = UNSET,
    status: Union[Unset, str] = UNSET,
    cursor: Union[Unset, str] = UNSET,
    limit: Union[Unset, int] = UNSET,
) -> Optional[ModelGetOrdersResponse]:
    """Get Orders

      Endpoint for getting all orders for the member.

    Args:
        ticker (Union[Unset, str]): Restricts the response to orders in a single market.
        event_ticker (Union[Unset, str]): Restricts the response to orders in a single event.
        min_ts (Union[Unset, int]): Restricts the response to orders after a timestamp, formatted
            as a Unix Timestamp.
        max_ts (Union[Unset, int]): Restricts the response to orders before a timestamp, formatted
            as a Unix Timestamp.
        status (Union[Unset, str]): Restricts the response to orders that have a certain status:
            resting, canceled, or executed.
        cursor (Union[Unset, str]): The Cursor represents a pointer to the next page of records in
            the pagination. Use the value returned from the previous response to get the next page.
        limit (Union[Unset, int]): Parameter to specify the number of results per page. Defaults
            to 100.

    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:
        ModelGetOrdersResponse
    """

    return sync_detailed(
        client=client,
        ticker=ticker,
        event_ticker=event_ticker,
        min_ts=min_ts,
        max_ts=max_ts,
        status=status,
        cursor=cursor,
        limit=limit,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.get_orders.asyncio(*, client: Union[AuthenticatedClient, Client], ticker: Union[Unset, str] = UNSET, event_ticker: Union[Unset, str] = UNSET, min_ts: Union[Unset, int] = UNSET, max_ts: Union[Unset, int] = UNSET, status: Union[Unset, str] = UNSET, cursor: Union[Unset, str] = UNSET, limit: Union[Unset, int] = UNSET) -> Optional[ModelGetOrdersResponse] async

Get Orders

Endpoint for getting all orders for the member.

Parameters:

Name Type Description Default
ticker Union[Unset, str]

Restricts the response to orders in a single market.

UNSET
event_ticker Union[Unset, str]

Restricts the response to orders in a single event.

UNSET
min_ts Union[Unset, int]

Restricts the response to orders after a timestamp, formatted as a Unix Timestamp.

UNSET
max_ts Union[Unset, int]

Restricts the response to orders before a timestamp, formatted as a Unix Timestamp.

UNSET
status Union[Unset, str]

Restricts the response to orders that have a certain status: resting, canceled, or executed.

UNSET
cursor Union[Unset, str]

The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.

UNSET
limit Union[Unset, int]

Parameter to specify the number of results per page. Defaults to 100.

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetOrdersResponse]

ModelGetOrdersResponse

Source code in kalshi_py/api/portfolio/get_orders.py
async def asyncio(
    *,
    client: Union[AuthenticatedClient, Client],
    ticker: Union[Unset, str] = UNSET,
    event_ticker: Union[Unset, str] = UNSET,
    min_ts: Union[Unset, int] = UNSET,
    max_ts: Union[Unset, int] = UNSET,
    status: Union[Unset, str] = UNSET,
    cursor: Union[Unset, str] = UNSET,
    limit: Union[Unset, int] = UNSET,
) -> Optional[ModelGetOrdersResponse]:
    """Get Orders

      Endpoint for getting all orders for the member.

    Args:
        ticker (Union[Unset, str]): Restricts the response to orders in a single market.
        event_ticker (Union[Unset, str]): Restricts the response to orders in a single event.
        min_ts (Union[Unset, int]): Restricts the response to orders after a timestamp, formatted
            as a Unix Timestamp.
        max_ts (Union[Unset, int]): Restricts the response to orders before a timestamp, formatted
            as a Unix Timestamp.
        status (Union[Unset, str]): Restricts the response to orders that have a certain status:
            resting, canceled, or executed.
        cursor (Union[Unset, str]): The Cursor represents a pointer to the next page of records in
            the pagination. Use the value returned from the previous response to get the next page.
        limit (Union[Unset, int]): Parameter to specify the number of results per page. Defaults
            to 100.

    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:
        ModelGetOrdersResponse
    """

    return (
        await asyncio_detailed(
            client=client,
            ticker=ticker,
            event_ticker=event_ticker,
            min_ts=min_ts,
            max_ts=max_ts,
            status=status,
            cursor=cursor,
            limit=limit,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.get_orders.sync_detailed(*, client: Union[AuthenticatedClient, Client], ticker: Union[Unset, str] = UNSET, event_ticker: Union[Unset, str] = UNSET, min_ts: Union[Unset, int] = UNSET, max_ts: Union[Unset, int] = UNSET, status: Union[Unset, str] = UNSET, cursor: Union[Unset, str] = UNSET, limit: Union[Unset, int] = UNSET) -> Response[ModelGetOrdersResponse]

Get Orders

Endpoint for getting all orders for the member.

Parameters:

Name Type Description Default
ticker Union[Unset, str]

Restricts the response to orders in a single market.

UNSET
event_ticker Union[Unset, str]

Restricts the response to orders in a single event.

UNSET
min_ts Union[Unset, int]

Restricts the response to orders after a timestamp, formatted as a Unix Timestamp.

UNSET
max_ts Union[Unset, int]

Restricts the response to orders before a timestamp, formatted as a Unix Timestamp.

UNSET
status Union[Unset, str]

Restricts the response to orders that have a certain status: resting, canceled, or executed.

UNSET
cursor Union[Unset, str]

The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.

UNSET
limit Union[Unset, int]

Parameter to specify the number of results per page. Defaults to 100.

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetOrdersResponse]

Response[ModelGetOrdersResponse]

Source code in kalshi_py/api/portfolio/get_orders.py
def sync_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    ticker: Union[Unset, str] = UNSET,
    event_ticker: Union[Unset, str] = UNSET,
    min_ts: Union[Unset, int] = UNSET,
    max_ts: Union[Unset, int] = UNSET,
    status: Union[Unset, str] = UNSET,
    cursor: Union[Unset, str] = UNSET,
    limit: Union[Unset, int] = UNSET,
) -> Response[ModelGetOrdersResponse]:
    """Get Orders

      Endpoint for getting all orders for the member.

    Args:
        ticker (Union[Unset, str]): Restricts the response to orders in a single market.
        event_ticker (Union[Unset, str]): Restricts the response to orders in a single event.
        min_ts (Union[Unset, int]): Restricts the response to orders after a timestamp, formatted
            as a Unix Timestamp.
        max_ts (Union[Unset, int]): Restricts the response to orders before a timestamp, formatted
            as a Unix Timestamp.
        status (Union[Unset, str]): Restricts the response to orders that have a certain status:
            resting, canceled, or executed.
        cursor (Union[Unset, str]): The Cursor represents a pointer to the next page of records in
            the pagination. Use the value returned from the previous response to get the next page.
        limit (Union[Unset, int]): Parameter to specify the number of results per page. Defaults
            to 100.

    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[ModelGetOrdersResponse]
    """

    kwargs = _get_kwargs(
        ticker=ticker,
        event_ticker=event_ticker,
        min_ts=min_ts,
        max_ts=max_ts,
        status=status,
        cursor=cursor,
        limit=limit,
    )

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.get_orders.asyncio_detailed(*, client: Union[AuthenticatedClient, Client], ticker: Union[Unset, str] = UNSET, event_ticker: Union[Unset, str] = UNSET, min_ts: Union[Unset, int] = UNSET, max_ts: Union[Unset, int] = UNSET, status: Union[Unset, str] = UNSET, cursor: Union[Unset, str] = UNSET, limit: Union[Unset, int] = UNSET) -> Response[ModelGetOrdersResponse] async

Get Orders

Endpoint for getting all orders for the member.

Parameters:

Name Type Description Default
ticker Union[Unset, str]

Restricts the response to orders in a single market.

UNSET
event_ticker Union[Unset, str]

Restricts the response to orders in a single event.

UNSET
min_ts Union[Unset, int]

Restricts the response to orders after a timestamp, formatted as a Unix Timestamp.

UNSET
max_ts Union[Unset, int]

Restricts the response to orders before a timestamp, formatted as a Unix Timestamp.

UNSET
status Union[Unset, str]

Restricts the response to orders that have a certain status: resting, canceled, or executed.

UNSET
cursor Union[Unset, str]

The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.

UNSET
limit Union[Unset, int]

Parameter to specify the number of results per page. Defaults to 100.

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetOrdersResponse]

Response[ModelGetOrdersResponse]

Source code in kalshi_py/api/portfolio/get_orders.py
async def asyncio_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    ticker: Union[Unset, str] = UNSET,
    event_ticker: Union[Unset, str] = UNSET,
    min_ts: Union[Unset, int] = UNSET,
    max_ts: Union[Unset, int] = UNSET,
    status: Union[Unset, str] = UNSET,
    cursor: Union[Unset, str] = UNSET,
    limit: Union[Unset, int] = UNSET,
) -> Response[ModelGetOrdersResponse]:
    """Get Orders

      Endpoint for getting all orders for the member.

    Args:
        ticker (Union[Unset, str]): Restricts the response to orders in a single market.
        event_ticker (Union[Unset, str]): Restricts the response to orders in a single event.
        min_ts (Union[Unset, int]): Restricts the response to orders after a timestamp, formatted
            as a Unix Timestamp.
        max_ts (Union[Unset, int]): Restricts the response to orders before a timestamp, formatted
            as a Unix Timestamp.
        status (Union[Unset, str]): Restricts the response to orders that have a certain status:
            resting, canceled, or executed.
        cursor (Union[Unset, str]): The Cursor represents a pointer to the next page of records in
            the pagination. Use the value returned from the previous response to get the next page.
        limit (Union[Unset, int]): Parameter to specify the number of results per page. Defaults
            to 100.

    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[ModelGetOrdersResponse]
    """

    kwargs = _get_kwargs(
        ticker=ticker,
        event_ticker=event_ticker,
        min_ts=min_ts,
        max_ts=max_ts,
        status=status,
        cursor=cursor,
        limit=limit,
    )

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

Get Portfolio Resting Order Total Value

Synchronous API Call

kalshi_py.api.portfolio.get_portfolio_resting_order_total_value.sync(*, client: Union[AuthenticatedClient, Client]) -> Optional[ModelGetUserRestingOrderTotalValueResponse]

Get Portfolio Resting Order Total Value

Endpoint for getting the total value, in cents, of resting orders. This endpoint is only intended for use by FCM members (rare). Note: If you're uncertain about this endpoint, it likely does not apply to you.

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetUserRestingOrderTotalValueResponse]

ModelGetUserRestingOrderTotalValueResponse

Source code in kalshi_py/api/portfolio/get_portfolio_resting_order_total_value.py
def sync(
    *,
    client: Union[AuthenticatedClient, Client],
) -> Optional[ModelGetUserRestingOrderTotalValueResponse]:
    """Get Portfolio Resting Order Total Value

      Endpoint for getting the total value, in cents, of resting orders. This endpoint is only intended
    for use by FCM members (rare). Note: If you're uncertain about this endpoint, it likely does not
    apply to you.

    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:
        ModelGetUserRestingOrderTotalValueResponse
    """

    return sync_detailed(
        client=client,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.get_portfolio_resting_order_total_value.asyncio(*, client: Union[AuthenticatedClient, Client]) -> Optional[ModelGetUserRestingOrderTotalValueResponse] async

Get Portfolio Resting Order Total Value

Endpoint for getting the total value, in cents, of resting orders. This endpoint is only intended for use by FCM members (rare). Note: If you're uncertain about this endpoint, it likely does not apply to you.

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetUserRestingOrderTotalValueResponse]

ModelGetUserRestingOrderTotalValueResponse

Source code in kalshi_py/api/portfolio/get_portfolio_resting_order_total_value.py
async def asyncio(
    *,
    client: Union[AuthenticatedClient, Client],
) -> Optional[ModelGetUserRestingOrderTotalValueResponse]:
    """Get Portfolio Resting Order Total Value

      Endpoint for getting the total value, in cents, of resting orders. This endpoint is only intended
    for use by FCM members (rare). Note: If you're uncertain about this endpoint, it likely does not
    apply to you.

    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:
        ModelGetUserRestingOrderTotalValueResponse
    """

    return (
        await asyncio_detailed(
            client=client,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.get_portfolio_resting_order_total_value.sync_detailed(*, client: Union[AuthenticatedClient, Client]) -> Response[ModelGetUserRestingOrderTotalValueResponse]

Get Portfolio Resting Order Total Value

Endpoint for getting the total value, in cents, of resting orders. This endpoint is only intended for use by FCM members (rare). Note: If you're uncertain about this endpoint, it likely does not apply to you.

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetUserRestingOrderTotalValueResponse]

Response[ModelGetUserRestingOrderTotalValueResponse]

Source code in kalshi_py/api/portfolio/get_portfolio_resting_order_total_value.py
def sync_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
) -> Response[ModelGetUserRestingOrderTotalValueResponse]:
    """Get Portfolio Resting Order Total Value

      Endpoint for getting the total value, in cents, of resting orders. This endpoint is only intended
    for use by FCM members (rare). Note: If you're uncertain about this endpoint, it likely does not
    apply to you.

    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[ModelGetUserRestingOrderTotalValueResponse]
    """

    kwargs = _get_kwargs()

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.get_portfolio_resting_order_total_value.asyncio_detailed(*, client: Union[AuthenticatedClient, Client]) -> Response[ModelGetUserRestingOrderTotalValueResponse] async

Get Portfolio Resting Order Total Value

Endpoint for getting the total value, in cents, of resting orders. This endpoint is only intended for use by FCM members (rare). Note: If you're uncertain about this endpoint, it likely does not apply to you.

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetUserRestingOrderTotalValueResponse]

Response[ModelGetUserRestingOrderTotalValueResponse]

Source code in kalshi_py/api/portfolio/get_portfolio_resting_order_total_value.py
async def asyncio_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
) -> Response[ModelGetUserRestingOrderTotalValueResponse]:
    """Get Portfolio Resting Order Total Value

      Endpoint for getting the total value, in cents, of resting orders. This endpoint is only intended
    for use by FCM members (rare). Note: If you're uncertain about this endpoint, it likely does not
    apply to you.

    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[ModelGetUserRestingOrderTotalValueResponse]
    """

    kwargs = _get_kwargs()

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

Get Positions

Synchronous API Call

kalshi_py.api.portfolio.get_positions.sync(*, client: Union[AuthenticatedClient, Client], cursor: Union[Unset, str] = UNSET, limit: Union[Unset, int] = UNSET, count_filter: Union[Unset, str] = UNSET, settlement_status: Union[Unset, str] = UNSET, ticker: Union[Unset, str] = UNSET, event_ticker: Union[Unset, str] = UNSET) -> Optional[ModelGetPositionsResponse]

Get Positions

Endpoint for getting all market positions for the member.

Parameters:

Name Type Description Default
cursor Union[Unset, str]

The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.

UNSET
limit Union[Unset, int]

Parameter to specify the number of results per page. Defaults to 100.

UNSET
count_filter Union[Unset, str]

Restricts the positions to those with any of following fields with non-zero values, as a comma separated list. The following values are accepted: position, total_traded, resting_order_count

UNSET
settlement_status Union[Unset, str]

Settlement status of the markets to return. Defaults to unsettled.

UNSET
ticker Union[Unset, str]

Ticker of desired positions.

UNSET
event_ticker Union[Unset, str]

Event ticker of desired positions.

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetPositionsResponse]

ModelGetPositionsResponse

Source code in kalshi_py/api/portfolio/get_positions.py
def sync(
    *,
    client: Union[AuthenticatedClient, Client],
    cursor: Union[Unset, str] = UNSET,
    limit: Union[Unset, int] = UNSET,
    count_filter: Union[Unset, str] = UNSET,
    settlement_status: Union[Unset, str] = UNSET,
    ticker: Union[Unset, str] = UNSET,
    event_ticker: Union[Unset, str] = UNSET,
) -> Optional[ModelGetPositionsResponse]:
    """Get Positions

      Endpoint for getting all market positions for the member.

    Args:
        cursor (Union[Unset, str]): The Cursor represents a pointer to the next page of records in
            the pagination. Use the value returned from the previous response to get the next page.
        limit (Union[Unset, int]): Parameter to specify the number of results per page. Defaults
            to 100.
        count_filter (Union[Unset, str]): Restricts the positions to those with any of following
            fields with non-zero values, as a comma separated list. The following values are accepted:
            position, total_traded, resting_order_count
        settlement_status (Union[Unset, str]): Settlement status of the markets to return.
            Defaults to unsettled.
        ticker (Union[Unset, str]): Ticker of desired positions.
        event_ticker (Union[Unset, str]): Event ticker of desired positions.

    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:
        ModelGetPositionsResponse
    """

    return sync_detailed(
        client=client,
        cursor=cursor,
        limit=limit,
        count_filter=count_filter,
        settlement_status=settlement_status,
        ticker=ticker,
        event_ticker=event_ticker,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.get_positions.asyncio(*, client: Union[AuthenticatedClient, Client], cursor: Union[Unset, str] = UNSET, limit: Union[Unset, int] = UNSET, count_filter: Union[Unset, str] = UNSET, settlement_status: Union[Unset, str] = UNSET, ticker: Union[Unset, str] = UNSET, event_ticker: Union[Unset, str] = UNSET) -> Optional[ModelGetPositionsResponse] async

Get Positions

Endpoint for getting all market positions for the member.

Parameters:

Name Type Description Default
cursor Union[Unset, str]

The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.

UNSET
limit Union[Unset, int]

Parameter to specify the number of results per page. Defaults to 100.

UNSET
count_filter Union[Unset, str]

Restricts the positions to those with any of following fields with non-zero values, as a comma separated list. The following values are accepted: position, total_traded, resting_order_count

UNSET
settlement_status Union[Unset, str]

Settlement status of the markets to return. Defaults to unsettled.

UNSET
ticker Union[Unset, str]

Ticker of desired positions.

UNSET
event_ticker Union[Unset, str]

Event ticker of desired positions.

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetPositionsResponse]

ModelGetPositionsResponse

Source code in kalshi_py/api/portfolio/get_positions.py
async def asyncio(
    *,
    client: Union[AuthenticatedClient, Client],
    cursor: Union[Unset, str] = UNSET,
    limit: Union[Unset, int] = UNSET,
    count_filter: Union[Unset, str] = UNSET,
    settlement_status: Union[Unset, str] = UNSET,
    ticker: Union[Unset, str] = UNSET,
    event_ticker: Union[Unset, str] = UNSET,
) -> Optional[ModelGetPositionsResponse]:
    """Get Positions

      Endpoint for getting all market positions for the member.

    Args:
        cursor (Union[Unset, str]): The Cursor represents a pointer to the next page of records in
            the pagination. Use the value returned from the previous response to get the next page.
        limit (Union[Unset, int]): Parameter to specify the number of results per page. Defaults
            to 100.
        count_filter (Union[Unset, str]): Restricts the positions to those with any of following
            fields with non-zero values, as a comma separated list. The following values are accepted:
            position, total_traded, resting_order_count
        settlement_status (Union[Unset, str]): Settlement status of the markets to return.
            Defaults to unsettled.
        ticker (Union[Unset, str]): Ticker of desired positions.
        event_ticker (Union[Unset, str]): Event ticker of desired positions.

    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:
        ModelGetPositionsResponse
    """

    return (
        await asyncio_detailed(
            client=client,
            cursor=cursor,
            limit=limit,
            count_filter=count_filter,
            settlement_status=settlement_status,
            ticker=ticker,
            event_ticker=event_ticker,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.get_positions.sync_detailed(*, client: Union[AuthenticatedClient, Client], cursor: Union[Unset, str] = UNSET, limit: Union[Unset, int] = UNSET, count_filter: Union[Unset, str] = UNSET, settlement_status: Union[Unset, str] = UNSET, ticker: Union[Unset, str] = UNSET, event_ticker: Union[Unset, str] = UNSET) -> Response[ModelGetPositionsResponse]

Get Positions

Endpoint for getting all market positions for the member.

Parameters:

Name Type Description Default
cursor Union[Unset, str]

The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.

UNSET
limit Union[Unset, int]

Parameter to specify the number of results per page. Defaults to 100.

UNSET
count_filter Union[Unset, str]

Restricts the positions to those with any of following fields with non-zero values, as a comma separated list. The following values are accepted: position, total_traded, resting_order_count

UNSET
settlement_status Union[Unset, str]

Settlement status of the markets to return. Defaults to unsettled.

UNSET
ticker Union[Unset, str]

Ticker of desired positions.

UNSET
event_ticker Union[Unset, str]

Event ticker of desired positions.

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetPositionsResponse]

Response[ModelGetPositionsResponse]

Source code in kalshi_py/api/portfolio/get_positions.py
def sync_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    cursor: Union[Unset, str] = UNSET,
    limit: Union[Unset, int] = UNSET,
    count_filter: Union[Unset, str] = UNSET,
    settlement_status: Union[Unset, str] = UNSET,
    ticker: Union[Unset, str] = UNSET,
    event_ticker: Union[Unset, str] = UNSET,
) -> Response[ModelGetPositionsResponse]:
    """Get Positions

      Endpoint for getting all market positions for the member.

    Args:
        cursor (Union[Unset, str]): The Cursor represents a pointer to the next page of records in
            the pagination. Use the value returned from the previous response to get the next page.
        limit (Union[Unset, int]): Parameter to specify the number of results per page. Defaults
            to 100.
        count_filter (Union[Unset, str]): Restricts the positions to those with any of following
            fields with non-zero values, as a comma separated list. The following values are accepted:
            position, total_traded, resting_order_count
        settlement_status (Union[Unset, str]): Settlement status of the markets to return.
            Defaults to unsettled.
        ticker (Union[Unset, str]): Ticker of desired positions.
        event_ticker (Union[Unset, str]): Event ticker of desired positions.

    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[ModelGetPositionsResponse]
    """

    kwargs = _get_kwargs(
        cursor=cursor,
        limit=limit,
        count_filter=count_filter,
        settlement_status=settlement_status,
        ticker=ticker,
        event_ticker=event_ticker,
    )

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.get_positions.asyncio_detailed(*, client: Union[AuthenticatedClient, Client], cursor: Union[Unset, str] = UNSET, limit: Union[Unset, int] = UNSET, count_filter: Union[Unset, str] = UNSET, settlement_status: Union[Unset, str] = UNSET, ticker: Union[Unset, str] = UNSET, event_ticker: Union[Unset, str] = UNSET) -> Response[ModelGetPositionsResponse] async

Get Positions

Endpoint for getting all market positions for the member.

Parameters:

Name Type Description Default
cursor Union[Unset, str]

The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.

UNSET
limit Union[Unset, int]

Parameter to specify the number of results per page. Defaults to 100.

UNSET
count_filter Union[Unset, str]

Restricts the positions to those with any of following fields with non-zero values, as a comma separated list. The following values are accepted: position, total_traded, resting_order_count

UNSET
settlement_status Union[Unset, str]

Settlement status of the markets to return. Defaults to unsettled.

UNSET
ticker Union[Unset, str]

Ticker of desired positions.

UNSET
event_ticker Union[Unset, str]

Event ticker of desired positions.

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetPositionsResponse]

Response[ModelGetPositionsResponse]

Source code in kalshi_py/api/portfolio/get_positions.py
async def asyncio_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    cursor: Union[Unset, str] = UNSET,
    limit: Union[Unset, int] = UNSET,
    count_filter: Union[Unset, str] = UNSET,
    settlement_status: Union[Unset, str] = UNSET,
    ticker: Union[Unset, str] = UNSET,
    event_ticker: Union[Unset, str] = UNSET,
) -> Response[ModelGetPositionsResponse]:
    """Get Positions

      Endpoint for getting all market positions for the member.

    Args:
        cursor (Union[Unset, str]): The Cursor represents a pointer to the next page of records in
            the pagination. Use the value returned from the previous response to get the next page.
        limit (Union[Unset, int]): Parameter to specify the number of results per page. Defaults
            to 100.
        count_filter (Union[Unset, str]): Restricts the positions to those with any of following
            fields with non-zero values, as a comma separated list. The following values are accepted:
            position, total_traded, resting_order_count
        settlement_status (Union[Unset, str]): Settlement status of the markets to return.
            Defaults to unsettled.
        ticker (Union[Unset, str]): Ticker of desired positions.
        event_ticker (Union[Unset, str]): Event ticker of desired positions.

    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[ModelGetPositionsResponse]
    """

    kwargs = _get_kwargs(
        cursor=cursor,
        limit=limit,
        count_filter=count_filter,
        settlement_status=settlement_status,
        ticker=ticker,
        event_ticker=event_ticker,
    )

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

Get Settlements

Synchronous API Call

kalshi_py.api.portfolio.get_settlements.sync(*, client: Union[AuthenticatedClient, Client], limit: Union[Unset, int] = UNSET, ticker: Union[Unset, str] = UNSET, event_ticker: Union[Unset, str] = UNSET, min_ts: Union[Unset, int] = UNSET, max_ts: Union[Unset, int] = UNSET, cursor: Union[Unset, str] = UNSET) -> Optional[ModelGetSettlementsResponse]

Get Settlements

Endpoint for getting the member's settlements historical track.

Parameters:

Name Type Description Default
limit Union[Unset, int]

Parameter to specify the number of results per page. Defaults to 100.

UNSET
ticker Union[Unset, str]

Restricts the response to settlements in a specific market.

UNSET
event_ticker Union[Unset, str]

Restricts the response to settlements in a single event.

UNSET
min_ts Union[Unset, int]

Restricts the response to settlements after a timestamp.

UNSET
max_ts Union[Unset, int]

Restricts the response to settlements before a timestamp.

UNSET
cursor Union[Unset, str]

The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetSettlementsResponse]

ModelGetSettlementsResponse

Source code in kalshi_py/api/portfolio/get_settlements.py
def sync(
    *,
    client: Union[AuthenticatedClient, Client],
    limit: Union[Unset, int] = UNSET,
    ticker: Union[Unset, str] = UNSET,
    event_ticker: Union[Unset, str] = UNSET,
    min_ts: Union[Unset, int] = UNSET,
    max_ts: Union[Unset, int] = UNSET,
    cursor: Union[Unset, str] = UNSET,
) -> Optional[ModelGetSettlementsResponse]:
    """Get Settlements

      Endpoint for getting the member's settlements historical track.

    Args:
        limit (Union[Unset, int]): Parameter to specify the number of results per page. Defaults
            to 100.
        ticker (Union[Unset, str]): Restricts the response to settlements in a specific market.
        event_ticker (Union[Unset, str]): Restricts the response to settlements in a single event.
        min_ts (Union[Unset, int]): Restricts the response to settlements after a timestamp.
        max_ts (Union[Unset, int]): Restricts the response to settlements before a timestamp.
        cursor (Union[Unset, str]): The Cursor represents a pointer to the next page of records in
            the pagination. Use the value returned from the previous response to get the next page.

    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:
        ModelGetSettlementsResponse
    """

    return sync_detailed(
        client=client,
        limit=limit,
        ticker=ticker,
        event_ticker=event_ticker,
        min_ts=min_ts,
        max_ts=max_ts,
        cursor=cursor,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.get_settlements.asyncio(*, client: Union[AuthenticatedClient, Client], limit: Union[Unset, int] = UNSET, ticker: Union[Unset, str] = UNSET, event_ticker: Union[Unset, str] = UNSET, min_ts: Union[Unset, int] = UNSET, max_ts: Union[Unset, int] = UNSET, cursor: Union[Unset, str] = UNSET) -> Optional[ModelGetSettlementsResponse] async

Get Settlements

Endpoint for getting the member's settlements historical track.

Parameters:

Name Type Description Default
limit Union[Unset, int]

Parameter to specify the number of results per page. Defaults to 100.

UNSET
ticker Union[Unset, str]

Restricts the response to settlements in a specific market.

UNSET
event_ticker Union[Unset, str]

Restricts the response to settlements in a single event.

UNSET
min_ts Union[Unset, int]

Restricts the response to settlements after a timestamp.

UNSET
max_ts Union[Unset, int]

Restricts the response to settlements before a timestamp.

UNSET
cursor Union[Unset, str]

The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelGetSettlementsResponse]

ModelGetSettlementsResponse

Source code in kalshi_py/api/portfolio/get_settlements.py
async def asyncio(
    *,
    client: Union[AuthenticatedClient, Client],
    limit: Union[Unset, int] = UNSET,
    ticker: Union[Unset, str] = UNSET,
    event_ticker: Union[Unset, str] = UNSET,
    min_ts: Union[Unset, int] = UNSET,
    max_ts: Union[Unset, int] = UNSET,
    cursor: Union[Unset, str] = UNSET,
) -> Optional[ModelGetSettlementsResponse]:
    """Get Settlements

      Endpoint for getting the member's settlements historical track.

    Args:
        limit (Union[Unset, int]): Parameter to specify the number of results per page. Defaults
            to 100.
        ticker (Union[Unset, str]): Restricts the response to settlements in a specific market.
        event_ticker (Union[Unset, str]): Restricts the response to settlements in a single event.
        min_ts (Union[Unset, int]): Restricts the response to settlements after a timestamp.
        max_ts (Union[Unset, int]): Restricts the response to settlements before a timestamp.
        cursor (Union[Unset, str]): The Cursor represents a pointer to the next page of records in
            the pagination. Use the value returned from the previous response to get the next page.

    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:
        ModelGetSettlementsResponse
    """

    return (
        await asyncio_detailed(
            client=client,
            limit=limit,
            ticker=ticker,
            event_ticker=event_ticker,
            min_ts=min_ts,
            max_ts=max_ts,
            cursor=cursor,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.get_settlements.sync_detailed(*, client: Union[AuthenticatedClient, Client], limit: Union[Unset, int] = UNSET, ticker: Union[Unset, str] = UNSET, event_ticker: Union[Unset, str] = UNSET, min_ts: Union[Unset, int] = UNSET, max_ts: Union[Unset, int] = UNSET, cursor: Union[Unset, str] = UNSET) -> Response[ModelGetSettlementsResponse]

Get Settlements

Endpoint for getting the member's settlements historical track.

Parameters:

Name Type Description Default
limit Union[Unset, int]

Parameter to specify the number of results per page. Defaults to 100.

UNSET
ticker Union[Unset, str]

Restricts the response to settlements in a specific market.

UNSET
event_ticker Union[Unset, str]

Restricts the response to settlements in a single event.

UNSET
min_ts Union[Unset, int]

Restricts the response to settlements after a timestamp.

UNSET
max_ts Union[Unset, int]

Restricts the response to settlements before a timestamp.

UNSET
cursor Union[Unset, str]

The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetSettlementsResponse]

Response[ModelGetSettlementsResponse]

Source code in kalshi_py/api/portfolio/get_settlements.py
def sync_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    limit: Union[Unset, int] = UNSET,
    ticker: Union[Unset, str] = UNSET,
    event_ticker: Union[Unset, str] = UNSET,
    min_ts: Union[Unset, int] = UNSET,
    max_ts: Union[Unset, int] = UNSET,
    cursor: Union[Unset, str] = UNSET,
) -> Response[ModelGetSettlementsResponse]:
    """Get Settlements

      Endpoint for getting the member's settlements historical track.

    Args:
        limit (Union[Unset, int]): Parameter to specify the number of results per page. Defaults
            to 100.
        ticker (Union[Unset, str]): Restricts the response to settlements in a specific market.
        event_ticker (Union[Unset, str]): Restricts the response to settlements in a single event.
        min_ts (Union[Unset, int]): Restricts the response to settlements after a timestamp.
        max_ts (Union[Unset, int]): Restricts the response to settlements before a timestamp.
        cursor (Union[Unset, str]): The Cursor represents a pointer to the next page of records in
            the pagination. Use the value returned from the previous response to get the next page.

    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[ModelGetSettlementsResponse]
    """

    kwargs = _get_kwargs(
        limit=limit,
        ticker=ticker,
        event_ticker=event_ticker,
        min_ts=min_ts,
        max_ts=max_ts,
        cursor=cursor,
    )

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.get_settlements.asyncio_detailed(*, client: Union[AuthenticatedClient, Client], limit: Union[Unset, int] = UNSET, ticker: Union[Unset, str] = UNSET, event_ticker: Union[Unset, str] = UNSET, min_ts: Union[Unset, int] = UNSET, max_ts: Union[Unset, int] = UNSET, cursor: Union[Unset, str] = UNSET) -> Response[ModelGetSettlementsResponse] async

Get Settlements

Endpoint for getting the member's settlements historical track.

Parameters:

Name Type Description Default
limit Union[Unset, int]

Parameter to specify the number of results per page. Defaults to 100.

UNSET
ticker Union[Unset, str]

Restricts the response to settlements in a specific market.

UNSET
event_ticker Union[Unset, str]

Restricts the response to settlements in a single event.

UNSET
min_ts Union[Unset, int]

Restricts the response to settlements after a timestamp.

UNSET
max_ts Union[Unset, int]

Restricts the response to settlements before a timestamp.

UNSET
cursor Union[Unset, str]

The Cursor represents a pointer to the next page of records in the pagination. Use the value returned from the previous response to get the next page.

UNSET

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelGetSettlementsResponse]

Response[ModelGetSettlementsResponse]

Source code in kalshi_py/api/portfolio/get_settlements.py
async def asyncio_detailed(
    *,
    client: Union[AuthenticatedClient, Client],
    limit: Union[Unset, int] = UNSET,
    ticker: Union[Unset, str] = UNSET,
    event_ticker: Union[Unset, str] = UNSET,
    min_ts: Union[Unset, int] = UNSET,
    max_ts: Union[Unset, int] = UNSET,
    cursor: Union[Unset, str] = UNSET,
) -> Response[ModelGetSettlementsResponse]:
    """Get Settlements

      Endpoint for getting the member's settlements historical track.

    Args:
        limit (Union[Unset, int]): Parameter to specify the number of results per page. Defaults
            to 100.
        ticker (Union[Unset, str]): Restricts the response to settlements in a specific market.
        event_ticker (Union[Unset, str]): Restricts the response to settlements in a single event.
        min_ts (Union[Unset, int]): Restricts the response to settlements after a timestamp.
        max_ts (Union[Unset, int]): Restricts the response to settlements before a timestamp.
        cursor (Union[Unset, str]): The Cursor represents a pointer to the next page of records in
            the pagination. Use the value returned from the previous response to get the next page.

    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[ModelGetSettlementsResponse]
    """

    kwargs = _get_kwargs(
        limit=limit,
        ticker=ticker,
        event_ticker=event_ticker,
        min_ts=min_ts,
        max_ts=max_ts,
        cursor=cursor,
    )

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)

Reset Order Group

Synchronous API Call

kalshi_py.api.portfolio.reset_order_group.sync(order_group_id: str, *, client: Union[AuthenticatedClient, Client]) -> Optional[ModelEmptyResponse]

Reset Order Group

Resets the order group's matched contracts counter to zero, allowing new orders to be placed again after the limit was hit.

Parameters:

Name Type Description Default
order_group_id str

Order group ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelEmptyResponse]

ModelEmptyResponse

Source code in kalshi_py/api/portfolio/reset_order_group.py
def sync(
    order_group_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Optional[ModelEmptyResponse]:
    """Reset Order Group

      Resets the order group's matched contracts counter to zero, allowing new orders to be placed again
    after the limit was hit.

    Args:
        order_group_id (str): Order group ID

    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:
        ModelEmptyResponse
    """

    return sync_detailed(
        order_group_id=order_group_id,
        client=client,
    ).parsed

Asynchronous API Call

kalshi_py.api.portfolio.reset_order_group.asyncio(order_group_id: str, *, client: Union[AuthenticatedClient, Client]) -> Optional[ModelEmptyResponse] async

Reset Order Group

Resets the order group's matched contracts counter to zero, allowing new orders to be placed again after the limit was hit.

Parameters:

Name Type Description Default
order_group_id str

Order group ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Optional[ModelEmptyResponse]

ModelEmptyResponse

Source code in kalshi_py/api/portfolio/reset_order_group.py
async def asyncio(
    order_group_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Optional[ModelEmptyResponse]:
    """Reset Order Group

      Resets the order group's matched contracts counter to zero, allowing new orders to be placed again
    after the limit was hit.

    Args:
        order_group_id (str): Order group ID

    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:
        ModelEmptyResponse
    """

    return (
        await asyncio_detailed(
            order_group_id=order_group_id,
            client=client,
        )
    ).parsed

Synchronous Detailed Response

kalshi_py.api.portfolio.reset_order_group.sync_detailed(order_group_id: str, *, client: Union[AuthenticatedClient, Client]) -> Response[ModelEmptyResponse]

Reset Order Group

Resets the order group's matched contracts counter to zero, allowing new orders to be placed again after the limit was hit.

Parameters:

Name Type Description Default
order_group_id str

Order group ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelEmptyResponse]

Response[ModelEmptyResponse]

Source code in kalshi_py/api/portfolio/reset_order_group.py
def sync_detailed(
    order_group_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Response[ModelEmptyResponse]:
    """Reset Order Group

      Resets the order group's matched contracts counter to zero, allowing new orders to be placed again
    after the limit was hit.

    Args:
        order_group_id (str): Order group ID

    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[ModelEmptyResponse]
    """

    kwargs = _get_kwargs(
        order_group_id=order_group_id,
    )

    response = client.get_httpx_client().request(
        **kwargs,
    )

    return _build_response(client=client, response=response)

Asynchronous Detailed Response

kalshi_py.api.portfolio.reset_order_group.asyncio_detailed(order_group_id: str, *, client: Union[AuthenticatedClient, Client]) -> Response[ModelEmptyResponse] async

Reset Order Group

Resets the order group's matched contracts counter to zero, allowing new orders to be placed again after the limit was hit.

Parameters:

Name Type Description Default
order_group_id str

Order group ID

required

Raises:

Type Description
UnexpectedStatus

If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

TimeoutException

If the request takes longer than Client.timeout.

Returns:

Type Description
Response[ModelEmptyResponse]

Response[ModelEmptyResponse]

Source code in kalshi_py/api/portfolio/reset_order_group.py
async def asyncio_detailed(
    order_group_id: str,
    *,
    client: Union[AuthenticatedClient, Client],
) -> Response[ModelEmptyResponse]:
    """Reset Order Group

      Resets the order group's matched contracts counter to zero, allowing new orders to be placed again
    after the limit was hit.

    Args:
        order_group_id (str): Order group ID

    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[ModelEmptyResponse]
    """

    kwargs = _get_kwargs(
        order_group_id=order_group_id,
    )

    response = await client.get_async_httpx_client().request(**kwargs)

    return _build_response(client=client, response=response)