From 61ad960296a15cdedf36d0428f24735ee4fa2ad4 Mon Sep 17 00:00:00 2001 From: dydxwill <119354122+dydxwill@users.noreply.github.com> Date: Fri, 14 Jun 2024 14:26:32 -0400 Subject: [PATCH 1/3] Add latest block height to /addresses API endpoint (#1701) (cherry picked from commit 035777597f5df925b3490c873a017836a13f4c06) # Conflicts: # indexer/services/comlink/__tests__/controllers/api/v4/addresses-controller.test.ts # indexer/services/comlink/public/api-documentation.md # indexer/services/comlink/public/swagger.json # indexer/services/comlink/src/request-helpers/request-transformer.ts # indexer/services/comlink/src/types.ts --- .../api/v4/addresses-controller.test.ts | 50 +++++++++++++++++++ .../comlink/public/api-documentation.md | 41 +++++++++++++++ indexer/services/comlink/public/swagger.json | 15 ++++++ .../api/v4/addresses-controller.ts | 5 ++ .../request-helpers/request-transformer.ts | 7 +++ indexer/services/comlink/src/types.ts | 5 ++ 6 files changed, 123 insertions(+) diff --git a/indexer/services/comlink/__tests__/controllers/api/v4/addresses-controller.test.ts b/indexer/services/comlink/__tests__/controllers/api/v4/addresses-controller.test.ts index 61961fd461..9b4eb7e20b 100644 --- a/indexer/services/comlink/__tests__/controllers/api/v4/addresses-controller.test.ts +++ b/indexer/services/comlink/__tests__/controllers/api/v4/addresses-controller.test.ts @@ -82,6 +82,11 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(159500), freeCollateral: getFixedRepresentation(152000), marginEnabled: true, +<<<<<<< HEAD +======= + updatedAtHeight: testConstants.defaultSubaccount.updatedAtHeight, + latestProcessedBlockHeight: latestHeight, +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) openPerpetualPositions: { [testConstants.defaultPerpetualMarket.ticker]: { market: testConstants.defaultPerpetualMarket.ticker, @@ -159,6 +164,11 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(10000), freeCollateral: getFixedRepresentation(10000), marginEnabled: true, +<<<<<<< HEAD +======= + updatedAtHeight: testConstants.defaultSubaccount.updatedAtHeight, + latestProcessedBlockHeight: latestHeight, +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) openPerpetualPositions: {}, assetPositions: { [testConstants.defaultAsset.symbol]: { @@ -243,6 +253,11 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(159500), freeCollateral: getFixedRepresentation(152000), marginEnabled: true, +<<<<<<< HEAD +======= + updatedAtHeight: testConstants.defaultSubaccount.updatedAtHeight, + latestProcessedBlockHeight: latestHeight, +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) openPerpetualPositions: { [testConstants.defaultPerpetualMarket.ticker]: { market: testConstants.defaultPerpetualMarket.ticker, @@ -293,6 +308,11 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(0), freeCollateral: getFixedRepresentation(0), marginEnabled: true, +<<<<<<< HEAD +======= + updatedAtHeight: testConstants.defaultSubaccount2.updatedAtHeight, + latestProcessedBlockHeight: latestHeight, +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) openPerpetualPositions: {}, assetPositions: {}, }, @@ -302,6 +322,11 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(0), freeCollateral: getFixedRepresentation(0), marginEnabled: true, +<<<<<<< HEAD +======= + updatedAtHeight: testConstants.isolatedSubaccount.updatedAtHeight, + latestProcessedBlockHeight: latestHeight, +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) openPerpetualPositions: {}, assetPositions: {}, }, @@ -311,6 +336,11 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(0), freeCollateral: getFixedRepresentation(0), marginEnabled: true, +<<<<<<< HEAD +======= + updatedAtHeight: testConstants.isolatedSubaccount2.updatedAtHeight, + latestProcessedBlockHeight: latestHeight, +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) openPerpetualPositions: {}, assetPositions: {}, }, @@ -348,6 +378,11 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(0), freeCollateral: getFixedRepresentation(0), marginEnabled: true, +<<<<<<< HEAD +======= + updatedAtHeight: testConstants.defaultSubaccount.updatedAtHeight, + latestProcessedBlockHeight: latestHeight, +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) assetPositions: {}, openPerpetualPositions: {}, }, @@ -431,6 +466,11 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(159500), freeCollateral: getFixedRepresentation(152000), marginEnabled: true, +<<<<<<< HEAD +======= + updatedAtHeight: testConstants.defaultSubaccount.updatedAtHeight, + latestProcessedBlockHeight: latestHeight, +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) openPerpetualPositions: { [testConstants.defaultPerpetualMarket.ticker]: { market: testConstants.defaultPerpetualMarket.ticker, @@ -481,6 +521,11 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(5000), freeCollateral: getFixedRepresentation(5000), marginEnabled: true, +<<<<<<< HEAD +======= + updatedAtHeight: testConstants.isolatedSubaccount.updatedAtHeight, + latestProcessedBlockHeight: latestHeight, +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) openPerpetualPositions: {}, assetPositions: { [testConstants.defaultAsset.symbol]: { @@ -498,6 +543,11 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(0), freeCollateral: getFixedRepresentation(0), marginEnabled: true, +<<<<<<< HEAD +======= + updatedAtHeight: testConstants.isolatedSubaccount2.updatedAtHeight, + latestProcessedBlockHeight: latestHeight, +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) openPerpetualPositions: {}, assetPositions: {}, }, diff --git a/indexer/services/comlink/public/api-documentation.md b/indexer/services/comlink/public/api-documentation.md index 1a43561cd2..14d8efdd4c 100644 --- a/indexer/services/comlink/public/api-documentation.md +++ b/indexer/services/comlink/public/api-documentation.md @@ -123,7 +123,13 @@ fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}', "subaccountNumber": 0 } }, +<<<<<<< HEAD "marginEnabled": true +======= + "marginEnabled": true, + "updatedAtHeight": "string", + "latestProcessedBlockHeight": "string" +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) } ], "totalTradingRewards": "string" @@ -251,7 +257,13 @@ fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}/subaccountNumber "subaccountNumber": 0 } }, +<<<<<<< HEAD "marginEnabled": true +======= + "marginEnabled": true, + "updatedAtHeight": "string", + "latestProcessedBlockHeight": "string" +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) } ``` @@ -382,7 +394,13 @@ fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}/parentSubaccount "subaccountNumber": 0 } }, +<<<<<<< HEAD "marginEnabled": true +======= + "marginEnabled": true, + "updatedAtHeight": "string", + "latestProcessedBlockHeight": "string" +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) } ] } @@ -2982,7 +3000,13 @@ This operation does not require authentication "subaccountNumber": 0 } }, +<<<<<<< HEAD "marginEnabled": true +======= + "marginEnabled": true, + "updatedAtHeight": "string", + "latestProcessedBlockHeight": "string" +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) } ``` @@ -2998,6 +3022,11 @@ This operation does not require authentication |openPerpetualPositions|[PerpetualPositionsMap](#schemaperpetualpositionsmap)|true|none|none| |assetPositions|[AssetPositionsMap](#schemaassetpositionsmap)|true|none|none| |marginEnabled|boolean|true|none|none| +<<<<<<< HEAD +======= +|updatedAtHeight|string|true|none|none| +|latestProcessedBlockHeight|string|true|none|none| +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) ## AddressResponse @@ -3068,7 +3097,13 @@ This operation does not require authentication "subaccountNumber": 0 } }, +<<<<<<< HEAD "marginEnabled": true +======= + "marginEnabled": true, + "updatedAtHeight": "string", + "latestProcessedBlockHeight": "string" +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) } ], "totalTradingRewards": "string" @@ -3156,7 +3191,13 @@ This operation does not require authentication "subaccountNumber": 0 } }, +<<<<<<< HEAD "marginEnabled": true +======= + "marginEnabled": true, + "updatedAtHeight": "string", + "latestProcessedBlockHeight": "string" +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) } ] } diff --git a/indexer/services/comlink/public/swagger.json b/indexer/services/comlink/public/swagger.json index d857a02dfe..57b7f42b48 100644 --- a/indexer/services/comlink/public/swagger.json +++ b/indexer/services/comlink/public/swagger.json @@ -167,6 +167,15 @@ }, "marginEnabled": { "type": "boolean" +<<<<<<< HEAD +======= + }, + "updatedAtHeight": { + "type": "string" + }, + "latestProcessedBlockHeight": { + "type": "string" +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) } }, "required": [ @@ -176,7 +185,13 @@ "freeCollateral", "openPerpetualPositions", "assetPositions", +<<<<<<< HEAD "marginEnabled" +======= + "marginEnabled", + "updatedAtHeight", + "latestProcessedBlockHeight" +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) ], "type": "object", "additionalProperties": false diff --git a/indexer/services/comlink/src/controllers/api/v4/addresses-controller.ts b/indexer/services/comlink/src/controllers/api/v4/addresses-controller.ts index 23ee3f280e..ed58fdebb9 100644 --- a/indexer/services/comlink/src/controllers/api/v4/addresses-controller.ts +++ b/indexer/services/comlink/src/controllers/api/v4/addresses-controller.ts @@ -154,6 +154,7 @@ class AddressesController extends Controller { assets, markets, unsettledFunding, + latestBlock.blockHeight, ); }, )); @@ -239,6 +240,7 @@ class AddressesController extends Controller { assets, markets, unsettledFunding, + latestBlock.blockHeight, ); return subaccountResponse; } @@ -322,6 +324,7 @@ class AddressesController extends Controller { assets, markets, unsettledFunding, + latestBlock.blockHeight, ); }, )); @@ -491,6 +494,7 @@ async function getSubaccountResponse( assets: AssetFromDatabase[], markets: MarketFromDatabase[], unsettledFunding: Big, + latestBlockHeight: string, ): Promise { const perpetualMarketsMap: PerpetualMarketsMap = perpetualMarketRefresher .getPerpetualMarketsMap(); @@ -567,6 +571,7 @@ async function getSubaccountResponse( subaccount, equity, freeCollateral, + latestBlockHeight, openPerpetualPositions: perpetualPositionsMap, assetPositions: adjustedAssetPositionsMap, }); diff --git a/indexer/services/comlink/src/request-helpers/request-transformer.ts b/indexer/services/comlink/src/request-helpers/request-transformer.ts index 16dc6ff5be..0605e64da6 100644 --- a/indexer/services/comlink/src/request-helpers/request-transformer.ts +++ b/indexer/services/comlink/src/request-helpers/request-transformer.ts @@ -311,12 +311,14 @@ export function subaccountToResponseObject({ subaccount, equity, freeCollateral, + latestBlockHeight, openPerpetualPositions = {}, assetPositions = {}, }: { subaccount: SubaccountFromDatabase, equity: string, freeCollateral: string, + latestBlockHeight: string, openPerpetualPositions: PerpetualPositionsMap, assetPositions: AssetPositionsMap, }): SubaccountResponseObject { @@ -329,6 +331,11 @@ export function subaccountToResponseObject({ assetPositions, // TODO(DEC-687): Track `marginEnabled` for subaccounts. marginEnabled: true, +<<<<<<< HEAD +======= + updatedAtHeight: subaccount.updatedAtHeight, + latestProcessedBlockHeight: latestBlockHeight, +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) }; } diff --git a/indexer/services/comlink/src/types.ts b/indexer/services/comlink/src/types.ts index 9d840f2cdc..2075e55171 100644 --- a/indexer/services/comlink/src/types.ts +++ b/indexer/services/comlink/src/types.ts @@ -63,6 +63,11 @@ export interface SubaccountResponseObject { openPerpetualPositions: PerpetualPositionsMap, assetPositions: AssetPositionsMap, marginEnabled: boolean, +<<<<<<< HEAD +======= + updatedAtHeight: string, + latestProcessedBlockHeight: string, +>>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) } export interface ParentSubaccountResponse { From f69ba34b0ed503bc4e36cb184f4d486c8024cf16 Mon Sep 17 00:00:00 2001 From: Will Liu Date: Thu, 27 Jun 2024 13:34:03 -0400 Subject: [PATCH 2/3] merge --- .../api/v4/addresses-controller.test.ts | 33 +- .../comlink/public/api-documentation.md | 674 +++++++++++------- indexer/services/comlink/public/swagger.json | 58 +- .../request-helpers/request-transformer.ts | 6 +- indexer/services/comlink/src/types.ts | 3 - 5 files changed, 418 insertions(+), 356 deletions(-) diff --git a/indexer/services/comlink/__tests__/controllers/api/v4/addresses-controller.test.ts b/indexer/services/comlink/__tests__/controllers/api/v4/addresses-controller.test.ts index 9b4eb7e20b..9930eb80df 100644 --- a/indexer/services/comlink/__tests__/controllers/api/v4/addresses-controller.test.ts +++ b/indexer/services/comlink/__tests__/controllers/api/v4/addresses-controller.test.ts @@ -15,7 +15,6 @@ import { RequestMethod } from '../../../../src/types'; import request from 'supertest'; import { getFixedRepresentation, sendRequest } from '../../../helpers/helpers'; import { stats } from '@dydxprotocol-indexer/base'; -import { defaultAddress } from '@dydxprotocol-indexer/postgres/build/__tests__/helpers/constants'; describe('addresses-controller#V4', () => { const latestHeight: string = '3'; @@ -82,11 +81,8 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(159500), freeCollateral: getFixedRepresentation(152000), marginEnabled: true, -<<<<<<< HEAD -======= updatedAtHeight: testConstants.defaultSubaccount.updatedAtHeight, latestProcessedBlockHeight: latestHeight, ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) openPerpetualPositions: { [testConstants.defaultPerpetualMarket.ticker]: { market: testConstants.defaultPerpetualMarket.ticker, @@ -164,11 +160,8 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(10000), freeCollateral: getFixedRepresentation(10000), marginEnabled: true, -<<<<<<< HEAD -======= updatedAtHeight: testConstants.defaultSubaccount.updatedAtHeight, latestProcessedBlockHeight: latestHeight, ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) openPerpetualPositions: {}, assetPositions: { [testConstants.defaultAsset.symbol]: { @@ -253,11 +246,8 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(159500), freeCollateral: getFixedRepresentation(152000), marginEnabled: true, -<<<<<<< HEAD -======= updatedAtHeight: testConstants.defaultSubaccount.updatedAtHeight, latestProcessedBlockHeight: latestHeight, ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) openPerpetualPositions: { [testConstants.defaultPerpetualMarket.ticker]: { market: testConstants.defaultPerpetualMarket.ticker, @@ -308,11 +298,8 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(0), freeCollateral: getFixedRepresentation(0), marginEnabled: true, -<<<<<<< HEAD -======= updatedAtHeight: testConstants.defaultSubaccount2.updatedAtHeight, latestProcessedBlockHeight: latestHeight, ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) openPerpetualPositions: {}, assetPositions: {}, }, @@ -322,11 +309,8 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(0), freeCollateral: getFixedRepresentation(0), marginEnabled: true, -<<<<<<< HEAD -======= updatedAtHeight: testConstants.isolatedSubaccount.updatedAtHeight, latestProcessedBlockHeight: latestHeight, ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) openPerpetualPositions: {}, assetPositions: {}, }, @@ -336,11 +320,8 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(0), freeCollateral: getFixedRepresentation(0), marginEnabled: true, -<<<<<<< HEAD -======= updatedAtHeight: testConstants.isolatedSubaccount2.updatedAtHeight, latestProcessedBlockHeight: latestHeight, ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) openPerpetualPositions: {}, assetPositions: {}, }, @@ -378,11 +359,8 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(0), freeCollateral: getFixedRepresentation(0), marginEnabled: true, -<<<<<<< HEAD -======= updatedAtHeight: testConstants.defaultSubaccount.updatedAtHeight, latestProcessedBlockHeight: latestHeight, ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) assetPositions: {}, openPerpetualPositions: {}, }, @@ -466,11 +444,8 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(159500), freeCollateral: getFixedRepresentation(152000), marginEnabled: true, -<<<<<<< HEAD -======= updatedAtHeight: testConstants.defaultSubaccount.updatedAtHeight, latestProcessedBlockHeight: latestHeight, ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) openPerpetualPositions: { [testConstants.defaultPerpetualMarket.ticker]: { market: testConstants.defaultPerpetualMarket.ticker, @@ -521,11 +496,8 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(5000), freeCollateral: getFixedRepresentation(5000), marginEnabled: true, -<<<<<<< HEAD -======= updatedAtHeight: testConstants.isolatedSubaccount.updatedAtHeight, latestProcessedBlockHeight: latestHeight, ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) openPerpetualPositions: {}, assetPositions: { [testConstants.defaultAsset.symbol]: { @@ -543,11 +515,8 @@ describe('addresses-controller#V4', () => { equity: getFixedRepresentation(0), freeCollateral: getFixedRepresentation(0), marginEnabled: true, -<<<<<<< HEAD -======= updatedAtHeight: testConstants.isolatedSubaccount2.updatedAtHeight, latestProcessedBlockHeight: latestHeight, ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) openPerpetualPositions: {}, assetPositions: {}, }, @@ -589,7 +558,7 @@ describe('addresses-controller#V4', () => { const parentSubaccountNumber: number = 128; const response: request.Response = await sendRequest({ type: RequestMethod.GET, - path: `/v4/addresses/${defaultAddress}/parentSubaccountNumber/${parentSubaccountNumber}`, + path: `/v4/addresses/${testConstants.defaultAddress}/parentSubaccountNumber/${parentSubaccountNumber}`, expectedStatus: 400, }); diff --git a/indexer/services/comlink/public/api-documentation.md b/indexer/services/comlink/public/api-documentation.md index 14d8efdd4c..7bb30848bd 100644 --- a/indexer/services/comlink/public/api-documentation.md +++ b/indexer/services/comlink/public/api-documentation.md @@ -5,7 +5,10 @@ Base URLs: -* https://dydx-testnet.imperator.co/v4 +* For **the deployment by DYDX token holders**, use https://indexer.dydx.trade/v4 +* For **Testnet**, use https://dydx-testnet.imperator.co/v4 + +Note: Messages on Indexer WebSocket feeds are typically more recent than data fetched via Indexer's REST API, because the latter is backed by read replicas of the databases that feed the former. Ordinarily this difference is minimal (less than a second), but it might become prolonged under load. Please see [Indexer Architecture](https://dydx.exchange/blog/v4-deep-dive-indexer) for more information. # Authentication @@ -23,7 +26,11 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/addresses/{address}', headers = headers) +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/addresses/{address}', headers = headers) print(r.json()) @@ -35,7 +42,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/addresses/{address}`, { method: 'GET', @@ -66,7 +77,7 @@ fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}', "subaccounts": [ { "address": "string", - "subaccountNumber": 0, + "subaccountNumber": 0.1, "equity": "string", "freeCollateral": "string", "openPerpetualPositions": { @@ -86,7 +97,7 @@ fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}', "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 }, "property2": { "market": "string", @@ -104,7 +115,7 @@ fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}', "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } }, "assetPositions": { @@ -113,23 +124,19 @@ fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}', "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } }, -<<<<<<< HEAD - "marginEnabled": true -======= "marginEnabled": true, "updatedAtHeight": "string", "latestProcessedBlockHeight": "string" ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) } ], "totalTradingRewards": "string" @@ -158,7 +165,11 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/addresses/{address}/subaccountNumber/{subaccountNumber}', headers = headers) +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/addresses/{address}/subaccountNumber/{subaccountNumber}', headers = headers) print(r.json()) @@ -170,7 +181,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}/subaccountNumber/{subaccountNumber}', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/addresses/{address}/subaccountNumber/{subaccountNumber}`, { method: 'GET', @@ -200,7 +215,7 @@ fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}/subaccountNumber ```json { "address": "string", - "subaccountNumber": 0, + "subaccountNumber": 0.1, "equity": "string", "freeCollateral": "string", "openPerpetualPositions": { @@ -220,7 +235,7 @@ fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}/subaccountNumber "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 }, "property2": { "market": "string", @@ -238,7 +253,7 @@ fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}/subaccountNumber "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } }, "assetPositions": { @@ -247,23 +262,19 @@ fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}/subaccountNumber "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } }, -<<<<<<< HEAD - "marginEnabled": true -======= "marginEnabled": true, "updatedAtHeight": "string", "latestProcessedBlockHeight": "string" ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) } ``` @@ -289,7 +300,11 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/addresses/{address}/parentSubaccountNumber/{parentSubaccountNumber}', headers = headers) +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/addresses/{address}/parentSubaccountNumber/{parentSubaccountNumber}', headers = headers) print(r.json()) @@ -301,7 +316,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}/parentSubaccountNumber/{parentSubaccountNumber}', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/addresses/{address}/parentSubaccountNumber/{parentSubaccountNumber}`, { method: 'GET', @@ -331,13 +350,13 @@ fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}/parentSubaccount ```json { "address": "string", - "parentSubaccountNumber": 0, + "parentSubaccountNumber": 0.1, "equity": "string", "freeCollateral": "string", "childSubaccounts": [ { "address": "string", - "subaccountNumber": 0, + "subaccountNumber": 0.1, "equity": "string", "freeCollateral": "string", "openPerpetualPositions": { @@ -357,7 +376,7 @@ fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}/parentSubaccount "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 }, "property2": { "market": "string", @@ -375,7 +394,7 @@ fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}/parentSubaccount "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } }, "assetPositions": { @@ -384,23 +403,19 @@ fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}/parentSubaccount "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } }, -<<<<<<< HEAD - "marginEnabled": true -======= "marginEnabled": true, "updatedAtHeight": "string", "latestProcessedBlockHeight": "string" ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) } ] } @@ -428,8 +443,12 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/assetPositions', params={ - 'address': 'string', 'subaccountNumber': '0' +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/assetPositions', params={ + 'address': 'string', 'subaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -442,7 +461,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/assetPositions?address=string&subaccountNumber=0', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/assetPositions?address=string&subaccountNumber=0.1`, { method: 'GET', @@ -477,7 +500,7 @@ fetch('https://dydx-testnet.imperator.co/v4/assetPositions?address=string&subacc "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } ] } @@ -505,8 +528,12 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/assetPositions/parentSubaccountNumber', params={ - 'address': 'string', 'parentSubaccountNumber': '0' +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/assetPositions/parentSubaccountNumber', params={ + 'address': 'string', 'parentSubaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -519,7 +546,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/assetPositions/parentSubaccountNumber?address=string&parentSubaccountNumber=0', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/assetPositions/parentSubaccountNumber?address=string&parentSubaccountNumber=0.1`, { method: 'GET', @@ -554,7 +585,7 @@ fetch('https://dydx-testnet.imperator.co/v4/assetPositions/parentSubaccountNumbe "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } ] } @@ -582,7 +613,11 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/candles/perpetualMarkets/{ticker}', params={ +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/candles/perpetualMarkets/{ticker}', params={ 'resolution': '1MIN' }, headers = headers) @@ -596,7 +631,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/candles/perpetualMarkets/{ticker}?resolution=1MIN', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/candles/perpetualMarkets/{ticker}?resolution=1MIN`, { method: 'GET', @@ -651,7 +690,7 @@ fetch('https://dydx-testnet.imperator.co/v4/candles/perpetualMarkets/{ticker}?re "close": "string", "baseTokenVolume": "string", "usdVolume": "string", - "trades": 0, + "trades": 0.1, "startingOpenInterest": "string", "id": "string" } @@ -681,7 +720,11 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/compliance/screen/{address}', headers = headers) +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/compliance/screen/{address}', headers = headers) print(r.json()) @@ -693,7 +736,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/compliance/screen/{address}', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/compliance/screen/{address}`, { method: 'GET', @@ -749,8 +796,12 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/fills', params={ - 'address': 'string', 'subaccountNumber': '0' +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/fills', params={ + 'address': 'string', 'subaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -763,7 +814,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/fills?address=string&subaccountNumber=0', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/fills?address=string&subaccountNumber=0.1`, { method: 'GET', @@ -805,9 +860,9 @@ fetch('https://dydx-testnet.imperator.co/v4/fills?address=string&subaccountNumbe ```json { - "pageSize": 0, - "totalResults": 0, - "offset": 0, + "pageSize": 0.1, + "totalResults": 0.1, + "offset": 0.1, "fills": [ { "id": "string", @@ -823,7 +878,7 @@ fetch('https://dydx-testnet.imperator.co/v4/fills?address=string&subaccountNumbe "createdAtHeight": "string", "orderId": "string", "clientMetadata": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } ] } @@ -851,8 +906,12 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/fills/parentSubaccount', params={ - 'address': 'string', 'parentSubaccountNumber': '0' +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/fills/parentSubaccount', params={ + 'address': 'string', 'parentSubaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -865,7 +924,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/fills/parentSubaccount?address=string&parentSubaccountNumber=0', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/fills/parentSubaccount?address=string&parentSubaccountNumber=0.1`, { method: 'GET', @@ -907,9 +970,9 @@ fetch('https://dydx-testnet.imperator.co/v4/fills/parentSubaccount?address=strin ```json { - "pageSize": 0, - "totalResults": 0, - "offset": 0, + "pageSize": 0.1, + "totalResults": 0.1, + "offset": 0.1, "fills": [ { "id": "string", @@ -925,7 +988,7 @@ fetch('https://dydx-testnet.imperator.co/v4/fills/parentSubaccount?address=strin "createdAtHeight": "string", "orderId": "string", "clientMetadata": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } ] } @@ -953,7 +1016,11 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/height', headers = headers) +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/height', headers = headers) print(r.json()) @@ -965,7 +1032,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/height', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/height`, { method: 'GET', @@ -1014,7 +1085,11 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/historicalBlockTradingRewards/{address}', headers = headers) +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/historicalBlockTradingRewards/{address}', headers = headers) print(r.json()) @@ -1026,7 +1101,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/historicalBlockTradingRewards/{address}', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/historicalBlockTradingRewards/{address}`, { method: 'GET', @@ -1089,7 +1168,11 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/historicalFunding/{ticker}', headers = headers) +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/historicalFunding/{ticker}', headers = headers) print(r.json()) @@ -1101,7 +1184,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/historicalFunding/{ticker}', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/historicalFunding/{ticker}`, { method: 'GET', @@ -1166,8 +1253,12 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/historical-pnl', params={ - 'address': 'string', 'subaccountNumber': '0' +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/historical-pnl', params={ + 'address': 'string', 'subaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -1180,7 +1271,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/historical-pnl?address=string&subaccountNumber=0', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/historical-pnl?address=string&subaccountNumber=0.1`, { method: 'GET', @@ -1215,9 +1310,9 @@ fetch('https://dydx-testnet.imperator.co/v4/historical-pnl?address=string&subacc ```json { - "pageSize": 0, - "totalResults": 0, - "offset": 0, + "pageSize": 0.1, + "totalResults": 0.1, + "offset": 0.1, "historicalPnl": [ { "id": "string", @@ -1255,8 +1350,12 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/historical-pnl/parentSubaccount', params={ - 'address': 'string', 'parentSubaccountNumber': '0' +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/historical-pnl/parentSubaccount', params={ + 'address': 'string', 'parentSubaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -1269,7 +1368,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/historical-pnl/parentSubaccount?address=string&parentSubaccountNumber=0', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/historical-pnl/parentSubaccount?address=string&parentSubaccountNumber=0.1`, { method: 'GET', @@ -1304,9 +1407,9 @@ fetch('https://dydx-testnet.imperator.co/v4/historical-pnl/parentSubaccount?addr ```json { - "pageSize": 0, - "totalResults": 0, - "offset": 0, + "pageSize": 0.1, + "totalResults": 0.1, + "offset": 0.1, "historicalPnl": [ { "id": "string", @@ -1344,7 +1447,11 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/historicalTradingRewardAggregations/{address}', params={ +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/historicalTradingRewardAggregations/{address}', params={ 'period': 'DAILY' }, headers = headers) @@ -1358,7 +1465,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/historicalTradingRewardAggregations/{address}?period=DAILY', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/historicalTradingRewardAggregations/{address}?period=DAILY`, { method: 'GET', @@ -1433,7 +1544,11 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/orderbooks/perpetualMarket/{ticker}', headers = headers) +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/orderbooks/perpetualMarket/{ticker}', headers = headers) print(r.json()) @@ -1445,7 +1560,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/orderbooks/perpetualMarket/{ticker}', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/orderbooks/perpetualMarket/{ticker}`, { method: 'GET', @@ -1510,8 +1629,12 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/orders', params={ - 'address': 'string', 'subaccountNumber': '0' +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/orders', params={ + 'address': 'string', 'subaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -1524,7 +1647,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/orders?address=string&subaccountNumber=0', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/orders?address=string&subaccountNumber=0.1`, { method: 'GET', @@ -1568,9 +1695,6 @@ fetch('https://dydx-testnet.imperator.co/v4/orders?address=string&subaccountNumb |type|TRAILING_STOP| |type|TAKE_PROFIT| |type|TAKE_PROFIT_MARKET| -|type|HARD_TRADE| -|type|FAILED_HARD_TRADE| -|type|TRANSFER_PLACEHOLDER| > Example responses @@ -1601,7 +1725,7 @@ fetch('https://dydx-testnet.imperator.co/v4/orders?address=string&subaccountNumb "ticker": "string", "updatedAt": "string", "updatedAtHeight": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } ] ``` @@ -1673,9 +1797,6 @@ Status Code **200** |type|TRAILING_STOP| |type|TAKE_PROFIT| |type|TAKE_PROFIT_MARKET| -|type|HARD_TRADE| -|type|FAILED_HARD_TRADE| -|type|TRANSFER_PLACEHOLDER| |timeInForce|GTT| |timeInForce|FOK| |timeInForce|IOC| @@ -1702,8 +1823,12 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/orders/parentSubaccountNumber', params={ - 'address': 'string', 'parentSubaccountNumber': '0' +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/orders/parentSubaccountNumber', params={ + 'address': 'string', 'parentSubaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -1716,7 +1841,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/orders/parentSubaccountNumber?address=string&parentSubaccountNumber=0', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/orders/parentSubaccountNumber?address=string&parentSubaccountNumber=0.1`, { method: 'GET', @@ -1760,9 +1889,6 @@ fetch('https://dydx-testnet.imperator.co/v4/orders/parentSubaccountNumber?addres |type|TRAILING_STOP| |type|TAKE_PROFIT| |type|TAKE_PROFIT_MARKET| -|type|HARD_TRADE| -|type|FAILED_HARD_TRADE| -|type|TRANSFER_PLACEHOLDER| > Example responses @@ -1793,7 +1919,7 @@ fetch('https://dydx-testnet.imperator.co/v4/orders/parentSubaccountNumber?addres "ticker": "string", "updatedAt": "string", "updatedAtHeight": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } ] ``` @@ -1865,9 +1991,6 @@ Status Code **200** |type|TRAILING_STOP| |type|TAKE_PROFIT| |type|TAKE_PROFIT_MARKET| -|type|HARD_TRADE| -|type|FAILED_HARD_TRADE| -|type|TRANSFER_PLACEHOLDER| |timeInForce|GTT| |timeInForce|FOK| |timeInForce|IOC| @@ -1894,7 +2017,11 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/orders/{orderId}', headers = headers) +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/orders/{orderId}', headers = headers) print(r.json()) @@ -1906,7 +2033,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/orders/{orderId}', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/orders/{orderId}`, { method: 'GET', @@ -1956,7 +2087,7 @@ fetch('https://dydx-testnet.imperator.co/v4/orders/{orderId}', "ticker": "string", "updatedAt": "string", "updatedAtHeight": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } ``` @@ -1982,7 +2113,11 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/perpetualMarkets', headers = headers) +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/perpetualMarkets', headers = headers) print(r.json()) @@ -1994,7 +2129,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/perpetualMarkets', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/perpetualMarkets`, { method: 'GET', @@ -2031,17 +2170,17 @@ fetch('https://dydx-testnet.imperator.co/v4/perpetualMarkets', "oraclePrice": "string", "priceChange24H": "string", "volume24H": "string", - "trades24H": 0, + "trades24H": 0.1, "nextFundingRate": "string", "initialMarginFraction": "string", "maintenanceMarginFraction": "string", "openInterest": "string", - "atomicResolution": 0, - "quantumConversionExponent": 0, + "atomicResolution": 0.1, + "quantumConversionExponent": 0.1, "tickSize": "string", "stepSize": "string", - "stepBaseQuantums": 0, - "subticksPerTick": 0, + "stepBaseQuantums": 0.1, + "subticksPerTick": 0.1, "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", @@ -2054,17 +2193,17 @@ fetch('https://dydx-testnet.imperator.co/v4/perpetualMarkets', "oraclePrice": "string", "priceChange24H": "string", "volume24H": "string", - "trades24H": 0, + "trades24H": 0.1, "nextFundingRate": "string", "initialMarginFraction": "string", "maintenanceMarginFraction": "string", "openInterest": "string", - "atomicResolution": 0, - "quantumConversionExponent": 0, + "atomicResolution": 0.1, + "quantumConversionExponent": 0.1, "tickSize": "string", "stepSize": "string", - "stepBaseQuantums": 0, - "subticksPerTick": 0, + "stepBaseQuantums": 0.1, + "subticksPerTick": 0.1, "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", @@ -2096,8 +2235,12 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/perpetualPositions', params={ - 'address': 'string', 'subaccountNumber': '0' +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/perpetualPositions', params={ + 'address': 'string', 'subaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -2110,7 +2253,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/perpetualPositions?address=string&subaccountNumber=0', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/perpetualPositions?address=string&subaccountNumber=0.1`, { method: 'GET', @@ -2168,7 +2315,7 @@ fetch('https://dydx-testnet.imperator.co/v4/perpetualPositions?address=string&su "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } ] } @@ -2196,8 +2343,12 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/perpetualPositions/parentSubaccountNumber', params={ - 'address': 'string', 'parentSubaccountNumber': '0' +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/perpetualPositions/parentSubaccountNumber', params={ + 'address': 'string', 'parentSubaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -2210,7 +2361,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/perpetualPositions/parentSubaccountNumber?address=string&parentSubaccountNumber=0', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/perpetualPositions/parentSubaccountNumber?address=string&parentSubaccountNumber=0.1`, { method: 'GET', @@ -2268,7 +2423,7 @@ fetch('https://dydx-testnet.imperator.co/v4/perpetualPositions/parentSubaccountN "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } ] } @@ -2296,7 +2451,11 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/sparklines', params={ +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/sparklines', params={ 'timePeriod': 'ONE_DAY' }, headers = headers) @@ -2310,7 +2469,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/sparklines?timePeriod=ONE_DAY', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/sparklines?timePeriod=ONE_DAY`, { method: 'GET', @@ -2376,7 +2539,11 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/time', headers = headers) +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/time', headers = headers) print(r.json()) @@ -2388,7 +2555,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/time', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/time`, { method: 'GET', @@ -2411,7 +2582,7 @@ fetch('https://dydx-testnet.imperator.co/v4/time', ```json { "iso": "string", - "epoch": 0 + "epoch": 0.1 } ``` @@ -2437,7 +2608,11 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/trades/perpetualMarket/{ticker}', headers = headers) +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/trades/perpetualMarket/{ticker}', headers = headers) print(r.json()) @@ -2449,7 +2624,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/trades/perpetualMarket/{ticker}', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/trades/perpetualMarket/{ticker}`, { method: 'GET', @@ -2481,9 +2660,9 @@ fetch('https://dydx-testnet.imperator.co/v4/trades/perpetualMarket/{ticker}', ```json { - "pageSize": 0, - "totalResults": 0, - "offset": 0, + "pageSize": 0.1, + "totalResults": 0.1, + "offset": 0.1, "trades": [ { "id": "string", @@ -2520,8 +2699,12 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/transfers', params={ - 'address': 'string', 'subaccountNumber': '0' +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/transfers', params={ + 'address': 'string', 'subaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -2534,7 +2717,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/transfers?address=string&subaccountNumber=0', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/transfers?address=string&subaccountNumber=0.1`, { method: 'GET', @@ -2567,18 +2754,18 @@ fetch('https://dydx-testnet.imperator.co/v4/transfers?address=string&subaccountN ```json { - "pageSize": 0, - "totalResults": 0, - "offset": 0, + "pageSize": 0.1, + "totalResults": 0.1, + "offset": 0.1, "transfers": [ { "id": "string", "sender": { - "subaccountNumber": 0, + "subaccountNumber": 0.1, "address": "string" }, "recipient": { - "subaccountNumber": 0, + "subaccountNumber": 0.1, "address": "string" }, "size": "string", @@ -2614,8 +2801,12 @@ headers = { 'Accept': 'application/json' } -r = requests.get('https://dydx-testnet.imperator.co/v4/transfers/parentSubaccountNumber', params={ - 'address': 'string', 'parentSubaccountNumber': '0' +# For the deployment by DYDX token holders, use +# baseURL = 'https://indexer.dydx.trade/v4' +baseURL = 'https://dydx-testnet.imperator.co/v4' + +r = requests.get(f'{baseURL}/transfers/parentSubaccountNumber', params={ + 'address': 'string', 'parentSubaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -2628,7 +2819,11 @@ const headers = { 'Accept':'application/json' }; -fetch('https://dydx-testnet.imperator.co/v4/transfers/parentSubaccountNumber?address=string&parentSubaccountNumber=0', +// For the deployment by DYDX token holders, use +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; + +fetch(`${baseURL}/transfers/parentSubaccountNumber?address=string&parentSubaccountNumber=0.1`, { method: 'GET', @@ -2661,18 +2856,18 @@ fetch('https://dydx-testnet.imperator.co/v4/transfers/parentSubaccountNumber?add ```json { - "pageSize": 0, - "totalResults": 0, - "offset": 0, + "pageSize": 0.1, + "totalResults": 0.1, + "offset": 0.1, "transfers": [ { "id": "string", "sender": { - "subaccountNumber": 0, + "subaccountNumber": 0.1, "address": "string" }, "recipient": { - "subaccountNumber": 0, + "subaccountNumber": 0.1, "address": "string" }, "size": "string", @@ -2791,7 +2986,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } ``` @@ -2842,7 +3037,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 }, "property2": { "market": "string", @@ -2860,7 +3055,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } } @@ -2885,7 +3080,7 @@ This operation does not require authentication "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } ``` @@ -2914,14 +3109,14 @@ This operation does not require authentication "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } } @@ -2943,7 +3138,7 @@ This operation does not require authentication ```json { "address": "string", - "subaccountNumber": 0, + "subaccountNumber": 0.1, "equity": "string", "freeCollateral": "string", "openPerpetualPositions": { @@ -2963,7 +3158,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 }, "property2": { "market": "string", @@ -2981,7 +3176,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } }, "assetPositions": { @@ -2990,23 +3185,19 @@ This operation does not require authentication "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } }, -<<<<<<< HEAD - "marginEnabled": true -======= "marginEnabled": true, "updatedAtHeight": "string", "latestProcessedBlockHeight": "string" ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) } ``` @@ -3022,11 +3213,8 @@ This operation does not require authentication |openPerpetualPositions|[PerpetualPositionsMap](#schemaperpetualpositionsmap)|true|none|none| |assetPositions|[AssetPositionsMap](#schemaassetpositionsmap)|true|none|none| |marginEnabled|boolean|true|none|none| -<<<<<<< HEAD -======= |updatedAtHeight|string|true|none|none| |latestProcessedBlockHeight|string|true|none|none| ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) ## AddressResponse @@ -3040,7 +3228,7 @@ This operation does not require authentication "subaccounts": [ { "address": "string", - "subaccountNumber": 0, + "subaccountNumber": 0.1, "equity": "string", "freeCollateral": "string", "openPerpetualPositions": { @@ -3060,7 +3248,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 }, "property2": { "market": "string", @@ -3078,7 +3266,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } }, "assetPositions": { @@ -3087,23 +3275,19 @@ This operation does not require authentication "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } }, -<<<<<<< HEAD - "marginEnabled": true -======= "marginEnabled": true, "updatedAtHeight": "string", "latestProcessedBlockHeight": "string" ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) } ], "totalTradingRewards": "string" @@ -3128,13 +3312,13 @@ This operation does not require authentication ```json { "address": "string", - "parentSubaccountNumber": 0, + "parentSubaccountNumber": 0.1, "equity": "string", "freeCollateral": "string", "childSubaccounts": [ { "address": "string", - "subaccountNumber": 0, + "subaccountNumber": 0.1, "equity": "string", "freeCollateral": "string", "openPerpetualPositions": { @@ -3154,7 +3338,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 }, "property2": { "market": "string", @@ -3172,7 +3356,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } }, "assetPositions": { @@ -3181,23 +3365,19 @@ This operation does not require authentication "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } }, -<<<<<<< HEAD - "marginEnabled": true -======= "marginEnabled": true, "updatedAtHeight": "string", "latestProcessedBlockHeight": "string" ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) } ] } @@ -3229,7 +3409,7 @@ This operation does not require authentication "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } ] } @@ -3290,7 +3470,7 @@ This operation does not require authentication "close": "string", "baseTokenVolume": "string", "usdVolume": "string", - "trades": 0, + "trades": 0.1, "startingOpenInterest": "string", "id": "string" } @@ -3334,7 +3514,7 @@ This operation does not require authentication "close": "string", "baseTokenVolume": "string", "usdVolume": "string", - "trades": 0, + "trades": 0.1, "startingOpenInterest": "string", "id": "string" } @@ -3349,28 +3529,6 @@ This operation does not require authentication |---|---|---|---|---| |candles|[[CandleResponseObject](#schemacandleresponseobject)]|true|none|none| -## ComplianceResponse - - - - - - -```json -{ - "restricted": true, - "reason": "string" -} - -``` - -### Properties - -|Name|Type|Required|Restrictions|Description| -|---|---|---|---|---| -|restricted|boolean|true|none|none| -|reason|string|false|none|none| - ## ComplianceStatus @@ -3424,7 +3582,6 @@ This operation does not require authentication |*anonymous*|MANUAL| |*anonymous*|US_GEO| |*anonymous*|CA_GEO| -|*anonymous*|GB_GEO| |*anonymous*|SANCTIONED_GEO| |*anonymous*|COMPLIANCE_PROVIDER| @@ -3577,7 +3734,7 @@ This operation does not require authentication "createdAtHeight": "string", "orderId": "string", "clientMetadata": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } ``` @@ -3610,9 +3767,9 @@ This operation does not require authentication ```json { - "pageSize": 0, - "totalResults": 0, - "offset": 0, + "pageSize": 0.1, + "totalResults": 0.1, + "offset": 0.1, "fills": [ { "id": "string", @@ -3628,7 +3785,7 @@ This operation does not require authentication "createdAtHeight": "string", "orderId": "string", "clientMetadata": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } ] } @@ -3815,9 +3972,9 @@ This operation does not require authentication ```json { - "pageSize": 0, - "totalResults": 0, - "offset": 0, + "pageSize": 0.1, + "totalResults": 0.1, + "offset": 0.1, "historicalPnl": [ { "id": "string", @@ -4115,9 +4272,6 @@ or |*anonymous*|TRAILING_STOP| |*anonymous*|TAKE_PROFIT| |*anonymous*|TAKE_PROFIT_MARKET| -|*anonymous*|HARD_TRADE| -|*anonymous*|FAILED_HARD_TRADE| -|*anonymous*|TRANSFER_PLACEHOLDER| ## OrderResponseObject @@ -4150,7 +4304,7 @@ or "ticker": "string", "updatedAt": "string", "updatedAtHeight": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } ``` @@ -4252,17 +4406,17 @@ or "oraclePrice": "string", "priceChange24H": "string", "volume24H": "string", - "trades24H": 0, + "trades24H": 0.1, "nextFundingRate": "string", "initialMarginFraction": "string", "maintenanceMarginFraction": "string", "openInterest": "string", - "atomicResolution": 0, - "quantumConversionExponent": 0, + "atomicResolution": 0.1, + "quantumConversionExponent": 0.1, "tickSize": "string", "stepSize": "string", - "stepBaseQuantums": 0, - "subticksPerTick": 0, + "stepBaseQuantums": 0.1, + "subticksPerTick": 0.1, "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", @@ -4314,17 +4468,17 @@ or "oraclePrice": "string", "priceChange24H": "string", "volume24H": "string", - "trades24H": 0, + "trades24H": 0.1, "nextFundingRate": "string", "initialMarginFraction": "string", "maintenanceMarginFraction": "string", "openInterest": "string", - "atomicResolution": 0, - "quantumConversionExponent": 0, + "atomicResolution": 0.1, + "quantumConversionExponent": 0.1, "tickSize": "string", "stepSize": "string", - "stepBaseQuantums": 0, - "subticksPerTick": 0, + "stepBaseQuantums": 0.1, + "subticksPerTick": 0.1, "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", @@ -4337,17 +4491,17 @@ or "oraclePrice": "string", "priceChange24H": "string", "volume24H": "string", - "trades24H": 0, + "trades24H": 0.1, "nextFundingRate": "string", "initialMarginFraction": "string", "maintenanceMarginFraction": "string", "openInterest": "string", - "atomicResolution": 0, - "quantumConversionExponent": 0, + "atomicResolution": 0.1, + "quantumConversionExponent": 0.1, "tickSize": "string", "stepSize": "string", - "stepBaseQuantums": 0, - "subticksPerTick": 0, + "stepBaseQuantums": 0.1, + "subticksPerTick": 0.1, "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", @@ -4391,7 +4545,7 @@ or "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0 + "subaccountNumber": 0.1 } ] } @@ -4464,7 +4618,7 @@ or ```json { "iso": "string", - "epoch": 0 + "epoch": 0.1 } ``` @@ -4543,9 +4697,9 @@ or ```json { - "pageSize": 0, - "totalResults": 0, - "offset": 0, + "pageSize": 0.1, + "totalResults": 0.1, + "offset": 0.1, "trades": [ { "id": "string", @@ -4608,11 +4762,11 @@ or { "id": "string", "sender": { - "subaccountNumber": 0, + "subaccountNumber": 0.1, "address": "string" }, "recipient": { - "subaccountNumber": 0, + "subaccountNumber": 0.1, "address": "string" }, "size": "string", @@ -4652,18 +4806,18 @@ or ```json { - "pageSize": 0, - "totalResults": 0, - "offset": 0, + "pageSize": 0.1, + "totalResults": 0.1, + "offset": 0.1, "transfers": [ { "id": "string", "sender": { - "subaccountNumber": 0, + "subaccountNumber": 0.1, "address": "string" }, "recipient": { - "subaccountNumber": 0, + "subaccountNumber": 0.1, "address": "string" }, "size": "string", @@ -4696,18 +4850,18 @@ or ```json { - "pageSize": 0, - "totalResults": 0, - "offset": 0, + "pageSize": 0.1, + "totalResults": 0.1, + "offset": 0.1, "transfers": [ { "id": "string", "sender": { - "subaccountNumber": 0, + "subaccountNumber": 0.1, "address": "string" }, "recipient": { - "subaccountNumber": 0, + "subaccountNumber": 0.1, "address": "string" }, "size": "string", diff --git a/indexer/services/comlink/public/swagger.json b/indexer/services/comlink/public/swagger.json index 57b7f42b48..ab5e2ec9c6 100644 --- a/indexer/services/comlink/public/swagger.json +++ b/indexer/services/comlink/public/swagger.json @@ -167,15 +167,12 @@ }, "marginEnabled": { "type": "boolean" -<<<<<<< HEAD -======= }, "updatedAtHeight": { "type": "string" }, "latestProcessedBlockHeight": { "type": "string" ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) } }, "required": [ @@ -185,13 +182,9 @@ "freeCollateral", "openPerpetualPositions", "assetPositions", -<<<<<<< HEAD - "marginEnabled" -======= "marginEnabled", "updatedAtHeight", "latestProcessedBlockHeight" ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) ], "type": "object", "additionalProperties": false @@ -346,21 +339,6 @@ "type": "object", "additionalProperties": false }, - "ComplianceResponse": { - "properties": { - "restricted": { - "type": "boolean" - }, - "reason": { - "type": "string" - } - }, - "required": [ - "restricted" - ], - "type": "object", - "additionalProperties": false - }, "ComplianceStatus": { "enum": [ "COMPLIANT", @@ -376,7 +354,6 @@ "MANUAL", "US_GEO", "CA_GEO", - "GB_GEO", "SANCTIONED_GEO", "COMPLIANCE_PROVIDER" ], @@ -815,10 +792,7 @@ "STOP_MARKET", "TRAILING_STOP", "TAKE_PROFIT", - "TAKE_PROFIT_MARKET", - "HARD_TRADE", - "FAILED_HARD_TRADE", - "TRANSFER_PLACEHOLDER" + "TAKE_PROFIT_MARKET" ], "type": "string" }, @@ -1543,34 +1517,6 @@ ] } }, - "/screen": { - "get": { - "operationId": "Screen", - "responses": { - "200": { - "description": "Ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ComplianceResponse" - } - } - } - } - }, - "security": [], - "parameters": [ - { - "in": "query", - "name": "address", - "required": true, - "schema": { - "type": "string" - } - } - ] - } - }, "/compliance/screen/{address}": { "get": { "operationId": "Screen", @@ -2856,7 +2802,7 @@ }, "servers": [ { - "url": "https://dydx-testnet.imperator.co/v4", + "url": "", "description": "Public Testnet" } ] diff --git a/indexer/services/comlink/src/request-helpers/request-transformer.ts b/indexer/services/comlink/src/request-helpers/request-transformer.ts index 0605e64da6..b06b70052c 100644 --- a/indexer/services/comlink/src/request-helpers/request-transformer.ts +++ b/indexer/services/comlink/src/request-helpers/request-transformer.ts @@ -97,8 +97,7 @@ export function perpetualPositionToResponseObject( exitPrice: position.exitPrice && Big(position.exitPrice).toFixed(), realizedPnl, unrealizedPnl: helpers.getUnrealizedPnl( - position, perpetualMarketsMap[position.perpetualId], - marketsMap[perpetualMarketsMap[position.perpetualId].marketId], + position, perpetualMarketsMap[position.perpetualId], marketsMap, ), createdAt: position.createdAt, createdAtHeight: position.createdAtHeight, @@ -331,11 +330,8 @@ export function subaccountToResponseObject({ assetPositions, // TODO(DEC-687): Track `marginEnabled` for subaccounts. marginEnabled: true, -<<<<<<< HEAD -======= updatedAtHeight: subaccount.updatedAtHeight, latestProcessedBlockHeight: latestBlockHeight, ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) }; } diff --git a/indexer/services/comlink/src/types.ts b/indexer/services/comlink/src/types.ts index 2075e55171..9108d0d4fd 100644 --- a/indexer/services/comlink/src/types.ts +++ b/indexer/services/comlink/src/types.ts @@ -63,11 +63,8 @@ export interface SubaccountResponseObject { openPerpetualPositions: PerpetualPositionsMap, assetPositions: AssetPositionsMap, marginEnabled: boolean, -<<<<<<< HEAD -======= updatedAtHeight: string, latestProcessedBlockHeight: string, ->>>>>>> 03577759 (Add latest block height to /addresses API endpoint (#1701)) } export interface ParentSubaccountResponse { From d2b4d673a121a9ef907e44a69e0287c9cd685c8d Mon Sep 17 00:00:00 2001 From: Will Liu Date: Thu, 27 Jun 2024 13:36:15 -0400 Subject: [PATCH 3/3] merge 2 --- .../comlink/public/api-documentation.md | 647 +++++++----------- indexer/services/comlink/public/swagger.json | 51 +- .../request-helpers/request-transformer.ts | 3 +- 3 files changed, 284 insertions(+), 417 deletions(-) diff --git a/indexer/services/comlink/public/api-documentation.md b/indexer/services/comlink/public/api-documentation.md index 7bb30848bd..f9b455aeb9 100644 --- a/indexer/services/comlink/public/api-documentation.md +++ b/indexer/services/comlink/public/api-documentation.md @@ -5,10 +5,7 @@ Base URLs: -* For **the deployment by DYDX token holders**, use https://indexer.dydx.trade/v4 -* For **Testnet**, use https://dydx-testnet.imperator.co/v4 - -Note: Messages on Indexer WebSocket feeds are typically more recent than data fetched via Indexer's REST API, because the latter is backed by read replicas of the databases that feed the former. Ordinarily this difference is minimal (less than a second), but it might become prolonged under load. Please see [Indexer Architecture](https://dydx.exchange/blog/v4-deep-dive-indexer) for more information. +* https://dydx-testnet.imperator.co/v4 # Authentication @@ -26,11 +23,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/addresses/{address}', headers = headers) +r = requests.get('https://dydx-testnet.imperator.co/v4/addresses/{address}', headers = headers) print(r.json()) @@ -42,11 +35,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/addresses/{address}`, +fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}', { method: 'GET', @@ -77,7 +66,7 @@ fetch(`${baseURL}/addresses/{address}`, "subaccounts": [ { "address": "string", - "subaccountNumber": 0.1, + "subaccountNumber": 0, "equity": "string", "freeCollateral": "string", "openPerpetualPositions": { @@ -97,7 +86,7 @@ fetch(`${baseURL}/addresses/{address}`, "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "market": "string", @@ -115,7 +104,7 @@ fetch(`${baseURL}/addresses/{address}`, "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "assetPositions": { @@ -124,14 +113,14 @@ fetch(`${baseURL}/addresses/{address}`, "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "marginEnabled": true, @@ -165,11 +154,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/addresses/{address}/subaccountNumber/{subaccountNumber}', headers = headers) +r = requests.get('https://dydx-testnet.imperator.co/v4/addresses/{address}/subaccountNumber/{subaccountNumber}', headers = headers) print(r.json()) @@ -181,11 +166,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/addresses/{address}/subaccountNumber/{subaccountNumber}`, +fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}/subaccountNumber/{subaccountNumber}', { method: 'GET', @@ -215,7 +196,7 @@ fetch(`${baseURL}/addresses/{address}/subaccountNumber/{subaccountNumber}`, ```json { "address": "string", - "subaccountNumber": 0.1, + "subaccountNumber": 0, "equity": "string", "freeCollateral": "string", "openPerpetualPositions": { @@ -235,7 +216,7 @@ fetch(`${baseURL}/addresses/{address}/subaccountNumber/{subaccountNumber}`, "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "market": "string", @@ -253,7 +234,7 @@ fetch(`${baseURL}/addresses/{address}/subaccountNumber/{subaccountNumber}`, "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "assetPositions": { @@ -262,14 +243,14 @@ fetch(`${baseURL}/addresses/{address}/subaccountNumber/{subaccountNumber}`, "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "marginEnabled": true, @@ -300,11 +281,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/addresses/{address}/parentSubaccountNumber/{parentSubaccountNumber}', headers = headers) +r = requests.get('https://dydx-testnet.imperator.co/v4/addresses/{address}/parentSubaccountNumber/{parentSubaccountNumber}', headers = headers) print(r.json()) @@ -316,11 +293,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/addresses/{address}/parentSubaccountNumber/{parentSubaccountNumber}`, +fetch('https://dydx-testnet.imperator.co/v4/addresses/{address}/parentSubaccountNumber/{parentSubaccountNumber}', { method: 'GET', @@ -350,13 +323,13 @@ fetch(`${baseURL}/addresses/{address}/parentSubaccountNumber/{parentSubaccountNu ```json { "address": "string", - "parentSubaccountNumber": 0.1, + "parentSubaccountNumber": 0, "equity": "string", "freeCollateral": "string", "childSubaccounts": [ { "address": "string", - "subaccountNumber": 0.1, + "subaccountNumber": 0, "equity": "string", "freeCollateral": "string", "openPerpetualPositions": { @@ -376,7 +349,7 @@ fetch(`${baseURL}/addresses/{address}/parentSubaccountNumber/{parentSubaccountNu "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "market": "string", @@ -394,7 +367,7 @@ fetch(`${baseURL}/addresses/{address}/parentSubaccountNumber/{parentSubaccountNu "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "assetPositions": { @@ -403,14 +376,14 @@ fetch(`${baseURL}/addresses/{address}/parentSubaccountNumber/{parentSubaccountNu "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "marginEnabled": true, @@ -443,12 +416,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/assetPositions', params={ - 'address': 'string', 'subaccountNumber': '0.1' +r = requests.get('https://dydx-testnet.imperator.co/v4/assetPositions', params={ + 'address': 'string', 'subaccountNumber': '0' }, headers = headers) print(r.json()) @@ -461,11 +430,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/assetPositions?address=string&subaccountNumber=0.1`, +fetch('https://dydx-testnet.imperator.co/v4/assetPositions?address=string&subaccountNumber=0', { method: 'GET', @@ -500,7 +465,7 @@ fetch(`${baseURL}/assetPositions?address=string&subaccountNumber=0.1`, "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] } @@ -528,12 +493,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/assetPositions/parentSubaccountNumber', params={ - 'address': 'string', 'parentSubaccountNumber': '0.1' +r = requests.get('https://dydx-testnet.imperator.co/v4/assetPositions/parentSubaccountNumber', params={ + 'address': 'string', 'parentSubaccountNumber': '0' }, headers = headers) print(r.json()) @@ -546,11 +507,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/assetPositions/parentSubaccountNumber?address=string&parentSubaccountNumber=0.1`, +fetch('https://dydx-testnet.imperator.co/v4/assetPositions/parentSubaccountNumber?address=string&parentSubaccountNumber=0', { method: 'GET', @@ -585,7 +542,7 @@ fetch(`${baseURL}/assetPositions/parentSubaccountNumber?address=string&parentSub "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] } @@ -613,11 +570,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/candles/perpetualMarkets/{ticker}', params={ +r = requests.get('https://dydx-testnet.imperator.co/v4/candles/perpetualMarkets/{ticker}', params={ 'resolution': '1MIN' }, headers = headers) @@ -631,11 +584,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/candles/perpetualMarkets/{ticker}?resolution=1MIN`, +fetch('https://dydx-testnet.imperator.co/v4/candles/perpetualMarkets/{ticker}?resolution=1MIN', { method: 'GET', @@ -690,7 +639,7 @@ fetch(`${baseURL}/candles/perpetualMarkets/{ticker}?resolution=1MIN`, "close": "string", "baseTokenVolume": "string", "usdVolume": "string", - "trades": 0.1, + "trades": 0, "startingOpenInterest": "string", "id": "string" } @@ -720,11 +669,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/compliance/screen/{address}', headers = headers) +r = requests.get('https://dydx-testnet.imperator.co/v4/compliance/screen/{address}', headers = headers) print(r.json()) @@ -736,11 +681,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/compliance/screen/{address}`, +fetch('https://dydx-testnet.imperator.co/v4/compliance/screen/{address}', { method: 'GET', @@ -796,12 +737,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/fills', params={ - 'address': 'string', 'subaccountNumber': '0.1' +r = requests.get('https://dydx-testnet.imperator.co/v4/fills', params={ + 'address': 'string', 'subaccountNumber': '0' }, headers = headers) print(r.json()) @@ -814,11 +751,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/fills?address=string&subaccountNumber=0.1`, +fetch('https://dydx-testnet.imperator.co/v4/fills?address=string&subaccountNumber=0', { method: 'GET', @@ -860,9 +793,9 @@ fetch(`${baseURL}/fills?address=string&subaccountNumber=0.1`, ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "fills": [ { "id": "string", @@ -878,7 +811,7 @@ fetch(`${baseURL}/fills?address=string&subaccountNumber=0.1`, "createdAtHeight": "string", "orderId": "string", "clientMetadata": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] } @@ -906,12 +839,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/fills/parentSubaccount', params={ - 'address': 'string', 'parentSubaccountNumber': '0.1' +r = requests.get('https://dydx-testnet.imperator.co/v4/fills/parentSubaccount', params={ + 'address': 'string', 'parentSubaccountNumber': '0' }, headers = headers) print(r.json()) @@ -924,11 +853,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/fills/parentSubaccount?address=string&parentSubaccountNumber=0.1`, +fetch('https://dydx-testnet.imperator.co/v4/fills/parentSubaccount?address=string&parentSubaccountNumber=0', { method: 'GET', @@ -970,9 +895,9 @@ fetch(`${baseURL}/fills/parentSubaccount?address=string&parentSubaccountNumber=0 ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "fills": [ { "id": "string", @@ -988,7 +913,7 @@ fetch(`${baseURL}/fills/parentSubaccount?address=string&parentSubaccountNumber=0 "createdAtHeight": "string", "orderId": "string", "clientMetadata": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] } @@ -1016,11 +941,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/height', headers = headers) +r = requests.get('https://dydx-testnet.imperator.co/v4/height', headers = headers) print(r.json()) @@ -1032,11 +953,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/height`, +fetch('https://dydx-testnet.imperator.co/v4/height', { method: 'GET', @@ -1085,11 +1002,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/historicalBlockTradingRewards/{address}', headers = headers) +r = requests.get('https://dydx-testnet.imperator.co/v4/historicalBlockTradingRewards/{address}', headers = headers) print(r.json()) @@ -1101,11 +1014,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/historicalBlockTradingRewards/{address}`, +fetch('https://dydx-testnet.imperator.co/v4/historicalBlockTradingRewards/{address}', { method: 'GET', @@ -1168,11 +1077,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/historicalFunding/{ticker}', headers = headers) +r = requests.get('https://dydx-testnet.imperator.co/v4/historicalFunding/{ticker}', headers = headers) print(r.json()) @@ -1184,11 +1089,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/historicalFunding/{ticker}`, +fetch('https://dydx-testnet.imperator.co/v4/historicalFunding/{ticker}', { method: 'GET', @@ -1253,12 +1154,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/historical-pnl', params={ - 'address': 'string', 'subaccountNumber': '0.1' +r = requests.get('https://dydx-testnet.imperator.co/v4/historical-pnl', params={ + 'address': 'string', 'subaccountNumber': '0' }, headers = headers) print(r.json()) @@ -1271,11 +1168,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/historical-pnl?address=string&subaccountNumber=0.1`, +fetch('https://dydx-testnet.imperator.co/v4/historical-pnl?address=string&subaccountNumber=0', { method: 'GET', @@ -1310,9 +1203,9 @@ fetch(`${baseURL}/historical-pnl?address=string&subaccountNumber=0.1`, ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "historicalPnl": [ { "id": "string", @@ -1350,12 +1243,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/historical-pnl/parentSubaccount', params={ - 'address': 'string', 'parentSubaccountNumber': '0.1' +r = requests.get('https://dydx-testnet.imperator.co/v4/historical-pnl/parentSubaccount', params={ + 'address': 'string', 'parentSubaccountNumber': '0' }, headers = headers) print(r.json()) @@ -1368,11 +1257,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/historical-pnl/parentSubaccount?address=string&parentSubaccountNumber=0.1`, +fetch('https://dydx-testnet.imperator.co/v4/historical-pnl/parentSubaccount?address=string&parentSubaccountNumber=0', { method: 'GET', @@ -1407,9 +1292,9 @@ fetch(`${baseURL}/historical-pnl/parentSubaccount?address=string&parentSubaccoun ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "historicalPnl": [ { "id": "string", @@ -1447,11 +1332,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/historicalTradingRewardAggregations/{address}', params={ +r = requests.get('https://dydx-testnet.imperator.co/v4/historicalTradingRewardAggregations/{address}', params={ 'period': 'DAILY' }, headers = headers) @@ -1465,11 +1346,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/historicalTradingRewardAggregations/{address}?period=DAILY`, +fetch('https://dydx-testnet.imperator.co/v4/historicalTradingRewardAggregations/{address}?period=DAILY', { method: 'GET', @@ -1544,11 +1421,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/orderbooks/perpetualMarket/{ticker}', headers = headers) +r = requests.get('https://dydx-testnet.imperator.co/v4/orderbooks/perpetualMarket/{ticker}', headers = headers) print(r.json()) @@ -1560,11 +1433,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/orderbooks/perpetualMarket/{ticker}`, +fetch('https://dydx-testnet.imperator.co/v4/orderbooks/perpetualMarket/{ticker}', { method: 'GET', @@ -1629,12 +1498,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/orders', params={ - 'address': 'string', 'subaccountNumber': '0.1' +r = requests.get('https://dydx-testnet.imperator.co/v4/orders', params={ + 'address': 'string', 'subaccountNumber': '0' }, headers = headers) print(r.json()) @@ -1647,11 +1512,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/orders?address=string&subaccountNumber=0.1`, +fetch('https://dydx-testnet.imperator.co/v4/orders?address=string&subaccountNumber=0', { method: 'GET', @@ -1695,6 +1556,9 @@ fetch(`${baseURL}/orders?address=string&subaccountNumber=0.1`, |type|TRAILING_STOP| |type|TAKE_PROFIT| |type|TAKE_PROFIT_MARKET| +|type|HARD_TRADE| +|type|FAILED_HARD_TRADE| +|type|TRANSFER_PLACEHOLDER| > Example responses @@ -1725,7 +1589,7 @@ fetch(`${baseURL}/orders?address=string&subaccountNumber=0.1`, "ticker": "string", "updatedAt": "string", "updatedAtHeight": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] ``` @@ -1797,6 +1661,9 @@ Status Code **200** |type|TRAILING_STOP| |type|TAKE_PROFIT| |type|TAKE_PROFIT_MARKET| +|type|HARD_TRADE| +|type|FAILED_HARD_TRADE| +|type|TRANSFER_PLACEHOLDER| |timeInForce|GTT| |timeInForce|FOK| |timeInForce|IOC| @@ -1823,12 +1690,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/orders/parentSubaccountNumber', params={ - 'address': 'string', 'parentSubaccountNumber': '0.1' +r = requests.get('https://dydx-testnet.imperator.co/v4/orders/parentSubaccountNumber', params={ + 'address': 'string', 'parentSubaccountNumber': '0' }, headers = headers) print(r.json()) @@ -1841,11 +1704,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/orders/parentSubaccountNumber?address=string&parentSubaccountNumber=0.1`, +fetch('https://dydx-testnet.imperator.co/v4/orders/parentSubaccountNumber?address=string&parentSubaccountNumber=0', { method: 'GET', @@ -1889,6 +1748,9 @@ fetch(`${baseURL}/orders/parentSubaccountNumber?address=string&parentSubaccountN |type|TRAILING_STOP| |type|TAKE_PROFIT| |type|TAKE_PROFIT_MARKET| +|type|HARD_TRADE| +|type|FAILED_HARD_TRADE| +|type|TRANSFER_PLACEHOLDER| > Example responses @@ -1919,7 +1781,7 @@ fetch(`${baseURL}/orders/parentSubaccountNumber?address=string&parentSubaccountN "ticker": "string", "updatedAt": "string", "updatedAtHeight": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] ``` @@ -1991,6 +1853,9 @@ Status Code **200** |type|TRAILING_STOP| |type|TAKE_PROFIT| |type|TAKE_PROFIT_MARKET| +|type|HARD_TRADE| +|type|FAILED_HARD_TRADE| +|type|TRANSFER_PLACEHOLDER| |timeInForce|GTT| |timeInForce|FOK| |timeInForce|IOC| @@ -2017,11 +1882,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/orders/{orderId}', headers = headers) +r = requests.get('https://dydx-testnet.imperator.co/v4/orders/{orderId}', headers = headers) print(r.json()) @@ -2033,11 +1894,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/orders/{orderId}`, +fetch('https://dydx-testnet.imperator.co/v4/orders/{orderId}', { method: 'GET', @@ -2087,7 +1944,7 @@ fetch(`${baseURL}/orders/{orderId}`, "ticker": "string", "updatedAt": "string", "updatedAtHeight": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ``` @@ -2113,11 +1970,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/perpetualMarkets', headers = headers) +r = requests.get('https://dydx-testnet.imperator.co/v4/perpetualMarkets', headers = headers) print(r.json()) @@ -2129,11 +1982,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/perpetualMarkets`, +fetch('https://dydx-testnet.imperator.co/v4/perpetualMarkets', { method: 'GET', @@ -2170,17 +2019,17 @@ fetch(`${baseURL}/perpetualMarkets`, "oraclePrice": "string", "priceChange24H": "string", "volume24H": "string", - "trades24H": 0.1, + "trades24H": 0, "nextFundingRate": "string", "initialMarginFraction": "string", "maintenanceMarginFraction": "string", "openInterest": "string", - "atomicResolution": 0.1, - "quantumConversionExponent": 0.1, + "atomicResolution": 0, + "quantumConversionExponent": 0, "tickSize": "string", "stepSize": "string", - "stepBaseQuantums": 0.1, - "subticksPerTick": 0.1, + "stepBaseQuantums": 0, + "subticksPerTick": 0, "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", @@ -2193,17 +2042,17 @@ fetch(`${baseURL}/perpetualMarkets`, "oraclePrice": "string", "priceChange24H": "string", "volume24H": "string", - "trades24H": 0.1, + "trades24H": 0, "nextFundingRate": "string", "initialMarginFraction": "string", "maintenanceMarginFraction": "string", "openInterest": "string", - "atomicResolution": 0.1, - "quantumConversionExponent": 0.1, + "atomicResolution": 0, + "quantumConversionExponent": 0, "tickSize": "string", "stepSize": "string", - "stepBaseQuantums": 0.1, - "subticksPerTick": 0.1, + "stepBaseQuantums": 0, + "subticksPerTick": 0, "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", @@ -2235,12 +2084,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/perpetualPositions', params={ - 'address': 'string', 'subaccountNumber': '0.1' +r = requests.get('https://dydx-testnet.imperator.co/v4/perpetualPositions', params={ + 'address': 'string', 'subaccountNumber': '0' }, headers = headers) print(r.json()) @@ -2253,11 +2098,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/perpetualPositions?address=string&subaccountNumber=0.1`, +fetch('https://dydx-testnet.imperator.co/v4/perpetualPositions?address=string&subaccountNumber=0', { method: 'GET', @@ -2315,7 +2156,7 @@ fetch(`${baseURL}/perpetualPositions?address=string&subaccountNumber=0.1`, "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] } @@ -2343,12 +2184,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/perpetualPositions/parentSubaccountNumber', params={ - 'address': 'string', 'parentSubaccountNumber': '0.1' +r = requests.get('https://dydx-testnet.imperator.co/v4/perpetualPositions/parentSubaccountNumber', params={ + 'address': 'string', 'parentSubaccountNumber': '0' }, headers = headers) print(r.json()) @@ -2361,11 +2198,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/perpetualPositions/parentSubaccountNumber?address=string&parentSubaccountNumber=0.1`, +fetch('https://dydx-testnet.imperator.co/v4/perpetualPositions/parentSubaccountNumber?address=string&parentSubaccountNumber=0', { method: 'GET', @@ -2423,7 +2256,7 @@ fetch(`${baseURL}/perpetualPositions/parentSubaccountNumber?address=string&paren "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] } @@ -2451,11 +2284,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/sparklines', params={ +r = requests.get('https://dydx-testnet.imperator.co/v4/sparklines', params={ 'timePeriod': 'ONE_DAY' }, headers = headers) @@ -2469,11 +2298,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/sparklines?timePeriod=ONE_DAY`, +fetch('https://dydx-testnet.imperator.co/v4/sparklines?timePeriod=ONE_DAY', { method: 'GET', @@ -2539,11 +2364,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/time', headers = headers) +r = requests.get('https://dydx-testnet.imperator.co/v4/time', headers = headers) print(r.json()) @@ -2555,11 +2376,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/time`, +fetch('https://dydx-testnet.imperator.co/v4/time', { method: 'GET', @@ -2582,7 +2399,7 @@ fetch(`${baseURL}/time`, ```json { "iso": "string", - "epoch": 0.1 + "epoch": 0 } ``` @@ -2608,11 +2425,7 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/trades/perpetualMarket/{ticker}', headers = headers) +r = requests.get('https://dydx-testnet.imperator.co/v4/trades/perpetualMarket/{ticker}', headers = headers) print(r.json()) @@ -2624,11 +2437,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/trades/perpetualMarket/{ticker}`, +fetch('https://dydx-testnet.imperator.co/v4/trades/perpetualMarket/{ticker}', { method: 'GET', @@ -2660,9 +2469,9 @@ fetch(`${baseURL}/trades/perpetualMarket/{ticker}`, ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "trades": [ { "id": "string", @@ -2699,12 +2508,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/transfers', params={ - 'address': 'string', 'subaccountNumber': '0.1' +r = requests.get('https://dydx-testnet.imperator.co/v4/transfers', params={ + 'address': 'string', 'subaccountNumber': '0' }, headers = headers) print(r.json()) @@ -2717,11 +2522,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/transfers?address=string&subaccountNumber=0.1`, +fetch('https://dydx-testnet.imperator.co/v4/transfers?address=string&subaccountNumber=0', { method: 'GET', @@ -2754,18 +2555,18 @@ fetch(`${baseURL}/transfers?address=string&subaccountNumber=0.1`, ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "transfers": [ { "id": "string", "sender": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "recipient": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "size": "string", @@ -2801,12 +2602,8 @@ headers = { 'Accept': 'application/json' } -# For the deployment by DYDX token holders, use -# baseURL = 'https://indexer.dydx.trade/v4' -baseURL = 'https://dydx-testnet.imperator.co/v4' - -r = requests.get(f'{baseURL}/transfers/parentSubaccountNumber', params={ - 'address': 'string', 'parentSubaccountNumber': '0.1' +r = requests.get('https://dydx-testnet.imperator.co/v4/transfers/parentSubaccountNumber', params={ + 'address': 'string', 'parentSubaccountNumber': '0' }, headers = headers) print(r.json()) @@ -2819,11 +2616,7 @@ const headers = { 'Accept':'application/json' }; -// For the deployment by DYDX token holders, use -// const baseURL = 'https://indexer.dydx.trade/v4'; -const baseURL = 'https://dydx-testnet.imperator.co/v4'; - -fetch(`${baseURL}/transfers/parentSubaccountNumber?address=string&parentSubaccountNumber=0.1`, +fetch('https://dydx-testnet.imperator.co/v4/transfers/parentSubaccountNumber?address=string&parentSubaccountNumber=0', { method: 'GET', @@ -2856,18 +2649,18 @@ fetch(`${baseURL}/transfers/parentSubaccountNumber?address=string&parentSubaccou ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "transfers": [ { "id": "string", "sender": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "recipient": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "size": "string", @@ -2986,7 +2779,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ``` @@ -3037,7 +2830,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "market": "string", @@ -3055,7 +2848,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } } @@ -3080,7 +2873,7 @@ This operation does not require authentication "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ``` @@ -3109,14 +2902,14 @@ This operation does not require authentication "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } } @@ -3138,7 +2931,7 @@ This operation does not require authentication ```json { "address": "string", - "subaccountNumber": 0.1, + "subaccountNumber": 0, "equity": "string", "freeCollateral": "string", "openPerpetualPositions": { @@ -3158,7 +2951,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "market": "string", @@ -3176,7 +2969,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "assetPositions": { @@ -3185,14 +2978,14 @@ This operation does not require authentication "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "marginEnabled": true, @@ -3228,7 +3021,7 @@ This operation does not require authentication "subaccounts": [ { "address": "string", - "subaccountNumber": 0.1, + "subaccountNumber": 0, "equity": "string", "freeCollateral": "string", "openPerpetualPositions": { @@ -3248,7 +3041,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "market": "string", @@ -3266,7 +3059,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "assetPositions": { @@ -3275,14 +3068,14 @@ This operation does not require authentication "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "marginEnabled": true, @@ -3312,13 +3105,13 @@ This operation does not require authentication ```json { "address": "string", - "parentSubaccountNumber": 0.1, + "parentSubaccountNumber": 0, "equity": "string", "freeCollateral": "string", "childSubaccounts": [ { "address": "string", - "subaccountNumber": 0.1, + "subaccountNumber": 0, "equity": "string", "freeCollateral": "string", "openPerpetualPositions": { @@ -3338,7 +3131,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "market": "string", @@ -3356,7 +3149,7 @@ This operation does not require authentication "unrealizedPnl": "string", "closedAt": null, "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "assetPositions": { @@ -3365,14 +3158,14 @@ This operation does not require authentication "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } }, "marginEnabled": true, @@ -3409,7 +3202,7 @@ This operation does not require authentication "side": "LONG", "size": "string", "assetId": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] } @@ -3470,7 +3263,7 @@ This operation does not require authentication "close": "string", "baseTokenVolume": "string", "usdVolume": "string", - "trades": 0.1, + "trades": 0, "startingOpenInterest": "string", "id": "string" } @@ -3514,7 +3307,7 @@ This operation does not require authentication "close": "string", "baseTokenVolume": "string", "usdVolume": "string", - "trades": 0.1, + "trades": 0, "startingOpenInterest": "string", "id": "string" } @@ -3529,6 +3322,28 @@ This operation does not require authentication |---|---|---|---|---| |candles|[[CandleResponseObject](#schemacandleresponseobject)]|true|none|none| +## ComplianceResponse + + + + + + +```json +{ + "restricted": true, + "reason": "string" +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|restricted|boolean|true|none|none| +|reason|string|false|none|none| + ## ComplianceStatus @@ -3582,6 +3397,7 @@ This operation does not require authentication |*anonymous*|MANUAL| |*anonymous*|US_GEO| |*anonymous*|CA_GEO| +|*anonymous*|GB_GEO| |*anonymous*|SANCTIONED_GEO| |*anonymous*|COMPLIANCE_PROVIDER| @@ -3734,7 +3550,7 @@ This operation does not require authentication "createdAtHeight": "string", "orderId": "string", "clientMetadata": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ``` @@ -3767,9 +3583,9 @@ This operation does not require authentication ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "fills": [ { "id": "string", @@ -3785,7 +3601,7 @@ This operation does not require authentication "createdAtHeight": "string", "orderId": "string", "clientMetadata": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] } @@ -3972,9 +3788,9 @@ This operation does not require authentication ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "historicalPnl": [ { "id": "string", @@ -4272,6 +4088,9 @@ or |*anonymous*|TRAILING_STOP| |*anonymous*|TAKE_PROFIT| |*anonymous*|TAKE_PROFIT_MARKET| +|*anonymous*|HARD_TRADE| +|*anonymous*|FAILED_HARD_TRADE| +|*anonymous*|TRANSFER_PLACEHOLDER| ## OrderResponseObject @@ -4304,7 +4123,7 @@ or "ticker": "string", "updatedAt": "string", "updatedAtHeight": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ``` @@ -4406,17 +4225,17 @@ or "oraclePrice": "string", "priceChange24H": "string", "volume24H": "string", - "trades24H": 0.1, + "trades24H": 0, "nextFundingRate": "string", "initialMarginFraction": "string", "maintenanceMarginFraction": "string", "openInterest": "string", - "atomicResolution": 0.1, - "quantumConversionExponent": 0.1, + "atomicResolution": 0, + "quantumConversionExponent": 0, "tickSize": "string", "stepSize": "string", - "stepBaseQuantums": 0.1, - "subticksPerTick": 0.1, + "stepBaseQuantums": 0, + "subticksPerTick": 0, "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", @@ -4468,17 +4287,17 @@ or "oraclePrice": "string", "priceChange24H": "string", "volume24H": "string", - "trades24H": 0.1, + "trades24H": 0, "nextFundingRate": "string", "initialMarginFraction": "string", "maintenanceMarginFraction": "string", "openInterest": "string", - "atomicResolution": 0.1, - "quantumConversionExponent": 0.1, + "atomicResolution": 0, + "quantumConversionExponent": 0, "tickSize": "string", "stepSize": "string", - "stepBaseQuantums": 0.1, - "subticksPerTick": 0.1, + "stepBaseQuantums": 0, + "subticksPerTick": 0, "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", @@ -4491,17 +4310,17 @@ or "oraclePrice": "string", "priceChange24H": "string", "volume24H": "string", - "trades24H": 0.1, + "trades24H": 0, "nextFundingRate": "string", "initialMarginFraction": "string", "maintenanceMarginFraction": "string", "openInterest": "string", - "atomicResolution": 0.1, - "quantumConversionExponent": 0.1, + "atomicResolution": 0, + "quantumConversionExponent": 0, "tickSize": "string", "stepSize": "string", - "stepBaseQuantums": 0.1, - "subticksPerTick": 0.1, + "stepBaseQuantums": 0, + "subticksPerTick": 0, "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", @@ -4545,7 +4364,7 @@ or "unrealizedPnl": "string", "closedAt": "string", "exitPrice": "string", - "subaccountNumber": 0.1 + "subaccountNumber": 0 } ] } @@ -4618,7 +4437,7 @@ or ```json { "iso": "string", - "epoch": 0.1 + "epoch": 0 } ``` @@ -4697,9 +4516,9 @@ or ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "trades": [ { "id": "string", @@ -4762,11 +4581,11 @@ or { "id": "string", "sender": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "recipient": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "size": "string", @@ -4806,18 +4625,18 @@ or ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "transfers": [ { "id": "string", "sender": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "recipient": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "size": "string", @@ -4850,18 +4669,18 @@ or ```json { - "pageSize": 0.1, - "totalResults": 0.1, - "offset": 0.1, + "pageSize": 0, + "totalResults": 0, + "offset": 0, "transfers": [ { "id": "string", "sender": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "recipient": { - "subaccountNumber": 0.1, + "subaccountNumber": 0, "address": "string" }, "size": "string", diff --git a/indexer/services/comlink/public/swagger.json b/indexer/services/comlink/public/swagger.json index ab5e2ec9c6..dd2b159ada 100644 --- a/indexer/services/comlink/public/swagger.json +++ b/indexer/services/comlink/public/swagger.json @@ -339,6 +339,21 @@ "type": "object", "additionalProperties": false }, + "ComplianceResponse": { + "properties": { + "restricted": { + "type": "boolean" + }, + "reason": { + "type": "string" + } + }, + "required": [ + "restricted" + ], + "type": "object", + "additionalProperties": false + }, "ComplianceStatus": { "enum": [ "COMPLIANT", @@ -354,6 +369,7 @@ "MANUAL", "US_GEO", "CA_GEO", + "GB_GEO", "SANCTIONED_GEO", "COMPLIANCE_PROVIDER" ], @@ -792,7 +808,10 @@ "STOP_MARKET", "TRAILING_STOP", "TAKE_PROFIT", - "TAKE_PROFIT_MARKET" + "TAKE_PROFIT_MARKET", + "HARD_TRADE", + "FAILED_HARD_TRADE", + "TRANSFER_PLACEHOLDER" ], "type": "string" }, @@ -1517,6 +1536,34 @@ ] } }, + "/screen": { + "get": { + "operationId": "Screen", + "responses": { + "200": { + "description": "Ok", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ComplianceResponse" + } + } + } + } + }, + "security": [], + "parameters": [ + { + "in": "query", + "name": "address", + "required": true, + "schema": { + "type": "string" + } + } + ] + } + }, "/compliance/screen/{address}": { "get": { "operationId": "Screen", @@ -2802,7 +2849,7 @@ }, "servers": [ { - "url": "", + "url": "https://dydx-testnet.imperator.co/v4", "description": "Public Testnet" } ] diff --git a/indexer/services/comlink/src/request-helpers/request-transformer.ts b/indexer/services/comlink/src/request-helpers/request-transformer.ts index b06b70052c..9f82fc4c86 100644 --- a/indexer/services/comlink/src/request-helpers/request-transformer.ts +++ b/indexer/services/comlink/src/request-helpers/request-transformer.ts @@ -97,7 +97,8 @@ export function perpetualPositionToResponseObject( exitPrice: position.exitPrice && Big(position.exitPrice).toFixed(), realizedPnl, unrealizedPnl: helpers.getUnrealizedPnl( - position, perpetualMarketsMap[position.perpetualId], marketsMap, + position, perpetualMarketsMap[position.perpetualId], + marketsMap[perpetualMarketsMap[position.perpetualId].marketId], ), createdAt: position.createdAt, createdAtHeight: position.createdAtHeight,