All URIs are relative to https://api.elections.kalshi.com/trade-api/v2
MethodHTTP requestDescription
amend_orderPOST /portfolio/orders//amendAmend Order
batch_cancel_ordersDELETE /portfolio/orders/batchedBatch Cancel Orders
batch_create_ordersPOST /portfolio/orders/batchedBatch Create Orders
cancel_orderDELETE /portfolio/orders/Cancel Order
create_orderPOST /portfolio/ordersCreate Order
create_order_groupPOST /portfolio/order_groups/createCreate Order Group
decrease_orderPOST /portfolio/orders//decreaseDecrease Order
delete_order_groupDELETE /portfolio/order_groups/Delete Order Group
get_balanceGET /portfolio/balanceGet Balance
get_fillsGET /portfolio/fillsGet Fills
get_orderGET /portfolio/orders/Get Order
get_order_groupsGET /portfolio/order_groupsGet Order Groups
get_order_queue_positionGET /portfolio/orders//queue_positionGet Order Queue Position
get_ordersGET /portfolio/ordersGet Orders
get_positionsGET /portfolio/positionsGet Positions
get_queue_positionsPOST /portfolio/orders/queue_positionsGet Queue Positions
get_settlementsGET /portfolio/settlementsGet Settlements
get_total_resting_order_valueGET /portfolio/summary/total_resting_order_valueGet Total Resting Order Value
reset_order_groupPOST /portfolio/order_groups//resetReset Order Group

amend_order

AmendOrderResponse amend_order(order_id, amend_order_request)
Amend Order Amend an existing order

Example

import kalshi_python
from kalshi_python.models.amend_order_request import AmendOrderRequest
from kalshi_python.models.amend_order_response import AmendOrderResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

order_id = 'order_id_example' # str | Order ID

amend_order_request = kalshi_python.AmendOrderRequest() # AmendOrderRequest | 

try:
    # Amend Order
    api_response = client.amend_order(order_id, amend_order_request)
    print("The response of PortfolioApi->amend_order:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling PortfolioApi->amend_order: %s\n" % e)

Parameters

NameTypeDescriptionNotes
order_idstrOrder ID
amend_order_requestAmendOrderRequest

Return type

AmendOrderResponse

HTTP response details

Status codeDescription
200Order amended successfully
400Bad request - invalid input
401Unauthorized - authentication required
404Resource not found
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

batch_cancel_orders

BatchCancelOrdersResponse batch_cancel_orders(batch_cancel_orders_request)
Batch Cancel Orders Cancel multiple orders in a single request

Example

import kalshi_python
from kalshi_python.models.batch_cancel_orders_request import BatchCancelOrdersRequest
from kalshi_python.models.batch_cancel_orders_response import BatchCancelOrdersResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

batch_cancel_orders_request = kalshi_python.BatchCancelOrdersRequest() # BatchCancelOrdersRequest | 

try:
    # Batch Cancel Orders
    api_response = client.batch_cancel_orders(batch_cancel_orders_request)
    print("The response of PortfolioApi->batch_cancel_orders:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling PortfolioApi->batch_cancel_orders: %s\n" % e)

Parameters

NameTypeDescriptionNotes
batch_cancel_orders_requestBatchCancelOrdersRequest

Return type

BatchCancelOrdersResponse

HTTP response details

Status codeDescription
200Batch order cancellation completed
400Bad request - invalid input
401Unauthorized - authentication required
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

batch_create_orders

BatchCreateOrdersResponse batch_create_orders(batch_create_orders_request)
Batch Create Orders Create multiple orders in a single request

Example

import kalshi_python
from kalshi_python.models.batch_create_orders_request import BatchCreateOrdersRequest
from kalshi_python.models.batch_create_orders_response import BatchCreateOrdersResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

batch_create_orders_request = kalshi_python.BatchCreateOrdersRequest() # BatchCreateOrdersRequest | 

