A Python library for buying and selling cryptocurrencies by pair across multiple exchanges. Built for Sertis Corp as part of their interview process.
- Supports kraken-futures and binance spot exchanges
- Simple to extend, adding exchanges, pairs, and order types
- Place and monitor market buy/sell orders
- Normalized OHLC data across exchanges
Run poetry build
to build the package and then pip install dist/sertis_crypto_exchange_client-0.1.0-py3-none-any.whl
to install it.
>>> from scec import Broker
>>> Broker()
<scec.broker.Broker object at 0x104e6e7e0>
See the docs for autogenerated documentation on the broker and exchange classes. See examples for usage example - buying and selling across multiple exchanges and pairs.
Sign up for a demo Kraken Futures account over at https://demo-futures.kraken.com - then create an API and Secret Key
A demo binance account can be created at https://testnet.binance.vision/
- Be sure to run
poetry install
to install the development dependencies. - Install
poethepoet
in your environment to run tasks withpoe <task>
. - Run
poe test
orpoetry run pytest --cov
to run tests and check coverage. Example test output:
---------- coverage: platform darwin, python 3.12.2-final-0 ----------
Name Stmts Miss Cover
------------------------------------------------------
scec/__init__.py 2 0 100%
scec/broker.py 42 3 93%
scec/exchanges/__init__.py 4 0 100%
scec/exchanges/base.py 94 8 91%
scec/exchanges/binance.py 46 0 100%
scec/exchanges/exceptions.py 14 0 100%
scec/exchanges/kraken_futures.py 67 7 90%
------------------------------------------------------
TOTAL 269 18 93%
PoeThePoet or poe
is a simple taskrunner compatible with pyproject.toml, you can
run common tasks easily by running poe <task>
- think of it like npm run <task>
To be able to run tasks you can install PoeThePoet with pip install poethepoet
and then run poe
to a see a list of
configured tasks.
Please implement all abstract methods from the scec.exchanges.CryptoCurrencyExchange
class and add tests for the
exchange under scec.tests.exchanges
- This library is not production-ready and should not be used for trading real money.
- The library is not optimized for speed or memory usage.
- Ideally the library would spin up another thread and constantly listen to websocket updates for orderbook changes, this is not implemented however due to time-constraints.
- No CI pipeline as of yet, but tests, linting, and type checking are easily run locally!