Skip to main content

bitmex-websocket

Install

$ pip install bitmex-websocket

Usage

  1. First you should set your BITMEX_API_KEY and BITMEX_API_SECRET. It can be done as follows:

$ cp .env.example .env
#  edit .env to reflect your API key and secret
$ source .env
  1. Then in your project you can consume Instrument as follows:

import websocket

from bitmex_websocket import Instrument
from bitmex_websocket.constants import InstrumentChannels

websocket.enableTrace(True)


channels = [
    InstrumentChannels.quote,
    InstrumentChannels.trade,
    InstrumentChannels.orderBookL2
]

XBTUSD = Instrument(symbol='XBTUSD',
                    channels=channels)
XBTUSD.on('action', lambda msg: print(msg))

XBTUSD.run_forever()

TestNet

You may change the BASE_URL by setting the BITMEX_BASE_URL environment variable to: https://testnet.bitmex.com/api/v1/.

Examples

Run example scripts:

$ ./examples/example.py

Tests

Testing is set up using pytest <http://pytest.org> and coverage is handled with the pytest-cov plugin.

Run your tests with pytest in the root directory.

Coverage is ran by default and is set in the pytest.ini file. To see an html output of coverage open htmlcov/index.html after running the tests.

Metadata

Release files for bitmex-websocket 0.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bitmex-websocket 0.3.5
File Size Uploaded Provenance Actions
bitmex_websocket-0.3.5.tar.gz 10.6 kB Without provenance Details for bitmex_websocket-0.3.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bitmex-websocket 0.3.5
File Interpreter ABI Platform Actions
bitmex_websocket-0.3.5-py2.py3-none-any.whl Python 3, Python 2 none any Details for bitmex_websocket-0.3.5-py2.py3-none-any.whl

Total release size: 20.4 kB

Release files / bitmex_websocket-0.3.5.tar.gz

Download URL bitmex_websocket-0.3.5.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
084087671a8cc1ced7b803beae187574c391ed3eae6fa5d37db8e0cfd5066b98
BLAKE2b-256 checksum
How to use checksums
f4101eada56be1082328a82908d930f65ea147ed053b7334162b561b0dc005e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / bitmex_websocket-0.3.5-py2.py3-none-any.whl

Download URL bitmex_websocket-0.3.5-py2.py3-none-any.whl
Size 9.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
1b873e1bea31050f1d757850140173b283e9ee2101c199d91828b7bfbdcba234
BLAKE2b-256 checksum
How to use checksums
3ed35ba73abbc4ff306dbaef077442fd747ac89b53e41c7242931953121f5511
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Security for bitmex-websocket 0.3.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.5 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page