Bitmex websocket API
Project description
Install
$ pip install bitmex-websocket
Usage
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
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(message))
XBTUSD.run_forever()
Examples
Run example scripts:
$ RUN_ENV=development python -m ./examples/example-2.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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
bitmex_websocket-0.2.51-py3.6.egg
(14.6 kB
view hashes)
Close
Hashes for bitmex_websocket-0.2.51-py3.6.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5a866443cb4d5915f521aefc590ad0507f70506298655a9747bb530fd843a12 |
|
MD5 | 15756b2517469194064742c54c737737 |
|
BLAKE2b-256 | 6c8da4738d72b292d742b30c2ee82ab1fd480caa5870b64d3b014be6fdee2974 |
Close
Hashes for bitmex_websocket-0.2.51-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 241825b15c353fcafcf5925df699d5a3b84ef54d9cd0532a8dd681a2a8aea25a |
|
MD5 | 46eed0ec08424e0e6fb0ab67174a22ff |
|
BLAKE2b-256 | 9ab00fcc7f18a91fdbc05e8a0d5a3822b27ce92d2b3d4640faf8160913879cb1 |