Skip to content

AD-Ventures/txbit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Txbit Build Status Last Commit Python Version License: MIT

A Python3 wrapper for the Txbit API

This is an unofficial wrapper with no affiliation with Txbit, use at your own risk.

Note: requests are limited to 10 per second per IP address

Installation

pip3 install txbit

Usage

Methods in the txbit package retrun a TxbitReponse object containing three attributes aligning with txbit API response (success, message, result).

import txbit

txbit = txbit.Txbit()  # initalize the object

request = txbit.getMarkets()  # use one of the object's methods to make an API call
request.success  # returns True
request.message  # returns ''
request.result  # returns a list of market dictionaries

Public API

The Txbit API is split into three groups (Public, Market, and Account). The Public group provides information about markets and does not require authentication with an API Key and Secret. An exception will be raised if trying to use the non-public methods without supplying a APIKey and Secret.

txbit = txbit.Txbit()  # no API Key and Secret supplied if only using public methods

Methods of the PublicClient class, and related documentation, below:

Authenticated API

The other two groups (Market and Account) require authentication for access/use.

  • Market - Used for setting and canceling orders. The ALLOW TRADING permission must be set up on the key(s) being used.
  • Acount - Used for account related functions such as balances, withdrawals and deposit addresses. The ALLOW READING permission must be set up on the key(s) being used.

This wrapper handles most of the authentication process, so the only thing that needs to be supplied is an API Key and Secret with proper permissions. We recommend saving your key and secret as variables (APIKEY = XXX and SECRET=XXX) in a separate python file named secrets.py and importing it such as the example below.

To create and manage your API keys go to Profile > Settings > API Keys on the Txbit.io site.

from secrets import APIKEY, SECRET  # import api key and secret

txbit = txbit.Txbit(APIKEY, SECRET)  # this time supplying a API Key and Secret

Methods of the Authenticated Client class, and related documentation, below:

Market API

Account API

Support

For any help or questions, please open an issue on GitHub.

License

MIT