All Projects → acontry → coinbasepro

acontry / coinbasepro

Licence: MIT license
A Python API for Coinbase Pro

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to coinbasepro

Coinbase.Pro
📈 A .NET/C# implementation of the Coinbase Pro API.
Stars: ✭ 63 (+21.15%)
Mutual labels:  coinbase-pro, coinbasepro, coinbasepro-api
rgdax
Wrapper for Coinbase pro (erstwhile GDAX) Cryptocurrency exchange
Stars: ✭ 34 (-34.62%)
Mutual labels:  coinbase-pro, coinbasepro, coinbasepro-api
BitView
A crypto portfolio written in Flutter. It supports Binance, Bittrex, HitBTC, Coinbase, Coinbase Pro and Mercatox
Stars: ✭ 50 (-3.85%)
Mutual labels:  coinbasepro, coinbasepro-api
Pi-Trader
A cryptocurrency day-trading bot for Raspberry Pi.
Stars: ✭ 44 (-15.38%)
Mutual labels:  coinbase-pro, coinbasepro-api
Coinbase-Pro-Crypto-Trading-Bot-CrypFinder
This is a crypto trading bot made in NodeJS that uses the coinbase pro API.
Stars: ✭ 138 (+165.38%)
Mutual labels:  coinbase-pro, coinbasepro-api
cryptogalaxy
Get any cryptocurrencies ticker and trade data in real time from multiple exchanges and then save it in multiple storage systems.
Stars: ✭ 96 (+84.62%)
Mutual labels:  coinbase-pro
socketcluster-client-python
Python client for socket-cluster framework in node.js
Stars: ✭ 47 (-9.62%)
Mutual labels:  python-client
gdax
GDAX PHP API Client Library
Stars: ✭ 15 (-71.15%)
Mutual labels:  coinbase-pro
pymobird
A python client for memobird printer
Stars: ✭ 18 (-65.38%)
Mutual labels:  python-client
onesait-cloud-platform-clientlibraries
Client libraries to interact with Onesait Platform Cloud Side (Digital Broker specially)
Stars: ✭ 15 (-71.15%)
Mutual labels:  python-client
gnewsclient
An easy-to-use python client for Google News feeds.
Stars: ✭ 42 (-19.23%)
Mutual labels:  python-client
etcd3-py
Pure python client for etcd v3 (Using gRPC-JSON-Gateway)
Stars: ✭ 97 (+86.54%)
Mutual labels:  python-client
graspit commander
Python ROS Client for GraspIt!
Stars: ✭ 15 (-71.15%)
Mutual labels:  python-client
CoinTaxman
Calculate your taxes from cryptocurrency gains
Stars: ✭ 110 (+111.54%)
Mutual labels:  coinbase-pro
cryptojp
cryptojp is a Python2 and Python3 client for crypto coin trade. Binance/Poloniex/Hitbtc/Bitflyer etc...
Stars: ✭ 22 (-57.69%)
Mutual labels:  python-client
notion-sdk-py
Official Notion SDK rewritten in Python (sync + async)
Stars: ✭ 753 (+1348.08%)
Mutual labels:  python-client
Crypto Signal
Github.com/CryptoSignal - #1 Quant Trading & Technical Analysis Bot - 3,100+ stars, 900+ forks
Stars: ✭ 3,690 (+6996.15%)
Mutual labels:  coinbase-pro
Confluent Kafka Python
Confluent's Kafka Python Client
Stars: ✭ 2,578 (+4857.69%)
Mutual labels:  python-client
PyBaiduPan
A python client for Baidu Pan.
Stars: ✭ 28 (-46.15%)
Mutual labels:  python-client
assemblyline client
Python client for Assemblyline 3 and 4 / Client python pour AssemblyLine 3 and 4
Stars: ✭ 19 (-63.46%)
Mutual labels:  python-client

CoinbasePro: A Python API