try:
    # Batch Create Orders
    api_response = client.batch_create_orders(batch_create_orders_request)
    print("The response of PortfolioApi->batch_create_orders:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling PortfolioApi->batch_create_orders: %s\n" % e)

Parameters

NameTypeDescriptionNotes
batch_create_orders_requestBatchCreateOrdersRequest

Return type

BatchCreateOrdersResponse

HTTP response details

Status codeDescription
200Batch order creation completed
400Bad request - invalid input
401Unauthorized - authentication required
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

cancel_order

CancelOrderResponse cancel_order(order_id)
Cancel Order Cancel an order

Example

import kalshi_python
from kalshi_python.models.cancel_order_response import CancelOrderResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

order_id = 'order_id_example' # str | Order ID

try:
    # Cancel Order
    api_response = client.cancel_order(order_id)
    print("The response of PortfolioApi->cancel_order:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling PortfolioApi->cancel_order: %s\n" % e)

Parameters

NameTypeDescriptionNotes
order_idstrOrder ID

Return type

CancelOrderResponse

HTTP response details

Status codeDescription
200Order cancelled successfully
401Unauthorized - authentication required
404Resource not found
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

create_order

CreateOrderResponse create_order(create_order_request)
Create Order Create a new order

Example

import kalshi_python
from kalshi_python.models.create_order_request import CreateOrderRequest
from kalshi_python.models.create_order_response import CreateOrderResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

create_order_request = kalshi_python.CreateOrderRequest() # CreateOrderRequest | 

try:
    # Create Order
    api_response = client.create_order(create_order_request)
    print("The response of PortfolioApi->create_order:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling PortfolioApi->create_order: %s\n" % e)

Parameters

NameTypeDescriptionNotes
create_order_requestCreateOrderRequest

Return type

CreateOrderResponse

HTTP response details

Status codeDescription
201Order created successfully
400Bad request - invalid input
401Unauthorized - authentication required
429Too Many Requests - rate limit exceeded
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

create_order_group

CreateOrderGroupResponse create_order_group(create_order_group_request)
Create Order Group Create a new order group

Example

import kalshi_python
from kalshi_python.models.create_order_group_request import CreateOrderGroupRequest
from kalshi_python.models.create_order_group_response import CreateOrderGroupResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

create_order_group_request = kalshi_python.CreateOrderGroupRequest() # CreateOrderGroupRequest | 

try:
    # Create Order Group
    api_response = client.create_order_group(create_order_group_request)
    print("The response of PortfolioApi->create_order_group:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling PortfolioApi->create_order_group: %s\n" % e)

Parameters

NameTypeDescriptionNotes
create_order_group_requestCreateOrderGroupRequest

Return type

CreateOrderGroupResponse

HTTP response details

Status codeDescription
201Order group created successfully
400Bad request - invalid input
401Unauthorized - authentication required
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

decrease_order

DecreaseOrderResponse decrease_order(order_id, decrease_order_request)
Decrease Order Decrease the size of an existing order

Example

import kalshi_python
from kalshi_python.models.decrease_order_request import DecreaseOrderRequest
from kalshi_python.models.decrease_order_response import DecreaseOrderResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

order_id = 'order_id_example' # str | Order ID

decrease_order_request = kalshi_python.DecreaseOrderRequest() # DecreaseOrderRequest | 

try:
    # Decrease Order
    api_response = client.decrease_order(order_id, decrease_order_request)
    print("The response of PortfolioApi->decrease_order:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling PortfolioApi->decrease_order: %s\n" % e)

Parameters

NameTypeDescriptionNotes
order_idstrOrder ID
decrease_order_requestDecreaseOrderRequest

Return type

DecreaseOrderResponse

HTTP response details

Status codeDescription
200Order decreased successfully
400Bad request - invalid input
401Unauthorized - authentication required
404Resource not found
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete_order_group

delete_order_group(order_group_id)
Delete Order Group Delete an order group

Example

import kalshi_python
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

order_group_id = 'order_group_id_example' # str | Order group ID

