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:])

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.1.tar.gz (5.2 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.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sbe-0.1.1.tar.gz
  • Upload date:
  • Size: 5.2 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.1.tar.gz
Algorithm Hash digest
SHA256 e353abc02049c21c47d93f14cb5e228059aa6c333163eae997f9128749b5ed96
MD5 21fa7babacba19b41a6111f239729646
BLAKE2b-256 306dd82203e329bd5ae36eaf647a94fc513237fce199a29e7576853e593788ba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sbe-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 44d58e2593e23cb6ab7a17e2455b972ca0f5b0e500106515a2b351cb9d3363dd
MD5 9ed58100cd8bf7d70c81e934e31613b3
BLAKE2b-256 804f56c5757845026d128fa03d8f6e3c850bc7670aa80da2835e5b239d37b09e

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