Bitstamp API wrapper for Python

Overview

NOTICE: THIS REPOSITORY IS NO LONGER ACTIVELY MAINTAINED

It is highly unlikely that I will respond to PRs and questions about usage.

This library was written a long time ago and not kept up to date. It may still hold value for you but it's increasingly out of date with the modern Bitstampy API and Python versions.

I heartily encourage a fork and welcome any contact about taking over ownership - find me at https://twitter.com/unwttng.

bitstampy

Bitstamp API wrapper for Python

Installation

Is pretty bloody easy, as long as you've got pip installed. If you haven't, take a look at the pip documentation - it's worth getting familiar with!

pip install bitstampy

Usage

> from bitstampy import api

Public calls (no API authorisation needed)

Ticker

# Ticker information
> api.ticker()
{
    'timestamp': datetime,   # Datetime
    'volume': decimal,       # Last 24 hours volume
    'last': decimal,         # Last BTC price
    'high': decimal,         # Last 24 hours high
    'low': decimal,          # Last 24 hours low
    'bid': decimal,          # Highest buy order
    'ask': decimal           # Lowest ask order
}

Order Book

# Global order book (see live at https://www.bitstamp.net/market/order_book/)
# Parameters
## [group = True] - Group orders with same price?
##                - boolean
> api.order_book()
{
    'timestamp': datetime,      # Datetime
    'bids': [                   # List of bids
        {
            'price': decimal,   ## Price for bid
            'amount': decimal   ## Amount bid
        }, ...
    ],
    'asks': [                   # List of asks
        {
            'price': decimal,   ## Price for ask
            'amount': decimal   ## Amount asked
        }, ...
    ]
}

Transactions

# Global transactions
# Parameters
## [offset = 0]    - Skip this many transactions before starting return list
##                 - int
## [limit = 100]   - Return this many transactions after the offset
##                 - int
## [sort = 'desc'] - Results are sorted by datetime
##                 - string - api.TRANSACTIONS_SORT_DESCENDING or
##                 -        - api.TRANSACTIONS_SORT_ASCENDING
> api.transactions()
[                           # List of transactions, length 'limit'
    {
        'date': datetime,   ## Datetime
        'tid': string,      ## Transaction ID
        'price': decimal,   ## Transaction price
        'amount': decimal   ## Transaction amount
    }, ...
]

EUR/USD Conversion Rate

# Bitstamp's Dollar to Euro conversion rate
> api.eur_usd_conversion_rate()
{
    'sell': decimal,   # Conversion rate for selling
    'buy': decimal     # Conversion rate for buying
}

Private calls (authorisation required)

Every call after this point requires you to have a working API key and secret associated with your account on Bitstampy. To get one set up, head to your Account > Security > API Access. Choose a set of permissions you'd like the key to have - the meaning of each of these should be pretty clear. After you've created a key, you need to activate it - this is done via a confirmation link in an email.