Features

  • Full support of Coinbase Pro/Coinbase Exchange REST API

  • Rate-limiting - no more 429 error responses!

  • Pythonic abstractions for a clean interface
    • Return values are returned as Python data types instead of all string values:
    >>> import coinbasepro as cbp
    >>> client = cbp.PublicClient()
    # datetime and Decimal are among the return types in the dict returned
    # by this call:
    >>> client.get_product_ticker('BTC-USD')
    {'trade_id': 2845680,
    'price': Decimal('2496.69000000'),
    'size': Decimal('0.00100000'),
    'time': datetime.datetime(2019, 3, 20, 23, 53, 59, 596000),
    'bid': Decimal('2496.69'), 'ask': Decimal('2496.7'),
    'volume': Decimal('771.51495215')}
    • Paginated endpoints are abstracted as generators:
    >>> import itertools
    # get_product_trades is a generator
    >>> client.get_product_trades('BTC-USD')
    <generator object PublicClient.get_product_trades.<locals>.<genexpr> at 0x1098d6f68>
    
    # Get 2 most recent trades. For many trade requests (>100), multiple
    # HTTP requests will be made under the hood.
    >>> list(itertools.islice(client.get_product_trades('BTC-USD'), 2))
    [{'time': datetime.datetime(2019, 3, 21, 0, 2, 45, 609000),
    'trade_id': 2845779,
    'price': Decimal('2463.38000000'),
    'size': Decimal('0.00100000'),
    'side': 'buy'},
    {'time': datetime.datetime(2019, 3, 21, 0, 2, 39, 877000),
    'trade_id': 2845778,
    'price': Decimal('2463.39000000'),
    'size': Decimal('0.00100000'),
    'side': 'sell'}]
    • Warts in the Coinbase REST API are smoothed out:
    # CBPro API returns raw candles from this call as tuples, which would
    # require user to look up value meaning in API docs. This python API
    # returns candles as a list of dicts, similar to other API endpoints.
    
    # Get first candle:
    >>> client.get_product_historic_rates('BTC-USD')[0]
    {'time': datetime.datetime(2019, 3, 21, 0, 6),
    'low': Decimal('2463.3'),
    'high': Decimal('2463.31'),
    'open': Decimal('2463.3'),
    'close': Decimal('2463.31'),
    'volume': Decimal('0.006')}
    • Python API uses typing available in Python3:
    # Example function prototype in API
    def get_product_ticker(self, product_id: str) -> Dict[str, Any]:
  • Exceptions to enable easy handling of Coinbase error responses

>>> client.get_product_ticker(product_id='fake_product')
coinbasepro.exceptions.CoinbaseAPIError: NotFound
>>> auth_client = cbp.AuthenticatedClient(key='fake',
                                          secret='fake',
                                          passphrase='fake')
>>> auth_client.get_accounts()
coinbasepro.exceptions.BadRequest: Invalid API Key
# Authenticated client using API key which doesn't have withdrawal
# privileges:
>>> auth_client.withdraw_to_coinbase(0.01, 'BTC', 'fake_acct_id')
coinbasepro.exceptions.InvalidAuthorization: Forbidden
# This call throws a BadRequest exception
>>> auth_client.get_order('invalid_order_num')
coinbasepro.exceptions.BadRequest: Invalid order id

# CoinbaseAPIError is the parent exception for all exceptions the API
# throws, so catching this will catch anything
>>> try:
>>>     auth_client.get_order('invalid_order_num')
>>> except cbp.exceptions.CoinbaseAPIError as e:
>>>     print('Caught error: {}'.format(e))
Caught error: Invalid order id

Installation

$ pip install coinbasepro

Development

Environment Setup

  1. Create virtual environment using preferred tool
  2. Bootstrap pip-tools by installing dev requirements directly:
$ pip install -r requirements.txt

Once pip-tools is installed in your environment, you can update requirements by:

$ make install-requirements

3. (Optional) Install pre-commit git hooks. This will run pre-commit with every commit, which should fix any lint issues before you push changes to your remote branch.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].