diff --git a/.github/workflows/build-slate.yml b/.github/workflows/build-slate.yml deleted file mode 100644 index 11e662ae..00000000 --- a/.github/workflows/build-slate.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Build Slate docs - -on: - push: - branches: [ '*' ] - pull_request: - branches: [ '*' ] - -jobs: - build-and-test-slate: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ${{ github.workspace }}/slate-docs - strategy: - matrix: - ruby-version: [2.7.0] - - steps: - - uses: actions/checkout@v2 - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby-version }} - - - uses: actions/cache@v1 - with: - path: vendor/bundle - key: gems-${{ runner.os }}-${{ matrix.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }} - - - run: bundle config set deployment 'true' - - run: bundle install - - - run: bundle exec middleman build diff --git a/.github/workflows/deploy-slate.yml b/.github/workflows/deploy-slate.yml deleted file mode 100644 index 78a75e2c..00000000 --- a/.github/workflows/deploy-slate.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Deploy Slate docs - -on: - push: - branches: [ 'main' ] - -permissions: - contents: write - pull-requests: write - -jobs: - deploy: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ${{ github.workspace }}/slate-docs - env: - ruby-version: 2.7.0 - - steps: - - uses: actions/checkout@v2 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ env.ruby-version }} - - - uses: actions/cache@v1 - with: - path: vendor/bundle - key: gems-${{ runner.os }}-${{ env.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }} - - - name: Install - run: | - bundle config set deployment 'true' - bundle install - - - name: Build - run: bundle exec middleman build - - - name: Disable jekyll builds - run: touch build/.nojekyll - - - name: Install Push Dependencies - run: npm i -g --silent gh-pages@2.0.1 - - - name: Configure Git - run: | - git config --global user.name "github_actions" - git config --global user.email "ci@dydx.exchange" - - - name: Deploy - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git - gh-pages --dotfiles --message "[skip ci] Updates" --dist build -u "github_actions " - diff --git a/.github/workflows/link-check.yml b/.github/workflows/link-check.yml new file mode 100644 index 00000000..40d8e954 --- /dev/null +++ b/.github/workflows/link-check.yml @@ -0,0 +1,26 @@ +name: Check Markdown links + +on: push + +jobs: + markdown-link-check-md: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + file-extension: '.md' + folder-path: 'pages' + base-branch: 'main' + use-quiet-mode: 'yes' + + markdown-link-check-mdx: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + file-extension: '.mdx' + folder-path: 'pages' + base-branch: 'main' + use-quiet-mode: 'yes' diff --git a/README.md b/README.md index e519d038..e00da246 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

dYdX Chain Documentation

- + License
@@ -21,3 +21,11 @@ Start development server on localhost:3000: ```bash pnpm dev ``` + +## Formatting +To format .mdx files, you can use the [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extension in VSCode. + +## Github Actions +Upon push of a commit, the following checks are made: +* [markdown-link-check](https://github.com/gaurav-nelson/github-action-markdown-link-check) checks that all links work. + * If you are configuring a link that is erroring out, considering adding something to the [mlc_config.json](./mlc_config.json) using [these options](https://github.com/tcort/markdown-link-check#config-file-format). diff --git a/mlc_config.json b/mlc_config.json new file mode 100644 index 00000000..606e4777 --- /dev/null +++ b/mlc_config.json @@ -0,0 +1,19 @@ +{ + "aliveStatusCodes": [0, 200, 403, 429], + "httpHeaders": [ + { + "urls": ["https://github.com/", "https://guides.github.com/", "https://help.github.com/", "https://docs.github.com/"], + "headers": { + "Accept-Encoding": "zstd, br, gzip, deflate" + } + } + ], + "ignorePatterns": [ + { + "pattern": "^https://indexer.dydx.trade" + }, + { + "pattern": "^https://github.com/dydxprotocol/v4-chain/releases/" + } + ] +} diff --git a/next.config.js b/next.config.js index ef283632..dfe847d7 100644 --- a/next.config.js +++ b/next.config.js @@ -1,6 +1,64 @@ const withNextra = require('nextra')({ theme: 'nextra-theme-docs', themeConfig: './theme.config.tsx', + mdxOptions: { + remarkPlugins: [], + rehypePlugins: [], + }, }) -module.exports = withNextra() +module.exports = withNextra({ + async redirects() { + return [ + // Original top-level + { source: '/security', destination: '/other-security', permanent: true }, + { source: '/terms_of_use_and_privacy_policy.md', destination: '/other-terms_of_use_and_privacy_policy.md', permanent: true }, + { source: '/FAQ', destination: '/user-faqs', permanent: true }, + + // Architecture + { source: '/architecture/architectural_overview', destination: '/concepts-architecture/architectural_overview', permanent: true }, + { source: '/architecture/indexer', destination: '/concepts-architecture/indexer', permanent: true }, + + // Deposits and Withdrawals + { source: '/deposits_and_withdrawals/:slug*', destination: '/api_integration-deposits_and_withdrawals/:slug*', permanent: true }, + + // Developers + { source: '/developers/constants', destination: '/api_integration-constants', permanent: true }, + { source: '/developers/open_source_repositories', destination: '/api_integration-repositories.md', permanent: true }, + + // Developers - Clients + { source: '/developers/clients/:slug*', destination: '/api_integration-clients/:slug*', permanent: true }, + + // Developers - Indexer + { source: '/developers/indexer/:slug*', destination: '/api_integration-indexer/:slug*', permanent: true }, + + // Getting started + { source: '/getting_started/depositing_and_user_journeys', destination: 'introduction-getting_started', permanent: true }, + { source: '/getting_started/margin_calculations', destination: 'concepts-trading/margin', permanent: true }, + { source: '/getting_started/onboarding_faqs', destination: 'introduction-onboarding_faqs', permanent: true }, + { source: '/getting_started/rewards_fees_and_parameters', destination: 'concepts-trading/rewards_fees_and_parameters', permanent: true }, + + // Governance + { source: '/governance/:slug*', destination: '/users-governance/:slug*', permanent: true }, + + // Guides + { source: '/guides/:slug*', destination: '/api_integration-guides/:slug*', permanent: true }, + + // Network + { source: '/network/:slug*', destination: '/infrastructure_providers-network/:slug*', permanent: true }, + + // Operators + { source: '/operators/:slug*', destination: '/infrastructure_providers-operators/:slug*', permanent: true }, + + // Rewards + { source: '/rewards/:slug*', destination: '/users-rewards/:slug*', permanent: true }, + + // Trading + { source: '/trading:slug*', destination: '/api_integration-trading/:slug*', permanent: true }, + + // Validators + { source: '/validators/:slug*', destination: '/infrastructure_providers-validators/:slug*', permanent: true }, + { source: '/validators/upgrades/:slug*', destination: '/infrastructure_providers-validators/upgrades/:slug*', permanent: true }, + ] + }, +}) diff --git a/package-lock.json b/package-lock.json index c7ff9592..28ffd20a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3564,66 +3564,6 @@ "type": "github", "url": "https://github.com/sponsors/wooorm" } - }, - "node_modules/@next/swc-android-arm-eabi": { - "version": "13.0.6", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-13.0.6.tgz", - "integrity": "sha512-FGFSj3v2Bluw8fD/X+1eXIEB0PhoJE0zfutsAauRhmNpjjZshLDgoXMWm1jTRL/04K/o9gwwO2+A8+sPVCH1uw==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-android-arm64": { - "version": "13.0.6", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-13.0.6.tgz", - "integrity": "sha512-7MgbtU7kimxuovVsd7jSJWMkIHBDBUsNLmmlkrBRHTvgzx5nDBXogP0hzZm7EImdOPwVMPpUHRQMBP9mbsiJYQ==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-freebsd-x64": { - "version": "13.0.6", - "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-13.0.6.tgz", - "integrity": "sha512-6Lbxd9gAdXneTkwHyYW/qtX1Tdw7ND9UbiGsGz/SP43ZInNWnW6q0au4hEVPZ9bOWWRKzcVoeTBdoMpQk9Hx9w==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm-gnueabihf": { - "version": "13.0.6", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-13.0.6.tgz", - "integrity": "sha512-wNdi5A519e1P+ozEuYOhWPzzE6m1y7mkO6NFwn6watUwO0X9nZs7fT9THmnekvmFQpaZ6U+xf2MQ9poQoCh6jQ==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } } } } diff --git a/pages/_error.tsx b/pages/_error.tsx new file mode 100644 index 00000000..7c855dbd --- /dev/null +++ b/pages/_error.tsx @@ -0,0 +1,26 @@ +import React from 'react'; + +const CustomError: React.FC = () => { + return ( +
+

Page Not Found

+

The page you are looking for does not exist. Head back to the homepage here.

