Skip to content

Latest commit

 

History

History
208 lines (183 loc) · 5.23 KB

Bitfinex.md

File metadata and controls

208 lines (183 loc) · 5.23 KB
Bitfinex

Bitfinex API Wrapper

Python 3.7+

PEP8

Async support (without cache)

Handles configurable requests cache, retries and general request errors.

Supports the latest API version: https://docs.bitfinex.com/


Installation:

pip install xnr-cryptowrapper

Functions:

Build around raw API commands, each endpoint is made directly available.
Currently supported endpoints, functions:

  • Public
    • API V1
      • v1_ticker_GET
      • v1_stats_GET
      • v1_fundingbook_GET
      • v1_orderbook_GET
      • v1_trades_GET
      • v1_lends_GET
      • v1_symbols_GET
      • v1_symbols_details_GET
    • API V2
      • platform_status_GET
      • ticker_GET
      • tickers_GET
      • trades_GET
      • stats_GET
      • candles_GET
  • Private
    • API V1
      • v1_account_info_POST
      • v1_account_fees_POST
      • v1_summary_POST
      • v1_deposit_POST
      • v1_key_permissions_POST
      • v1_margin_information_POST
      • v1_wallet_balances_POST
      • v1_transfer_between_balances_POST
      • v1_withdrawal_POST
      • v1_order_new_POST
      • v1_orders_new_POST
      • v1_order_cancel_POST
      • v1_orders_cancel_POST
      • v1_orders_cancel_all_POST
      • v1_order_replace_POST
      • v1_order_status_POST
      • v1_orders_active_POST
      • v1_orders_history_POST
      • v1_active_positions_POST
      • v1_claim_position_POST
      • v1_balance_history_POST
      • v1_deposit_withdrawal_history_POST
      • v1_past_trades_POST
      • v1_offer_new_POST
      • v1_offer_cancel_POST
      • v1_offer_status_POST
      • v1_credit__POST
      • v1_offers_POST
      • v1_offers_hist_POST
      • v1_past_funding_trades_POST
      • v1_taken_funds_POST
      • v1_taken_funds_unsused_POST
      • v1_taken_funds_total_POST
      • v1_margin_funding_close_POST
      • v1_basket_manage_POST
      • v1_close_position_POST
    • API V2
      • alert_delete_POST
      • alert_list_POST
      • alert_set_POST
      • calculate_available_balance_POST
      • foreign_exchange_rate_POST
      • funding_credits_POST
      • funding_credits_history_POST
      • funding_info_POST
      • funding_loans_POST
      • funding_loans_history_POST
      • funding_offers_POST
      • funding_offers_history_POST
      • funding_trades_POST
      • ledgers_POST
      • margin_info_POST
      • market_average_price_POST
      • orderbook_GET
      • order_trades_POST
      • orders_POST
      • orders_history_POST
      • performance_POST
      • positions_POST
      • positions_audit_POST
      • positions_history_POST
      • trades_POST
      • user_info_POST
      • user_settings_delete_POST
      • user_settings_read_POST
      • user_settings_write_POST
      • wallet_movements_POST
      • wallets_POST
      • wallets_history_POST

Examples:

If unspecified, result will not be cached.
Retries avoided for errors (400, 401, 403, 404, 429, 500).

Bitfinex.candles_GET() (+ cache example)

>>> from cryptowrapper import Bitfinex
>>> bitfinex = Bitfinex(cache_expire=10, max_retries=2)
>>> timeframe = "15m"
>>> symbol = "tBTCUSD"
>>> bitfinex.candles_GET(timeframe, symbol, section="last")
{
    'response': [
        1550693700000,
        4032.8,
        4036.16202164,
        4038.5,
        4032.8,
        23.86667945
    ],
    'cached': False
}
>>> bitfinex.candles_GET(timeframe, symbol, section="last")
{
    'response': [
        1550693700000,
        4032.8,
        4036.16202164,
        4038.5,
        4032.8,
        23.86667945
    ],
    'cached': False
}

Bitfinex.tickers_GET()

>>> from cryptowrapper import Bitfinex
>>> bitfinex = Bitfinex()
>>> bitfinex.tickers_GET(symbols="tBTCUSD,tLTCUSD,fUSD")
{
    'response': [
        [
            'tBTCUSD', 4035.8, 88.93737361, 4037.8, 66.10953452,
            2, 0.0005, 4038.5, 15541.6379859, 4070, 3963
        ],
        [
            'tLTCUSD', 51.801, 753.11870272, 51.855, 2630.01828493,
            2.745, 0.0559, 51.834, 333799.15790456, 53.792, 47.222
        ],
        [
            'fUSD', 0.0002887917808219178, 0.0002, 30,
            743223.3168098801, 0.0001134, 2, 295323.29085854,
            -0.00010668, -0.4828, 0.0001143, 114264379.42683165,
            0.00029996, 6.4e-07, None, None, 20719118.45678719
        ]
    ],
    'cached': False
}

Bitfinex.platform_status_GET()

>>> from cryptowrapper import Bitfinex
>>> bitfinex = Bitfinex()
>>> bitfinex.platform_status_GET()
{
    'response': [1],
    'cached': False
}

For a quick combined example see: example.py
For the async version see: async_example.py


Feedback:

Constructive feedback & bug reports are welcome.
Contact informations: