FTX API has 2 types of methods: public and private. Public methods can be accessed without authentication, example: get ticker prices. Only are only private and related to user data, those methods requires the use of FTX API keys.
The websocket feed provides real-time market data updates for orders and trades. The websocket feed has some public channels like ticker, trades... and some private channels which require an API Key and API Secret like Fills and Orders.
The websocket feed uses a bidirectional protocol, which encodes all messages as JSON objects. All messages have a type attribute that can be used to handle the message appropriately.
You can subscribe to the following Public channels:
Method | Arguments | Description |
SubscribeTicker | aMarket: name of the market | The ticker channel provides the latest best bid and offer market data. |
SubscribeMarkets | The markets channel provides information on the full set of tradable markets and their specifications. After subscription and whenever any market lists, delsists, or changes, you will receive a partial message with information on all markets. | |
SubscribeTrades | aMarket: name of the market | The trades channel provides data on all trades in the market. |
SubscribeOrderbooks | aMarket: name of the market | The orderbook channel provides data about the orderbook's best 100 orders on either side. |
SubscribeGroupedOrderbooks | aMarket: name of the market | The grouped orderbooks channel supplies orderbook data with grouped (collapsed) prices. |
Some of this channels requires Authenticate against FTX servers. So first request your API keys in your FTX Account and then set the values in the property FTX of the component:
ApiKey
ApiSecret
SubAccount (optional)
When the WebSocket client connects to FTX servers, if detect the ApiKey and ApiSecret are defined automatically try to login to the FTX Server. If successful, you can subscribe to the following Private Channels:
Method | Arguments | Description |
SubscribeFills | This channel streams your fills across all markets. | |
SubscribeOrders | This channel streams updates to your orders across all markets. |
Some of the REST Channels are public, so you don't need to configure the API Keys.
Markets
This section covers all types of markets on FTX: spot, perpetual futures, expiring futures, and MOVE contracts. Examples for each type are BTC/USD, BTC-PERP, BTC-0626, and BTC-MOVE-1005.
Method | Arguments | Description |
GetMarkets | ||
GetMarket | aMarket: name of the market | |
GetOrderbook | aMarket: name of the market | |
GetTrades | aMarket: name of the market | |
GetHistoricalPrices | aMarket: name of the market | Historical prices of expired futures can be retrieved with this end point but make sure to specify start time and end time. |
Futures
This section covers all types of futures on FTX: perpetual, expiring, and MOVE. Examples for each type are BTC-PERP, BTC-0626, and BTC-MOVE-1005.
Method | Arguments | Description |
GetFutures | ||
GetFuture | aFuture: name of the future | |
GetFutureStats | aFuture: name of the future | |
GetFundingRates | ||
GetIndexWeights | aFuture: name of the future | Note that this only applies to index futures, e.g. ALT/MID/SHIT/EXCH/DRAGON. |
GetExpiredFutures | Returns the list of all expired futures. | |
GetHistoricalIndex | aFuture: name of the future |
Private endpoints are available for order management, and account management.
Before being able to sign any requests, you must create an API key via the FTX website. The API key will be scoped to a specific profile. Upon creating a key you will have 2 pieces of information which you must remember:
Private endpoints require your local time is synchronized with FTX server time, if there is a difference too high, you will get a 401 Unauthorized error
{"success":false:"error":"Not logged in"}
Account
Method | Arguments | Description |
GetAccount | ||
GetAccountHistory | ||
ChangeAccountLeverage | aLeverage: desired account-wide leverage setting |
Subaccounts
Method | Arguments | Description |
GetAllSubaccounts | ||
CreateSubaccount | aNickName: name of the subaccount | |
ChangeSubaccountName | aOldNickname: current nickname of subaccount aNewNickname: new nickname of subaccount | |
DeleteSubaccount | aNickName: name of the subaccount | |
GetSubaccountBalances | aNickName: name of the subaccount | |
TransferBetweenSubaccounts | aCoin: example XRP aSize: size of transfer aSource: name of the source subaccount. "main" for the main account. aDestination: name of the destination subaccount. "main" for the main account. |
Wallets
Method | Arguments | Description |
GetCoins | ||
GetBalances | ||
GetBalancesAllAccounts | ||
GetDepositAddress | aCoin: USDT aMethod: optional, for coins available on different blockchains, example: USDT | |
GetDepositHistory | aStartTime: optional; minimum time of items to return, in Unix time aEndTime: optional; maximum time of items to return, in Unix time | |
GetWithdrawalHistory | aStartTime: optional; minimum time of items to return, in Unix time aEndTime: optional; maximum time of items to return, in Unix time | |
RequestWithdrawal | aCoin: coin to withdraw. aSize: amount to withdraw. aAddress: address to send to (example: 0x83a127952d266A6eA306c40Ac62A4a70668FE3BE) aTag: optional. aPassword: optional, withdrawal password if it is required for your account aCode: optional; 2fa code if it is required for your account | |
GetAirDrops | aStartTime: optional; minimum time of items to return, in Unix time aEndTime: optional; maximum time of items to return, in Unix time | This endpoint provides you with updates to your AMPL balances based on AMPL rebases. |
GetWithdrawalFees | aCoin: coin id. aSize: amount. aAddress: address to withdraw (example: 0x83a127952d266A6eA306c40Ac62A4a70668FE3BE) aTag: optional. | |
GetSavedAddresses | aCoin: optional, filters saved addresses by coin; | This endpoint provides you with your saved addresses |
CreateSavedAddresses | aCoin: coin id. aAddress: address to create (example: 0x83a127952d266A6eA306c40Ac62A4a70668FE3BE) aAddressName: string aIsPrimetrust: boolean aTag: optional | |
DeleteSavedAddresses | aSavedAddressId: id of the saved address. |
Orders
Method | Arguments | Description |
GetOpenOrders | aMarket: name of the market | |
GetOrderHistory | aMarket: name of the market | |
GetOpenTriggerOrders | aMarket: name of the market aTriggerOrder: [fttotNone, fttotStop, fttotTrailing_Stop, fttotTake_Profit] | |
GetTriggerOrderTriggers | aOrderId: number that identificates the Order. | |
GetTriggerOrderHistory | aMarket: name of the market | |
PlaceOrder | aOrder: TsgcHTTPFTXOrder instance | Places a new order. Passes a TsgcHTTPFTXOrder object as a parameter. |
PlaceMarketOrder | aMarket: name of the market aSide: buy or sell aSize: size of the order | Places a new Market order. |
PlaceLimitOrder | aMarket: name of the market aSide: buy or sell aSize: size of the order aPrice: price limit of the order | Places a new Limit Order |
PlaceTriggerOrder | aOrder: TsgcHTTPFTXTriggerOrder instance | Places a new trigger order. Passes a TsgcHTTPFTXTriggerOrder object as a parameter. |
PlaceTriggerStopOrder | aMarket: name of the market aSide: buy or sell aSize: size of the order aTriggerPrice: trigger price aOrderPrice: optional, order type is limit if has value greater than zero, otherwise market. | |
PlaceTriggerTrailingStopOrder | aMarket: name of the market aSide: buy or sell aSize: size of the order aTrailValue: negative for "sell", positive for "buy" | |
PlaceTriggerTakeProfitOrder | aMarket: name of the market aSide: buy or sell aSize: size of the order aTriggerPrice: trigger price aOrderPrice: optional, order type is limit if has value greater than zero, otherwise market. | |
ModifyOrder | aOrderId: number that identificates the Order. aPrice: price limit of the order aSize: size of the order | |
ModifyOrderByClientId | aOrderClientId: string that identificates the Order. aPrice: price limit of the order aSize: size of the order | |
ModifyTriggerOrder_StopLoss | aOrderId: number that identificates the Order. aSize: size of the order aTriggerPrice: trigger price aOrderPrice: order price | |
ModifyTriggerOrder_TakeProfit | aOrderId: number that identificates the Order. aSize: size of the order aTriggerPrice: trigger price aOrderPrice: order price | |
ModifyTriggerOrder_TrailingStop | aOrderId: number that identificates the Order. aSize: size of the order aTrailValue: trail value of the order | |
GetOrderStatus | aOrderId: number that identificates the Order. | |
GetOrderStatusByClientId | aOrderClientId: string that identificates the Order. | |
CancelOrder | aOrderId: number that identificates the Order. | |
CancelOrderByClientId | aOrderClientId: string that identificates the Order. | |
CancelOpenTriggerOrder | aOrderId: number that identificates the Order. | |
CancelAllOrders |
Other
Method | Arguments | Description |
GetFills | aMarket: name of the market |