Skip to content

Latest commit

 

History

History
106 lines (79 loc) · 4.51 KB

PortfolioApi.md

File metadata and controls

106 lines (79 loc) · 4.51 KB

kalshi.PortfolioApi

All URIs are relative to https://trading-api.kalshi.com/v1

Method HTTP request Description
user_get_portfolio_history GET /users/{user_id}/portfolio/history UserGetPortfolioHistory

user_get_portfolio_history

UserGetPortfolioHistoryResponse user_get_portfolio_history(user_id)

UserGetPortfolioHistory

End-point for getting the logged in user's portfolio historical track. The value for the user_id path parameter should match the user_id value returned on the response for the last login request (POST /log_in).

Example

  • Api Key Authentication (cookie):
import time
import kalshi
from kalshi.api import portfolio_api
from kalshi.model.user_get_portfolio_history_response import UserGetPortfolioHistoryResponse
from kalshi.model.user_get_portfolio_history_request import UserGetPortfolioHistoryRequest
from pprint import pprint
# Defining the host is optional and defaults to https://trading-api.kalshi.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi.Configuration(
    host = "https://trading-api.kalshi.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: cookie
configuration.api_key['cookie'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['cookie'] = 'Bearer'

# Enter a context with an instance of the API client
with kalshi.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = portfolio_api.PortfolioApi(api_client)
    user_id = "user_id_example" # str | This parameter should be filled with your user_id provided on log_in
    user_get_portfolio_history_request = UserGetPortfolioHistoryRequest(
        max_date=dateutil_parser('1970-01-01T00:00:00.00Z'),
        max_ts=1,
        min_date=dateutil_parser('1970-01-01T00:00:00.00Z'),
        min_ts=1,
    ) # UserGetPortfolioHistoryRequest | Order create input data (optional)

    # example passing only required values which don't have defaults set
    try:
        # UserGetPortfolioHistory
        api_response = api_instance.user_get_portfolio_history(user_id)
        pprint(api_response)
    except kalshi.ApiException as e:
        print("Exception when calling PortfolioApi->user_get_portfolio_history: %s\n" % e)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # UserGetPortfolioHistory
        api_response = api_instance.user_get_portfolio_history(user_id, user_get_portfolio_history_request=user_get_portfolio_history_request)
        pprint(api_response)
    except kalshi.ApiException as e:
        print("Exception when calling PortfolioApi->user_get_portfolio_history: %s\n" % e)

Parameters

Name Type Description Notes
user_id str This parameter should be filled with your user_id provided on log_in
user_get_portfolio_history_request UserGetPortfolioHistoryRequest Order create input data [optional]

Return type

UserGetPortfolioHistoryResponse

Authorization

cookie

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 -
400 JSONError is a generic structure for API error responses. * code -
* details -
* message -
* service -
401 JSONError is a generic structure for API error responses. * code -
* details -
* message -
* service -
403 JSONError is a generic structure for API error responses. * code -
* details -
* message -
* service -
500 JSONError is a generic structure for API error responses. * code -
* details -
* message -
* service -

[Back to top] [Back to API list] [Back to Model list] [Back to README]