Skip to main content

Python wrapper for Bitfinex API v1 and v2

Project description


Python wrapper for Bitfinex API.


Requests library is required.


Include the pyfinex module and use it as a toolbox. For trading, a key and a secret key must be provided.

import pyfinex

API_KEY = 'insert key'
API_SECRET = 'insert secret'

resp =, secret_key=API_SECRET)
resp = pyfinex.v1.public.ticker(symbol='btcusd')

Function names are organized for better coding

Function names are referred in part to the api doc's html, which you can see Bitfinex API web page. Required params to build the request's url are coded in the function's args, other query params are to be added acording to api doc

BEWARE: some inputs varies from v1 to v2. Example: v1>> 'BTCUSD' v2>> 'tBTCUSD'

All documented API calls are implemented!


Get the latest BTCUSD price

resp = pyfinex.v1.public.ticker(symbol='btcusd')

View your active orders

resp =,API_SECRET)

Get the BTCUSD order book

resp = pyfinex.v1.public.order_book(symbol='btcusd')

Get the last BTCUSD 1m candle

resp = pyfinex.v2.public.candles(Symbol='tBTCUSD', TimeFrame='1m', Section='last')

Note: in v2 the parameters are capital case.

Submit a new order

For example, if you'd like to buy 0.001 BTC as 0.01 BTC/USD, you need to specify the parameters acording to the api doc. You may parse the response to get the order id for future use.

resp ="BTCUSD", amount=0.001, price=0.01, side='buy', type='market')

In case there is a new call you can do it yourself!:



  1. Replace your keys in .env.example file, and rename it to .env
  2. Include your unit tests as functions in a test_vX_*.py file
    def test_ticker():
        resp = pyfinex.v1.public.ticker(symbol='btcusd')
  3. Run the tests using pytest

Known Issues

  • No


  • Test every endpoint


  1. Create an issue and discuss.
  2. Create a feature branch containing only your fix or feature.
  3. Add tests, please!!
  4. Create a pull request.
  5. Thanks!



The MIT License (MIT)

Copyright (c) 2018 faberquisque


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyfinex, version 1.0.3
Filename, size File type Python version Upload date Hashes
Filename, size pyfinex-1.0.3-py3-none-any.whl (14.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pyfinex-1.0.3.tar.gz (9.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page