#rest #ftx #rest-api #api-rest #crypto #websocket #cryptography

rusftx

Rust bindings for the FTX REST and Websocket API

4 releases (breaking)

0.4.0 Nov 3, 2022
0.3.0 Nov 3, 2022
0.2.0 Nov 2, 2022
0.1.0 Nov 2, 2022

#23 in #api-rest

Download history 1/week @ 2024-02-23 85/week @ 2024-03-01

86 downloads per month

Custom license

155KB
4.5K SLoC

RusFTX

Rust bindings for the FTX REST and Websocket API

Crates.io Docs.rs License

FTX API Documentation

Not all APIs are implemented yet. If you need a specific API, please open an issue, or consider contributing by creating a pull request.

RusFTX has taken inspiration from the existing ftx crate by Fabian Boesiger.

  • All bindings follow the naming convention of the FTX API documentation whenever possible, making it easy to find the corresponding function.
  • Calls to REST APIs that require authentication are compile-time checked

Authentication

RusFTX supports both API key and subaccount authentication, as well as having the ability to provide a custom endpoint (which could be used for proxies for example). RusFTX has implemented endpoints for both FTX (.com) and FTX-US (.us) which can be configured using EndpointCom and EndpointUs.

let api_key = "YOUR_FTX_API_KEY";
let secret = "YOUR_FTX_SECRET";

let rest_api = RestApiWithAuthenticationBuilder::new()
    .endpoint(EndpointCom)
    .authentication(api_key, secret)
    .build();

You can also use the Rustftx without authentication for endpoints that support it.

let rest_api = RestApi::new(EndpointCom);

Pagination

Pagination can be performed using the start_time and end_time parameters on all endpoints that support it by providing a chrono DateTime<Utc>.

Implemented REST API bindings

  • Authentication
  • Rate limits
  • Pagination
  • 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
    • Get index constituents
  • Account
    • Get account information
    • Request historical balances and positions snapshot
    • Get historical balances and positions snapshot
    • Get all historical balances and positions snapshots
    • Get positions
    • Change account leverage
  • Wallet
    • Get coins
    • Get balances
    • Get balances of all accounts
    • Get deposit address
    • Get deposit address list
    • Get deposit history
    • Get withdrawal history
    • Request withdrawal
    • Get airdrops
    • Get withdrawal fees
    • Get saved addresses
    • Create saved addresses
    • Delete saved addresses
    • Register a SEN deposit
    • Request a SEN withdrawal
    • Register a Signet deposit
    • Request a Signet withdrawal
  • Orders
    • Get open orders
    • Get order history
    • Get open trigger orders
    • Get trigger order triggers
    • Get trigger order history
    • Get TWAP orders
    • Get TWAP order executions
    • Place order
    • Place trigger order
    • Place TWAP order
    • Modify order
    • Modify order by client ID
    • Modify trigger order
    • Get order status
    • Get order status by client ID
    • Cancel order
    • Cancel TWAP order
    • Cancel order by client ID
    • Cancel open trigger order
    • Cancel all orders
    • Bulk cancel orders
    • Bulk cancel orders by client id
    • Get fills
  • Funding Payments
  • Leveraged Tokens
    • List leveraged tokens
    • Get token info
    • Get leveraged token balances
    • List leveraged token creation requests
    • Request leveraged token creation
    • List leveraged token redemption requests
    • Request leveraged token redemption
    • Request ETF rebalance info
  • Options
    • List quote requests
    • Your quote requests
    • Create quote request
    • Cancel quote request
    • Get quotes for your quote request
    • Create quote
    • Get my quotes
    • Cancel quote
    • Accept options quote
    • Get account options info
    • Get options positions
    • Get public options trades
    • Get options fills
    • Get 24h option volume
    • Get option historical volumes
    • Get option open interest
    • Get historical option open interest
  • Staking
    • Get stakes
    • Unstake request
    • Get stake balances
    • Cancel unstake request
    • Get staking rewards
    • Stake request
  • Convert
    • Request quote
    • Get quote status
    • Accept quote
  • 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
    • List NFTs
    • Get NFT info
    • Get NFT trades
    • Get all NFT trades
    • Get NFT account info
    • Get all NFT collections
    • Get NFT balances
    • Make NFT offer
    • Buy NFT
    • Create Auction
    • Edit Auction
    • Cancel Auction
    • Get bids
    • Place bid
    • Get NFT deposits
    • Get NFT withdrawals
    • Get NFT fills
    • Redeem NFT
    • Get NFT gallery
    • Get gallery settings
    • Edit gallery settings
  • Latency statistics
  • Optimized access
    • Add IP
    • Get IPs
    • Enable IP
    • Disable IP
    • Delete IP
  • Support tickets
    • Get all support tickets
    • Get support ticket messages
    • Send support ticket messages
    • Send a support message
    • Update the status of your support ticket
    • Count total number of unread support messages
    • Mark support messages read

Implemented Websocket API bindings

  • Public Channels
    • Ticker Channel
    • Markets Channel
    • Trades Channel
    • Orderbook Channel
    • Global Orderbook Channel
  • Private Channels
    • Authentication
    • Fills Channel
    • Orders Channel

Dependencies

~11–27MB
~422K SLoC