try:
    # Delete Order Group
    client.delete_order_group(order_group_id)
except Exception as e:
    print("Exception when calling PortfolioApi->delete_order_group: %s\n" % e)

Parameters

NameTypeDescriptionNotes
order_group_idstrOrder group ID

Return type

void (empty response body)

HTTP response details

Status codeDescription
204Order group deleted successfully
401Unauthorized - authentication required
404Resource not found
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_balance

GetBalanceResponse get_balance()
Get Balance Get the user’s current balance

Example

import kalshi_python
from kalshi_python.models.get_balance_response import GetBalanceResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

try:
    # Get Balance
    api_response = client.get_balance()
    print("The response of PortfolioApi->get_balance:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling PortfolioApi->get_balance: %s\n" % e)

Parameters

This endpoint does not need any parameter.

Return type

GetBalanceResponse

HTTP response details

Status codeDescription
200Balance retrieved successfully
401Unauthorized - authentication required
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_fills

GetFillsResponse get_fills(ticker=ticker, order_id=order_id, min_ts=min_ts, max_ts=max_ts, limit=limit, cursor=cursor)
Get Fills Get fills for the logged-in user. A fill represents a partial or complete execution of an order. When an order matches with another order in the orderbook, a fill is created for each side of the trade.

Example

import kalshi_python
from kalshi_python.models.get_fills_response import GetFillsResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

ticker = 'ticker_example' # str | Filter by market ticker (optional)

order_id = 'order_id_example' # str | Filter by order ID (optional)

min_ts = 56 # int | Filter items after this Unix timestamp (optional)

max_ts = 56 # int | Filter items before this Unix timestamp (optional)

limit = 100 # int | Number of results per page. Defaults to 100. Maximum value is 200. (optional) (default to 100)

cursor = 'cursor_example' # str | Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. (optional)

try:
    # Get Fills
    api_response = client.get_fills(ticker=ticker, order_id=order_id, min_ts=min_ts, max_ts=max_ts, limit=limit, cursor=cursor)
    print("The response of PortfolioApi->get_fills:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling PortfolioApi->get_fills: %s\n" % e)

Parameters

NameTypeDescriptionNotes
tickerstrFilter by market ticker[optional]
order_idstrFilter by order ID[optional]
min_tsintFilter items after this Unix timestamp[optional]
max_tsintFilter items before this Unix timestamp[optional]
limitintNumber of results per page. Defaults to 100. Maximum value is 200.[optional] [default to 100]
cursorstrPagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.[optional]

Return type

GetFillsResponse

HTTP response details

Status codeDescription
200Fills retrieved successfully
400Bad request - invalid input
401Unauthorized - authentication required
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_order

GetOrderResponse get_order(order_id)
Get Order Get a single order by ID

Example

import kalshi_python
from kalshi_python.models.get_order_response import GetOrderResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

order_id = 'order_id_example' # str | Order ID

try:
    # Get Order
    api_response = client.get_order(order_id)
    print("The response of PortfolioApi->get_order:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling PortfolioApi->get_order: %s\n" % e)

Parameters

NameTypeDescriptionNotes
order_idstrOrder ID

Return type

GetOrderResponse

HTTP response details

Status codeDescription
200Order retrieved successfully
401Unauthorized - authentication required
404Resource not found
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_order_groups

GetOrderGroupsResponse get_order_groups(status=status, limit=limit, cursor=cursor)
Get Order Groups Get order groups for the logged-in user

Example

import kalshi_python
from kalshi_python.models.get_order_groups_response import GetOrderGroupsResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

status = 'status_example' # str | Filter by status. Possible values depend on the endpoint. (optional)

limit = 100 # int | Number of results per page. Defaults to 100. Maximum value is 200. (optional) (default to 100)

cursor = 'cursor_example' # str | Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. (optional)

try:
    # Get Order Groups
    api_response = client.get_order_groups(status=status, limit=limit, cursor=cursor)
    print("The response of PortfolioApi->get_order_groups:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling PortfolioApi->get_order_groups: %s\n" % e)