+
+ ); +}; + +export default CustomError; diff --git a/pages/_meta.json b/pages/_meta.json index ed361e86..e3353dd1 100644 --- a/pages/_meta.json +++ b/pages/_meta.json @@ -1,48 +1,59 @@ { "----------INTRODUCTION----------": { - "title": "INTRODUCTION", + "title": "šŸ¦” INTRODUCTION", "type": "separator" }, "index": "Introduction", - "getting_started": "Getting Started", - "architecture": "Architecture", + "introduction-getting_started": "Getting Started", + "introduction-onboarding_faqs": "Onboarding FAQs", "----------INFRASTRUCTURE PROVIDERS----------": { - "title": "INFRASTRUCTURE PROVIDERS", + "title": "šŸ˜ļø INFRASTRUCTURE PROVIDERS", "type": "separator" }, - "validators": "Validators & Full-Nodes", - "network": "Network Configuration", - "operators": "Indexer Operators", + "infrastructure_providers-validators": "Validators & Full-Nodes", + "infrastructure_providers-network": "Network Configuration", + "infrastructure_providers-operators": "Indexer Operators", "----------API INTEGRATION----------": { - "title": "API INTEGRATION", + "title": "šŸ”— API INTEGRATION", "type": "separator" }, - "trading": "Trading", - "deposits_and_withdrawals": "Deposits and Withdrawals", - "developers": "Developers", - "guides": "Guides", + "api_integration-clients": "Client Documentation", + "api_integration-indexer": "Indexer Documentation", + "api_integration-repositories": "Repositories", + "api_integration-trading": "Trading", + "api_integration-deposits_and_withdrawals": "Deposits and Withdrawals", + "api_integration-constants": "Constants", + "api_integration-guides": "Guides", "----------USERS----------": { - "title": "USERS", + "title": "šŸ‘„ USERS", "type": "separator" }, - "rewards": "Rewards", - "governance": "Governance", - "FAQ": "FAQs", + "users-rewards": "Rewards", + "users-governance": "Governance", + "users-faqs": "FAQs", + + "----------CONCEPTS----------": { + "title": "šŸ¤” CONCEPTS", + "type": "separator" + }, + + "concepts-architecture": "Architecture", + "concepts-trading": "Trading", "----------OTHER----------": { - "title": "OTHER", + "title": "šŸ’¬ OTHER", "type": "separator" }, - "security": "Security", - "terms_of_use_and_privacy_policy": "Terms & Policies", + "other-security": "Security", + "other-terms_of_use_and_privacy_policy": "Terms & Policies", "testnet app": { "title": "Testnet App ā†—", diff --git a/pages/developers/clients/_meta.json b/pages/api_integration-clients/_meta.json similarity index 100% rename from pages/developers/clients/_meta.json rename to pages/api_integration-clients/_meta.json diff --git a/pages/developers/clients/composite_client.mdx b/pages/api_integration-clients/composite_client.mdx similarity index 100% rename from pages/developers/clients/composite_client.mdx rename to pages/api_integration-clients/composite_client.mdx diff --git a/pages/developers/clients/indexer_client.mdx b/pages/api_integration-clients/indexer_client.mdx similarity index 100% rename from pages/developers/clients/indexer_client.mdx rename to pages/api_integration-clients/indexer_client.mdx diff --git a/pages/developers/clients/socket_client.mdx b/pages/api_integration-clients/socket_client.mdx similarity index 100% rename from pages/developers/clients/socket_client.mdx rename to pages/api_integration-clients/socket_client.mdx diff --git a/pages/developers/clients/validator_client.mdx b/pages/api_integration-clients/validator_client.mdx similarity index 100% rename from pages/developers/clients/validator_client.mdx rename to pages/api_integration-clients/validator_client.mdx diff --git a/pages/api_integration-constants.md b/pages/api_integration-constants.md new file mode 100644 index 00000000..22697930 --- /dev/null +++ b/pages/api_integration-constants.md @@ -0,0 +1,25 @@ +# Constants + +| Name | Value | Description | +| --------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `sdk.DefaultPowerReduction` | `1e18` | The staking power is equal the number of staked-token coins divided by this number (to prevent overflow). This number typically denotes how many of the staked-token denom are considered to be equal to one canonical token. | + +# Module Accounts + +In Cosmos-SDK, a module account is an account with address generated by hashing a string. The module account has no known private key and is therefore only controlled by the state-machine and governance. Here we list the module account addresses (assuming the default HRP of `dydx`) and the hashed string that results in the address. + +| Module | Name | Address | String | +| ---------------- | ------------------- | --------------------------------------------- | -------------------------- | +| `x/auth` | Fee Collector | `dydx17xpfvakm2amg962yls6f84z3kell8c5leqdyt2` | `"fee_collector"` | +| `x/bridge` | Bridge Module | `dydx1zlefkpe3g0vvm9a4h0jf9000lmqutlh9jwjnsv` | `"bridge"` | +| `x/distribution` | Distribution Module | `dydx1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8wx2cfg` | `"distribution"` | +| `x/staking` | Bonded Pool | `dydx1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3uz8teq` | `"bonded_tokens_pool"` | +| `x/staking` | Not-Bonded Pool | `dydx1tygms3xhhs3yv487phx3dw4a95jn7t7lgzm605` | `"not_bonded_tokens_pool"` | +| `x/gov` | Gov Module | `dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky` | `"gov"` | +| `x/ibc` | IBC Module | `dydx1yl6hdjhmkf37639730gffanpzndzdpmh8xcdh5` | `"transfer"` | +| `x/subaccounts` | Subaccounts Module | `dydx1v88c3xv9xyv3eetdx0tvcmq7ung3dywp5upwc6` | `"subaccounts"` | +| `x/clob` | Insurance Fund | `dydx1c7ptc87hkd54e3r7zjy92q29xkq7t79w64slrq` | `"insurance_fund"` | +| `x/rewards` | Rewards Treasury | `dydx16wrau2x4tsg033xfrrdpae6kxfn9kyuerr5jjp` | `"rewards_treasury"` | +| `x/rewards` | Rewards Vester | `dydx1ltyc6y4skclzafvpznpt2qjwmfwgsndp458rmp` | `"rewards_vester"` | +| `x/vest` | Community Treasury | `dydx15ztc7xy42tn2ukkc0qjthkucw9ac63pgp70urn` | `"community_treasury"` | +| `x/vest` | Community Vester | `dydx1wxje320an3karyc6mjw4zghs300dmrjkwn7xtk` | `"community_vester"` | diff --git a/pages/deposits_and_withdrawals/cli_commands.md b/pages/api_integration-deposits_and_withdrawals/cli_commands.md similarity index 94% rename from pages/deposits_and_withdrawals/cli_commands.md rename to pages/api_integration-deposits_and_withdrawals/cli_commands.md index 72616cc8..88791ed8 100644 --- a/pages/deposits_and_withdrawals/cli_commands.md +++ b/pages/api_integration-deposits_and_withdrawals/cli_commands.md @@ -1,6 +1,6 @@ ## CLI commands -Note: Native token denoms for transfer amounts and fees can be found [here](../network/network_constants.md#native-token-denom) +Note: Native token denoms for transfer amounts and fees can be found [here](../infrastructure_providers-network/network_constants.mdx#native-token-denom) ### Deposit to Subaccount diff --git a/pages/deposits_and_withdrawals/how_to_send_usdc_from_ethereum_to_dydx.md b/pages/api_integration-deposits_and_withdrawals/how_to_send_usdc_from_ethereum_to_dydx.md similarity index 82% rename from pages/deposits_and_withdrawals/how_to_send_usdc_from_ethereum_to_dydx.md rename to pages/api_integration-deposits_and_withdrawals/how_to_send_usdc_from_ethereum_to_dydx.md index fbf20b4a..9f15e69d 100644 --- a/pages/deposits_and_withdrawals/how_to_send_usdc_from_ethereum_to_dydx.md +++ b/pages/api_integration-deposits_and_withdrawals/how_to_send_usdc_from_ethereum_to_dydx.md @@ -1,10 +1,10 @@ # How to send USDC from Ethereum to dYdX ## Deployments -| Deployment | USDC Native Chain | USDC_ERC20_ADDRESS | TOKEN_MESSENGER_CONTRACT_ADDRESS | -|--------------------|-------------------|--------------------|----------------------------------| -| DYDX token holders | Ethereum | [0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48](https://etherscan.io/address/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48) | [0xBd3fa81B58Ba92a82136038B25aDec7066af3155](https://etherscan.io/address/0xbd3fa81b58ba92a82136038b25adec7066af3155) | -| Testnet | Sepolia Testnet | [0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238](https://sepolia.etherscan.io/address/0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238) | [0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5](https://sepolia.etherscan.io/address/0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5) | +| Deployment | Chain ID | USDC Native Chain | USDC_ERC20_ADDRESS | TOKEN_MESSENGER_CONTRACT_ADDRESS | +| ------------------ | -------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | +| DYDX token holders | dydx-mainnet-1 | Ethereum | [0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48](https://etherscan.io/address/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48) | [0xBd3fa81B58Ba92a82136038B25aDec7066af3155](https://etherscan.io/address/0xbd3fa81b58ba92a82136038b25adec7066af3155) | +| Testnet | dydx-testnet-4 | Sepolia Testnet | [0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238](https://sepolia.etherscan.io/address/0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238) | [0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5](https://sepolia.etherscan.io/address/0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5) | > **Note:** the example values in the steps below align with the **deployment by DYDX token holders**. diff --git a/pages/deposits_and_withdrawals/rate_limits_and_gating.md b/pages/api_integration-deposits_and_withdrawals/rate_limits_and_gating.md similarity index 100% rename from pages/deposits_and_withdrawals/rate_limits_and_gating.md rename to pages/api_integration-deposits_and_withdrawals/rate_limits_and_gating.md diff --git a/pages/guides/_meta.json b/pages/api_integration-guides/_meta.json similarity index 100% rename from pages/guides/_meta.json rename to pages/api_integration-guides/_meta.json diff --git a/pages/guides/cli_python_script.md b/pages/api_integration-guides/cli_python_script.md similarity index 100% rename from pages/guides/cli_python_script.md rename to pages/api_integration-guides/cli_python_script.md diff --git a/pages/guides/how_to_interpret_block_data_for_trades.md b/pages/api_integration-guides/how_to_interpret_block_data_for_trades.md similarity index 92% rename from pages/guides/how_to_interpret_block_data_for_trades.md rename to pages/api_integration-guides/how_to_interpret_block_data_for_trades.md index 6b97b111..79ef6fd7 100644 --- a/pages/guides/how_to_interpret_block_data_for_trades.md +++ b/pages/api_integration-guides/how_to_interpret_block_data_for_trades.md @@ -8,7 +8,7 @@ In dYdX Chain trading, quantities and prices are represented in quantums (for qu The smallest increment of position size. Determined from `atomicResolution`. -atomicResolution - Determines the size of a quantum. [For example](https://github.com/dydxprotocol/v4/blob/08069ba905753158b9f390ca52e3f9f0fb2cb3d5/config.yml#L101), an `atomicResolution` of 10 for `BTC`, means that 1 quantum is `1e-10` `BTC`. +atomicResolution - Determines the size of a quantum. [For example](https://github.com/dydxprotocol/v4-testnets/blob/aa1c7ac589d6699124942a66c2362acad2e6f50d/dydx-testnet-4/genesis.json#L5776), an `atomicResolution` of 10 for `BTC`, means that 1 quantum is `1e-10` `BTC`. ### Subticks diff --git a/pages/guides/how_to_uncross_orderbook.md b/pages/api_integration-guides/how_to_uncross_orderbook.md similarity index 100% rename from pages/guides/how_to_uncross_orderbook.md rename to pages/api_integration-guides/how_to_uncross_orderbook.md diff --git a/pages/guides/setting_up_raspberry_pi_for_api_trading.md b/pages/api_integration-guides/setting_up_raspberry_pi_for_api_trading.md similarity index 96% rename from pages/guides/setting_up_raspberry_pi_for_api_trading.md rename to pages/api_integration-guides/setting_up_raspberry_pi_for_api_trading.md index 753aa9d2..b5d34cc8 100644 --- a/pages/guides/setting_up_raspberry_pi_for_api_trading.md +++ b/pages/api_integration-guides/setting_up_raspberry_pi_for_api_trading.md @@ -13,7 +13,7 @@ `sudo apt-get update` `sudo apt-get upgrade` 6. Add more swap memory: Instructions here, except use ā€œCONF_SWAPSIZE=4096ā€ (your microSD memory card should be 16GB or more) -https://nebl.io/neblio-university/enabling-increasing-raspberry-pi-swap/ +https://web.archive.org/web/20240228194730/https://nebl.io/neblio-university/enabling-increasing-raspberry-pi-swap/ 7. Reboot with: `sudo shutdown -r 0` 8. For the next part, you will need to know how to use the ā€˜viā€™ text editor. Take the simple tutorial here: diff --git a/pages/developers/indexer/_meta.json b/pages/api_integration-indexer/_meta.json similarity index 100% rename from pages/developers/indexer/_meta.json rename to pages/api_integration-indexer/_meta.json diff --git a/pages/developers/indexer/indexer_api.mdx b/pages/api_integration-indexer/indexer_api.mdx similarity index 66% rename from pages/developers/indexer/indexer_api.mdx rename to pages/api_integration-indexer/indexer_api.mdx index 08170406..f2b11117 100644 --- a/pages/developers/indexer/indexer_api.mdx +++ b/pages/api_integration-indexer/indexer_api.mdx @@ -1,3 +1,4 @@ + # Indexer API v1.0.0 > Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu. @@ -42,10 +43,10 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; -fetch(`${baseURL}/addresses/${address}`, +fetch(`${baseURL}/addresses/{address}`, { method: 'GET', @@ -76,7 +77,7 @@ fetch(`${baseURL}/addresses/${address}`, "subaccounts": [ { "address": "string", - "subaccountNumber": 0, + "subaccountNumber": 0.1, "equity": "string", "freeCollateral": "string", "openPerpetualPositions": { @@ -95,7 +96,8 @@ fetch(`${baseURL}/addresses/${address}`, "netFunding": "string", "unrealizedPnl": "string", "closedAt": null, - "exitPrice": "string" + "exitPrice": "string", + "subaccountNumber": 0.1 }, "property2": { "market": "string", @@ -112,7 +114,8 @@ fetch(`${baseURL}/addresses/${address}`, "netFunding": "string", "unrealizedPnl": "string", "closedAt": null, - "exitPrice": "string" + "exitPrice": "string", + "subaccountNumber": 0.1 } }, "assetPositions": { @@ -120,16 +123,19 @@ fetch(`${baseURL}/addresses/${address}`, "symbol": "string", "side": "LONG", "size": "string", - "assetId": "string" + "assetId": "string", + "subaccountNumber": 0.1 }, "property2": { "symbol": "string", "side": "LONG", "size": "string", - "assetId": "string" + "assetId": "string", + "subaccountNumber": 0.1 } }, - "marginEnabled": true + "marginEnabled": true, + "updatedAtHeight": "string" } ], "totalTradingRewards": "string" @@ -175,10 +181,10 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; -fetch(`${baseURL}/addresses/${address}/subaccountNumber/${subaccountNumber}`, +fetch(`${baseURL}/addresses/{address}/subaccountNumber/{subaccountNumber}`, { method: 'GET', @@ -207,68 +213,67 @@ fetch(`${baseURL}/addresses/${address}/subaccountNumber/${subaccountNumber}`, ```json { - "subaccounts": [ - { - "address": "string", - "subaccountNumber": 0, - "equity": "string", - "freeCollateral": "string", - "openPerpetualPositions": { - "property1": { - "market": "string", - "status": "OPEN", - "side": "LONG", - "size": "string", - "maxSize": "string", - "entryPrice": "string", - "realizedPnl": "string", - "createdAt": "string", - "createdAtHeight": "string", - "sumOpen": "string", - "sumClose": "string", - "netFunding": "string", - "unrealizedPnl": "string", - "closedAt": "string", - "exitPrice": "string" - }, - "property2": { - "market": "string", - "status": "OPEN", - "side": "LONG", - "size": "string", - "maxSize": "string", - "entryPrice": "string", - "realizedPnl": "string", - "createdAt": "string", - "createdAtHeight": "string", - "sumOpen": "string", - "sumClose": "string", - "netFunding": "string", - "unrealizedPnl": "string", - "closedAt": "string", - "exitPrice": "string" - } - }, - "assetPositions": { - "property1": { - "symbol": "string", - "side": "LONG", - "size": "string", - "assetId": "string" - }, - "property2": { - "symbol": "string", - "side": "LONG", - "size": "string", - "assetId": "string" - } - }, - "marginEnabled": true - } - ], - "totalTradingRewards": "string" + "address": "string", + "subaccountNumber": 0.1, + "equity": "string", + "freeCollateral": "string", + "openPerpetualPositions": { + "property1": { + "market": "string", + "status": "OPEN", + "side": "LONG", + "size": "string", + "maxSize": "string", + "entryPrice": "string", + "realizedPnl": "string", + "createdAt": "string", + "createdAtHeight": "string", + "sumOpen": "string", + "sumClose": "string", + "netFunding": "string", + "unrealizedPnl": "string", + "closedAt": "string", + "exitPrice": "string", + "subaccountNumber": 0.1 + }, + "property2": { + "market": "string", + "status": "OPEN", + "side": "LONG", + "size": "string", + "maxSize": "string", + "entryPrice": "string", + "realizedPnl": "string", + "createdAt": "string", + "createdAtHeight": "string", + "sumOpen": "string", + "sumClose": "string", + "netFunding": "string", + "unrealizedPnl": "string", + "closedAt": "string", + "exitPrice": "string", + "subaccountNumber": 0.1 + } + }, + "assetPositions": { + "property1": { + "symbol": "string", + "side": "LONG", + "size": "string", + "assetId": "string", + "subaccountNumber": 0.1 + }, + "property2": { + "symbol": "string", + "side": "LONG", + "size": "string", + "assetId": "string", + "subaccountNumber": 0.1 + } + }, + "marginEnabled": true, + "updatedAtHeight": "string" } - ``` ### Responses @@ -281,9 +286,9 @@ fetch(`${baseURL}/addresses/${address}/subaccountNumber/${subaccountNumber}`, This operation does not require authentication -## GetAssetPositions +## GetParentSubaccount - + > Code samples @@ -297,9 +302,7 @@ headers = { # baseURL = 'https://indexer.dydx.trade/v4' baseURL = 'https://dydx-testnet.imperator.co/v4' -r = requests.get(f'{baseURL}/assetPositions', params={ - 'address': 'string', 'subaccountNumber': '0' -}, headers = headers) +r = requests.get(f'{baseURL}/addresses/{address}/parentSubaccountNumber/{parentSubaccountNumber}', headers = headers) print(r.json()) @@ -312,10 +315,10 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; -fetch(`${baseURL}/assetPositions?address=${address}&subaccountNumber=${subaccountNumber}`, +fetch(`${baseURL}/addresses/{address}/parentSubaccountNumber/{parentSubaccountNumber}`, { method: 'GET', @@ -329,14 +332,14 @@ fetch(`${baseURL}/assetPositions?address=${address}&subaccountNumber=${subaccoun ``` -`GET /assetPositions` +`GET /addresses/{address}/parentSubaccountNumber/{parentSubaccountNumber}` ### Parameters |Name|In|Type|Required|Description| |---|---|---|---|---| -|address|query|string|true|none| -|subaccountNumber|query|number(double)|true|none| +|address|path|string|true|none| +|parentSubaccountNumber|path|number(double)|true|none| > Example responses @@ -344,12 +347,72 @@ fetch(`${baseURL}/assetPositions?address=${address}&subaccountNumber=${subaccoun ```json { - "positions": [ + "address": "string", + "parentSubaccountNumber": 0.1, + "equity": "string", + "freeCollateral": "string", + "childSubaccounts": [ { - "symbol": "string", - "side": "LONG", - "size": "string", - "assetId": "string" + "address": "string", + "subaccountNumber": 0.1, + "equity": "string", + "freeCollateral": "string", + "openPerpetualPositions": { + "property1": { + "market": "string", + "status": "OPEN", + "side": "LONG", + "size": "string", + "maxSize": "string", + "entryPrice": "string", + "realizedPnl": "string", + "createdAt": "string", + "createdAtHeight": "string", + "sumOpen": "string", + "sumClose": "string", + "netFunding": "string", + "unrealizedPnl": "string", + "closedAt": null, + "exitPrice": "string", + "subaccountNumber": 0.1 + }, + "property2": { + "market": "string", + "status": "OPEN", + "side": "LONG", + "size": "string", + "maxSize": "string", + "entryPrice": "string", + "realizedPnl": "string", + "createdAt": "string", + "createdAtHeight": "string", + "sumOpen": "string", + "sumClose": "string", + "netFunding": "string", + "unrealizedPnl": "string", + "closedAt": null, + "exitPrice": "string", + "subaccountNumber": 0.1 + } + }, + "assetPositions": { + "property1": { + "symbol": "string", + "side": "LONG", + "size": "string", + "assetId": "string", + "subaccountNumber": 0.1 + }, + "property2": { + "symbol": "string", + "side": "LONG", + "size": "string", + "assetId": "string", + "subaccountNumber": 0.1 + } + }, + "marginEnabled": true, + "updatedAtHeight": "string" } ] } @@ -359,15 +422,15 @@ fetch(`${baseURL}/assetPositions?address=${address}&subaccountNumber=${subaccoun |Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[AssetPositionResponse](#schemaassetpositionresponse)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[ParentSubaccountResponse](#schemaparentsubaccountresponse)| -## GetCandles +## GetAssetPositions - + > Code samples @@ -381,8 +444,8 @@ headers = { # baseURL = 'https://indexer.dydx.trade/v4' baseURL = 'https://dydx-testnet.imperator.co/v4' -r = requests.get(f'{baseURL}/candles/perpetualMarkets/{ticker}', params={ - 'resolution': '1MIN', 'limit': '0' +r = requests.get(f'{baseURL}/assetPositions', params={ + 'address': 'string', 'subaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -396,10 +459,10 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; -fetch(`${baseURL}/candles/perpetualMarkets/{ticker}?resolution=1MIN&limit=0`, +fetch(`${baseURL}/assetPositions?address=string&subaccountNumber=0.1`, { method: 'GET', @@ -413,29 +476,14 @@ fetch(`${baseURL}/candles/perpetualMarkets/{ticker}?resolution=1MIN&limit=0`, ``` -`GET /candles/perpetualMarkets/{ticker}` +`GET /assetPositions` ### Parameters |Name|In|Type|Required|Description| |---|---|---|---|---| -|ticker|path|string|true|none| -|resolution|query|[CandleResolution](#schemacandleresolution)|true|none| -|limit|query|number(double)|true|none| -|fromISO|query|string|false|none| -|toISO|query|string|false|none| - -#### Enumerated Values - -|Parameter|Value| -|---|---| -|resolution|1MIN| -|resolution|5MINS| -|resolution|15MINS| -|resolution|30MINS| -|resolution|1HOUR| -|resolution|4HOURS| -|resolution|1DAY| +|address|query|string|true|none| +|subaccountNumber|query|number(double)|true|none| > Example responses @@ -443,20 +491,13 @@ fetch(`${baseURL}/candles/perpetualMarkets/{ticker}?resolution=1MIN&limit=0`, ```json { - "candles": [ + "positions": [ { - "startedAt": "string", - "ticker": "string", - "resolution": "1MIN", - "low": "string", - "high": "string", - "open": "string", - "close": "string", - "baseTokenVolume": "string", - "usdVolume": "string", - "trades": 0, - "startingOpenInterest": "string", - "id": "string" + "symbol": "string", + "side": "LONG", + "size": "string", + "assetId": "string", + "subaccountNumber": 0.1 } ] } @@ -466,15 +507,15 @@ fetch(`${baseURL}/candles/perpetualMarkets/{ticker}?resolution=1MIN&limit=0`, |Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[CandleResponse](#schemacandleresponse)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[AssetPositionResponse](#schemaassetpositionresponse)| -## Screen +## GetAssetPositionsForParentSubaccount - + > Code samples @@ -488,8 +529,8 @@ headers = { # baseURL = 'https://indexer.dydx.trade/v4' baseURL = 'https://dydx-testnet.imperator.co/v4' -r = requests.get(f'{baseURL}/screen', params={ - 'address': 'string' +r = requests.get(f'{baseURL}/assetPositions/parentSubaccountNumber', params={ + 'address': 'string', 'parentSubaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -503,10 +544,10 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; -fetch(`${baseURL}/screen?address=string`, +fetch(`${baseURL}/assetPositions/parentSubaccountNumber?address=string&parentSubaccountNumber=0.1`, { method: 'GET', @@ -520,13 +561,14 @@ fetch(`${baseURL}/screen?address=string`, ``` -`GET /screen` +`GET /assetPositions/parentSubaccountNumber` ### Parameters |Name|In|Type|Required|Description| |---|---|---|---|---| |address|query|string|true|none| +|parentSubaccountNumber|query|number(double)|true|none| > Example responses @@ -534,8 +576,15 @@ fetch(`${baseURL}/screen?address=string`, ```json { - "restricted": true, - "reason": "string" + "positions": [ + { + "symbol": "string", + "side": "LONG", + "size": "string", + "assetId": "string", + "subaccountNumber": 0.1 + } + ] } ``` @@ -543,15 +592,15 @@ fetch(`${baseURL}/screen?address=string`, |Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[ComplianceResponse](#schemacomplianceresponse)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[AssetPositionResponse](#schemaassetpositionresponse)| -## GetFills +## GetCandles - + > Code samples @@ -565,8 +614,8 @@ headers = { # baseURL = 'https://indexer.dydx.trade/v4' baseURL = 'https://dydx-testnet.imperator.co/v4' -r = requests.get(f'{baseURL}/fills', params={ - 'address': 'string', 'subaccountNumber': '0', 'market': 'string', 'marketType': 'PERPETUAL', 'limit': '0' +r = requests.get(f'{baseURL}/candles/perpetualMarkets/{ticker}', params={ + 'resolution': '1MIN' }, headers = headers) print(r.json()) @@ -580,10 +629,10 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; -fetch(`${baseURL}/fills?address=string&subaccountNumber=0&market=string&marketType=PERPETUAL&limit=0`, +fetch(`${baseURL}/candles/perpetualMarkets/{ticker}?resolution=1MIN`, { method: 'GET', @@ -597,26 +646,29 @@ fetch(`${baseURL}/fills?address=string&subaccountNumber=0&market=string&marketTy ``` -`GET /fills` +`GET /candles/perpetualMarkets/{ticker}` ### Parameters |Name|In|Type|Required|Description| |---|---|---|---|---| -|address|query|string|true|none| -|subaccountNumber|query|number(double)|true|none| -|market|query|string|false|none| -|marketType|query|[MarketType](#schemamarkettype)|false|none| +|ticker|path|string|true|none| +|resolution|query|[CandleResolution](#schemacandleresolution)|true|none| |limit|query|number(double)|false|none| -|createdBeforeOrAtHeight|query|number(double)|false|none| -|createdBeforeOrAt|query|[IsoString](#schemaisostring)|false|none| +|fromISO|query|string|false|none| +|toISO|query|string|false|none| #### Enumerated Values |Parameter|Value| |---|---| -|marketType|PERPETUAL| -|marketType|SPOT| +|resolution|1MIN| +|resolution|5MINS| +|resolution|15MINS| +|resolution|30MINS| +|resolution|1HOUR| +|resolution|4HOURS| +|resolution|1DAY| > Example responses @@ -624,21 +676,20 @@ fetch(`${baseURL}/fills?address=string&subaccountNumber=0&market=string&marketTy ```json { - "fills": [ + "candles": [ { - "id": "string", - "side": "BUY", - "liquidity": "TAKER", - "type": "LIMIT", - "market": "string", - "marketType": "PERPETUAL", - "price": "string", - "size": "string", - "fee": "string", - "createdAt": "string", - "createdAtHeight": "string", - "orderId": "string", - "clientMetadata": "string" + "startedAt": "string", + "ticker": "string", + "resolution": "1MIN", + "low": "string", + "high": "string", + "open": "string", + "close": "string", + "baseTokenVolume": "string", + "usdVolume": "string", + "trades": 0.1, + "startingOpenInterest": "string", + "id": "string" } ] } @@ -648,15 +699,15 @@ fetch(`${baseURL}/fills?address=string&subaccountNumber=0&market=string&marketTy |Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[FillResponse](#schemafillresponse)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[CandleResponse](#schemacandleresponse)| -## GetHeight +## Screen - + > Code samples @@ -670,7 +721,7 @@ headers = { # baseURL = 'https://indexer.dydx.trade/v4' baseURL = 'https://dydx-testnet.imperator.co/v4' -r = requests.get(f'{baseURL}/height', headers = headers) +r = requests.get(f'{baseURL}/compliance/screen/{address}', headers = headers) print(r.json()) @@ -683,10 +734,10 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; -fetch(`${baseURL}/height`, +fetch(`${baseURL}/compliance/screen/{address}`, { method: 'GET', @@ -700,7 +751,13 @@ fetch(`${baseURL}/height`, ``` -`GET /height` +`GET /compliance/screen/{address}` + +### Parameters + +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|address|path|string|true|none| > Example responses @@ -708,8 +765,9 @@ fetch(`${baseURL}/height`, ```json { - "height": "string", - "time": "string" + "status": "COMPLIANT", + "reason": "MANUAL", + "updatedAt": "string" } ``` @@ -717,15 +775,15 @@ fetch(`${baseURL}/height`, |Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[HeightResponse](#schemaheightresponse)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[ComplianceV2Response](#schemacompliancev2response)| -## GetTradingRewards +## GetFills - + > Code samples @@ -739,8 +797,8 @@ headers = { # baseURL = 'https://indexer.dydx.trade/v4' baseURL = 'https://dydx-testnet.imperator.co/v4' -r = requests.get(f'{baseURL}/historicalBlockTradingRewards/{address}', params={ - 'limit': '0' +r = requests.get(f'{baseURL}/fills', params={ + 'address': 'string', 'subaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -754,10 +812,10 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; -fetch(`${baseURL}/historicalBlockTradingRewards/{address}?limit=0`, +fetch(`${baseURL}/fills?address=string&subaccountNumber=0.1`, { method: 'GET', @@ -771,18 +829,305 @@ fetch(`${baseURL}/historicalBlockTradingRewards/{address}?limit=0`, ``` -`GET /historicalBlockTradingRewards/{address}` +`GET /fills` ### Parameters |Name|In|Type|Required|Description| |---|---|---|---|---| -|address|path|string|true|none| -|limit|query|number(double)|true|none| -|startingBeforeOrAt|query|[IsoString](#schemaisostring)|false|none| -|startingBeforeOrAtHeight|query|string|false|none| - -> Example responses +|address|query|string|true|none| +|subaccountNumber|query|number(double)|true|none| +|market|query|string|false|none| +|marketType|query|[MarketType](#schemamarkettype)|false|none| +|limit|query|number(double)|false|none| +|createdBeforeOrAtHeight|query|number(double)|false|none| +|createdBeforeOrAt|query|[IsoString](#schemaisostring)|false|none| +|page|query|number(double)|false|none| + +#### Enumerated Values + +|Parameter|Value| +|---|---| +|marketType|PERPETUAL| +|marketType|SPOT| + +> Example responses + +> 200 Response + +```json +{ + "pageSize": 0.1, + "totalResults": 0.1, + "offset": 0.1, + "fills": [ + { + "id": "string", + "side": "BUY", + "liquidity": "TAKER", + "type": "LIMIT", + "market": "string", + "marketType": "PERPETUAL", + "price": "string", + "size": "string", + "fee": "string", + "createdAt": "string", + "createdAtHeight": "string", + "orderId": "string", + "clientMetadata": "string", + "subaccountNumber": 0.1 + } + ] +} +``` + +### Responses + +|Status|Meaning|Description|Schema| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[FillResponse](#schemafillresponse)| + + + +## GetFillsForParentSubaccount + + + +> Code samples + +```python +import requests +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' +}, headers = headers) + +print(r.json()) + +``` + +```javascript + +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`, +{ + method: 'GET', + + headers: headers +}) +.then(function(res) { + return res.json(); +}).then(function(body) { + console.log(body); +}); + +``` + +`GET /fills/parentSubaccount` + +### Parameters + +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|address|query|string|true|none| +|parentSubaccountNumber|query|number(double)|true|none| +|market|query|string|false|none| +|marketType|query|[MarketType](#schemamarkettype)|false|none| +|limit|query|number(double)|false|none| +|createdBeforeOrAtHeight|query|number(double)|false|none| +|createdBeforeOrAt|query|[IsoString](#schemaisostring)|false|none| +|page|query|number(double)|false|none| + +#### Enumerated Values + +|Parameter|Value| +|---|---| +|marketType|PERPETUAL| +|marketType|SPOT| + +> Example responses + +> 200 Response + +```json +{ + "pageSize": 0.1, + "totalResults": 0.1, + "offset": 0.1, + "fills": [ + { + "id": "string", + "side": "BUY", + "liquidity": "TAKER", + "type": "LIMIT", + "market": "string", + "marketType": "PERPETUAL", + "price": "string", + "size": "string", + "fee": "string", + "createdAt": "string", + "createdAtHeight": "string", + "orderId": "string", + "clientMetadata": "string", + "subaccountNumber": 0.1 + } + ] +} +``` + +### Responses + +|Status|Meaning|Description|Schema| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[FillResponse](#schemafillresponse)| + + + +## GetHeight + + + +> Code samples + +```python +import requests +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) + +print(r.json()) + +``` + +```javascript + +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`, +{ + method: 'GET', + + headers: headers +}) +.then(function(res) { + return res.json(); +}).then(function(body) { + console.log(body); +}); + +``` + +`GET /height` + +> Example responses + +> 200 Response + +```json +{ + "height": "string", + "time": "string" +} +``` + +### Responses + +|Status|Meaning|Description|Schema| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[HeightResponse](#schemaheightresponse)| + + + +## GetTradingRewards + + + +> Code samples + +```python +import requests +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) + +print(r.json()) + +``` + +```javascript + +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}`, +{ + method: 'GET', + + headers: headers +}) +.then(function(res) { + return res.json(); +}).then(function(body) { + console.log(body); +}); + +``` + +`GET /historicalBlockTradingRewards/{address}` + +### Parameters + +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|address|path|string|true|none| +|limit|query|number(double)|false|none| +|startingBeforeOrAt|query|[IsoString](#schemaisostring)|false|none| +|startingBeforeOrAtHeight|query|string|false|none| + +> Example responses > 200 Response @@ -824,9 +1169,7 @@ headers = { # baseURL = 'https://indexer.dydx.trade/v4' baseURL = 'https://dydx-testnet.imperator.co/v4' -r = requests.get(f'{baseURL}/historicalFunding/{ticker}', params={ - 'limit': '0' -}, headers = headers) +r = requests.get(f'{baseURL}/historicalFunding/{ticker}', headers = headers) print(r.json()) @@ -839,10 +1182,10 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; -fetch(`${baseURL}/historicalFunding/{ticker}?limit=0`, +fetch(`${baseURL}/historicalFunding/{ticker}`, { method: 'GET', @@ -863,7 +1206,7 @@ fetch(`${baseURL}/historicalFunding/{ticker}?limit=0`, |Name|In|Type|Required|Description| |---|---|---|---|---| |ticker|path|string|true|none| -|limit|query|number(double)|true|none| +|limit|query|number(double)|false|none| |effectiveBeforeOrAtHeight|query|number(double)|false|none| |effectiveBeforeOrAt|query|[IsoString](#schemaisostring)|false|none| @@ -912,7 +1255,7 @@ headers = { baseURL = 'https://dydx-testnet.imperator.co/v4' r = requests.get(f'{baseURL}/historical-pnl', params={ - 'address': 'string', 'subaccountNumber': '0', 'limit': '0' + 'address': 'string', 'subaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -926,10 +1269,10 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; -fetch(`${baseURL}/historical-pnl?address=string&subaccountNumber=0&limit=0`, +fetch(`${baseURL}/historical-pnl?address=string&subaccountNumber=0.1`, { method: 'GET', @@ -951,11 +1294,109 @@ fetch(`${baseURL}/historical-pnl?address=string&subaccountNumber=0&limit=0`, |---|---|---|---|---| |address|query|string|true|none| |subaccountNumber|query|number(double)|true|none| -|limit|query|number(double)|true|none| +|limit|query|number(double)|false|none| +|createdBeforeOrAtHeight|query|number(double)|false|none| +|createdBeforeOrAt|query|[IsoString](#schemaisostring)|false|none| +|createdOnOrAfterHeight|query|number(double)|false|none| +|createdOnOrAfter|query|[IsoString](#schemaisostring)|false|none| +|page|query|number(double)|false|none| + +> Example responses + +> 200 Response + +```json +{ + "pageSize": 0.1, + "totalResults": 0.1, + "offset": 0.1, + "historicalPnl": [ + { + "id": "string", + "subaccountId": "string", + "equity": "string", + "totalPnl": "string", + "netTransfers": "string", + "createdAt": "string", + "blockHeight": "string", + "blockTime": "string" + } + ] +} +``` + +### Responses + +|Status|Meaning|Description|Schema| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[HistoricalPnlResponse](#schemahistoricalpnlresponse)| + + + +## GetHistoricalPnlForParentSubaccount + + + +> Code samples + +```python +import requests +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' +}, headers = headers) + +print(r.json()) + +``` + +```javascript + +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`, +{ + method: 'GET', + + headers: headers +}) +.then(function(res) { + return res.json(); +}).then(function(body) { + console.log(body); +}); + +``` + +`GET /historical-pnl/parentSubaccount` + +### Parameters + +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|address|query|string|true|none| +|parentSubaccountNumber|query|number(double)|true|none| +|limit|query|number(double)|false|none| |createdBeforeOrAtHeight|query|number(double)|false|none| |createdBeforeOrAt|query|[IsoString](#schemaisostring)|false|none| |createdOnOrAfterHeight|query|number(double)|false|none| |createdOnOrAfter|query|[IsoString](#schemaisostring)|false|none| +|page|query|number(double)|false|none| > Example responses @@ -963,6 +1404,9 @@ fetch(`${baseURL}/historical-pnl?address=string&subaccountNumber=0&limit=0`, ```json { + "pageSize": 0.1, + "totalResults": 0.1, + "offset": 0.1, "historicalPnl": [ { "id": "string", @@ -1005,7 +1449,7 @@ headers = { baseURL = 'https://dydx-testnet.imperator.co/v4' r = requests.get(f'{baseURL}/historicalTradingRewardAggregations/{address}', params={ - 'period': 'DAILY', 'limit': '0' + 'period': 'DAILY' }, headers = headers) print(r.json()) @@ -1019,10 +1463,10 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; -fetch(`${baseURL}/historicalTradingRewardAggregations/{address}?period=DAILY&limit=0`, +fetch(`${baseURL}/historicalTradingRewardAggregations/{address}?period=DAILY`, { method: 'GET', @@ -1044,7 +1488,7 @@ fetch(`${baseURL}/historicalTradingRewardAggregations/{address}?period=DAILY&lim |---|---|---|---|---| |address|path|string|true|none| |period|query|[TradingRewardAggregationPeriod](#schematradingrewardaggregationperiod)|true|none| -|limit|query|number(double)|true|none| +|limit|query|number(double)|false|none| |startingBeforeOrAt|query|[IsoString](#schemaisostring)|false|none| |startingBeforeOrAtHeight|query|string|false|none| @@ -1114,8 +1558,8 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; fetch(`${baseURL}/orderbooks/perpetualMarket/{ticker}`, { @@ -1129,50 +1573,244 @@ fetch(`${baseURL}/orderbooks/perpetualMarket/{ticker}`, console.log(body); }); -``` +``` + +`GET /orderbooks/perpetualMarket/{ticker}` + +### Parameters + +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|ticker|path|string|true|none| + +> Example responses + +> 200 Response + +```json +{ + "bids": [ + { + "price": "string", + "size": "string" + } + ], + "asks": [ + { + "price": "string", + "size": "string" + } + ] +} +``` + +### Responses + +|Status|Meaning|Description|Schema| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[OrderbookResponseObject](#schemaorderbookresponseobject)| + + + +## ListOrders + + + +> Code samples + +```python +import requests +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' +}, headers = headers) + +print(r.json()) + +``` + +```javascript + +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`, +{ + method: 'GET', + + headers: headers +}) +.then(function(res) { + return res.json(); +}).then(function(body) { + console.log(body); +}); + +``` + +`GET /orders` + +### Parameters + +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|address|query|string|true|none| +|subaccountNumber|query|number(double)|true|none| +|limit|query|number(double)|false|none| +|ticker|query|string|false|none| +|side|query|[OrderSide](#schemaorderside)|false|none| +|type|query|[OrderType](#schemaordertype)|false|none| +|status|query|array[any]|false|none| +|goodTilBlockBeforeOrAt|query|number(double)|false|none| +|goodTilBlockTimeBeforeOrAt|query|[IsoString](#schemaisostring)|false|none| +|returnLatestOrders|query|boolean|false|none| + +#### Enumerated Values + +|Parameter|Value| +|---|---| +|side|BUY| +|side|SELL| +|type|LIMIT| +|type|MARKET| +|type|STOP_LIMIT| +|type|STOP_MARKET| +|type|TRAILING_STOP| +|type|TAKE_PROFIT| +|type|TAKE_PROFIT_MARKET| + +> Example responses + +> 200 Response + +```json +[ + { + "id": "string", + "subaccountId": "string", + "clientId": "string", + "clobPairId": "string", + "side": "BUY", + "size": "string", + "totalFilled": "string", + "price": "string", + "type": "LIMIT", + "reduceOnly": true, + "orderFlags": "string", + "goodTilBlock": "string", + "goodTilBlockTime": "string", + "createdAtHeight": "string", + "clientMetadata": "string", + "triggerPrice": "string", + "timeInForce": "GTT", + "status": "OPEN", + "postOnly": true, + "ticker": "string", + "updatedAt": "string", + "updatedAtHeight": "string", + "subaccountNumber": 0.1 + } +] +``` + +### Responses + +|Status|Meaning|Description|Schema| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|Inline| + +### Response Schema + +Status Code **200** + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|*anonymous*|[[OrderResponseObject](#schemaorderresponseobject)]|false|none|none| +|Ā» id|string|true|none|none| +|Ā» subaccountId|string|true|none|none| +|Ā» clientId|string|true|none|none| +|Ā» clobPairId|string|true|none|none| +|Ā» side|[OrderSide](#schemaorderside)|true|none|none| +|Ā» size|string|true|none|none| +|Ā» totalFilled|string|true|none|none| +|Ā» price|string|true|none|none| +|Ā» type|[OrderType](#schemaordertype)|true|none|none| +|Ā» reduceOnly|boolean|true|none|none| +|Ā» orderFlags|string|true|none|none| +|Ā» goodTilBlock|string|false|none|none| +|Ā» goodTilBlockTime|string|false|none|none| +|Ā» createdAtHeight|string|false|none|none| +|Ā» clientMetadata|string|true|none|none| +|Ā» triggerPrice|string|false|none|none| +|Ā» timeInForce|[APITimeInForce](#schemaapitimeinforce)|true|none|none| +|Ā» status|any|true|none|none| + +*anyOf* -`GET /orderbooks/perpetualMarket/{ticker}` +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|Ā»Ā» *anonymous*|[OrderStatus](#schemaorderstatus)|false|none|none| -### Parameters +*or* -|Name|In|Type|Required|Description| +|Name|Type|Required|Restrictions|Description| |---|---|---|---|---| -|ticker|path|string|true|none| - -> Example responses +|Ā»Ā» *anonymous*|[BestEffortOpenedStatus](#schemabesteffortopenedstatus)|false|none|none| -> 200 Response +*continued* -```json -{ - "bids": [ - { - "price": "string", - "size": "string" - } - ], - "asks": [ - { - "price": "string", - "size": "string" - } - ] -} -``` +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|Ā» postOnly|boolean|true|none|none| +|Ā» ticker|string|true|none|none| +|Ā» updatedAt|[IsoString](#schemaisostring)|false|none|none| +|Ā» updatedAtHeight|string|false|none|none| +|Ā» subaccountNumber|number(double)|true|none|none| -### Responses +#### Enumerated Values -|Status|Meaning|Description|Schema| -|---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[OrderbookResponseObject](#schemaorderbookresponseobject)| +|Property|Value| +|---|---| +|side|BUY| +|side|SELL| +|type|LIMIT| +|type|MARKET| +|type|STOP_LIMIT| +|type|STOP_MARKET| +|type|TRAILING_STOP| +|type|TAKE_PROFIT| +|type|TAKE_PROFIT_MARKET| +|timeInForce|GTT| +|timeInForce|FOK| +|timeInForce|IOC| +|*anonymous*|OPEN| +|*anonymous*|FILLED| +|*anonymous*|CANCELED| +|*anonymous*|BEST_EFFORT_CANCELED| +|*anonymous*|UNTRIGGERED| +|*anonymous*|BEST_EFFORT_OPENED| -## ListOrders +## ListOrdersForParentSubaccount - + > Code samples @@ -1186,8 +1824,8 @@ headers = { # baseURL = 'https://indexer.dydx.trade/v4' baseURL = 'https://dydx-testnet.imperator.co/v4' -r = requests.get(f'{baseURL}/orders', params={ - 'address': 'string', 'subaccountNumber': '0', 'limit': '0' +r = requests.get(f'{baseURL}/orders/parentSubaccountNumber', params={ + 'address': 'string', 'parentSubaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -1201,10 +1839,10 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; -fetch(`${baseURL}/orders?address=string&subaccountNumber=0&limit=0`, +fetch(`${baseURL}/orders/parentSubaccountNumber?address=string&parentSubaccountNumber=0.1`, { method: 'GET', @@ -1218,15 +1856,15 @@ fetch(`${baseURL}/orders?address=string&subaccountNumber=0&limit=0`, ``` -`GET /orders` +`GET /orders/parentSubaccountNumber` ### Parameters |Name|In|Type|Required|Description| |---|---|---|---|---| |address|query|string|true|none| -|subaccountNumber|query|number(double)|true|none| -|limit|query|number(double)|true|none| +|parentSubaccountNumber|query|number(double)|true|none| +|limit|query|number(double)|false|none| |ticker|query|string|false|none| |side|query|[OrderSide](#schemaorderside)|false|none| |type|query|[OrderType](#schemaordertype)|false|none| @@ -1277,7 +1915,8 @@ fetch(`${baseURL}/orders?address=string&subaccountNumber=0&limit=0`, "postOnly": true, "ticker": "string", "updatedAt": "string", - "updatedAtHeight": "string" + "updatedAtHeight": "string", + "subaccountNumber": 0.1 } ] ``` @@ -1334,6 +1973,7 @@ Status Code **200** |Ā» ticker|string|true|none|none| |Ā» updatedAt|[IsoString](#schemaisostring)|false|none|none| |Ā» updatedAtHeight|string|false|none|none| +|Ā» subaccountNumber|number(double)|true|none|none| #### Enumerated Values @@ -1391,8 +2031,8 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; fetch(`${baseURL}/orders/{orderId}`, { @@ -1443,7 +2083,8 @@ fetch(`${baseURL}/orders/{orderId}`, "postOnly": true, "ticker": "string", "updatedAt": "string", - "updatedAtHeight": "string" + "updatedAtHeight": "string", + "subaccountNumber": 0.1 } ``` @@ -1473,9 +2114,7 @@ headers = { # baseURL = 'https://indexer.dydx.trade/v4' baseURL = 'https://dydx-testnet.imperator.co/v4' -r = requests.get(f'{baseURL}/perpetualMarkets', params={ - 'limit': '0' -}, headers = headers) +r = requests.get(f'{baseURL}/perpetualMarkets', headers = headers) print(r.json()) @@ -1488,10 +2127,10 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; -fetch(`${baseURL}/perpetualMarkets?limit=0`, +fetch(`${baseURL}/perpetualMarkets`, { method: 'GET', @@ -1511,7 +2150,7 @@ fetch(`${baseURL}/perpetualMarkets?limit=0`, |Name|In|Type|Required|Description| |---|---|---|---|---| -|limit|query|number(double)|true|none| +|limit|query|number(double)|false|none| |ticker|query|string|false|none| > Example responses @@ -1528,17 +2167,21 @@ fetch(`${baseURL}/perpetualMarkets?limit=0`, "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", + "baseOpenInterest": "string" }, "property2": { "clobPairId": "string", @@ -1547,17 +2190,21 @@ fetch(`${baseURL}/perpetualMarkets?limit=0`, "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", + "baseOpenInterest": "string" } } } @@ -1590,9 +2237,7 @@ headers = { baseURL = 'https://dydx-testnet.imperator.co/v4' r = requests.get(f'{baseURL}/perpetualPositions', params={ - 'address': 'string', 'subaccountNumber': '0', 'status': [ - "OPEN" -], 'limit': '0' + 'address': 'string', 'subaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -1606,10 +2251,10 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; -fetch(`${baseURL}/perpetualPositions?address=string&subaccountNumber=0&status=OPEN&limit=0`, +fetch(`${baseURL}/perpetualPositions?address=string&subaccountNumber=0.1`, { method: 'GET', @@ -1631,8 +2276,116 @@ fetch(`${baseURL}/perpetualPositions?address=string&subaccountNumber=0&status=OP |---|---|---|---|---| |address|query|string|true|none| |subaccountNumber|query|number(double)|true|none| -|status|query|array[string]|true|none| -|limit|query|number(double)|true|none| +|status|query|array[string]|false|none| +|limit|query|number(double)|false|none| +|createdBeforeOrAtHeight|query|number(double)|false|none| +|createdBeforeOrAt|query|[IsoString](#schemaisostring)|false|none| + +#### Enumerated Values + +|Parameter|Value| +|---|---| +|status|OPEN| +|status|CLOSED| +|status|LIQUIDATED| + +> Example responses + +> 200 Response + +```json +{ + "positions": [ + { + "market": "string", + "status": "OPEN", + "side": "LONG", + "size": "string", + "maxSize": "string", + "entryPrice": "string", + "realizedPnl": "string", + "createdAt": "string", + "createdAtHeight": "string", + "sumOpen": "string", + "sumClose": "string", + "netFunding": "string", + "unrealizedPnl": "string", + "closedAt": "string", + "exitPrice": "string", + "subaccountNumber": 0.1 + } + ] +} +``` + +### Responses + +|Status|Meaning|Description|Schema| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[PerpetualPositionResponse](#schemaperpetualpositionresponse)| + + + +## ListPositionsForParentSubaccount + + + +> Code samples + +```python +import requests +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' +}, headers = headers) + +print(r.json()) + +``` + +```javascript + +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`, +{ + method: 'GET', + + headers: headers +}) +.then(function(res) { + return res.json(); +}).then(function(body) { + console.log(body); +}); + +``` + +`GET /perpetualPositions/parentSubaccountNumber` + +### Parameters + +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|address|query|string|true|none| +|parentSubaccountNumber|query|number(double)|true|none| +|status|query|array[string]|false|none| +|limit|query|number(double)|false|none| |createdBeforeOrAtHeight|query|number(double)|false|none| |createdBeforeOrAt|query|[IsoString](#schemaisostring)|false|none| @@ -1666,7 +2419,8 @@ fetch(`${baseURL}/perpetualPositions?address=string&subaccountNumber=0&status=OP "netFunding": "string", "unrealizedPnl": "string", "closedAt": "string", - "exitPrice": "string" + "exitPrice": "string", + "subaccountNumber": 0.1 } ] } @@ -1713,8 +2467,8 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; fetch(`${baseURL}/sparklines?timePeriod=ONE_DAY`, { @@ -1738,12 +2492,85 @@ fetch(`${baseURL}/sparklines?timePeriod=ONE_DAY`, |---|---|---|---|---| |timePeriod|query|[SparklineTimePeriod](#schemasparklinetimeperiod)|true|none| -#### Enumerated Values +#### Enumerated Values + +|Parameter|Value| +|---|---| +|timePeriod|ONE_DAY| +|timePeriod|SEVEN_DAYS| + +> Example responses + +> 200 Response + +```json +{ + "property1": [ + "string" + ], + "property2": [ + "string" + ] +} +``` + +### Responses + +|Status|Meaning|Description|Schema| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[SparklineResponseObject](#schemasparklineresponseobject)| + + + +## GetTime + + + +> Code samples + +```python +import requests +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) + +print(r.json()) + +``` + +```javascript + +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`, +{ + method: 'GET', + + headers: headers +}) +.then(function(res) { + return res.json(); +}).then(function(body) { + console.log(body); +}); + +``` -|Parameter|Value| -|---|---| -|timePeriod|ONE_DAY| -|timePeriod|SEVEN_DAYS| +`GET /time` > Example responses @@ -1751,12 +2578,8 @@ fetch(`${baseURL}/sparklines?timePeriod=ONE_DAY`, ```json { - "property1": [ - "string" - ], - "property2": [ - "string" - ] + "iso": "string", + "epoch": 0.1 } ``` @@ -1764,15 +2587,15 @@ fetch(`${baseURL}/sparklines?timePeriod=ONE_DAY`, |Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[SparklineResponseObject](#schemasparklineresponseobject)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[TimeResponse](#schematimeresponse)| -## GetTime +## GetTrades - + > Code samples @@ -1786,7 +2609,7 @@ headers = { # baseURL = 'https://indexer.dydx.trade/v4' baseURL = 'https://dydx-testnet.imperator.co/v4' -r = requests.get(f'{baseURL}/time', headers = headers) +r = requests.get(f'{baseURL}/trades/perpetualMarket/{ticker}', headers = headers) print(r.json()) @@ -1799,10 +2622,10 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; -fetch(`${baseURL}/time`, +fetch(`${baseURL}/trades/perpetualMarket/{ticker}`, { method: 'GET', @@ -1816,7 +2639,17 @@ fetch(`${baseURL}/time`, ``` -`GET /time` +`GET /trades/perpetualMarket/{ticker}` + +### Parameters + +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|ticker|path|string|true|none| +|limit|query|number(double)|false|none| +|createdBeforeOrAtHeight|query|number(double)|false|none| +|createdBeforeOrAt|query|[IsoString](#schemaisostring)|false|none| +|page|query|number(double)|false|none| > Example responses @@ -1824,8 +2657,20 @@ fetch(`${baseURL}/time`, ```json { - "iso": "string", - "epoch": 0 + "pageSize": 0.1, + "totalResults": 0.1, + "offset": 0.1, + "trades": [ + { + "id": "string", + "side": "BUY", + "size": "string", + "price": "string", + "type": "LIMIT", + "createdAt": "string", + "createdAtHeight": "string" + } + ] } ``` @@ -1833,15 +2678,15 @@ fetch(`${baseURL}/time`, |Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[TimeResponse](#schematimeresponse)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[TradeResponse](#schematraderesponse)| -## GetTrades +## GetTransfers - + > Code samples @@ -1855,8 +2700,8 @@ headers = { # baseURL = 'https://indexer.dydx.trade/v4' baseURL = 'https://dydx-testnet.imperator.co/v4' -r = requests.get(f'{baseURL}/trades/perpetualMarket/{ticker}', params={ - 'limit': '0' +r = requests.get(f'{baseURL}/transfers', params={ + 'address': 'string', 'subaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -1870,10 +2715,10 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; -fetch(`${baseURL}/trades/perpetualMarket/{ticker}?limit=0`, +fetch(`${baseURL}/transfers?address=string&subaccountNumber=0.1`, { method: 'GET', @@ -1887,16 +2732,18 @@ fetch(`${baseURL}/trades/perpetualMarket/{ticker}?limit=0`, ``` -`GET /trades/perpetualMarket/{ticker}` +`GET /transfers` ### Parameters |Name|In|Type|Required|Description| |---|---|---|---|---| -|ticker|path|string|true|none| -|limit|query|number(double)|true|none| +|address|query|string|true|none| +|subaccountNumber|query|number(double)|true|none| +|limit|query|number(double)|false|none| |createdBeforeOrAtHeight|query|number(double)|false|none| |createdBeforeOrAt|query|[IsoString](#schemaisostring)|false|none| +|page|query|number(double)|false|none| > Example responses @@ -1904,15 +2751,26 @@ fetch(`${baseURL}/trades/perpetualMarket/{ticker}?limit=0`, ```json { - "trades": [ + "pageSize": 0.1, + "totalResults": 0.1, + "offset": 0.1, + "transfers": [ { "id": "string", - "side": "BUY", + "sender": { + "subaccountNumber": 0.1, + "address": "string" + }, + "recipient": { + "subaccountNumber": 0.1, + "address": "string" + }, "size": "string", - "price": "string", - "type": "LIMIT", "createdAt": "string", - "createdAtHeight": "string" + "createdAtHeight": "string", + "symbol": "string", + "type": "TRANSFER_IN", + "transactionHash": "string" } ] } @@ -1922,15 +2780,15 @@ fetch(`${baseURL}/trades/perpetualMarket/{ticker}?limit=0`, |Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[TradeResponse](#schematraderesponse)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[TransferResponse](#schematransferresponse)| -## GetTransfers +## GetTransfersForParentSubaccount - + > Code samples @@ -1944,8 +2802,8 @@ headers = { # baseURL = 'https://indexer.dydx.trade/v4' baseURL = 'https://dydx-testnet.imperator.co/v4' -r = requests.get(f'{baseURL}/transfers', params={ - 'address': 'string', 'subaccountNumber': '0', 'limit': '0' +r = requests.get(f'{baseURL}/transfers/parentSubaccountNumber', params={ + 'address': 'string', 'parentSubaccountNumber': '0.1' }, headers = headers) print(r.json()) @@ -1959,10 +2817,10 @@ const headers = { }; // For the deployment by DYDX token holders, use -// baseURL = 'https://indexer.dydx.trade/v4' -const baseURL = 'https://dydx-testnet.imperator.co/v4' +// const baseURL = 'https://indexer.dydx.trade/v4'; +const baseURL = 'https://dydx-testnet.imperator.co/v4'; -fetch(`${baseURL}/transfers?address=string&subaccountNumber=0&limit=0`, +fetch(`${baseURL}/transfers/parentSubaccountNumber?address=string&parentSubaccountNumber=0.1`, { method: 'GET', @@ -1976,17 +2834,18 @@ fetch(`${baseURL}/transfers?address=string&subaccountNumber=0&limit=0`, ``` -`GET /transfers` +`GET /transfers/parentSubaccountNumber` ### Parameters |Name|In|Type|Required|Description| |---|---|---|---|---| |address|query|string|true|none| -|subaccountNumber|query|number(double)|true|none| -|limit|query|number(double)|true|none| +|parentSubaccountNumber|query|number(double)|true|none| +|limit|query|number(double)|false|none| |createdBeforeOrAtHeight|query|number(double)|false|none| |createdBeforeOrAt|query|[IsoString](#schemaisostring)|false|none| +|page|query|number(double)|false|none| > Example responses @@ -1994,15 +2853,18 @@ fetch(`${baseURL}/transfers?address=string&subaccountNumber=0&limit=0`, ```json { + "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", @@ -2020,7 +2882,7 @@ fetch(`${baseURL}/transfers?address=string&subaccountNumber=0&limit=0`, |Status|Meaning|Description|Schema| |---|---|---|---| -|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[TransferResponse](#schematransferresponse)| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[ParentSubaccountTransferResponse](#schemaparentsubaccounttransferresponse)|