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
A collection of scripts to steal BTC from Lightning Network enabled custodial services. Only for educational purpose! Share your findings only when design flaws are fixed.

Lightning Network Fee Siphoning Attack LN-fee-siphoning is a collection of scripts to subtract BTC from Lightning Network enabled custodial services b

Reckless_Satoshi 14 Oct 15, 2022
Telegram Bot to learn English by words and more.. ( in Arabic )

Get the mp3 files Extract the mp3.rar on the same file that bot.py on install requirements pip install -r requirements.txt #Then enter you bot token

Plugin 10 Feb 19, 2022
Algofi Python SDK is useful for developers who want to programatically interact with the Algofi lending protocol

algofi-py-sdk Algofi Python SDK Documentation https://algofi-py-sdk.readthedocs.

Algofi 41 Dec 15, 2022
Programmeertheorie 2022 - Team Trainspotters - RailNL

Trainspotters Vak: Programmeertheorie 2022 Gekozen case: RailNL Teamnaam: Trainspotters Studenten: Mijntje Meijer, Sam Bijhouwer, Maik Larooij To-do's

Maik Larooij 1 Jan 25, 2022
Telegram group manager moderen and simple.

Upin Robot A Advanced Powerful, Smart And Intelligent Group Management Bot With New And Powerful Features ... Written with Pyrogram and Telethon... If

Muhammad Nawawi 3 Dec 23, 2021
Python wrapper library for World Weather Online API

pywwo Python wrapper library for World Weather Online API using lxml.objectify How to use from pywwo import * setKey('your_key', 'free') w=LocalWeat

World Weather Online 20 Dec 19, 2022
Telegram music & video bot direct play music

⚡ NOINOI MUSIC PLAYER 🎵 SUPERFAST MUSIC BOT WHO CAN DIRECT PLAY SONG ON TELEGRAM VOICE CHAT ALSO CAN PLAY VIDEO ON VOICE CHATS ✨ Heroku Deploy YOU CA

noinoi-X 1 Dec 28, 2021
Battle.net and PlayStation title watcher that reports updates via Discord.

Renovate Renovate is a Battle.net and PlayStation title watcher that reports updates via Discord. Usage Open config_example.json and provide the confi

Ethan 1 Nov 23, 2022
Automatically render tens of thousands of unique NFT images individually as png's.

Blend_My_NFTs Description This project is a work in progress (as of Oct 24th, 2021) and will eventually be an add on to Blender. Blend_My_NFTs is bing

Torrin Leonard 894 Dec 29, 2022
CoWIN Vaccination slot booking telegram bot with auto captcha resolver & alerting feature.Now, never miss a slot.

COWIN VACCINATION SLOT AUTO BOOKING (Bot with captcha solving & alerting capabilities. Never miss the vaccine slot.) June-10-2021/ 0030 hrs: 23 succes

Shashank Bafna 17 Nov 12, 2022
Force-Subscribe-Bot - A Telegram Bot to force users to join a specific channel before sending messages in a group

Introduction A Telegram Bot to force users to join a specific channel before sen

LG Bot Updates 0 Jan 16, 2022
A free and open-source SMS/Call bombing application

TBOMB V0.1 A free and open-source SMS/Call bombing application NOTE: For Termux To use the bomber type the following commands in Termux: pkg install g

ᴀɴᴋɪᴛ ᴋᴜᴍᴀʀ 2 Dec 07, 2021
A simple Telegram bot, written in Python, that you can use to shill (i.e. send messages) your token, or whatever, to channels.

Telegram Shill Bot Ever wanted a Shill Bot but wankers keep scamming for one OR wanted to charge you an arm and a leg? This is a simple bot written in

53 Nov 25, 2022
The first open-source PyTgCalls-based project.

SU Music Player — The first open-source PyTgCalls based Pyrogram bot to play music in voice chats Requirements FFmpeg NodeJS 15+ Python 3.7+ Deploymen

Calls Music 74 Nov 19, 2022
Aqui está disponível GRATUITAMENTE, um bot de discord feito em python, saiba que, terá que criar seu bot como aplicação, e utilizar seu próprio token, e lembrando, é um bot básico, não se utiliza Cogs nem slash commands nele!

BotDiscordPython Aqui está disponível GRATUITAMENTE, um bot de discord feito em python, saiba que, terá que criar seu bot como aplicação, e utilizar s

Matheus Muguet 4 Feb 05, 2022
A python library for creating selfbots/automating your Nertivia account.

nertivia-selfbot (WIP) A python library for creating selfbots/automating your Nertivia account. how to use Download the nertivia_selfbot folder from t

Ben Tettmar 2 Feb 03, 2022
Crosschat - A bot for cross-server communication

CrossChat A bot for cross-server communication. Running the bot To run the bot y

8 May 15, 2022
Your custom slash commands Discord bot!

Slashy - Your custom slash-commands bot Hey, I'm Slashy - your friendly neighborhood custom-command bot! The code for this bot exists because I'm like

Omar Zunic 8 Dec 20, 2022
Example notebooks for working with SageMaker Studio Lab. Sign up for an account at the link below!

SageMaker Studio Lab Sample Notebooks Available today in public preview. If you are looking for a no-cost compute environment to run Jupyter notebooks

Amazon Web Services 304 Jan 01, 2023
Simple Similarities Service

simsity Simsity is a Super Simple Similarities Service[tm]. It's all about building a neighborhood. Literally! This repository contains simple tools t

vincent d warmerdam 95 Dec 25, 2022