
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Generated with DocToc
Last Update: 2020-05-17
Subscribe to all websocket channels available at blockchain.com | exchage:
Subscription to new channels doesn't require client restart
Create Market orders
Create Limit orders
All API is available through a websocket client:
import logging
from bcx.client import BlockchainWebsocketClient
logging.basicConfig(level=logging.INFO)
client = BlockchainWebsocketClient()
See our documentation for API reference and gallery of examples for more info.
In order to get started you should have Python>=3.6 installed.
This is as simple as running
pip install bcx
Get source code
git clone git@github.com:ilya-bc/blockchain-exchange-api.git
cd blockchain-exchange-api
Install package in editable mode. Since there are hundred ways to do that, a standardised way for this project is with Makefile
. It will create virtual environment with pipenv
based on python==3.7
and install all necessary dependencies for development
make install-dev
If you don't have pipenv
or prefer to manage a virtual environment using different tools, then you can use
pip install -e '.[dev]'
In order to build documentation
(cd docs && make html)
open docs/build/html/index.html
:exclamation: Important: Building documentation will execute example scripts, so be extremely cautious when writing sample scripts that make use of trading channel.
Actual trading and accessing balance of your account requires authentication with an API key. In order to get one:
You should have an account at blockchain.com | exchange
Create API key here and store information. Note, you can have setup key with permissions view
and view & trade
.
You should receive an email asking you to activate API key.
Setup the following environment variable
export BLOCKCHAIN_API_SECRET="__ENTER_YOUR_API_SECRET_HERE__"
:fire: Tip: If you use pipenv
then you can just put it into .env
file (ignored by git) at the root of the cloned directory
:pencil2: Note: There are time.sleep(2)
between calling different methods, in order to be able to see intermediate results.
:pencil2: Note: Both orders got rejected (expected behaviour) because of invalid quantity and price being to big.
[
{"channel": "l2", "symbol": "BTC-USD"},
{"channel": "ticker", "symbol": "BTC-USD"},
{"channel": "trades", "symbol": "BTC-USD"}
]
[
{"seqnum":1,"event":"subscribed","channel":"prices","symbol":"BTC-USD","granularity":60},
{"seqnum":2,"event":"subscribed","channel":"prices","symbol":"ETH-USD","granularity":60},
{"seqnum":3,"event":"subscribed","channel":"prices","symbol":"BTC-USD","granularity":300},
{"seqnum":4,"event":"subscribed","channel":"prices","symbol":"ETH-USD","granularity":300}
]
[
{"seqnum":0,"event":"subscribed","channel":"ticker","symbol":"BTC-USD"},
{"seqnum":1,"event":"snapshot","channel":"ticker","symbol":"BTC-USD","price_24h":8744.9,"volume_24h":155.77132628,"last_trade_price":8881.0},
{"seqnum":2,"event":"updated","channel":"ticker","symbol":"BTC-USD","price_24h":8754.8,"volume_24h":155.70446581}
]
FAQs
Blockchain.com Exchange API
We found that bcx demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.