You'll get an API key and an associated secret. Note these down in your incredibly secure password manager / encrypted system / sneaky hidden notepad of choice, because Bitstampy'll only let you view the API secret for 5 minutes after you activate it ('cus security).

Each of the following API function calls takes three additional parameters - client_id, api_key and api_secret. The API key and secret are obvious, and client_id is your customer ID on Bitstampy (the numerical one). I'll include them in the function prototypes abbreviated as c, k, s.

Let's see the rest of the calls! These are the interesting ones because they get you access to do actual stuff stuff with your account.

Account Balance

# Your account balance
> api.account_balance(c, k, s)
{
    'usd_balance': decimal,     # US Dollar balance
    'btc_balance': decimal,     # Bitcoin balance
    'usd_reserved': decimal,    # US Dollars reserved in open orders
    'btc_reserved': decimal,    # Bitcoins reserved in open orders
    'usd_available': decimal,   # US Dollars available
    'btc_available': decimal,   # Bitcoins available
    'fee': decimal              # Account trading fee (in %)
}

User Transactions

# Your transactions
# Parameters
## [offset = 0]    - Skip this many transactions before starting return list
##                 - int
## [limit = 100]   - Return this many transactions after the offset
##                 - int
## [sort = 'desc'] - Results are sorted by datetime
##                 - string - api.USER_TRANSACTIONS_SORT_DESCENDING or
##                 -        - api.USER_TRANSACTIONS_SORT_ASCENDING
> api.user_transactions(c, k, s)
[                               # List of transactions, length 'limit'
    {
        'datetime': datetime,   ## Datetime
        'id': string,           ## Transaction ID
        'type': string,         ## Transaction type - one of
                                ### api.USER_TRANSACTIONS_TYPE_DEPOSIT,
                                ### api.USER_TRANSACTIONS_TYPE_WITHDRAWAL,
                                ### api.USER_TRANSACTIONS_TYPE_MARKET_TRADE
        'usd': decimal,         ## US Dollar amount
        'btc': decimal,         ## Bitcoin amount
        'fee': decimal,         ## Transaction fee (in %)
        'order_id': decimal     ## Transaction amount
    }, ...
]

Open Orders

# Your open orders
> api.open_orders(c, k, s)
[                               # List of open orders
    {
        'datetime': datetime,   ## Datetime
        'id': string,           ## Order ID
        'type': string,         ## Order type - one of
                                ### api.OPEN_ORDERS_TYPE_BUY,
                                ### api.OPEN_ORDERS_TYPE_SELL
        'price': decimal,       ## Order price
        'amount': decimal       ## Order amount
    }, ...
]

Cancel Order

# Cancel an order
# Parameters
## order_id - ID of order to cancel
##          - string
> api.cancel_order(c, k, s)
True / False   # Returns boolean success

Buy Limit Order

# Place a buy order
## amount - Amount to buy
##        - float
## price  - Price to offer
##        - float
> api.buy_limit_order(c, k, s)
{
    'datetime': datetime,   # Datetime placed
    'id': string,           # Order ID
    'type': string,         # Order type - one of 
                            ## api.BUY_LIMIT_ORDER_TYPE_BUY,
                            ## api.BUY_LIMIT_ORDER_TYPE_SELL
    'price': decimal,       # Placed order price
    'amount': decimal       # Placed order amount
}

Sell Limit Order

# Place a sell order
## amount - Amount to sell
##        - float
## price  - Price to ask for
##        - float
> api.sell_limit_order(c, k, s)
{
    'datetime': datetime,   # Datetime placed
    'id': string,           # Order ID
    'type': string,         # Order type - one of 
                            ## api.SELL_LIMIT_ORDER_TYPE_BUY,
                            ## api.SELL_LIMIT_ORDER_TYPE_SELL
    'price': decimal,       # Placed order price
    'amount': decimal       # Placed order amount
}

Check Bitstamp Code

# Check the value of a bitstamp code
## code - Bitstamp code
##      - string
> api.check_bitstamp_code(c, k, s)
{
    'usd': decimal,   # US Dollar amount in the code
    'btc': decimal    # Bitcoin amount in the code
}

Redeem Bitstamp Code

# Redeem a bitstamp code
## code - Bitstamp code
##      - string
> api.redeem_bitstamp_code(c, k, s)
{
    'usd': decimal,   # US Dollar amount added to account by code
    'btc': decimal    # Bitcoin amount added to account by code
}

Withdrawal Requests

# Get list of withdrawal requests
> api.withdrawal_requests(c, k, s)
[                               # List of withdrawal requests
    {
        'datetime': datetime,   ## Datetime
        'id': string,           ## Withdrawal ID
        'type': string,         ## Request type - one of
                                ### api.WITHDRAWAL_REQUEST_TYPE_SEPA,
                                ### api.WITHDRAWAL_REQUEST_TYPE_BITCOIN,
                                ### api.WITHDRAWAL_REQUEST_TYPE_WIRE,
                                ### api.WITHDRAWAL_REQUEST_TYPE_BITSTAMP_CODE_1,
                                ### api.WITHDRAWAL_REQUEST_TYPE_BITSTAMP_CODE_2,
                                ### api.WITHDRAWAL_REQUEST_TYPE_MTGOX
        'status': string,       ## Request status - one of
                                ### api.WITHDRAWAL_REQUEST_STATUS_OPEN,
                                ### api.WITHDRAWAL_REQUEST_STATUS_IN_PROCESS,
                                ### api.WITHDRAWAL_REQUEST_STATUS_FINISHED,
                                ### api.WITHDRAWAL_REQUEST_STATUS_CANCELLED,
                                ### api.WITHDRAWAL_REQUEST_STATUS_FAILED
        'amount': decimal,      ## Request amount
        'data': string          ## Extra data (specific to type)
    }, ...
]

Bitcoin Withdrawal

# Withdraw bitcoins to an address
## amount  - amount to withdraw in BTC
##         - decimal
## address - bitcoin address to withdraw to
##         - string
> api.bitcoin_withdrawal(c, k, s)
True / False   # Returns boolean success

Bitcoin Deposit Address

# Get your account's address for bitcoin deposits
> api.bitcoin_deposit_address(c, k, s)
# Returns deposit address as string

Unconfirmed Bitcoin Deposits

# Retrieve list of as-yet unconfirmed bitcoin deposits into your account
> api.unconfirmed_bitcoin_deposits(c, k, s)
[                              # List of unconfirmed deposits
    {
        'amount': decimal,     ## Amount deposited
        'address': string,     ## Address deposited to
        'confirmations': int   ## How many confirmations on the deposit so far
    }, ...
]
Owner
Jack Preston
twitter.com/unwttng
Jack Preston
This Lambda will Pull propagated routes from TGW and update VPC route table

AWS-Transitgateway-Route-Propagation This Lambda will Pull propagated routes from TGW and update VPC route table. Tested on python 3.8 Lambda AWS INST

4 Jan 20, 2022
Python 3 tools for interacting with Notion API

NotionDB Python 3 tools for interacting with Notion API: API client Relational database wrapper Installation pip install notiondb API client from noti

Viet Hoang 14 Nov 24, 2022
An open source API to validate the EU Covid Certificates / Green Certificates

Open Covid Certificate Validator This an open source API to validate EU Digital COVID Certificates. It receives a COVID certificate and validates it u

Merlin Schumacher 47 May 30, 2022
Tomli is a Python library for parsing TOML. Tomli is fully compatible with TOML v1.0.0.

Tomli A lil' TOML parser Table of Contents generated with mdformat-toc Intro Installation Usage Parse a TOML string Parse a TOML file Handle invalid T

Taneli Hukkinen 313 Dec 26, 2022
Sie_banxico - A python class for the Economic Information System (SIE) API of Banco de México

sie_banxico A python class for the Economic Information System (SIE) API of Banco de México. Args: token (str): A query token from Banco de México id_

Dillan 2 Apr 07, 2022
This library is for simplified work with the sms-man.com API

SMSMAN Public API Python This is a lightweight library that works as a connector to Sms-Man public API Installation pip install smsman Documentation h

13 Nov 19, 2022
DeKrypt 24 Sep 21, 2022
Modular Python-based Twitch bot optimized for customizability and ease of use.

rasbot Modular Python-based Twitch bot optimized for customizability and ease of use. rasbot is a Python-based Twitch bot that runs on your Twitch acc

raspy 9 Dec 14, 2022
A Telegram bot that can stream Telegram files to users over HTTP

AK-FILE-TO-LINK-BOT A Telegram bot that can stream Telegram files to users over HTTP. Setup Install dependencies (see requirements.txt), configure env

3 Dec 29, 2021
Singer Tap for dbt Artifacts built with the Meltano SDK

tap-dbt-artifacts tap-dbt-artifacts is a Singer tap for dbtArtifacts. Built with the Meltano SDK for Singer Taps.

Prratek Ramchandani 9 Nov 25, 2022
The Official Twilio SendGrid Led, Community Driven Python API Library

The default branch name for this repository has been changed to main as of 07/27/2020. This library allows you to quickly and easily use the SendGrid

Twilio SendGrid 1.4k Jan 07, 2023
Deploy your apps on any Cloud provider in just a few seconds

The simplest way to deploy your apps in the Cloud Deploy your apps on any Cloud providers in just a few seconds ⚡ Qovery Engine is an open-source abst

Qovery 1.9k Dec 26, 2022
Watches your earnings on EarnApp and notifies you when you earned balance or received an payout.

EarnApp-Earning-Monitor Watches your earnings on EarnApp and notifies you when you earned balance or received an payout. Installation Install Python3

Yariya 21 Oct 17, 2022
A tool to customize your discord tokens

Fastest Discord Token Manager - Features: Change Token Username Change Token Password Change Token Avatar Change Token Bio This tool is created by Ace

trey 15 Dec 27, 2022
Discord Token Creator 🥵

Discord Token Creator 🥵

dropout 304 Jan 03, 2023
Tinyman Python SDK

tinyman-py-sdk Tinyman Python SDK Design Goal This SDK is designed for automated interaction with the Tinyman AMM. It will be most useful for develope

Tinyman 113 Dec 30, 2022
提供火币网交易接口API最简封装,提供现货买入、卖出、huobi币安查询账户余额等接口,数字货币,虚拟货币,BTC量化交易框架,自动交易,轻量便携,不用安装,即开即用

火币网交易接口的最简封装(只管用,不用再关注细节) 提供火币网交易接口的python封装,提供买入、卖出、查询账户余额等接口 接口说明 order_value() 进行买入操作,参数为买入的币和买入的金额 买入返回的详情数据: {'单号': '272229546125038', '成交数量': 0.

dev 95 Sep 24, 2021
An open source, multipurpose, configurable discord bot that does it all

Spacebot - Discord Bot Music, Moderation, Fun, Utilities, Games and Fully Configurable. Overview • Contributing • Self hosting • Documentation (not re

Dhravya Shah 41 Dec 10, 2022
Transcript-Extractor-Bot - Yet another Telegram Voice Recognition bot but using vosk and supports 20+ languages

transcript extractor Yet another Telegram Voice Recognition bot but using vosk a

6 Oct 21, 2022
Secret messaging app which you can use to communicate with your friends by encrypting / decrypting secret messages or sending secret message through mail.

Secret-Whisper A Secret messaging app which you can use to communicate with your friends by encrypting / decrypting secret messages 🤫 or sending secr

3 Jan 01, 2022