Parameters

NameTypeDescriptionNotes
statusstrFilter by status. Possible values depend on the endpoint.[optional]
limitintNumber of results per page. Defaults to 100. Maximum value is 200.[optional] [default to 100]
cursorstrPagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.[optional]

Return type

GetOrderGroupsResponse

HTTP response details

Status codeDescription
200Order groups retrieved successfully
400Bad request - invalid input
401Unauthorized - authentication required
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_order_queue_position

GetOrderQueuePositionResponse get_order_queue_position(order_id)
Get Order Queue Position Get the queue position for an order

Example

import kalshi_python
from kalshi_python.models.get_order_queue_position_response import GetOrderQueuePositionResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

order_id = 'order_id_example' # str | Order ID

try:
    # Get Order Queue Position
    api_response = client.get_order_queue_position(order_id)
    print("The response of PortfolioApi->get_order_queue_position:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling PortfolioApi->get_order_queue_position: %s\n" % e)

Parameters

NameTypeDescriptionNotes
order_idstrOrder ID

Return type

GetOrderQueuePositionResponse

HTTP response details

Status codeDescription
200Queue position retrieved successfully
401Unauthorized - authentication required
404Resource not found
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_orders

GetOrdersResponse get_orders(ticker=ticker, event_ticker=event_ticker, min_ts=min_ts, max_ts=max_ts, status=status, limit=limit, cursor=cursor)
Get Orders Get orders for the logged-in user

Example

import kalshi_python
from kalshi_python.models.get_orders_response import GetOrdersResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

ticker = 'ticker_example' # str | Filter by market ticker (optional)

event_ticker = 'event_ticker_example' # str | Filter by event ticker (optional)

min_ts = 56 # int | Filter items after this Unix timestamp (optional)

max_ts = 56 # int | Filter items before this Unix timestamp (optional)

status = 'status_example' # str | Filter by status. Possible values depend on the endpoint. (optional)

limit = 100 # int | Number of results per page. Defaults to 100. Maximum value is 200. (optional) (default to 100)

cursor = 'cursor_example' # str | Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. (optional)

try:
    # Get Orders
    api_response = client.get_orders(ticker=ticker, event_ticker=event_ticker, min_ts=min_ts, max_ts=max_ts, status=status, limit=limit, cursor=cursor)
    print("The response of PortfolioApi->get_orders:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling PortfolioApi->get_orders: %s\n" % e)

Parameters

NameTypeDescriptionNotes
tickerstrFilter by market ticker[optional]
event_tickerstrFilter by event ticker[optional]
min_tsintFilter items after this Unix timestamp[optional]
max_tsintFilter items before this Unix timestamp[optional]
statusstrFilter by status. Possible values depend on the endpoint.[optional]
limitintNumber of results per page. Defaults to 100. Maximum value is 200.[optional] [default to 100]
cursorstrPagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.[optional]

Return type

GetOrdersResponse

HTTP response details

Status codeDescription
200Orders retrieved successfully
400Bad request - invalid input
401Unauthorized - authentication required
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_positions

GetPositionsResponse get_positions(ticker=ticker, event_ticker=event_ticker, count_down=count_down, count_up=count_up, limit=limit, cursor=cursor)
Get Positions Get positions for the logged-in user

Example

import kalshi_python
from kalshi_python.models.get_positions_response import GetPositionsResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

ticker = 'ticker_example' # str | Filter by market ticker (optional)

event_ticker = 'event_ticker_example' # str | Filter by event ticker (optional)

count_down = 56 # int | Filter positions by minimum count down value (optional)

count_up = 56 # int | Filter positions by minimum count up value (optional)

limit = 100 # int | Number of results per page. Defaults to 100. Maximum value is 200. (optional) (default to 100)

cursor = 'cursor_example' # str | Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. (optional)

