edgeX 백서

edgeX

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 22쪽 중 11쪽

-------- | | 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | successful response | [Result](#account) | ## GET Account Asset GET /api/v2/private/account/getAccountAsset ### Request Parameters | Name | Type | Required | Description | | --------- | ------ | -------- | ----------- | | accountId | string | Yes | Account ID | > Response Example > 200 Response ```json { "code": "SUCCESS", "data": { "account": { "id": "543429922991899150", "userId": "543429922866069763", "ethAddress": "0x1fB51aa234287C3CA1F957eA9AD0E148Bb814b7A", "l2Key": "0x5580341e2c99823a0a35356b8ac84e372dd38fd1f4b50f607b931ec8038c211", "l2KeyYCoordinate": "0x6ea3dd81a7fc864893c8c6f674e4a4510c369f939bdc0259a0980dfde882c2d", "clientAccountId": "main", "isSystemAccount": false, "defaultTradeSetting": { "isSetFeeRate": true, "takerFeeRate": "0.000500", "makerFeeRate": "0.000180", "isSetFeeDiscount": false, "takerFeeDiscount": "0", "makerFeeDiscount": "0", "isSetMaxLeverage": false, "maxLeverage": "0" }, "contractIdToTradeSetting": { "10000001": { "isSetFeeRate": false, "takerFeeRate": "", "makerFeeRate": "", "isSetFeeDiscount": false, "takerFeeDiscount": "", "makerFeeDiscount": "", "isSetMaxLeverage": true, "maxLeverage": "50" } }, "maxLeverageLimit": "0", "createOrderPerMinuteLimit": 0, "createOrderDelayMillis": 0, "extraType": "", "extraDataJson": "", "status": "NORMAL", "isLiquidating": false, "createdTime": "1730204434094", "updatedTime": "1733993378059" }, "collateralList": [ { "userId": "543429922866069763", "accountId": "543429922991899150", "coinId": "1000", "amount": "-81.943188", "legacyAmount": "15.501312", "cumDepositAmount": "70.000000", "cumWithdrawAmount": "0", "cumTransferInAmount": "0", "cumTransferOutAmount": "-55.000000", "cumPositionBuyAmount": "-388.4645", "cumPositionSellAmount": "291.7367", "cumFillFeeAmount": "-0.215388", "cumFundingFeeAmount": "0", "cumFillFeeIncomeAmount": "0", "createdTime": "1730204434094", "updatedTime": "1734663352066" } ], "positionList": [ { "userId": "543429922866069763", "accountId": "543429922991899150", "coinId": "1000", "contractId": "10000001", "openSize": "0.001", "openValue": "97.444500", "openFee": "-0.017540", "fundingFee": "0.000000", "longTermCount": 3, "longTermStat": { "cumOpenSize": "0.001", "cumOpenValue": "97.444500", "cumOpenFee": "-0.017540", "cumCloseSize": "0", "cumCloseValue": "0", "cumCloseFee": "0", "cumFundingFee": "0", "cumLiquidateFee": "0" }, "longTermCreatedTime": "1734662617992", "longTermUpdatedTime": "1734662617992", "shortTermCount": 0, "shortTermStat": { "cumOpenSize": "0", "cumOpenValue": "0", "cumOpenFee": "0", "cumCloseSize": "0", "cumCloseValue": "0", "cumCloseFee": "0", "cumFundingFee": "0", "cumLiquidateFee": "0" }, "shortTermCreatedTime": "0", "shortTermUpdatedTime": "0", "longTotalStat": { "cumOpenSize": "0.004", "cumOpenValue": "388.464500", "cumOpenFee": "-0.131882", "cumCloseSize": "-0.003", "cumCloseValue": "-291.736700", "cumCloseFee": "-0.083506", "cumFundingFee": "0", "cumLiquidateFee": "0" }, "shortTotalStat": { "cumOpenSize": "0", "cumOpenValue": "0", "cumOpenFee": "0", "cumCloseSize": "0", "cumCloseValue": "0", "cumCloseFee": "0", "cumFundingFee": "0", "cumLiquidateFee": "0" }, "createdTime": "1734661018663", "updatedTime": "1734662617992" } ], "version": "1021", "positionAssetList": [ { "userId": "543429922866069763", "accountId": "543429922991899150", "coinId": "1000", "contractId": "10000001", "positionValue": "97.734426609240472316741943359375", "maxLeverage": "50", "initialMarginRequirement": "1.954688532184809446334838867187500000", "riskRate": "0.00500000012107193470001220703125", "riskValue": "0.48867214487909847796080764492643311314168386161327362060546875", "avgEntryPrice": "97444.5", "liquidatePrice": "82354.9", "bankruptPrice": "81943.1", "worstClosePrice": "81984.2", "unrealizePnl": "0.289926609240472316741943359375", "termRealizePnl": "0.000000", "totalRealizePnl": "0.716700" } ], "collateralAssetModelList": [ { "userId": "543429922866069763", "accountId": "543429922991899150", "coinId": "1000", "totalEquity": "15.791238609240472316741943359375", "totalPositionValueAbs": "97.734426609240472316741943359375", "initialMarginRequirement": "1.954688532184809446334838867187500000", "riskValue": "0.48867214487909847796080764492643311314168386161327362060546875", "pendingWithdrawAmount": "0", "pendingTransferOutAmount": "0", "orderFrozenAmount": "0", "availableAmount": "13.836550" } ], "oraclePriceList": [] }, "msg": null, "errorParam": null, "requestTime": "1734664627939", "responseTime": "1734664627957", "traceId": "4a3a5cd027ea6c255c8c944567b634f1" } ``` ### Response | Status Code | Status Code Description | Description | Data Model | | ----------- | ------------------------------------------------------- | ------------------- | ------------------------------- | | 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | successful response | [Result](#accountassetsnapshot) | ## GET Get Account Asset Snapshot Page by Account ID GET /api/v2/private/account/getAccountAssetSnapshotPage ### Request Parameters | Name | Type | Required | Description | | ------------------------ | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | accountId | string | Yes | Account ID | | size | string | No | Number of items to retrieve. Must be greater than 0 and less than or equal to 1000 | | offsetData | string | No | Pagination offset. If empty or not provided, the first page is retrieved | | coinId | string | No | Filter by the specified coin ID. | | filterTimeTag | string | No | Specifies time tag. If not provided or 0, returns snapshots by the hour. 1 returns snapshots by the day | | filterStartTimeInclusive | string | No | Filter snapshots created after or at the specified start time (inclusive). If not provided or 0, retrieves records from the earliest time | | filterEndTimeExclusive | string | No | Filter snapshots created before the specified end time (exclusive). If not provided or 0, retrieves records up to the latest time | > Response Example > 200 Response ```json { "code": "SUCCESS", "data": { "dataList": [ { "userId": "543429922866069763", "accountId": "543429922991899150", "coinId": "1000", "timeTag": 1, "snapshotTime": "1734652800000", "totalEquity": "16.000000", "termRealizePnl": "0", "unrealizePnl": "0", "totalRealizePnl": "0" }, { "userId": "543429922866069763", "accountId": "543429922991899150", "coinId": "1000", "timeTag": 1, "snapshotTime": "1734566400000", "totalEquity": "16.000000", "termRealizePnl": "0", "unrealizePnl": "0", "totalRealizePnl": "0" } ], "nextPageOffsetData": "" }, "msg": null, "errorParam": null, "requestTime": "1734663257066", "responseTime": "1734663257075", "traceId": "f52222cd41b6ff8bcd059a57ecd986a1" } ``` ### Response | Status Code | Status Code Description | Description | Data Model | | ----------- | ------------------------------------------------------- | ------------------- | -------------------------------- | | 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | successful response | [Result](#accountassetsnapshot>) | ## Data Model Notes * Start with `GetAccountAssetPayload` if you are integrating balances, collateral, and position summaries. * The remaining models mostly support paginated history endpoints for collateral, position, and transaction data. * Preserve server field names exactly as returned, especially account, collateral, and position identifiers. ## Data Models ### AccountAssetSnapshotRecord | Name | Type | Description | | -------------------------- | ------------------------------------------------------------------- | --------------------------------------------------- | | code | string | Status Code | | data | [PageDataAccountAssetSnapshot](#schemapagedataaccountassetsnapshot) | Generic Paginated Response | | errorParam | object | Error Parameters | | » **additionalProperties** | string | Error Parameters | | requestTime | string(timestamp) | Server Request Time | | responseTime | string(timestamp) | Server Response Time | | traceId | string | Trace ID for request tracing and support follow-up. | ### AccountAssetSnapshotPage | Name | Type | Description | | ------------------ | ------------------------------------------------------ | ----------------------------------------------------------------- | | dataList | \[[AccountAssetSnapshot](#schemaaccountassetsnapshot)] | Data List | | nextPageOffsetData | string | Offset token for the next page. Empty when there is no next page. | ### AccountAssetSnapshotPayload | Name | Type | Description | | --------------- | -------------- | ---------------------- | | userId | string(int64) | User ID | | accountId | string(int64) | Account ID | | coinId | string(int64) | Collateral Coin ID | | timeTag | integer(int32) | Time Tag | | snapshotTime | string(int64) | Snapshot Time | | totalEquity | string | Total Collateral Value | | termRealizePnl | string | Term Realized PnL | | unrealizePnl | string | Unrealized PnL | | totalRealizePnl | string | Total Realized PnL | ### GetAccountAssetResult | Name | Type | Description | | ------------ | ----------------------------------------- | --------------------------------------------------- | | code | string | Status Code | | data | [GetAccountAsset](#schemagetaccountasset) | Get Account Asset Response | | errorParam | object | Error Parameters | | requestTime | string(timestamp) | Server Request Time | | responseTime | string(timestamp) | Server Response Time | | traceId | string | Trace ID for request tracing and support follow-up. | ### GetAccountAssetPayload | Name | Type | Description | | ------------------------ | -------------------------------------------- | ------------------------------------ | | account | [Account](#schemaaccount) | Account Information | | collateralList | \[[Collateral](#schemacollateral)] | Collateral Information List | | positionList | \[[Position](#schemaposition)] | Perpetual Contract Position List | | version | string(int64) | Account Version | | positionAssetList | \[[PositionAsset](#schemapositionasset)] | Position Asset Information List | | collateralAssetModelList | \[[CollateralAsset](#schemacollateralasset)] | Account-Level Asset Information List | | oraclePriceList | \[[IndexPrice](#schemaindexprice)] | Oracle Price List | ### IndexPriceRecord | Name | Type | Description | | -------------------- | ------------------------------------------------------ | ---------------------------------- | | contractId | string(int64) | Contract ID | | priceType | string | Price Type | | priceValue | string | Price Value | | createdTime | string(int64) | Creation Time | | oraclePriceSignature | \[[OraclePriceSignature](#schemaoraclepricesignature)] | Oracle Price Signature Information | #### Enumerated Values | Property | Value | | --------- | -------------------- | | priceType | UNKNOWN\_PRICE\_TYPE | | priceType | ORACLE\_PRICE | | priceType | INDEX\_PRICE | | priceType | LAST\_PRICE | | priceType | ASK1\_PRICE | | priceType | BID1\_PRICE | | priceType | OPEN\_INTEREST | | priceType | UNRECOGNIZED | ### OraclePriceSignature | Name | Type | Description | | --------------- | --------------------------------- | ----------------------------------- | | contractId | string(int64) | Contract ID | | signer | string | Signer ID | | price | string | Signed Price | | externalAssetId | string | Concatenated Asset and Oracle Names | | signature | [L2Signature](#schemal2signature) | L2 Signature Information | | timestamp | string(int64) | Signature Creation Time | ### L2SignaturePayload | Name | Type | Description | | ---- | ------ | ----------- | | r | string | R Value | | s | string | S Value | | v | string | V Value | ### CollateralAssetRecord | Name | Type | Description | | ------------------------ | ------------- | ------------------------------- | | userId | string(int64) | User ID | | accountId | string(int64) | Account ID | | coinId | string(int64) | Collateral Coin ID | | totalEquity | string | Total Collateral Value | | totalPositionValueAbs | string | Sum of Absolute Position Values | | initialMarginRequirement | string | Initial Margin Requirement | | riskValue | string | Total Risk Value | | pendingWithdrawAmount | string | Pending Withdrawal Amount | | pendingTransferOutAmount | string | Pending Transfer Out Amount | | orderFrozenAmount | string | Order Frozen Amount | | availableAmount | string | Available Amount | ### PositionAssetRecord | Name | Type | Description | | ------------------------ | ------------- | -------------------------- | | userId | string(int64) | User ID | | accountId | string(int64) | Account ID | | coinId | string(int64) | Collateral Coin ID | | contractId | string(int64) | Contract ID | | positionValue | string | Position Value | | maxLeverage | string | Maximum Leverage | | initialMarginRequirement | string | Initial Margin Requirement | | riskRate | string | Risk Rate | | riskValue | string | Risk Value | | avgEntryPrice | string | Average Entry Price | | liquidatePrice | string | Liquidation Price | | bankruptPrice | string | Bankruptcy Price | | worstClosePrice | string | Worst Close Price | | unrealizePnl | string | Unrealized PnL | | termRealizePnl | string | Term Realized PnL | | totalRealizePnl | string | Total Realized PnL | ### PositionPayload | Name | Type | Description | | -------------------- | ----------------------------------- | ------------------------------------ | | userId | string(int64) | User ID | | accountId | string(int64) | Account ID | | coinId | string(int64) | Collateral Coin ID | | contractId | string(int64) | Contract ID | | openSize | string | Current Open Size | | openValue | string | Current Open Value | | openFee | string | Current Open Fee | | fundingFee | string | Current Funding Fee | | longTermCount | integer(int32) | Long Position Term Count | | longTermStat | [PositionStat](#schemapositionstat) | Long Position Cumulative Statistics | | longTermCreatedTime | string | Long Position Term Creation Time | | longTermUpdatedTime | string | Long Position Term Update Time | | shortTermCount | integer(int32) | Short Position Term Count | | shortTermStat | [PositionStat](#schemapositionstat) | Short Position Cumulative Statistics | | shortTermCreatedTime | string | Short Position Term Creation Time | | shortTermUpdatedTime | string | Short Position Term Update Time | | longTotalStat | [PositionStat](#schemapositionstat) | Long Cumulative Statistics | | shortTotalStat | [PositionStat](#schemapositionstat) | Short Cumulative Statistics | | createdTime | string(int64) | Creation Time | | updatedTime | string(int64) | Update Time | ### PositionStatRecord | Name | Type | Description | | --------------- | ------ | ------------------------ | | cumOpenSize | string | Cumulative Open Size | | cumOpenValue | string | Cumulative Open Value | | cumOpenFee | string | Cumulative Open Fee | | cumCloseSize | string | Cumulative Close Size | | cumCloseValue | string | Cumulative Close Value | | cumCloseFee | string | Cumulative Close Fee | | cumFundingFee | string | Cumulative Funding Fee | | cumLiquidateFee | string | Cumulative Liquidate Fee | ### CollateralPayload | Name | Type | Description | | ---------------------- | --------------- | --------------------------------------- | | userId | string(int64) | User ID | | accountId | string(int64) | Account ID | | coinId | string(int64) | Coin ID | | amount | string(decimal) | Collateral Amount | | legacyAmount | string(decimal) | Legacy Amount | | cumDepositAmount | string(decimal) | Cumulative Deposit Amount | | cumWithdrawAmount | string(decimal) | Cumulative Withdrawal Amount | | cumTransferInAmount | string(decimal) | Cumulative Transfer In Amount | | cumTransferOutAmount | string(decimal) | Cumulative Transfer Out Amount | | cumPositionBuyAmount | string(decimal) | Cumulative Position Buy Amount | | cumPositionSellAmount | string(decimal) | Cumulative Position Sell Amount | | cumFillFeeAmount | string(decimal) | Cumulative Fill Fee Amount | | cumFundingFeeAmount | string(decimal) | Cumulative Funding Fee Amount | | cumFillFeeIncomeAmount | string(decimal) | Cumulative Order Fill Fee Income Amount | | createdTime | string(int64) | Creation Time | | updatedTime | string(int64) | Update Time | ### AccountPayload | Name | Type | Description | | -------------------------- | ----------------------------------- | ------------------------------------- | | id | string(int64) | Account ID | | userId | string(int64) | User ID | | ethAddress | string | Wallet ETH Address | | l2Key | string | L2 Account Key | | l2KeyYCoordinate | string | L2 Key Y Coordinate | | clientAccountId | string | Client Account ID | | isSystemAccount | boolean | System Account | | defaultTradeSetting | [TradeSetting](#schematradesetting) | Default Trade Setting | | contractIdToTradeSetting | object | Contract-Level Account Trade Settings | | » **additionalProperties** | [TradeSetting](#schematradesetting) | Contract-Level Account Trade Settings | | maxLeverageLimit | string | Maximum Leverage Limit | | createOrderPerMinuteLimit | integer(int32) | Order Creation Limit per Minute | | createOrderDelayMillis | integer(int32) | Order Creation Delay Milliseconds | | extraType | string | Extra Type | | extraDataJson | string | Extra Data | | status | string | Account Status | | isLiquidating | boolean | Is Liquidating | | createdTime | string(int64) | Creation Time | | updatedTime | string(int64) | Update Time | #### Enumerated Values | Property | Value | | -------- | ------------------------ | | status | UNKNOWN\_ACCOUNT\_STATUS | | status | CENSORING | | status | NORMAL | | status | DISABLED | | status | INVALID | | status | UNRECOGNIZED | ### TradeSettingRecord | Name | Type | Description | | ---------------- | --------------- | ------------------------------- | | isSetFeeRate | boolean | Whether Fee Rate is Set | | takerFeeRate | string(decimal) | Taker Fee Rate | | makerFeeRate | string(decimal) | Maker Fee Rate | | isSetFeeDiscount | boolean | Whether Fee Discount is Set | | takerFeeDiscount | string(decimal) | Taker Fee Discount | | makerFeeDiscount | string(decimal) | Maker Fee Discount | | isSetMaxLeverage | boolean | Whether Maximum Leverage is Set | | maxLeverage | string(decimal) | Maximum Leverage | ### AccountResult | Name | Type | Description | | ------------ | ------------------------- | --------------------------------------------------- | | code | string | Status Code | | data | [Account](#schemaaccount) | Account Information | | errorParam | object | Error Parameters | | requestTime | string(timestamp) | Server Request Time | | responseTime | string(timestamp) | Server Response Time | | traceId | string | Trace ID for request tracing and support follow-up. | ### GetAccountDeleverageLightResult | Name | Type | Description | | ------------ | ------------------------------------------------------------- | --------------------------------------------------- | | code | string | Status Code | | data | [GetAccountDeleverageLight](#schemagetaccountdeleveragelight) | Get Account Deleverage Light Response | | errorParam | object | Error Parameters | | requestTime | string(timestamp) | Server Request Time | | responseTime | string(timestamp) | Server Response Time | | traceId | string | Trace ID for request tracing and support follow-up. | ### DeleverageLightResponse | Name | Type | Description | | ---------------------------------- | ------ | --------------------------------------------- | | positionContractIdToLightNumberMap | object | Map from Position Contract ID to Light Number | ### AccountRecord | Name | Type | Description | | -----------
프로젝트로 돌아가기