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 |
#26 in #market
40 downloads per month
Used in termcrypt
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
- Query the price of BTC/USD:
examples/btc_price.rs
- Get account info:
examples/get_accounts.rs
- Get markets:
rest::tests::get_markets
- Get futures:
rest::tests::get_futures
- Get orderbook:
rest::tests::get_orderbook
- Get trades:
rest::tests::get_trades
- Get historical prices:
rest::tests::get_historical_prices
- Placing, modifying, and cancelling orders:
rest::tests::place_modify_cancel_orders
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
~6–21MB
~329K SLoC