Skip to main content

Biscoint API wrapper for python

This is a simple wrapper for Biscoint's API (v1). It handles all authentication stuffs so you can just worry about your killer robot.

Dependencies

It only depends on the awesome requests package.

Usage

pip install biscoint-api-python

Example

import json
import requests

from biscoint_api_python import Biscoint

api_data = {
    'api_key': '3ddc931bf25c94ff0344a2e409aa37339e400b8d4da72265f97c3a31d0cfb36e',
    'api_secret': 'd4c4db1567fba7dbc63b73e0a5c3a810360825a1de4530e05a77652efce91bcb',
}

bsc = Biscoint(api_data['api_key'], api_data['api_secret'])

try:
    ticker = bsc.get_ticker()
    print(json.dumps(ticker, indent=4))

    """
    {
        "base": "BTC",
        "quote": "BRL",
        "vol": 0.07414472,
        "low": 36010.54,
        "high": 36285,
        "last": 36069,
        "ask": 35343.56,
        "askQuoteAmountRef": 1000,
        "askBaseAmountRef": 0.0282937,
        "bid": 35149.76,
        "bidQuoteAmountRef": 1000,
        "bidBaseAmountRef": 0.0284497,
        "timestamp": "2020-01-23T12:26:11.564Z"
    }
    """

    fees = bsc.get_fees()
    print(json.dumps(fees, indent=4))

    """
    {
        "withdrawal": {
            "BTC": {
                "rate": "0.0",
                "fixed": {
                    "slow": "0.00005",
                    "normal": "0.00013",
                    "fast": "0.0002"
                }
            },
            "BRL": {
                "rate": "0.0",
                "fixed": {
                    "ted": "14.90",
                    "sameBankTransfer": "14.90"
                }
            }
        }
    }
    """

    meta = bsc.get_meta()
    print(json.dumps(meta, indent=4))

    """
    {
        "version": "v1",
        "endpoints": {
            "ticker": {
                "get": {
                    "type": "public",
                    "rateLimit": {
                        "windowMs": 60000,
                        "maxRequests": 6000,
                        "rate": "6000 per 1 minute"
                    }
                }
            },
            "fees": {
                "get": {
                    "type": "public",
                    "rateLimit": {
                        "windowMs": 60000,
                        "maxRequests": 2000,
                        "rate": "2000 per 1 minute"
                    }
                }
            },
            "meta": {
                "get": {
                    "type": "public",
                    "rateLimit": {
                        "windowMs": 60000,
                        "maxRequests": 2000,
                        "rate": "2000 per 1 minute"
                    }
                }
            },
            "balance": {
                "get": {
                    "type": "private",
                    "rateLimit": {
                        "windowMs": 60000,
                        "maxRequests": 12000,
                        "rate": "12000 per 1 minute"
                    }
                }
            },
            "offer": {
                "get": {
                    "type": "private",
                    "rateLimit": {
                        "windowMs": 60000,
                        "maxRequests": 24000,
                        "rate": "24000 per 1 minute"
                    }
                },
                "post": {
                    "type": "private",
                    "rateLimit": {
                        "windowMs": 60000,
                        "maxRequests": 24000,
                        "rate": "24000 per 1 minute"
                    }
                }
            },
            "trades": {
                "get": {
                    "type": "private",
                    "rateLimit": {
                        "windowMs": 60000,
                        "maxRequests": 12000,
                        "rate": "12000 per 1 minute"
                    }
                }
            }
        }
    }
    """

    balance = bsc.get_balance()
    print(json.dumps(balance, indent=4))

    """
    {
        "BRL": "9580.58",
        "BTC": "0.01138164"
    }
    """

    trades = bsc.get_trades(op='buy', length=1)
    print(json.dumps(trades, indent=4))

    """
    [
        {
            "id": "D6x63B3q3Mec4tggY",
            "op": "buy",
            "base": "BTC",
            "quote": "BRL",
            "baseAmount": "0.01000000",
            "quoteAmount": "362.82",
            "apiKeyId": "BdFABxNakZyxPwnRu",
            "efPrice": "36282.00",
            "date": "2020-01-22T23:25:02.785Z"
        }
    ]
    """

    offer = bsc.get_offer('buy', '0.002', False)
    print(json.dumps(offer, indent=4))

    """
    {
        "offerId": "ets52q7WQLrWw79Bq",
        "base": "BTC",
        "quote": "BRL",
        "op": "buy",
        "isQuote": false,
        "baseAmount": "0.01000000",
        "quoteAmount": "353.43",
        "efPrice": "35343.00",
        "createdAt": "2020-01-23T12:26:13.454Z",
        "expiresAt": "2020-01-23T12:26:28.454Z",
        "apiKeyId": "BdFABxNakZyxPwnRu"
    }
    """

    # WARNING: this will actually execute the buy operation!
    offerConfirmation = bsc.confirm_offer(offer['offerId'])
    print(json.dumps(offerConfirmation, indent=4))

    """
    {
        "offerId": "ets52q7WQLrWw79Bq",
        "base": "BTC",
        "quote": "BRL",
        "op": "buy",
        "isQuote": false,
        "baseAmount": "0.01000000",
        "quoteAmount": "353.43",
        "efPrice": "35343.00",
        "createdAt": "2020-01-23T12:26:13.454Z",
        "confirmedAt": "2020-01-23T12:26:14.096Z",
        "apiKeyId": "BdFABxNakZyxPwnRu"
    }
    """
except requests.exceptions.HTTPError as error:
    print(error)
    print(json.dumps(error.response.json(), indent=4))

Release files for biscoint-api-python 0.6.0

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

Source distribution (sdist)

Source distribution for biscoint-api-python 0.6.0
File Size Uploaded
biscoint-api-python-0.6.0.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for biscoint-api-python 0.6.0
File Interpreter ABI Platform
biscoint_api_python-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / biscoint-api-python-0.6.0.tar.gz

Download URL biscoint-api-python-0.6.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f6f10c0a71a00822d8d7459f4110fc430ccceff3a7530e159b313b3410f05c24
BLAKE2b-256 checksum
How to use checksums
e249c69a2ea0bbb5fd2fcfbc3988fd42e1465607566bda0c2678e20ece227fa4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.8.1

Release files / biscoint_api_python-0.6.0-py3-none-any.whl

Download URL biscoint_api_python-0.6.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9cb304b284bbc4d46bdd15083e8c3d877195e694e6b122d7e3776f8a437fc1d9
BLAKE2b-256 checksum
How to use checksums
c8ed992812e6dd58a25cc0b5826947fcca6b0c5ad772d44fabc8a949c5443532
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.8.1

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

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