try:
    # Get Positions
    api_response = client.get_positions(ticker=ticker, event_ticker=event_ticker, count_down=count_down, count_up=count_up, limit=limit, cursor=cursor)
    print("The response of PortfolioApi->get_positions:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling PortfolioApi->get_positions: %s\n" % e)

Parameters

NameTypeDescriptionNotes
tickerstrFilter by market ticker[optional]
event_tickerstrFilter by event ticker[optional]
count_downintFilter positions by minimum count down value[optional]
count_upintFilter positions by minimum count up value[optional]
limitintNumber of results per page. Defaults to 100. Maximum value is 200.[optional] [default to 100]
cursorstrPagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.[optional]

Return type

GetPositionsResponse

HTTP response details

Status codeDescription
200Positions retrieved successfully
400Bad request - invalid input
401Unauthorized - authentication required
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_queue_positions

GetQueuePositionsResponse get_queue_positions(get_queue_positions_request)
Get Queue Positions Get queue positions for multiple orders

Example

import kalshi_python
from kalshi_python.models.get_queue_positions_request import GetQueuePositionsRequest
from kalshi_python.models.get_queue_positions_response import GetQueuePositionsResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

get_queue_positions_request = kalshi_python.GetQueuePositionsRequest() # GetQueuePositionsRequest | 

try:
    # Get Queue Positions
    api_response = client.get_queue_positions(get_queue_positions_request)
    print("The response of PortfolioApi->get_queue_positions:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling PortfolioApi->get_queue_positions: %s\n" % e)

Parameters

NameTypeDescriptionNotes
get_queue_positions_requestGetQueuePositionsRequest

Return type

GetQueuePositionsResponse

HTTP response details

Status codeDescription
200Queue positions retrieved successfully
400Bad request - invalid input
401Unauthorized - authentication required
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_settlements

GetSettlementsResponse get_settlements(limit=limit, cursor=cursor)
Get Settlements Get settlements for the logged-in user

Example

import kalshi_python
from kalshi_python.models.get_settlements_response import GetSettlementsResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

limit = 100 # int | Number of results per page. Defaults to 100. Maximum value is 200. (optional) (default to 100)

cursor = 'cursor_example' # str | Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. (optional)

try:
    # Get Settlements
    api_response = client.get_settlements(limit=limit, cursor=cursor)
    print("The response of PortfolioApi->get_settlements:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling PortfolioApi->get_settlements: %s\n" % e)

Parameters

NameTypeDescriptionNotes
limitintNumber of results per page. Defaults to 100. Maximum value is 200.[optional] [default to 100]
cursorstrPagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.[optional]

Return type

GetSettlementsResponse

HTTP response details

Status codeDescription
200Settlements retrieved successfully
400Bad request - invalid input
401Unauthorized - authentication required
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_total_resting_order_value

GetTotalRestingOrderValueResponse get_total_resting_order_value()
Get Total Resting Order Value Get the total value of all resting orders

Example

import kalshi_python
from kalshi_python.models.get_total_resting_order_value_response import GetTotalRestingOrderValueResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

try:
    # Get Total Resting Order Value
    api_response = client.get_total_resting_order_value()
    print("The response of PortfolioApi->get_total_resting_order_value:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling PortfolioApi->get_total_resting_order_value: %s\n" % e)

Parameters

This endpoint does not need any parameter.

Return type

GetTotalRestingOrderValueResponse

HTTP response details

Status codeDescription
200Total resting order value retrieved successfully
401Unauthorized - authentication required
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

reset_order_group

reset_order_group(order_group_id)
Reset Order Group Reset an order group

Example

import kalshi_python
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

order_group_id = 'order_group_id_example' # str | Order group ID

try:
    # Reset Order Group
    client.reset_order_group(order_group_id)
except Exception as e:
    print("Exception when calling PortfolioApi->reset_order_group: %s\n" % e)

Parameters

NameTypeDescriptionNotes
order_group_idstrOrder group ID

Return type

void (empty response body)

HTTP response details

Status codeDescription
204Order group reset successfully
401Unauthorized - authentication required
404Resource not found
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]