Skip to main content

No project description provided

Project description

sbe-python

Easy to use, pure Python FIX SBE encoder and decoder.

Install

pip isntall sbe

Usage

Decoding

import sbe

with open('your-schema.xml', 'r') as f:
  schema = sbe.Schema.parse(f)

wtih open('your-data.sbe', 'rb') as f:
  buf = f.read()

# Get a Python dict in one-line
x = schema.decode(buf)

x.name  # The template message name
# 'PriceFeed'

x.value
# {'userId': 11,
# 'timestamp': 1598784004840,
# 'orderSize': 0,
# 'price': 5678.0,
# ...

# If you need an offset, apply them Pythonicaly
schema.decode(buf[19:])

# decode_header to avoid filter out messages based on header to avoid decoding
# message bodies that are not needed
schema.decode_header(buf)['templateId']

Encoding

import sbe

with open('./your-schema.xml', 'r') as f:
  schema = sbe.Schema.parse(f)

# message_id from the schema you want to encode
message_id = 3

# Encode from Python dict in one-line
schema.encode(schema.messages[3], obj)

# You can supply your header values as a dict
schema.encode(schema.messages[3], obj, headers)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sbe-0.1.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sbe-0.1.2-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file sbe-0.1.2.tar.gz.

File metadata

  • Download URL: sbe-0.1.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for sbe-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5d317d375d229ae86ced9c69baf23c17b800648925a3ef18681c0505299f761f
MD5 f08ff111ddc20822b634c7530a85a70a
BLAKE2b-256 dcf6243f2c52781615d581992e19ed616c56b85a840e67b091bb96b1a3f26bd0

See more details on using hashes here.

File details

Details for the file sbe-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: sbe-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for sbe-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 83b2df9d91e77bcecba200d16d466114db1e14ce5cd49d6176a6f69578438b80
MD5 991eed7f7aa71234851b147e1ec0861f
BLAKE2b-256 9c9e30e9c2b17be3458eaff3a0b748fd2a53718ac6cf1d595cf1578f3dc622ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page