kalshi-python


Namekalshi-python JSON
Version 1.3.0 PyPI version JSON
download
home_pagehttps://github.com/Kalshi/kalshi-python
SummaryKalshi Trade API
upload_time2023-01-05 15:14:13
maintainer
docs_urlNone
author
requires_python
license
keywords swagger kalshi trade api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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 api](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 *
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 you.
kalshi_api = kalshi_python.ApiInstance(
    email='YOUR_EMAIL_HERE',
    password='YOUR_PASSWORD_HERE',
    configuration=config,
)

# Alternatively you can manage the authentication yourself by doing:
# kalshi_api = kalshi_python.ApiInstance(
#     configuration=config,
# )
# loginResponse = kalshi_api.login(LoginRequest(email='YOUR_EMAIL_HERE', password='YOUR_PASSWORD_HERE'))
# token = loginResponse.token
# kalshi_api.set_api_token(loginResponse.token)
# # The token used above can eventually expire if you stop using it for more than 30 minutes.
# # In that case you should redo the process by doing a new login request and setting the api token again in the same way.

# Checks if the exchange is available.
exchangeStatus = kalshi_api.get_exchange_status()
print('Exchange status response: ')
pprint(exchangeStatus)

# Gets the data for a specific series.
seriesTicker = 'FED'
seriesResponse = kalshi_api.get_series(seriesTicker)
print('\nSeries: ' + seriesTicker)
pprint(seriesResponse)

# Gets the data for a specific event.
eventTicker = 'FED-23DEC'
eventResponse = kalshi_api.get_event(eventTicker)
print('\nEvent: ' + seriesTicker)
pprint(eventResponse)

# 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)

# Gets the balance for your kalshi account.
balanceResponse = kalshi_api.get_balance()
print('\nUser balance: ')
pprint(balanceResponse)

if exchangeStatus.trading_active:
    # 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)
else:
    print('\nThe exchange is not trading active, no orders will be sent right now.')
```


## Additional resources

The documentation for the underlying web api used by the sdk [can be found here](https://trading-api.readme.io). 


## Author

support@kalshi.com



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Kalshi/kalshi-python",
    "name": "kalshi-python",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Swagger,Kalshi Trade API",
    "author": "",
    "author_email": "support@kalshi.com",
    "download_url": "https://files.pythonhosted.org/packages/4f/67/da5ca300b17d106ba86240b39909b91de2687b272794bd398a8ad04b55ce/kalshi_python-1.3.0.tar.gz",
    "platform": null,
    "description": "# kalshi_python\n\n This library is the official python SDK for algorithmic trading on [Kalshi](https://kalshi.com). \n    \nThis SDK is powered by [Kalshi's trading api](https://trading-api.readme.io). \n\nBy using this SDK, you agree to Kalshi's Developer Agreement (https://kalshi.com/developer-agreement).\n\nThis Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:\n\n- API version: 2.0.0\n- Package version: 1.0.0\n- Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen\n\n## Requirements.\n\nPython 2.7 and 3.4+\n\n## Installation & Usage\n\n### pip install\n\nIf the python package is hosted on Github, you can install directly from Github\n\n```sh\npip install kalshi-python\n```\n\nThen import the package:\n```python\nimport kalshi_python \n```\n\n## Quick start\n\nPlease follow the [installation procedure](#installation--usage) and then run the following:\n\n```python\nimport uuid\nimport kalshi_python\nfrom kalshi_python.models import *\nfrom pprint import pprint\n\nconfig = kalshi_python.Configuration()\n# Comment the line below to use production\nconfig.host = 'https://demo-api.kalshi.co/trade-api/v2'\n\n# Create an API configuration passing your credentials.\n# Use this if you want the kalshi_python sdk to manage the authentication for you.\nkalshi_api = kalshi_python.ApiInstance(\n    email='YOUR_EMAIL_HERE',\n    password='YOUR_PASSWORD_HERE',\n    configuration=config,\n)\n\n# Alternatively you can manage the authentication yourself by doing:\n# kalshi_api = kalshi_python.ApiInstance(\n#     configuration=config,\n# )\n# loginResponse = kalshi_api.login(LoginRequest(email='YOUR_EMAIL_HERE', password='YOUR_PASSWORD_HERE'))\n# token = loginResponse.token\n# kalshi_api.set_api_token(loginResponse.token)\n# # The token used above can eventually expire if you stop using it for more than 30 minutes.\n# # In that case you should redo the process by doing a new login request and setting the api token again in the same way.\n\n# Checks if the exchange is available.\nexchangeStatus = kalshi_api.get_exchange_status()\nprint('Exchange status response: ')\npprint(exchangeStatus)\n\n# Gets the data for a specific series.\nseriesTicker = 'FED'\nseriesResponse = kalshi_api.get_series(seriesTicker)\nprint('\\nSeries: ' + seriesTicker)\npprint(seriesResponse)\n\n# Gets the data for a specific event.\neventTicker = 'FED-23DEC'\neventResponse = kalshi_api.get_event(eventTicker)\nprint('\\nEvent: ' + seriesTicker)\npprint(eventResponse)\n\n# Replace the series ticker with the market ticker you want.\nmarketTicker = 'FED-23DEC-T3.00'\nmarketResponse = kalshi_api.get_market(marketTicker)\nprint('\\nMarket: ' + marketTicker)\npprint(marketResponse)\n\n# Gets the balance for your kalshi account.\nbalanceResponse = kalshi_api.get_balance()\nprint('\\nUser balance: ')\npprint(balanceResponse)\n\nif exchangeStatus.trading_active:\n    # Submit an order for 10 yes contracts at 50cents on 'FED-23DEC-T3.00'.\n    orderUuid = str(uuid.uuid4())\n    orderResponse = kalshi_api.create_order(CreateOrderRequest(\n        ticker=marketTicker,\n        action='buy',\n        type='limit',\n        yes_price=50,\n        count=10,\n        client_order_id=orderUuid,\n        side='yes',\n    ))\n    print('\\nOrder submitted: ')\n    pprint(orderResponse)\nelse:\n    print('\\nThe exchange is not trading active, no orders will be sent right now.')\n```\n\n\n## Additional resources\n\nThe documentation for the underlying web api used by the sdk [can be found here](https://trading-api.readme.io). \n\n\n## Author\n\nsupport@kalshi.com\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Kalshi Trade API",
    "version": "1.3.0",
    "split_keywords": [
        "swagger",
        "kalshi trade api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1eaa5119676f6fd83e6245c6ac95d323f9a14eb046050d7565887a2f6f7a47c2",
                "md5": "79fac4c2c0659e13f192d4394c3c33d3",
                "sha256": "5b93f12d056c53bc9b72e40332c101c02fba0f839e45b93850ab130b6b7ff23a"
            },
            "downloads": -1,
            "filename": "kalshi_python-1.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "79fac4c2c0659e13f192d4394c3c33d3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 147408,
            "upload_time": "2023-01-05T15:14:11",
            "upload_time_iso_8601": "2023-01-05T15:14:11.743507Z",
            "url": "https://files.pythonhosted.org/packages/1e/aa/5119676f6fd83e6245c6ac95d323f9a14eb046050d7565887a2f6f7a47c2/kalshi_python-1.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4f67da5ca300b17d106ba86240b39909b91de2687b272794bd398a8ad04b55ce",
                "md5": "ab39b03b44787e8af04b6afece028657",
                "sha256": "c1d84a98247bd5aebb6632c8467168543a4801e99f3f2cd2150b65b6966772ac"
            },
            "downloads": -1,
            "filename": "kalshi_python-1.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ab39b03b44787e8af04b6afece028657",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 53583,
            "upload_time": "2023-01-05T15:14:13",
            "upload_time_iso_8601": "2023-01-05T15:14:13.546315Z",
            "url": "https://files.pythonhosted.org/packages/4f/67/da5ca300b17d106ba86240b39909b91de2687b272794bd398a8ad04b55ce/kalshi_python-1.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-05 15:14:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "Kalshi",
    "github_project": "kalshi-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "tox": true,
    "lcname": "kalshi-python"
}
        
Elapsed time: 0.03950s