Metadata-Version: 2.1
Name: kalshi-python
Version: 1.1.0
Summary: Kalshi Trade API
Home-page: https://github.com/Kalshi/kalshi-python
Author-email: support@kalshi.com
License: UNKNOWN
Keywords: Swagger,Kalshi Trade API
Platform: UNKNOWN
Description-Content-Type: text/markdown
License-File: LICENSE

# kalshi_python

 This library is the official python SDK for algorithmic trading on [Kalshi](https://kalshi.com). 
    
This SDK is powered by Kalshi's trading rest api v2. The documentation for the underlying api [can be found here](https://trading-api.readme.io). 

By using this SDK, you agree to Kalshi's Developer Agreement (https://kalshi.com/developer-agreement).

This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:

- API version: 2.0.0
- Package version: 1.0.0
- Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen

## Requirements.

Python 2.7 and 3.4+

## Installation & Usage

### pip install

If the python package is hosted on Github, you can install directly from Github

```sh
pip install kalshi-python
```

Then import the package:
```python
import kalshi_python 
```

## Quick start

Please follow the [installation procedure](#installation--usage) and then run the following:

```python
import uuid
import kalshi_python
from kalshi_python.models import CreateOrderRequest
from pprint import pprint

config = kalshi_python.Configuration()
# Comment the line below to use production
config.host = 'https://demo-api.kalshi.co/trade-api/v2'

# Create an API configuration passing your credentials.
# Use this if you want the kalshi_python sdk to manage the authentication for your.
kalshi_api = kalshi_python.ApiInstance(
    email='YOUR_EMAIL_HERE',
    password='YOUR_PASSWORD_HERE',
    configuration=config,
)

# Optionally you can use the
exchangeStatus = kalshi_api.get_exchange_status()
print('Exchange status response: ')
pprint(exchangeStatus)

# Replace the series ticker with the market ticker you want.
marketTicker = 'FED-23DEC-T3.00'
marketResponse = kalshi_api.get_market(marketTicker)
print('\nMarket: ' + marketTicker)
pprint(marketResponse)

balanceResponse = kalshi_api.get_balance()
print('\nUser balance: ')
pprint(balanceResponse)

# Submit an order for 10 yes contracts at 50cents on 'FED-23DEC-T3.00'
orderUuid = str(uuid.uuid4())
orderResponse = kalshi_api.create_order(CreateOrderRequest(
    ticker=marketTicker,
    action='buy',
    type='limit',
    yes_price=50,
    count=10,
    client_order_id=orderUuid,
    side='yes',
))
print('\nOrder submitted: ')
pprint(orderResponse)
```

## Documentation for API Endpoints

All URIs are relative to *https://trading-api.kalshi.com/trade-api/v2*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AuthApi* | [**login**](docs/AuthApi.md#login) | **POST** /login | Login
*AuthApi* | [**logout**](docs/AuthApi.md#logout) | **POST** /logout | Logout
*ExchangeApi* | [**get_exchange_status**](docs/ExchangeApi.md#get_exchange_status) | **GET** /exchange/status | Endpoint for getting the exchange status.
*MarketApi* | [**get_event**](docs/MarketApi.md#get_event) | **GET** /events/{event_ticker} | GetEvent
*MarketApi* | [**get_market**](docs/MarketApi.md#get_market) | **GET** /markets/{ticker} | GetMarket
*MarketApi* | [**get_market_history**](docs/MarketApi.md#get_market_history) | **GET** /markets/{ticker}/history | GetMarketHistory
*MarketApi* | [**get_market_orderbook**](docs/MarketApi.md#get_market_orderbook) | **GET** /markets/{ticker}/orderbook | GetMarketOrderbook
*MarketApi* | [**get_markets**](docs/MarketApi.md#get_markets) | **GET** /markets | GetMarkets
*MarketApi* | [**get_series**](docs/MarketApi.md#get_series) | **GET** /series/{series_ticker} | GetSeries
*MarketApi* | [**get_trades**](docs/MarketApi.md#get_trades) | **GET** /markets/trades | GetTrades
*PortfolioApi* | [**batch_cancel_orders**](docs/PortfolioApi.md#batch_cancel_orders) | **DELETE** /portfolio/orders/batched | BatchCancelOrders
*PortfolioApi* | [**batch_create_orders**](docs/PortfolioApi.md#batch_create_orders) | **POST** /portfolio/orders/batched | BatchCreateOrders
*PortfolioApi* | [**cancel_order**](docs/PortfolioApi.md#cancel_order) | **DELETE** /portfolio/orders/{order_id} | CancelOrder
*PortfolioApi* | [**create_order**](docs/PortfolioApi.md#create_order) | **POST** /portfolio/orders | CreateOrder
*PortfolioApi* | [**decrease_order**](docs/PortfolioApi.md#decrease_order) | **POST** /portfolio/orders/{order_id}/decrease | DecreaseOrder
*PortfolioApi* | [**get_balance**](docs/PortfolioApi.md#get_balance) | **GET** /portfolio/balance | GetBalance
*PortfolioApi* | [**get_fills**](docs/PortfolioApi.md#get_fills) | **GET** /portfolio/fills | GetFills
*PortfolioApi* | [**get_order**](docs/PortfolioApi.md#get_order) | **GET** /portfolio/orders/{order_id} | GetOrder
*PortfolioApi* | [**get_orders**](docs/PortfolioApi.md#get_orders) | **GET** /portfolio/orders | GetOrders
*PortfolioApi* | [**get_portfolio_settlements**](docs/PortfolioApi.md#get_portfolio_settlements) | **GET** /portfolio/settlements | GetPortfolioSettlements
*PortfolioApi* | [**get_positions**](docs/PortfolioApi.md#get_positions) | **GET** /portfolio/positions | GetPositions

## Documentation For Models

 - [BatchCancelOrdersIndividualResponse](docs/BatchCancelOrdersIndividualResponse.md)
 - [BatchCancelOrdersRequest](docs/BatchCancelOrdersRequest.md)
 - [BatchCancelOrdersResponse](docs/BatchCancelOrdersResponse.md)
 - [BatchCreateOrdersIndividualResponse](docs/BatchCreateOrdersIndividualResponse.md)
 - [BatchCreateOrdersRequest](docs/BatchCreateOrdersRequest.md)
 - [BatchCreateOrdersResponse](docs/BatchCreateOrdersResponse.md)
 - [CancelOrderResponse](docs/CancelOrderResponse.md)
 - [Cent](docs/Cent.md)
 - [CreateOrderRequest](docs/CreateOrderRequest.md)
 - [CreateOrderResponse](docs/CreateOrderResponse.md)
 - [DecreaseOrderRequest](docs/DecreaseOrderRequest.md)
 - [DecreaseOrderResponse](docs/DecreaseOrderResponse.md)
 - [EventData](docs/EventData.md)
 - [EventPosition](docs/EventPosition.md)
 - [ExchangeStatus](docs/ExchangeStatus.md)
 - [Fill](docs/Fill.md)
 - [Fills](docs/Fills.md)
 - [GetBalanceResponse](docs/GetBalanceResponse.md)
 - [GetEventResponse](docs/GetEventResponse.md)
 - [GetFillsResponse](docs/GetFillsResponse.md)
 - [GetMarketHistoryResponse](docs/GetMarketHistoryResponse.md)
 - [GetMarketOrderbookResponse](docs/GetMarketOrderbookResponse.md)
 - [GetMarketResponse](docs/GetMarketResponse.md)
 - [GetMarketsResponse](docs/GetMarketsResponse.md)
 - [GetOrderResponse](docs/GetOrderResponse.md)
 - [GetOrdersResponse](docs/GetOrdersResponse.md)
 - [GetPortfolioSettlementsResponse](docs/GetPortfolioSettlementsResponse.md)
 - [GetPositionsResponse](docs/GetPositionsResponse.md)
 - [GetSeriesResponse](docs/GetSeriesResponse.md)
 - [JSONError](docs/JSONError.md)
 - [LoginRequest](docs/LoginRequest.md)
 - [LoginResponse](docs/LoginResponse.md)
 - [Market](docs/Market.md)
 - [MarketPosition](docs/MarketPosition.md)
 - [MarketStatsPoint](docs/MarketStatsPoint.md)
 - [Order](docs/Order.md)
 - [OrderBook](docs/OrderBook.md)
 - [OrderList](docs/OrderList.md)
 - [OrderStatus](docs/OrderStatus.md)
 - [OrderType](docs/OrderType.md)
 - [OutputTime](docs/OutputTime.md)
 - [PriceLevel](docs/PriceLevel.md)
 - [PublicTrade](docs/PublicTrade.md)
 - [PublicTradeList](docs/PublicTradeList.md)
 - [PublicTradesGetResponse](docs/PublicTradesGetResponse.md)
 - [Series](docs/Series.md)
 - [Settlement](docs/Settlement.md)

## Documentation For Authorization

## bearer_token

- **Type**: API key
- **API key parameter name**: Authorization
- **Location**: HTTP header
- **Example**: "Authorization: Bearer f73f541a-fa99-42ca-87e3-bc593289d58d:P0hRpKR8lKkeVYsVYN13h382xsLThe1HbCb3BdGm2fgtoQVJwVLQF7JiiiRNfmQS"


## Author

support@kalshi.com


