10 unstable releases (4 breaking)

0.5.0 Apr 17, 2022
0.4.3 Nov 2, 2021
0.4.2 Oct 21, 2021
0.3.1 Jul 6, 2021
0.1.0 Apr 22, 2021

#37 in #market

Download history 1/week @ 2024-07-20 32/week @ 2024-07-27 2/week @ 2024-08-03 7/week @ 2024-08-10 1/week @ 2024-08-17 5/week @ 2024-08-24 13/week @ 2024-08-31 21/week @ 2024-09-07 24/week @ 2024-09-14 82/week @ 2024-09-21 30/week @ 2024-09-28 16/week @ 2024-10-05 17/week @ 2024-10-12 11/week @ 2024-10-19 7/week @ 2024-10-26 18/week @ 2024-11-02

54 downloads per month
Used in termcrypt

MIT/Apache

115KB
3K SLoC

FTX API

Unofficial Rust API bindings for the FTX exchange.

crates.io | docs.rs | FTX API Documentation

Progress

Work in progress, contributions are welcome.

REST

  • Authentication
  • Subaccounts
    • Get all subaccounts
    • Create subaccount
    • Change subaccount name
    • Delete subaccount
    • Get subaccount balances
    • Transfer between subaccounts
  • Markets
    • Get markets
    • Get single market
    • Get orderbook
    • Get trades
    • Get historical prices
  • Futures
    • List all futures
    • Get future
    • Get future stats
    • Get funding rates
    • Get index weights
    • Get expired futures
    • Get historical index
  • Account
    • Get account information
    • Get positions
    • Change account leverage
  • Wallet
    • Get coins
    • Get balances
    • Get balances of all accounts
    • Get deposit address
    • Get deposit history
    • Get withdrawal history
    • Request withdrawal
    • Get airdrops
    • Get withdrawal fees
    • Get saved addresses
    • Create saved addresses
    • Delete saved addresses
  • Orders
    • Get open orders
    • Get order history
    • Get open trigger orders
    • Get trigger order triggers
    • Get trigger order history
    • Place order
    • Place trigger order
    • Modify order
    • Modify order by client ID
    • Modify trigger order
    • Get order status
    • Get order status by client ID
    • Cancel order
    • Cancel order by client ID
    • Cancel open trigger order
    • Cancel all orders
  • Fills
  • Funding Payments
  • Leveraged Tokens
  • Options
  • Staking
  • Convert
  • Spot Margin
    • Get lending history
    • Get borrow rates
    • Get lending rates
    • Get daily borrowed amounts
    • Get market info
    • Get my borrow history
    • Get my lending history
    • Get lending offers
    • Get lending info
    • Submit lending offer
  • NFTs
  • FTXPay

Websockets

  • Public Channels
    • Ticker
    • Markets
    • Trades
    • Orderbooks
      • Verify checksum
    • Grouped Orderbooks
  • Private Channels
    • Fills
    • Orders

Installation

The minimal supported Rust version is 1.54.

Add the following line to your Cargo.toml file:

ftx = "0.3"

Or for the latest github version:

ftx = { git = "https://github.com/fabianboesiger/ftx", branch = "main" }

Usage

Rate Limiting

Using the FTX API requires rate-limiting requests to no more than 30 requests per second in order to avoid HTTP 429 errors. You will need to rate-limit your own requests in your usage of this library.

See the FTX API Documentation

Pagination

If needed, you will need to paginate your own requests in your usage of this library. See the FTX API Documentation and sample Python code

REST Usage Examples

Websockets Usage Examples

  • Listen to latest Trades and Orderbook updates: examples/watch_market.rs
  • Subscribe and unsubscribe from Channels: ws::tests::subscribe_unsubscribe
  • Update an Orderbook: ws::tests::order_book_update
  • Verify OrderBook checksums: ws::tests::order_book_checksum
  • Use the Orderbook convenience methods: ws::tests::order_book_helpers
    • bid_price, ask_price, mid_price
    • best_bid, best_ask, best_bid_and_ask
    • quote
  • Listen for Fills: ws::tests::fills
  • Listen for Order updates: ws::tests::orders

Dependencies

~7–21MB
~318K SLoC