skip to navigation
skip to content

smk_python_sdk 1.1.10

Smarkets Python SDK - API clients and utility library

Latest Version: 9.4.1

Smarkets Python library (streaming API client, id generation, more to come).

Compatible with Python 2.x >= 2.6 and PyPy 1.9+.


Installing using source distribution

When you install smk-python-sdk using PyPI distribution there are no non-Python dependencies. All the Python dependencies will be fetched for you when you install smk-python-sdk.

PyPI page:

pip install smk-python-sdk

Getting Started

import logging

from smarkets.streaming_api.api import (
    BUY, GOOD_TIL_CANCELLED, OrderCreate, SessionSettings, Session, StreamingAPIClient)

username = 'username'
password = 'password'

settings = SessionSettings(username, password) = ''
settings.port = 3701

session = Session(settings)

client = StreamingAPIClient(session)


market_id = client.str_to_uuid128('fc024')

order = OrderCreate()
order.quantity = 400000 # £40 payout
order.price = 2500 # 25.00%
order.side = BUY = market_id
order.contract = client.str_to_uuid128('fcccc')
order.time_in_force = GOOD_TIL_CANCELLED


Registering callbacks

from google.protobuf import text_format

def login_response(msg):
    print("eto.login_response", text_format.MessageToString(msg))

def global_callback(name, msg):
    print(name, text_format.MessageToString(msg))

client.add_handler('eto.login_response', login_response)

Thread Safety

Functions and class members contained in this package are thread safe. Instance members are not thread safe.


GitHub repository:

Non-Python dependencies:

  • piqi
  • Google protocol buffers compiler and libraries

You can install Python dependencies by executing:

pip install -r requirements-dev-py2.txt

To build and install call:

python clean build install

Note: building the package does not fetch the most recent piqi files from their respective locations in In order to do so, you must call python clean, and then python build.


Copyright (C) 2011-2013 Smarkets Limited <>

This module is released under the MIT License: (or see the LICENSE file)

File Type Py Version Uploaded on Size
smk_python_sdk-1.1.10-py2.py3-none-any.whl (md5) Python Wheel 2.7 2014-03-28 48KB
smk_python_sdk-1.1.10.tar.gz (md5) Source 2014-03-28 57KB