### Sample Request to Subscribe to 1-Day Kline Data (Phemex WebSocket API) Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md An example demonstrating how to subscribe to 1-day kline data for the 'sBTCUSDT' symbol. The interval is specified in seconds (86400 for 1 day). ```json { "id": 0, "method": "kline.subscribe", "params": [ "sBTCUSDT", 86400 ] } ``` -------------------------------- ### Phemex Deposit History API Response Example Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_withdraw.md Provides an example of the JSON response structure returned by the Phemex deposit history API, illustrating the data fields for a single deposit record. ```JSON { "code": 0, "msg": "OK", "data": [ { "accountType": 1, "address": "44exxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "amountEv": 50000000, "chainCode": 1, "chainName": "BTC", "confirmations": 1, "confirmedHeight": null, "createdAt": 1670000000000, "currency": "BTC", "currencyCode": 1, "email": "abcdefg@gmail.com", "errorCode": null, "errMsg": null, "id": 1, "needConfirmHeight": null, "status": "Success", "transferStatus": null, "txHash": "567exxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "type": "Deposit", "userId": 10000001 } ] } ``` -------------------------------- ### Phemex Spot Order API: Query All Open Orders by Symbol (HTTP GET) Request URL Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md Defines the HTTP GET endpoint for retrieving all open spot orders associated with a specific symbol. ```HTTP GET /spot/orders?symbol= ``` -------------------------------- ### Phemex Spot Order API: Place Order (HTTP POST) Request Body JSON Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md Example JSON request body for placing a spot order via HTTP POST, specifying order parameters. ```JSON { "symbol": "sBTCUSDT", "clOrdID": "", "side": "Buy/Sell", "qtyType": "ByBase/ByQuote", "quoteQtyEv": 0, "baseQtyEv": 0, "priceEp": 0, "stopPxEp": 0, "trigger": "UNSPECIFIED", "ordType": "Limit", "timeInForce": "GoodTillCancel" } ``` -------------------------------- ### Phemex Spot Order API: Place Order (HTTP PUT) Response JSON Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md Example JSON response received after successfully placing a spot order via HTTP PUT, including order details like orderID, status, and quantities. ```JSON { "code": 0, "msg": "", "data": { "orderID": "d1d09454-cabc-4a23-89a7-59d43363f16d", "clOrdID": "309bcd5c-9f6e-4a68-b775-4494542eb5cb", "priceEp": 0, "action": "New", "trigger": "UNSPECIFIED", "pegPriceType": "UNSPECIFIED", "stopDirection": "UNSPECIFIED", "bizError": 0, "symbol": "sBTCUSDT", "side": "Buy", "baseQtyEv": 0, "ordType": "Limit", "timeInForce": "GoodTillCancel", "ordStatus": "Created", "cumFeeEv": 0, "cumBaseQtyEv": 0, "cumQuoteQtyEv": 0, "leavesBaseQtyEv": 0, "leavesQuoteQtyEv": 0, "avgPriceEp": 0, "cumBaseAmountEv": 0, "cumQuoteAmountEv": 0, "quoteQtyEv": 0, "qtyType": "ByBase", "stopPxEp": 0, "pegOffsetValueEp": 0 } } ``` -------------------------------- ### Phemex REST API Signature Example: HTTP GET Request with Single Query Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_generic.md Illustrates how to construct the HMAC SHA256 signature for a simple HTTP GET request with a single query parameter on the Phemex API. ```APIDOC API REST Request URL: https://api.phemex.com/accounts/accountPositions?currency=BTC Request Path: /accounts/accountPositions Request Query: currency=BTC Request Body: Request Expiry: 1575735514 Signature Formula: HMacSha256( /accounts/accountPositions + currency=BTC + 1575735514 ) ``` -------------------------------- ### Wallet-Order Message Sample: Snapshot Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md An example of a 'snapshot' Wallet-Order message, providing a complete state of a user's wallets and orders (closed, fills, and open) at a specific point in time. This message type is typically sent upon initial connection or full synchronization. ```json { "orders": { "closed": [ { "action": "New", "avgPriceEp": 0, "baseCurrency": "BTC", "baseQtyEv": 10000, "bizError": 0, "clOrdID": "123456", "createTimeNs": 1587463924959744800, "cumBaseQtyEv": 10000, "cumFeeEv": 0, "cumQuoteQtyEv": 66900000, "curBaseWalletQtyEv": 899990000, "curQuoteWalletQtyEv": 66900000, "cxlRejReason": 0, "feeCurrency": "BTC", "leavesBaseQtyEv": 0, "leavesQuoteQtyEv": 0, "ordStatus": "Filled", "ordType": "Limit", "orderID": "35217ade-3c6b-48c7-a280-8a1edb88013e", "pegOffsetValueEp": 0, "priceEp": 68000000, "qtyType": "ByBase", "quoteCurrency": "USDT", "quoteQtyEv": 66900000, "side": "Sell", "stopPxEp": 0, "symbol": "sBTCUSDT", "timeInForce": "GoodTillCancel", "transactTimeNs": 1587463924964876800, "triggerTimeNs": 0, "userID": 200076 } ], "fills": [ { "avgPriceEp": 0, "baseCurrency": "BTC", "baseQtyEv": 10000, "clOrdID": "123456", "execBaseQtyEv": 10000, "execFeeEv": 0, "execID": "8135ebe3-f767-577b-b70d-1a839d5178e0", "execPriceEp": 669000000000, "execQuoteQtyEv": 66900000, "feeCurrency": "BTC", "lastLiquidityInd": "RemovedLiquidity", "ordType": "Limit", "orderID": "35217ade-3c6b-48c7-a280-8a1edb88013e", "priceEp": 68000000, "qtyType": "ByBase", "quoteCurrency": "USDT", "quoteQtyEv": 66900000, "side": "Sell", "symbol": "sBTCUSDT", "transactTimeNs": 1587463924964876800, "userID": 200076 } ], "open": [ { "action": "New", "avgPriceEp": 0, "baseCurrency": "BTC", "baseQtyEv": 100000000, "bizError": 0, "clOrdID": "31f793f4-163d-aa3f-5994-0e1164719ba2", "createTimeNs": 1587547657438536000, "cumBaseQtyEv": 0, "cumFeeEv": 0, "cumQuoteQtyEv": 0, "curBaseWalletQtyEv": 630000005401500000, "curQuoteWalletQtyEv": 351802500000, "cxlRejReason": 0, "feeCurrency": "BTC", "leavesBaseQtyEv": 100000000, "leavesQuoteQtyEv": 0, "ordStatus": "New", "ordType": "Limit", "orderID": "b98b25c5-6aa4-4158-b9e5-477e37bd46d8", "pegOffsetValueEp": 0, "priceEp": 666500000000, "qtyType": "ByBase", "quoteCurrency": "USDT", "quoteQtyEv": 0, "side": "Sell", "stopPxEp": 0, "symbol": "sBTCUSDT", "timeInForce": "GoodTillCancel", "transactTimeNs": 1587547657442753000, "triggerTimeNs": 0, "userID": 200076 } ] }, "sequence": 349, "timestamp": 1587549121318737700, "type": "snapshot", "wallets": [ { "balanceEv": 0, "currency": "LTC", "lastUpdateTimeNs": 1587481897840503600, "lockedTradingBalanceEv": 0, "lockedWithdrawEv": 0, "userID": 200076 }, { "balanceEv": 351802500000, "currency": "USDT", "lastUpdateTimeNs": 1587543489127498200, "lockedTradingBalanceEv": 0, "lockedWithdrawEv": 0, "userID": 200076 }, { "balanceEv": 630000005401500000, "currency": "BTC", "lastUpdateTimeNs": 1587547210089640400, "lockedTradingBalanceEv": 100000000, "lockedWithdrawEv": 0, "userID": 200076 } ] } ``` -------------------------------- ### Phemex REST API Signature Example: HTTP GET Request with Multiple Queries Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_generic.md Demonstrates the HMAC SHA256 signature generation for an HTTP GET request with multiple query parameters on the Phemex API, showing the concatenated string used for signing. ```APIDOC API REST Request URL: https://api.phemex.com/orders/activeList?ordStatus=New&ordStatus=PartiallyFilled&ordStatus=Untriggered&symbol=BTCUSD Request Path: /orders/activeList Request Query: ordStatus=New&ordStatus=PartiallyFilled&ordStatus=Untriggered&symbol=BTCUSD Request Body: Request Expire: 1575735951 Signature Formula: HMacSha256(/orders/activeList + ordStatus=New&ordStatus=PartiallyFilled&ordStatus=Untriggered&symbol=BTCUSD + 1575735951) Signed String: /orders/activeListordStatus=New&ordStatus=PartiallyFilled&ordStatus=Untriggered&symbol=BTCUSD1575735951 ``` -------------------------------- ### API Request: Query Deposit Chain Settings Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_withdraw.md Defines the HTTP GET request to retrieve deposit chain configurations. The `currency` parameter is required to specify the coin name for which settings are requested. ```APIDOC GET /phemex-deposit/wallets/api/chainCfg?currency= Parameters: - currency (String, Required): coin name (Example: ETH) ``` -------------------------------- ### Phemex Trade Message Format and Samples Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md This section details the structure of trade messages published by DataGW, including both snapshot and incremental types. It describes fields like timestamp, side, priceEp, qty, sequence, and message type, providing samples for both snapshot and incremental updates. Incremental messages are published with 20ms interval. And snapshot messages are published on connection initial setup for client recovery. ```javascript { "trades": [ [ , "", , ], . . . ], "sequence": , "symbol": "", "type": "" } ``` ```APIDOC Field | Type | Description | Possible values -------------|--------|-------------------------------|----------------- timestamp | Integer| Timestamp in nanoseconds for each trade | side | String | Execution taker side | bid, ask priceEp | Integer| Scaled execution price | qty | Integer| Execution size | sequence | Integer| Latest message sequence | symbol | String | Spot symbol name | type | String | Message type | snapshot, incremental ``` ```json { "sequence": 1167852, "symbol": "sBTCUSDT", "trades": [ [ 1573716998128563500, "Buy", 867350000000, 560000 ], [ 1573716995033683000, "Buy", 867350000000, 520000 ], [ 1573716991485286000, "Buy", 867350000000, 510000 ], [ 1573716988636291300, "Buy", 867350000000, 120000 ] ], "type": "snapshot" } ``` ```json { "sequence": 1188273, "symbol": "sBTCUSDT", "trades": [ [ 1573717116484024300, "Buy", 86730000000, 210000 ] ], "type": "incremental" } ``` -------------------------------- ### Wallet-Order Message Sample: Incremental Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md An example of an 'incremental' Wallet-Order message, containing only the changes or new entries for wallets and orders since the last update. This message type is used for efficient real-time updates, reducing bandwidth usage. ```json { "orders": { "closed": [], "fills": [], "open": [ { "action": "New", "avgPriceEp": 0, "baseCurrency": "BTC", "baseQtyEv": 100000000, "bizError": 0, "clOrdID": "0c1099e5-b900-5351-cf60-edb15ea2539c", "createTimeNs": 1587549529513521700, "cumBaseQtyEv": 0, "cumFeeEv": 0, "cumQuoteQtyEv": 0, "curBaseWalletQtyEv": 630000005401500000, "curQuoteWalletQtyEv": 351802500000, "cxlRejReason": 0, "feeCurrency": "BTC", "leavesBaseQtyEv": 100000000, "leavesQuoteQtyEv": 0, "ordStatus": "New", "ordType": "Limit", "orderID": "494a6cbb-32b3-4d6a-b9b7-196ea2506fb5", "pegOffsetValueEp": 0, "priceEp": 666500000000, "qtyType": "ByBase", "quoteCurrency": "USDT", "quoteQtyEv": 0, "side": "Sell", "stopPxEp": 0, "symbol": "sBTCUSDT", "timeInForce": "GoodTillCancel", "transactTimeNs": 1587549529517738000, "triggerTimeNs": 0, "userID": 200076 } ] }, "sequence": 349, "timestamp": 1587549529517738000, "type": "incremental", "wallets": [ { "balanceEv": 630000005401500000, "currency": "BTC", "lastUpdateTimeNs": 1587549529517738000, "lockedTradingBalanceEv": 100000000, "lockedWithdrawEv": 0, "userID": 200076 } ] } ``` -------------------------------- ### Query Chain Information API Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md API endpoint to retrieve chain settings for a specific currency. This can be used to get details necessary for deposit/withdrawal operations. ```APIDOC GET /exchange/public/cfg/chain-settings?currency= ``` -------------------------------- ### Kline Data Message Formats and Samples (Phemex WebSocket API) Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md Details the structure of kline messages received from the DataGW, including the general format and examples of snapshot and incremental updates. Snapshot messages provide historical data on connection, while incremental messages deliver real-time updates. ```javascript { "kline": [ [ , "", , , , , , , , ], . . . ], "sequence": , "symbol": "", "type": "" } ``` ```json { "kline": [ [ 1590019200, 86400, 952057000000, 952000000000, 955587000000, 947835000000, 954446000000, 1162621600, 11095452729869 ], [ 1589932800, 86400, 977566000000, 978261000000, 984257000000, 935452000000, 952057000000, 11785486656, 113659374080189 ], [ 1589846400, 86400, 972343000000, 972351000000, 989607000000, 949106000000, 977566000000, 11337554900, 109928494593609 ] ], "sequence": 380876982, "symbol": "sBTCUSDT", "type": "snapshot" } ``` ```json { "kline": [ [ 1590019200, 86400, 952057000000, 952000000000, 955587000000, 928440000000, 941597000000, 4231329700, 40057408967508 ] ], "sequence": 396865028, "symbol": "sBTCUSDT", "type": "incremental" } ``` -------------------------------- ### Phemex Spot Order API: Query Open Order by ID (HTTP GET) Request URLs Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md Defines the HTTP GET endpoints for querying a specific open spot order using either its order ID or client order ID. ```HTTP GET /spot/orders/active?symbol=&orderID= GET /spot/orders/active?symbol=&clOrDID= ``` -------------------------------- ### GET Request Format for Withdraw Chain Settings Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_withdraw.md Defines the HTTP GET request format to query withdrawal chain settings for a specific currency and amount. ```HTTP GET /phemex-withdraw/wallets/api/asset/info?currency=&amount= ``` -------------------------------- ### API Request Parameters for Withdraw Chain Settings Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_withdraw.md Details the parameters available for the GET /phemex-withdraw/wallets/api/asset/info endpoint, including their types, requirements, and descriptions. ```APIDOC Endpoint: GET /phemex-withdraw/wallets/api/asset/info Parameters: currency: Type: String Required: NO Description: coin name Example: "ETH" amount: Type: String Required: NO Description: withdraw amount with fee Example: "0.1234" ``` -------------------------------- ### Phemex REST API Signature Example: HTTP POST Request with Body Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_generic.md Provides an example of generating the HMAC SHA256 signature for an HTTP POST request on the Phemex API, including a JSON request body in the signature calculation. ```APIDOC API REST Request URL: https://api.phemex.com/orders Request Path: /orders Request Query: Request Body: {"symbol":"BTCUSD","clOrdID":"uuid-1573058952273","side":"Sell","priceEp":93185000,"orderQty":7,"ordType":"Limit","reduceOnly":false,"timeInForce":"GoodTillCancel","takeProfitEp":0,"stopLossEp":0} Request Expiry: 1575735514 Signature Formula: HMacSha256( /orders + 1575735514 + {"symbol":"BTCUSD","clOrdID":"uuid-1573058952273","side":"Sell","priceEp":93185000,"orderQty":7,"ordType":"Limit","reduceOnly":false,"timeInForce":"GoodTillCancel","takeProfitEp":0,"stopLossEp":0}) Signed String: /orders1575735514{"symbol":"BTCUSD","clOrdID":"uuid-1573058952273","side":"Sell","priceEp":93185000,"orderQty":7,"ordType":"Limit","reduceOnly":false,"timeInForce":"GoodTillCancel","takeProfitEp":0,"stopLossEp":0} ``` -------------------------------- ### Query 24-Hour Ticker for All Symbols API Endpoint Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md This section describes the API endpoint for fetching 24-hour ticker data across all available symbols. It outlines the GET request format, the expected JSON response structure, and a detailed table explaining each field in the response. ```APIDOC GET /md/spot/ticker/24hr/all ``` ```json { "error": null, "id": 0, "result": [ { "askEp": , "bidEp": , "highEp": , "indexEp": , "lastEp": , "lowEp": , "openEp": , "symbol": , "timestamp": , "turnoverEv": , "volumeEv": }, ... // other more symbols ... ] } ``` ```APIDOC Field | Type | Description | Possible Value ---------------|---------|--------------------------------------------|--------------------------------- open priceEp | Integer | The scaled open price in last 24 hours | high priceEp | Integer | The scaled highest price in last 24 hours | low priceEp | Integer | The scaled lowest price in last 24 hours | index priceEp | Integer | The scaled index price in last 24 hours | last priceEp | Integer | The scaled last price | bid priceEp | Integer | Scaled bid price | ask priceEp | Integer | Scaled ask price | timestamp | Integer | Timestamp in nanoseconds | symbol | String | symbol name | [Spot Symbols](#spot_symbols) turnoverEv | Integer | The scaled turnover value in last 24 hours | volumeEv | Integer | The scaled trade volume in last 24 hours | ``` -------------------------------- ### Query Recent Trades API Endpoint Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md This section details the API endpoint for retrieving recent trade data for a specified symbol. It includes the GET request format, the structure of the JSON response, and a table describing each field in the response. A sample request and response are also provided. ```APIDOC GET /md/trade?symbol= ``` ```javascript { "error": null, "id": 0, "result": { "type": "snapshot", "sequence": , "symbol": "", "trades": [ [ , "", , ], ... ... ... ] } } ``` ```APIDOC Field | Type | Description | Possible values -------------|--------|--------------------------------------------|-------------- timestamp | Integer| Timestamp in nanoseconds | side | String | Trade side string | Buy, Sell priceEp | Integer| Scaled trade price | size | Integer| Scaled trade size | sequence | Integer| Current message sequence | symbol | String | Spot symbol name | ``` ```APIDOC GET /md/trade?symbol=sBTCUSDT ``` ```json { "error": null, "id": 0, "result": { "sequence": 15934323, "symbol": "sBTCUSDT", "trades": [ [ 1579164056368538508, "Sell", 869600000000, 1210000 ], [ 1579164055036820552, "Sell", 869600000000, 580000 ] ], "type": "snapshot" } } ``` -------------------------------- ### API Response Format: Account Wallet Transfer History Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_transferV2.md Example JSON structure returned by the API when querying account wallet transfer history, including total count and a list of transfer records. ```json { "code": 0, "data": { "total": 1, "rows": [ { "formUserId": 99900001, "toUserId": 99900001, "fromAccType": "SPOT", "toAccType": "CONTRACT", "currency": "USDT", "amountEv": 100000000, "amount": 1, "status": 10, "bizCode": 3, "requestKey": "13adf", "requestTime": 1706601733000 } ] } } ``` -------------------------------- ### Subscribe to Full Order Book on Phemex WebSocket Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md This snippet shows the request format and a sample for subscribing to the full order book with 100ms interval. Upon successful subscription, the client receives an immediate full order book snapshot followed by continuous updates. ```javascript { "id": , "method": "orderbook.subscribe", "params": [ "", true ] } ``` ```json { "id": 0, "method": "orderbook.subscribe", "params": [ "sBTCUSDT", true ] } ``` -------------------------------- ### Wallet and Order Update Message Sample Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md A sample JSON message demonstrating the structure of real-time wallet and order updates received via WebSocket. It includes details on individual orders, their properties, and user wallet balances for different currencies. ```json { "orders": [ { "qtyType": "ByBase", "quoteCurrency": "USDT", "quoteQtyEv": 0, "side": "Sell", "stopPxEp": 0, "symbol": "sBTCUSDT", "timeInForce": "GoodTillCancel", "transactTimeNs": 1587549529518394000, "triggerTimeNs": 0, "userID": 200076 } ], "sequence": 350, "timestamp": 1587549529519959300, "type": "incremental", "wallets": [ { "balanceEv": 630000005401500000, "currency": "BTC", "lastUpdateTimeNs": 1587547210089640400, "lockedTradingBalanceEv": 200000000, "lockedWithdrawEv": 0, "userID": 200076 }, { "balanceEv": 351802500000, "currency": "USDT", "lastUpdateTimeNs": 1587543489127498200, "lockedTradingBalanceEv": 0, "lockedWithdrawEv": 0, "userID": 200076 } ] } ``` -------------------------------- ### Spot Trading API Endpoints Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_generic.md Lists API endpoints specifically for spot trading, covering order placement, amendment, cancellation, and queries for active and all open spot orders. ```APIDOC Path: /spot/orders Method: POST Weight: 1 Description: Place spot order Path: /spot/orders Method: PUT Weight: 1 Description: Amend spot order Path: /spot/orders Method: DELETE Weight: 2 Description: Cancel spot order Path: /spot/orders/all Method: DELETE Weight: 2 Description: Cancel spot orders by symbol Path: /spot/orders/active Method: GET Weight: 1 Description: Query open spot order Path: /spot/orders Method: GET Weight: 1 Description: Query all open spot orders by symbol ``` -------------------------------- ### Subscribe to Margin Account and Order Updates WebSocket API Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md This section outlines the WebSocket API subscription for real-time updates on margin accounts and orders. It provides the request message format for subscribing and a sample incremental message showing wallet and open order details. ```json { "id": 0, "method": "mao.subscribe", "params": [] } ``` ```json { "wallets_mao": [{ "balanceRv": "6300000054.015", "currency": "BTC", "lastUpdateTimeNs": 1587547210089640382, "lockedTradingBalanceRv": "2", "lockedWithdrawRv": "0", "borrowedRv": "12", "cumInterestRv": "0.5", "hourlyInterestRateRr": "0.0012", "maxAmountToBorrowRv": "100", "userID": 200076 }, { "balanceRv": "3518.025", "currency": "USDT", "lastUpdateTimeNs": 1587543489127498121, "lockedTradingBalanceRv": "0", "lockedWithdrawRv": "0", "borrowedRv": "12", "cumInterestRv": "0.5", "hourlyInterestRateRr": "0.0012", "maxAmountToBorrowRv": "100", "userID": 200076 }], "orders_mao": { "closed": [], "fills": [], "open": [{ "action": "New", "avgPriceRp": "0", "baseCurrency": "BTC", "baseQtyRq": "10000", "bizError": 0, "clOrdID": "0c1099e5-b900-5351-cf60-edb15ea2539c", "createTimeNs": 1587549529513521745, "cumBaseQtyRq": "0", "cumFeeRv": "0", "cumQuoteQtyRq": "0", "curBaseWalletQtyRq": "6300000.0540150", "curQuoteWalletQtyRq": "3518.0250", "cxlRejReason": 0, "feeCurrency": "BTC", "leavesBaseQtyRq": "1", "leavesQuoteQtyRq": "0", "ordStatus": "New", "ordType": "Limit", "orderID": "494a6cbb-32b3-4d6a-b9b7-196ea2506fb5", "pegOffsetValueRv": "0", "priceRp": "6665", "qtyType": "ByBase", "quoteCurrency": "USDT", "quoteQtyRq": "0", "side": "Sell", "stopPxRp": "0", "symbol": "sBTCUSDT", "timeInForce": "GoodTillCancel", "transactTimeNs": 1587549529518394235, "triggerTimeNs": 0, "userID": 200076 }] }, "sequence": 350, "timestamp": 1587549529519959388, "type": "incremental" } ``` -------------------------------- ### Phemex Spot Order API: Place Order (HTTP PUT) Request Parameters Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md Detailed description of parameters required for placing a spot order via HTTP PUT, including their types, requirement status, and possible values. ```APIDOC symbol: String, Required, Description: "", Possible values: [Spot Symbols] side: Enum, Required, Description: "", Possible values: Sell, Buy qtyType: Enum, Required, Description: "Set order quantity by base or quote currency", Possible values: ByBase, ByQuote quoteQtyEv: Integer, Optional, Description: "Required if qtyType = ByQuote" baseQtyEv: Integer, Optional, Description: "Required if qtyType = ByBase" priceEp: Integer, Optional, Description: "Scaled price" stopPxEp: Integer, Optional, Description: "used in conditionalorder" trigger: Enum, Optional, Description: "Required in conditional order", Possible values: ByLastPrice timeInForce: Enum, Optional, Description: "Default GoodTillCancel", Possible values: GoodTillCancel, PostOnly,ImmediateOrCancel,FillOrKill ordType: Enum, Optional, Description: "Default to Limit", Possible values: Market, Limit, Stop, StopLimit, MarketIfTouched, LimitIfTouched ``` -------------------------------- ### Subscribe to Wallet and Order Data (Phemex WebSocket API) Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md This request subscribes to real-time wallet and order updates. It requires a successfully authorized session. Upon subscription, initial snapshot messages are sent, followed by incremental updates for later changes. The snapshot includes wallet balances and recent order history. ```json { "id": 0, "method": "wo.subscribe", "params": [] } ``` -------------------------------- ### Phemex Deposit History API Request Format Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_withdraw.md Defines the HTTP GET request endpoint and structure for querying user deposit history records on Phemex. ```HTTP GET /phemex-deposit/wallets/api/depositHist?currency=&offset=&limit=&withCount= ``` -------------------------------- ### Query Withdraw History API Request Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_withdraw.md Describes the HTTP GET request format and parameters for retrieving a user's withdrawal history records from the Phemex API. ```APIDOC GET /phemex-withdraw/wallets/api/withdrawHist?currency=&chainName=&offset=&limit=&withCount= Request Parameters: - currency: List, NO, currency name list (e.g., USDT, ETH) - chainName: List, NO, chain name list (e.g., ETH, TRX) - offset: Long, NO, default 0 - limit: Integer, NO, default 20 - withCount: Boolean, NO, Total conditional rows found, default False ``` -------------------------------- ### Subscribe to Trades on Phemex WebSocket Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md This snippet shows the request format and a sample for subscribing to trade messages. Upon successful subscription, DataGW sends 200 historical trades immediately for the subscribed symbol, followed by all later trades. ```javascript { "id": , "method": "trade.subscribe", "params": [ "" ] } ``` ```json { "id": 0, "method": "trade.subscribe", "params": [ "sBTCUSDT" ] } ``` -------------------------------- ### Investment Account Message Sample Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md A sample JSON message illustrating the data received for investment account updates. It shows actual values for different currency investments, their respective balances, and interest details. ```json { "investments":[ { "currency":"USDT", "balanceEv":21797700000, "userId":1234, "demandPendingInterestBalanceEv":0, "demandInterestedBalanceEv":0, "timedDepositBalanceEv":20000000000, "currentTimeMillis":1653972360161 }, { "currency":"BTC", "balanceEv":0, "userId":1234, "demandPendingInterestBalanceEv":0, "demandInterestedBalanceEv":0, "timedDepositBalanceEv":0, "currentTimeMillis":1653972360166 } ] } ``` -------------------------------- ### Phemex API Endpoints for REST and Websocket Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_generic.md Details the various base URLs for Phemex's REST and Websocket APIs, categorized by user type (VIP, Public, Testnet). ```APIDOC VIP User Endpoints: REST API: https://vapi.phemex.com Websocket: wss://vapi.phemex.com/ws Public User Endpoints: REST API: https://api.phemex.com Websocket: wss://ws.phemex.com Testnet User Endpoints: REST API: https://testnet-api.phemex.com Websocket: wss://testnet-api.phemex.com/ws ``` -------------------------------- ### Convert REST API: Request for Quote (RFQ) API Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_transfer.md This API endpoint provides a Request for Quote (RFQ) for asset conversion. It allows users to get a quote for converting one currency to another based on a specified amount. ```APIDOC GET /assets/quote ``` ```json { "code": "string", "quoteArgs": { "expireAt": 0, "origin": 0, "price": "string", "proceeds": "string", "quoteAt": 0, "requestAt": 0, "ttlMs": 0 } } ``` ```APIDOC Request Parameters: fromCurrency: String (True) - From currency (e.g., BTC,USD ...) toCurrency: String (True) - To currency (e.g., BTC,USD ...) fromAmountEv: Long (True) - AmountEv to transfer (e.g., 100000 ...) ``` -------------------------------- ### Understanding Phemex Scaled Fields (Ep, Er, Ev) Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md Explains the scaling conventions for price, ratio, and value fields in Phemex API responses. Fields ending with 'Ep' are scaled prices, 'Er' are scaled ratios, and 'Ev' are scaled values. Provides notes on specific scaling factors for ratioScale, priceScale, and qtyScale, linking them to product information. ```APIDOC Scaled Fields: Fields with "Ep" suffix: Scaled prices (priceScale from products) Fields with "Er" suffix: Scaled ratios (ratioScale from products) Fields with "Ev" suffix: Scaled values (valueScale of settleCurrency from products) Notes: 1. ratioScale is always 8. 2. priceScale follows valueScale of quote-currency and quote-ticksize criteria. Example: priceScale of sBTCUSDT follows USDT-valueScale (1e8); scaled price must be multiple of quoteTickSizeEv (1e6). 3. qtyScale follows valueScale of base-currency and base-tickSize criteria. Example: qtyScale of sETHUSDT follows ETH-valueScale (1e8); scaled qty must be multiple of baseTickSizeEv (10000). ``` -------------------------------- ### Subscribe to Spot Order Book Updates (Phemex WebSocket API) Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md This section explains how to subscribe to real-time order book updates for a specified trading symbol on the Phemex Spot WebSocket API. Upon successful subscription, the client receives an initial order book snapshot (depth 30, interval 20ms) followed by continuous updates. ```javascript { "id": , "method": "orderbook.subscribe", "params": [ "" ] } ``` ```APIDOC Subscribe orderbook update messages with **depth = 30 and interval = 20ms**. On each successful subscription, DataGW will immediately send the current Order Book (with default depth=30) snapshot to client and all later order book updates will be published. ``` ```json { "id": 0, "method": "orderbook.subscribe", "params": [ "sBTCUSDT" ] } ``` -------------------------------- ### Phemex Order Book Message Format and Samples Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md This section details the structure of order book messages published by DataGW, including both snapshot and incremental types. It describes fields like priceEp, qty, sequence, depth, and message type, providing samples for both snapshot and incremental updates. Snapshot messages are published with 60-second interval for client self-verification. ```javascript { "book": { "asks": [ [ , ], . . . ], "bids": [ [ , ], . . . ] }, "depth": , "sequence": , "timestamp": , "symbol": "", } ``` ```APIDOC Field | Type | Description | Possible values -------------|--------|-----------------------------------------------------------------------------|----------------- side | String | Price level side | bid, ask priceEp | Integer| Scaled price | qty | Integer| Price level size. Non-zero qty indicates price level insertion or updation, and qty 0 indicates price level deletion. | sequence | Integer| Latest message sequence | depth | Integer| Market depth | 30 by default, 0 denotes fullbook type | String | Message type | snapshot, incremental ``` ```json { "book": { "asks": [ [ 892697000000, 1781800 ], [ 892708000000, 7543500 ] ], "bids": [ [ 892376000000, 6866500 ], [ 892354000000, 14209000 ] ] }, "depth": 30, "sequence": 677996311, "symbol": "sBTCUSDT", "timestamp": 1590570810187571000, "type": "snapshot" } ``` ```json { "book": { "asks": [], "bids": [ [ 892387000000, 4792900 ], [ 892226000000, 0 ] ] }, "depth": 30, "sequence": 677996941, "symbol": "sBTCUSDT", "timestamp": 1590570811244189000, "type": "incremental" } ``` -------------------------------- ### Query Wallets API Endpoint Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md This API endpoint allows users to query their cryptocurrency wallets. It supports filtering by currency and provides details like balance, locked balances, and last update time. By default, it queries all currencies if no specific currency is provided. ```APIDOC GET /spot/wallets?currency= Parameters: currency: String (Optional) - the currency to query (BTC, USDT...) NOTE: GET /spot/wallets queries the wallets of all currencies ``` ```json { "code": 0, "msg": "", "data": [ { "currency": "BTC", "balanceEv": 0, "lockedTradingBalanceEv": 0, "lockedWithdrawEv": 0, "lastUpdateTimeNs": 0 } ] } ``` -------------------------------- ### Subscribe to Kline Data (Phemex WebSocket API) Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md This request initiates a subscription to real-time kline (candlestick) data for a specified symbol and interval. Upon successful subscription, historical kline data is sent, followed by real-time updates. ```javascript { "id": , "method": "kline.subscribe", "params": [ "", "" ] } ``` -------------------------------- ### Contract Trading API Endpoints Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_generic.md Lists API endpoints for contract trading, including order management (place, amend, cancel), and queries for active orders, account, and position information. ```APIDOC Path: /orders Method: POST Weight: 1 Description: Place new order Path: /orders/replace Method: PUT Weight: 1 Description: Amend order Path: /orders/cancel Method: DELETE Weight: 1 Description: Cancel order Path: /orders/all Method: DELETE Weight: 3 Description: Cancel all order by symbol Path: /orders Method: DELETE Weight: 1 Description: cancel orders Path: /orders/activeList Method: GET Weight: 1 Description: Query open orders by symbol Path: /orders/active Method: GET Weight: 1 Description: Query open order by orderID Path: /accounts/accountPositions Method: GET Weight: 1 Description: Query account & position by currency Path: /accounts/positions Method: GET Weight: 25 Description: Query positions with unrealized PNL Path: /g-orders Method: POST Weight: 1 Description: Place new order Path: /g-orders/replace Method: PUT Weight: 1 Description: Amend order Path: /g-orders/cancel Method: DELETE Weight: 1 Description: Cancel order Path: /g-orders/all Method: DELETE Weight: 3 Description: Cancel All Orders Path: /g-orders Method: DELETE Weight: 1 Description: Bulk Cancel Orders Path: /g-orders/activeList Method: GET Weight: 1 Description: Query open orders by symbol Path: /g-orders/active Method: GET Weight: 1 Description: Query open order by orderID Path: /g-orders/create Method: PUT Weight: 1 Description: Place order Path: /g-accounts/accountPositions Method: GET Weight: 1 Description: Query Account Positions Path: /g-accounts/positions Method: GET Weight: 25 Description: Query Account Positions with unrealized PNL Path: /g-positions/assign Method: POST Weight: 1 Description: Assign Position Balance Path: /g-positions/leverage Method: PUT Weight: 1 Description: Set Leverage Path: /g-positions/riskLimit Method: PUT Weight: 1 Description: Set RiskLimit Path: /g-positions/switch-pos-mode-sync Method: PUT Weight: 1 Description: /g-positions/switch-pos-mode-sync ``` -------------------------------- ### Query Phemex Public Products API Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md This API endpoint allows users to retrieve public product information, including spot symbols and currencies. Spot symbols are defined in '.products[]' with type=Spot, and spot currencies are defined in '.currencies[]'. ```APIDOC GET /public/products ``` -------------------------------- ### Subscribe Investment Account Request Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md JSON request to subscribe to real-time investment account information. Upon successful subscription, the user will receive updates on their investment details for each currency type. ```json { "id": 0, "method": "wm.subscribe", "params": [] } ``` -------------------------------- ### Query PnL API Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md API endpoint to retrieve a user's profit and loss (PnL) data, with optional time filters. This provides an overview of daily and cumulative PnL for the user. ```APIDOC GET /api-data/spots/pnls ``` ```json [ { "collectTime": 0, "cumPnlEv": 0, "dailyPnlEv": 0, "userId": 0 } ] ``` ```APIDOC Parameters: start: Type: Integer Required: False Description: Start time in millisecond Default: 2 days before the end time end: Type: Integer Required: False Description: End time in millisecond Default: now ``` -------------------------------- ### Query Margin Wallets REST API Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md This section describes how to query margin wallets using the Phemex REST API. It details the request parameters, including optional currency filtering, and provides the expected JSON response format for wallet balances and related information. ```APIDOC Request parameters: Parameter | Type | Required | Description | Case ---|---|---|---|--- currency | String | No | the currency to query | BTC, USDT... ``` ```http GET /margin-trade/wallets?currency= ``` ```json { "code": 0, "msg": "", "data": [ { "currency": "BTC", "balanceRq": "0", "lockedTradingBalanceRq": "0", "lockedWithdrawRq": "0", "borrowedRq": "0", "cumInterestRq": "0", "lastUpdateTimeNs": 0 } ] } ``` -------------------------------- ### Post Margin Payback Request API Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md Submits a request to payback margin. This endpoint requires specifying the currency and the amount to be paid back. ```HTTP POST /margin/payback?currency=&amountRv= ``` ```APIDOC Parameters: currency: String (Required) - payback currency (e.g., USDT) amountRv: String (Required) - payback amount real value (e.g., 1000.12) ``` ```json { "code": 0, "msg": "OK", "data": { "maxBorrowAmountRq": "80000", "borrowedAmountRq": "40", "currency": "USDT" } } ``` -------------------------------- ### Investment Account Message Fields Reference Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md Detailed API documentation for the fields contained within the investment account message. It specifies data types, descriptions, and possible values for each attribute, including currency, balances, and user ID. ```APIDOC Field | Type | Description | Possible values -------------|--------|------------------|----------------- currency | String |Invested currency | BTC,ETH balanceEv | Integer|Invested amount | 0 userId | Integer| User id | demandPendingInterestBalanceEv | Integer| Pending interest for flexible product | 0 demandInterestedBalanceEv | Integer| Paid interest for flexible product | 0 timedDepositBalanceEv | Integer| Amount for fixed product | 20000000000 currentTimeMillis | Integer| Time in milliseconds | 165397230166 ``` -------------------------------- ### Phemex Spot Order API: Place Order (HTTP POST) Endpoint Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md Defines the HTTP POST endpoint for placing a new spot order using a JSON request body. ```HTTP POST /spot/orders ``` -------------------------------- ### Query Fee Rate by Quote Currency API Endpoint Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md This API endpoint provides the taker and maker fee rates for trading pairs based on a specified quote currency. ```APIDOC GET /api-data/spots/fee-rate?quoteCurrency= ``` ```json { "symbolFeeRates": [ { "takerFeeRateEr": 80000, "makerFeeRateEr": 80000, "symbol": "sETHTRY" } ] } ``` ```APIDOC Field | Type | Required | Description | Possible Values ----------|----------------|----------|---------------------------|--------------------------------- currency | String | True | the currency to query | BTC,ETH, USDT ... start | Integer | False | start time in millisecond | default 2 days ago from the end end | Integer | False | end time in millisecond | default now offset | Integer | False | page start from 0 | start from 0, default 0 limit | Integer | False | page size | default 20, max 200 ``` -------------------------------- ### Phemex REST API Required and Optional Request Headers Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_generic.md Documents the essential HTTP headers required for Phemex REST API requests, including access token, expiry, signature, and an optional tracing header for latency issues. ```APIDOC x-phemex-access-token: API-KEY (id field) from Phemex site. x-phemex-request-expiry: Unix Epoch SECONDS to expire the request (normally Now() + 1 minute). x-phemex-request-signature: HMAC SHA256 signature of the http request. Formula: HMacSha256(URL Path + QueryString + Expiry + body). x-phemex-request-tracing (Optional): A unique string (less than 40 bytes) to trace http-request, crucial for resolving latency issues. ``` -------------------------------- ### Phemex Common Order Fields Definitions Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md Defines common fields used in Phemex orders, including various order types, order statuses, TimeInForce options, and trigger sources. Provides descriptions for each possible value. ```APIDOC Order Type: Limit: -- Market: -- Stop: -- StopLimit: -- MarketIfTouched: -- LimitIfTouched: -- MarketAsLimit: -- StopAsLimit: -- MarketIfTouchedAsLimit: -- Order Status: Untriggered: Conditional order waiting to be triggered Triggered: Conditional order being triggered Rejected: Order rejected New: Order placed in cross engine PartiallyFilled: Order partially filled Filled: Order fully filled Canceled: Order canceled TimeInForce: GoodTillCancel: -- PostOnly: -- ImmediateOrCancel: -- FillOrKill: -- Trigger Source: ByLastPrice: Trigger by last price ``` -------------------------------- ### Phemex New Contract API Symbol Rate Limit Headers Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_generic.md Lists additional HTTP headers for the new Contract API rate limits, specifically those related to symbol-dimensioned capacities, including remaining, total capacity, and retry-after for symbol groups. ```APIDOC Header name | Description -------------------------------------------------|--------------------------------------------------------------------------- x-ratelimit-remaining-*groupName_symbol* | Remaining request ratelimit in the symbol group in this minute x-ratelimit-capacity-*groupName_symbol* | Total request capacity in the symbol group x-ratelimit-retry-after-*groupName_symbol* | Reset timeout in seconds for current ratelimited user in the symbol group ``` -------------------------------- ### Phemex Trading Engine Error Codes Reference Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_generic.md This section lists error codes returned by the Phemex Trading Engine, detailing issues related to wallet operations, order placement, and bracket orders. Each entry includes the error code, its symbolic name, and a brief description of the cause. ```APIDOC Error Codes: - Code: 11099 Name: TE_WALLET_VID_UNMATCHED Description: Wallet operation request has a wrong wallet vid - Code: 11100 Name: TE_WALLET_INSUFFICIENT_BALANCE Description: Wallet has insufficient balance - Code: 11101 Name: TE_WALLET_INSUFFICIENT_LOCKED_BALANCE Description: Locked balance in wallet is not enough for unlock/withdraw request - Code: 11102 Name: TE_WALLET_INVALID_DEPOSIT_AMOUNT Description: Deposit amount must be greater than zero - Code: 11103 Name: TE_WALLET_INVALID_WITHDRAW_AMOUNT Description: Withdraw amount must be less than zero - Code: 11104 Name: TE_WALLET_REACHED_MAX_AMOUNT Description: Deposit makes wallet exceed max amount allowed - Code: 11105 Name: TE_PLACE_ORDER_INSUFFICIENT_BASE_BALANCE Description: Insufficient funds in base wallet - Code: 11106 Name: TE_PLACE_ORDER_INSUFFICIENT_QUOTE_BALANCE Description: Insufficient funds in quote wallet - Code: 11107 Name: TE_CANNOT_CONNECT_TO_REQUEST_SEQ Description: TradingEngine failed to connect with CrossEngine - Code: 11108 Name: TE_CANNOT_REPLACE_OR_CANCEL_MARKET_ORDER Description: Cannot replace/amend market order - Code: 11109 Name: TE_CANNOT_REPLACE_OR_CANCEL_IOC_ORDER Description: Cannot replace/amend ImmediateOrCancel order - Code: 11110 Name: TE_CANNOT_REPLACE_OR_CANCEL_FOK_ORDER Description: Cannot replace/amend FillOrKill order - Code: 11111 Name: TE_MISSING_ORDER_ID Description: OrderId is missing - Code: 11112 Name: TE_QTY_TYPE_INVALID Description: QtyType is invalid - Code: 11113 Name: TE_USER_ID_INVALID Description: UserId is invalid - Code: 11114 Name: TE_ORDER_VALUE_TOO_LARGE Description: Order value is too large - Code: 11115 Name: TE_ORDER_VALUE_TOO_SMALL Description: Order value is too small - Code: 11116 Name: TE_BO_NUM_EXCEEDS Description: The total count of bracket orders should equal or less than 5 - Code: 11117 Name: TE_BO_CANNOT_HAVE_BO_WITH_DIFF_SIDE Description: All bracket orders should have the same Side. - Code: 11118 Name: TE_BO_TP_PRICE_INVALID Description: Bracket order take profit price is invalid - Code: 11119 Name: TE_BO_SL_PRICE_INVALID Description: Bracket order stop loss price is invalid - Code: 11120 Name: TE_BO_SL_TRIGGER_PRICE_INVALID Description: Bracket order stop loss trigger price is invalid - Code: 11121 Name: TE_BO_CANNOT_REPLACE Description: Cannot replace bracket order. - Code: 11122 Name: TE_BO_BOTP_STATUS_INVALID Description: Bracket take profit order status is invalid - Code: 11123 Name: TE_BO_CANNOT_PLACE_BOTP_OR_BOSL_ORDER Description: Cannot place bracket take profit order - Code: 11124 Name: TE_BO_CANNOT_REPLACE_BOTP_OR_BOSL_ORDER Description: Cannot place bracket stop loss order - Code: 11125 Name: TE_BO_CANNOT_CANCEL_BOTP_OR_BOSL_ORDER Description: Cannot cancel bracket sl/tp order - Code: 11126 Name: TE_BO_DONOT_SUPPORT_API Description: Doesn't support bracket order via API - Code: 11128 Name: TE_BO_INVALID_EXECINST Description: ExecInst value is invalid - Code: 11129 Name: TE_BO_MUST_BE_SAME_SIDE_AS_POS Description: Bracket order should have the same side as position's side - Code: 11130 Name: TE_BO_WRONG_SL_TRIGGER_TYPE Description: Bracket stop loss order trigger type is invalid - Code: 11131 Name: TE_BO_WRONG_TP_TRIGGER_TYPE Description: Bracket take profit order trigger type is invalid - Code: 11132 Name: TE_BO_ABORT_BOSL_DUE_BOTP_CREATE_FAILED Description: Cancel bracket stop loss order due failed to create take profit order. - Code: 11133 Name: TE_BO_ABORT_BOSL_DUE_BOPO_CANCELED Description: Cancel bracket stop loss order due main order canceled. - Code: 11134 Name: TE_BO_ABORT_BOTP_DUE_BOPO_CANCELED Description: Cancel bracket take profit order due main order canceled. ``` -------------------------------- ### Query Spot Product Information Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md Retrieves detailed information about spot trading products and currencies available on Phemex. Spot symbols are identified by 'type=Spot' within the products array, and currencies are listed in the currencies array. ```APIDOC Request: Method: GET Path: /public/products Response Details: .products[]: Spot symbols (type=Spot) .currencies[]: Spot currencies ``` -------------------------------- ### Post Margin Borrow Request API Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md Submits a request to borrow margin. This endpoint requires specifying the currency and the amount to be borrowed. ```HTTP POST /margin/borrow?currency=&amountRv= ``` ```APIDOC Parameters: currency: String (Required) - borrow currency (e.g., USDT) amountRv: String (Required) - borrow amount real value (e.g., 1000.12) ``` ```json { "code": 0, "msg": "OK", "data": { "maxBorrowAmountRq": "80000", "borrowedAmountRq": "40", "currency": "USDT" } } ``` -------------------------------- ### Query Extended Spot Product Information Source: https://github.com/phemex-docs/phemex-docs.github.io/blob/main/source/includes/_spot.md Retrieves extended information about spot trading products and currencies, including list and delist times for products. Spot symbols are identified by 'type=Spot' within the products array, and currencies are listed in the currencies array. ```APIDOC Request: Method: GET Path: /public/products-plus Response Details: .products[]: Spot symbols (type=Spot) timeline[1]: list time timeline[3]: delist time .currencies[]: Spot currencies ```