GithubHelp home page GithubHelp logo

sam-nejad / bitfinex_api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from akcarsten/bitfinex_api

0.0 0.0 0.0 27 KB

Python client for the Bitfinex REST API

Home Page: https://medium.com/coinmonks/how-to-get-historical-crypto-currency-data-954062d40d2d

License: MIT License

Python 100.00%

bitfinex_api's Introduction

Python Bitfinex API client


This is a simple Python client for the Bitfinex REST API (V1 and V2). It supports public as well as private endpoints. An example on how to use this tool to gather historical bitcoin data is documented in this article.


Installation

You can either clone the repository directly from the Github webpage or run the following command(s) in your terminal:

Pip Installation:

pip install bitfinex-tencars

Alternatively you can clone the Git repository:

git clone https://github.com/akcarsten/bitfinex_api.git

Then go to the folder to which you cloned the repository and run:

python setup.py install

Now you can run Python and import the Bitfinex client.


Examples of how to use the interface

Public endpoints

Public endpoints can be used without providing any keys as shown in the examples below.

Example 1: Retrieving current tick data

import bitfinex

# Initialize the api
api = bitfinex.api_v1()

# Select a trading pair
pair = 'btcusd'

# Get the current ticker data for the pair
api.ticker(pair)

Example 2: Available currency pairs

import bitfinex

# Initialize the api
api = bitfinex.api_v1()

# Get all available currency pairs
symbols = api.symbols()

All available public endpoints are included in this client. For a full documentation check the Bitfinex API webpage.

Private endpoints

In order to use private endpoints the public- and secrete keys need to be provided while initializing the API as shown in the example below in which the current account balance can be retrieved.

Example 1: Check account balance

import bitfinex

key = 'YOUR_PUBLIC_KEY'
secrete = 'YOUR_SECRETE_KEY'

api = bitfinex.api_v1(key, secrete)
my_balance = api_bitfinex.balance()

Example 2: Place a buy order

import bitfinex

symbol = 'btcusd'        # Currency pair to trade
amount = '0'             # Amount to buy
price = '0'              # Buy price
side = 'buy'             # Buy or sell
type = 'exchange market' # Which type

# Send the order
api.place_order(symbol, amount, price, side, type)

Further information

For a full documentation of all API commands and what parameters are needed to run them, check out the Bitfinex API documentation for public endpoints and the documentation for the private endpoints of the V1 API.

For the V2 API you can find the reference here.

All endpoints should be included in this API. In case of changes or bugs please let me know.

bitfinex_api's People

Contributors

akcarsten avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.