diff --git a/bun.lock b/bun.lock
index 084e18a..1f8e600 100644
--- a/bun.lock
+++ b/bun.lock
@@ -4,10 +4,11 @@
"": {
"name": "ritmex-bot",
"dependencies": {
+ "@grvt/sdk": "^0.0.1-beta.17",
+ "axios": "^1.12.2",
"ccxt": "^4.5.5",
"dotenv": "^17.2.2",
"ink": "^6.3.1",
- "ink-table": "^3.1.0",
"react": "^19.1.1",
"ws": "^8.18.3",
},
@@ -21,6 +22,8 @@
},
},
"packages": {
+ "@adraffy/ens-normalize": ["@adraffy/ens-normalize@1.10.1", "", {}, "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw=="],
+
"@alcalzone/ansi-tokenize": ["@alcalzone/ansi-tokenize@0.2.0", "", { "dependencies": { "ansi-styles": "^6.2.1", "is-fullwidth-code-point": "^5.0.0" } }, "sha512-qI/5TaaaCZE4yeSZ83lu0+xi1r88JSxUjnH4OP/iZF7+KKZ75u3ee5isd0LxX+6N8U0npL61YrpbthILHB6BnA=="],
"@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.10", "", { "os": "aix", "cpu": "ppc64" }, "sha512-0NFWnA+7l41irNuaSVlLfgNT12caWJVLzp5eAVhZ0z1qpxbockccEt3s+149rE64VUI3Ml2zt8Nv5JVc4QXTsw=="],
@@ -75,8 +78,32 @@
"@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.10", "", { "os": "win32", "cpu": "x64" }, "sha512-9KpxSVFCu0iK1owoez6aC/s/EdUQLDN3adTxGCqxMVhrPDj6bt5dbrHDXUuq+Bs2vATFBBrQS5vdQ/Ed2P+nbw=="],
+ "@ethereumjs/common": ["@ethereumjs/common@3.2.0", "", { "dependencies": { "@ethereumjs/util": "^8.1.0", "crc-32": "^1.2.0" } }, "sha512-pksvzI0VyLgmuEF2FA/JR/4/y6hcPq8OUail3/AvycBaW1d5VSauOZzqGvJ3RTmR4MU35lWE8KseKOsEhrFRBA=="],
+
+ "@ethereumjs/rlp": ["@ethereumjs/rlp@4.0.1", "", { "bin": { "rlp": "bin/rlp" } }, "sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw=="],
+
+ "@ethereumjs/tx": ["@ethereumjs/tx@4.2.0", "", { "dependencies": { "@ethereumjs/common": "^3.2.0", "@ethereumjs/rlp": "^4.0.1", "@ethereumjs/util": "^8.1.0", "ethereum-cryptography": "^2.0.0" } }, "sha512-1nc6VO4jtFd172BbSnTnDQVr9IYBFl1y4xPzZdtkrkKIncBCkdbgfdRV+MiTkJYAtTxvV12GRZLqBFT1PNK6Yw=="],
+
+ "@ethereumjs/util": ["@ethereumjs/util@8.1.0", "", { "dependencies": { "@ethereumjs/rlp": "^4.0.1", "ethereum-cryptography": "^2.0.0", "micro-ftch": "^0.3.1" } }, "sha512-zQ0IqbdX8FZ9aw11vP+dZkKDkS+kgIvQPHnSAXzP9pLu+Rfu3D3XEeLbicvoXJTYnhZiPmsZUxgdzXwNKxRPbA=="],
+
+ "@grvt/client": ["@grvt/client@1.6.4", "", { "dependencies": { "axios": "^1.12.2" } }, "sha512-yZfEvsC/BtkcdMjoB7Eh6gshBraz/9810qCllvNXDx6OmdxR+NfxPO+ucNlPbyjEt1HfSVzHBWB1yGnVl1usNA=="],
+
+ "@grvt/sdk": ["@grvt/sdk@0.0.1-beta.17", "", { "dependencies": { "@grvt/client": "^1.4.21", "@metamask/eth-sig-util": "^8.2.0", "@types/ws": "^8.18.1", "ethers": "^6.13.5", "set-cookie-parser": "^2.7.1", "ws": "^8.18.1" } }, "sha512-ADWGg7mM79xOu354DaYNZY3hyAEGEFC076vEK1dXFL6ykITyluKOPj2eetP3mkLeyLUyYvA7ct1pz6JmLC77Hw=="],
+
"@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="],
+ "@metamask/abi-utils": ["@metamask/abi-utils@3.0.0", "", { "dependencies": { "@metamask/superstruct": "^3.1.0", "@metamask/utils": "^11.0.1" } }, "sha512-a/l0DiSIr7+CBYVpHygUa3ztSlYLFCQMsklLna+t6qmNY9+eIO5TedNxhyIyvaJ+4cN7TLy0NQFbp9FV3X2ktg=="],
+
+ "@metamask/eth-sig-util": ["@metamask/eth-sig-util@8.2.0", "", { "dependencies": { "@ethereumjs/rlp": "^4.0.1", "@ethereumjs/util": "^8.1.0", "@metamask/abi-utils": "^3.0.0", "@metamask/utils": "^11.0.1", "@scure/base": "~1.1.3", "ethereum-cryptography": "^2.1.2", "tweetnacl": "^1.0.3" } }, "sha512-LZDglIh4gYGw9Myp+2aIwKrj6lIJpMC4e0m7wKJU+BxLLBFcrTgKrjdjstXGVWvuYG3kutlh9J+uNBRPJqffWQ=="],
+
+ "@metamask/superstruct": ["@metamask/superstruct@3.2.1", "", {}, "sha512-fLgJnDOXFmuVlB38rUN5SmU7hAFQcCjrg3Vrxz67KTY7YHFnSNEKvX4avmEBdOI0yTCxZjwMCFEqsC8k2+Wd3g=="],
+
+ "@metamask/utils": ["@metamask/utils@11.8.1", "", { "dependencies": { "@ethereumjs/tx": "^4.2.0", "@metamask/superstruct": "^3.1.0", "@noble/hashes": "^1.3.1", "@scure/base": "^1.1.3", "@types/debug": "^4.1.7", "@types/lodash": "^4.17.20", "debug": "^4.3.4", "lodash": "^4.17.21", "pony-cause": "^2.1.10", "semver": "^7.5.4", "uuid": "^9.0.1" } }, "sha512-DIbsNUyqWLFgqJlZxi1OOCMYvI23GqFCvNJAtzv8/WXWzJfnJnvp1M24j7VvUe3URBi3S86UgQ7+7aWU9p/cnQ=="],
+
+ "@noble/curves": ["@noble/curves@1.2.0", "", { "dependencies": { "@noble/hashes": "1.3.2" } }, "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw=="],
+
+ "@noble/hashes": ["@noble/hashes@1.3.2", "", {}, "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ=="],
+
"@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.52.0", "", { "os": "android", "cpu": "arm" }, "sha512-VxDYCDqOaR7NXzAtvRx7G1u54d2kEHopb28YH/pKzY6y0qmogP3gG7CSiWsq9WvDFxOQMpNEyjVAHZFXfH3o/A=="],
"@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.52.0", "", { "os": "android", "cpu": "arm64" }, "sha512-pqDirm8koABIKvzL59YI9W9DWbRlTX7RWhN+auR8HXJxo89m4mjqbah7nJZjeKNTNYopqL+yGg+0mhCpf3xZtQ=="],
@@ -121,18 +148,32 @@
"@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.52.0", "", { "os": "win32", "cpu": "x64" }, "sha512-6iKDCVSIUQ8jPMoIV0OytRKniaYyy5EbY/RRydmLW8ZR3cEBhxbWl5ro0rkUNe0ef6sScvhbY79HrjRm8i3vDQ=="],
+ "@scure/base": ["@scure/base@1.1.9", "", {}, "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg=="],
+
+ "@scure/bip32": ["@scure/bip32@1.4.0", "", { "dependencies": { "@noble/curves": "~1.4.0", "@noble/hashes": "~1.4.0", "@scure/base": "~1.1.6" } }, "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg=="],
+
+ "@scure/bip39": ["@scure/bip39@1.3.0", "", { "dependencies": { "@noble/hashes": "~1.4.0", "@scure/base": "~1.1.6" } }, "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ=="],
+
"@types/bun": ["@types/bun@1.2.22", "", { "dependencies": { "bun-types": "1.2.22" } }, "sha512-5A/KrKos2ZcN0c6ljRSOa1fYIyCKhZfIVYeuyb4snnvomnpFqC0tTsEkdqNxbAgExV384OETQ//WAjl3XbYqQA=="],
"@types/chai": ["@types/chai@5.2.2", "", { "dependencies": { "@types/deep-eql": "*" } }, "sha512-8kB30R7Hwqf40JPiKhVzodJs2Qc1ZJ5zuT3uzw5Hq/dhNCl3G3l83jfpdI1e20BP348+fV7VIL/+FxaXkqBmWg=="],
+ "@types/debug": ["@types/debug@4.1.12", "", { "dependencies": { "@types/ms": "*" } }, "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ=="],
+
"@types/deep-eql": ["@types/deep-eql@4.0.2", "", {}, "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw=="],
"@types/estree": ["@types/estree@1.0.8", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="],
+ "@types/lodash": ["@types/lodash@4.17.20", "", {}, "sha512-H3MHACvFUEiujabxhaI/ImO6gUrd8oOurg7LQtS7mbwIXA/cUqWrvBsaeJ23aZEPk1TAYkurjfMbSELfoCXlGA=="],
+
+ "@types/ms": ["@types/ms@2.1.0", "", {}, "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA=="],
+
"@types/node": ["@types/node@24.5.2", "", { "dependencies": { "undici-types": "~7.12.0" } }, "sha512-FYxk1I7wPv3K2XBaoyH2cTnocQEu8AOZ60hPbsyukMPLv5/5qr7V1i8PLHdl6Zf87I+xZXFvPCXYjiTFq+YSDQ=="],
"@types/react": ["@types/react@19.1.13", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-hHkbU/eoO3EG5/MZkuFSKmYqPbSVk5byPFa3e7y/8TybHiLMACgI8seVYlicwk7H5K/rI2px9xrQp/C+AUDTiQ=="],
+ "@types/ws": ["@types/ws@8.18.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="],
+
"@vitest/expect": ["@vitest/expect@3.2.4", "", { "dependencies": { "@types/chai": "^5.2.2", "@vitest/spy": "3.2.4", "@vitest/utils": "3.2.4", "chai": "^5.2.0", "tinyrainbow": "^2.0.0" } }, "sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig=="],
"@vitest/mocker": ["@vitest/mocker@3.2.4", "", { "dependencies": { "@vitest/spy": "3.2.4", "estree-walker": "^3.0.3", "magic-string": "^0.30.17" }, "peerDependencies": { "msw": "^2.4.9", "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" }, "optionalPeers": ["msw", "vite"] }, "sha512-46ryTE9RZO/rfDd7pEqFl7etuyzekzEhUbTW3BvmeO/BcCMEgq59BKhek3dXDWgAj4oMK6OZi+vRr1wPW6qjEQ=="],
@@ -147,6 +188,8 @@
"@vitest/utils": ["@vitest/utils@3.2.4", "", { "dependencies": { "@vitest/pretty-format": "3.2.4", "loupe": "^3.1.4", "tinyrainbow": "^2.0.0" } }, "sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA=="],
+ "aes-js": ["aes-js@4.0.0-beta.5", "", {}, "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q=="],
+
"ansi-escapes": ["ansi-escapes@7.1.0", "", { "dependencies": { "environment": "^1.0.0" } }, "sha512-YdhtCd19sKRKfAAUsrcC1wzm4JuzJoiX4pOJqIoW2qmKj5WzG/dL8uUJ0361zaXtHqK7gEhOwtAtz7t3Yq3X5g=="],
"ansi-regex": ["ansi-regex@6.2.2", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
@@ -155,12 +198,18 @@
"assertion-error": ["assertion-error@2.0.1", "", {}, "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA=="],
+ "asynckit": ["asynckit@0.4.0", "", {}, "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="],
+
"auto-bind": ["auto-bind@5.0.1", "", {}, "sha512-ooviqdwwgfIfNmDwo94wlshcdzfO64XV0Cg6oDsDYBJfITDz1EngD2z7DkbvCWn+XIMsIqW27sEVF6qcpJrRcg=="],
+ "axios": ["axios@1.12.2", "", { "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.4", "proxy-from-env": "^1.1.0" } }, "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw=="],
+
"bun-types": ["bun-types@1.2.22", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-hwaAu8tct/Zn6Zft4U9BsZcXkYomzpHJX28ofvx7k0Zz2HNz54n1n+tDgxoWFGB4PcFvJXJQloPhaV2eP3Q6EA=="],
"cac": ["cac@6.7.14", "", {}, "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ=="],
+ "call-bind-apply-helpers": ["call-bind-apply-helpers@1.0.2", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2" } }, "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ=="],
+
"ccxt": ["ccxt@4.5.5", "", { "dependencies": { "ws": "^8.8.1" } }, "sha512-AyhwTFLkx4sO985ImIOfumEBox7AHD/iqk5tPGICObUSZG6wTXg0aRzU8Hjz974aCMG4msFwLk3A/iXPKAU4wA=="],
"chai": ["chai@5.3.3", "", { "dependencies": { "assertion-error": "^2.0.1", "check-error": "^2.1.1", "deep-eql": "^5.0.1", "loupe": "^3.1.0", "pathval": "^2.0.0" } }, "sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw=="],
@@ -177,22 +226,38 @@
"code-excerpt": ["code-excerpt@4.0.0", "", { "dependencies": { "convert-to-spaces": "^2.0.1" } }, "sha512-xxodCmBen3iy2i0WtAK8FlFNrRzjUqjRsMfho58xT/wvZU1YTM3fCnRjcy1gJPMepaRlgm/0e6w8SpWHpn3/cA=="],
+ "combined-stream": ["combined-stream@1.0.8", "", { "dependencies": { "delayed-stream": "~1.0.0" } }, "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg=="],
+
"convert-to-spaces": ["convert-to-spaces@2.0.1", "", {}, "sha512-rcQ1bsQO9799wq24uE5AM2tAILy4gXGIK/njFWcVQkGNZ96edlpY+A7bjwvzjYvLDyzmG1MmMLZhpcsb+klNMQ=="],
+ "crc-32": ["crc-32@1.2.2", "", { "bin": { "crc32": "bin/crc32.njs" } }, "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ=="],
+
"csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="],
"debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],
"deep-eql": ["deep-eql@5.0.2", "", {}, "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q=="],
+ "delayed-stream": ["delayed-stream@1.0.0", "", {}, "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="],
+
"dotenv": ["dotenv@17.2.2", "", {}, "sha512-Sf2LSQP+bOlhKWWyhFsn0UsfdK/kCWRv1iuA2gXAwt3dyNabr6QSj00I2V10pidqz69soatm9ZwZvpQMTIOd5Q=="],
+ "dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="],
+
"emoji-regex": ["emoji-regex@10.5.0", "", {}, "sha512-lb49vf1Xzfx080OKA0o6l8DQQpV+6Vg95zyCJX9VB/BqKYlhG7N4wgROUUHRA+ZPUefLnteQOad7z1kT2bV7bg=="],
"environment": ["environment@1.1.0", "", {}, "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q=="],
+ "es-define-property": ["es-define-property@1.0.1", "", {}, "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g=="],
+
+ "es-errors": ["es-errors@1.3.0", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="],
+
"es-module-lexer": ["es-module-lexer@1.7.0", "", {}, "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA=="],
+ "es-object-atoms": ["es-object-atoms@1.1.1", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA=="],
+
+ "es-set-tostringtag": ["es-set-tostringtag@2.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "get-intrinsic": "^1.2.6", "has-tostringtag": "^1.0.2", "hasown": "^2.0.2" } }, "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA=="],
+
"es-toolkit": ["es-toolkit@1.39.10", "", {}, "sha512-E0iGnTtbDhkeczB0T+mxmoVlT4YNweEKBLq7oaU4p11mecdsZpNWOglI4895Vh4usbQ+LsJiuLuI2L0Vdmfm2w=="],
"esbuild": ["esbuild@0.25.10", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.10", "@esbuild/android-arm": "0.25.10", "@esbuild/android-arm64": "0.25.10", "@esbuild/android-x64": "0.25.10", "@esbuild/darwin-arm64": "0.25.10", "@esbuild/darwin-x64": "0.25.10", "@esbuild/freebsd-arm64": "0.25.10", "@esbuild/freebsd-x64": "0.25.10", "@esbuild/linux-arm": "0.25.10", "@esbuild/linux-arm64": "0.25.10", "@esbuild/linux-ia32": "0.25.10", "@esbuild/linux-loong64": "0.25.10", "@esbuild/linux-mips64el": "0.25.10", "@esbuild/linux-ppc64": "0.25.10", "@esbuild/linux-riscv64": "0.25.10", "@esbuild/linux-s390x": "0.25.10", "@esbuild/linux-x64": "0.25.10", "@esbuild/netbsd-arm64": "0.25.10", "@esbuild/netbsd-x64": "0.25.10", "@esbuild/openbsd-arm64": "0.25.10", "@esbuild/openbsd-x64": "0.25.10", "@esbuild/openharmony-arm64": "0.25.10", "@esbuild/sunos-x64": "0.25.10", "@esbuild/win32-arm64": "0.25.10", "@esbuild/win32-ia32": "0.25.10", "@esbuild/win32-x64": "0.25.10" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ=="],
@@ -201,38 +266,66 @@
"estree-walker": ["estree-walker@3.0.3", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g=="],
+ "ethereum-cryptography": ["ethereum-cryptography@2.2.1", "", { "dependencies": { "@noble/curves": "1.4.2", "@noble/hashes": "1.4.0", "@scure/bip32": "1.4.0", "@scure/bip39": "1.3.0" } }, "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg=="],
+
+ "ethers": ["ethers@6.15.0", "", { "dependencies": { "@adraffy/ens-normalize": "1.10.1", "@noble/curves": "1.2.0", "@noble/hashes": "1.3.2", "@types/node": "22.7.5", "aes-js": "4.0.0-beta.5", "tslib": "2.7.0", "ws": "8.17.1" } }, "sha512-Kf/3ZW54L4UT0pZtsY/rf+EkBU7Qi5nnhonjUb8yTXcxH3cdcWrV2cRyk0Xk/4jK6OoHhxxZHriyhje20If2hQ=="],
+
"expect-type": ["expect-type@1.2.2", "", {}, "sha512-JhFGDVJ7tmDJItKhYgJCGLOWjuK9vPxiXoUFLwLDc99NlmklilbiQJwoctZtt13+xMw91MCk/REan6MWHqDjyA=="],
"fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="],
+ "follow-redirects": ["follow-redirects@1.15.11", "", {}, "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ=="],
+
+ "form-data": ["form-data@4.0.4", "", { "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "es-set-tostringtag": "^2.1.0", "hasown": "^2.0.2", "mime-types": "^2.1.12" } }, "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow=="],
+
"fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
+ "function-bind": ["function-bind@1.1.2", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="],
+
"get-east-asian-width": ["get-east-asian-width@1.4.0", "", {}, "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q=="],
+ "get-intrinsic": ["get-intrinsic@1.3.0", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ=="],
+
+ "get-proto": ["get-proto@1.0.1", "", { "dependencies": { "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" } }, "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g=="],
+
+ "gopd": ["gopd@1.2.0", "", {}, "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg=="],
+
+ "has-symbols": ["has-symbols@1.1.0", "", {}, "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ=="],
+
+ "has-tostringtag": ["has-tostringtag@1.0.2", "", { "dependencies": { "has-symbols": "^1.0.3" } }, "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw=="],
+
+ "hasown": ["hasown@2.0.2", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="],
+
"indent-string": ["indent-string@5.0.0", "", {}, "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg=="],
"ink": ["ink@6.3.1", "", { "dependencies": { "@alcalzone/ansi-tokenize": "^0.2.0", "ansi-escapes": "^7.0.0", "ansi-styles": "^6.2.1", "auto-bind": "^5.0.1", "chalk": "^5.6.0", "cli-boxes": "^3.0.0", "cli-cursor": "^4.0.0", "cli-truncate": "^4.0.0", "code-excerpt": "^4.0.0", "es-toolkit": "^1.39.10", "indent-string": "^5.0.0", "is-in-ci": "^2.0.0", "patch-console": "^2.0.0", "react-reconciler": "^0.32.0", "signal-exit": "^3.0.7", "slice-ansi": "^7.1.0", "stack-utils": "^2.0.6", "string-width": "^7.2.0", "type-fest": "^4.27.0", "widest-line": "^5.0.0", "wrap-ansi": "^9.0.0", "ws": "^8.18.0", "yoga-layout": "~3.2.1" }, "peerDependencies": { "@types/react": ">=19.0.0", "react": ">=19.0.0", "react-devtools-core": "^6.1.2" }, "optionalPeers": ["@types/react", "react-devtools-core"] }, "sha512-3wGwITGrzL6rkWsi2gEKzgwdafGn4ZYd3u4oRp+sOPvfoxEHlnoB5Vnk9Uy5dMRUhDOqF3hqr4rLQ4lEzBc2sQ=="],
- "ink-table": ["ink-table@3.1.0", "", { "dependencies": { "object-hash": "^2.0.3" }, "peerDependencies": { "ink": ">=3.0.0", "react": ">=16.8.0" } }, "sha512-qxVb4DIaEaJryvF9uZGydnmP9Hkmas3DCKVpEcBYC0E4eJd3qNgNe+PZKuzgCERFe9LfAS1TNWxCr9+AU4v3YA=="],
-
"is-fullwidth-code-point": ["is-fullwidth-code-point@5.1.0", "", { "dependencies": { "get-east-asian-width": "^1.3.1" } }, "sha512-5XHYaSyiqADb4RnZ1Bdad6cPp8Toise4TzEjcOYDHZkTCbKgiUl7WTUCpNWHuxmDt91wnsZBc9xinNzopv3JMQ=="],
"is-in-ci": ["is-in-ci@2.0.0", "", { "bin": { "is-in-ci": "cli.js" } }, "sha512-cFeerHriAnhrQSbpAxL37W1wcJKUUX07HyLWZCW1URJT/ra3GyUTzBgUnh24TMVfNTV2Hij2HLxkPHFZfOZy5w=="],
"js-tokens": ["js-tokens@9.0.1", "", {}, "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ=="],
+ "lodash": ["lodash@4.17.21", "", {}, "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="],
+
"loupe": ["loupe@3.2.1", "", {}, "sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ=="],
"magic-string": ["magic-string@0.30.19", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-2N21sPY9Ws53PZvsEpVtNuSW+ScYbQdp4b9qUaL+9QkHUrGFKo56Lg9Emg5s9V/qrtNBmiR01sYhUOwu3H+VOw=="],
+ "math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="],
+
+ "micro-ftch": ["micro-ftch@0.3.1", "", {}, "sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg=="],
+
+ "mime-db": ["mime-db@1.52.0", "", {}, "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="],
+
+ "mime-types": ["mime-types@2.1.35", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="],
+
"mimic-fn": ["mimic-fn@2.1.0", "", {}, "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg=="],
"ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
"nanoid": ["nanoid@3.3.11", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w=="],
- "object-hash": ["object-hash@2.2.0", "", {}, "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw=="],
-
"onetime": ["onetime@5.1.2", "", { "dependencies": { "mimic-fn": "^2.1.0" } }, "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg=="],
"patch-console": ["patch-console@2.0.0", "", {}, "sha512-0YNdUceMdaQwoKce1gatDScmMo5pu/tfABfnzEqeG0gtTmd7mh/WcwgUjtAeOU7N8nFFlbQBnFK2gXW5fGvmMA=="],
@@ -245,8 +338,12 @@
"picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
+ "pony-cause": ["pony-cause@2.1.11", "", {}, "sha512-M7LhCsdNbNgiLYiP4WjsfLUuFmCfnjdF6jKe2R9NKl4WFN+HZPGHJZ9lnLP7f9ZnKe3U9nuWD0szirmj+migUg=="],
+
"postcss": ["postcss@8.5.6", "", { "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg=="],
+ "proxy-from-env": ["proxy-from-env@1.1.0", "", {}, "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="],
+
"react": ["react@19.1.1", "", {}, "sha512-w8nqGImo45dmMIfljjMwOGtbmC/mk4CMYhWIicdSflH91J9TyCyczcPFXJzrZ/ZXcgGRFeP6BU0BEJTw6tZdfQ=="],
"react-reconciler": ["react-reconciler@0.32.0", "", { "dependencies": { "scheduler": "^0.26.0" }, "peerDependencies": { "react": "^19.1.0" } }, "sha512-2NPMOzgTlG0ZWdIf3qG+dcbLSoAc/uLfOwckc3ofy5sSK0pLJqnQLpUFxvGcN2rlXSjnVtGeeFLNimCQEj5gOQ=="],
@@ -257,6 +354,10 @@
"scheduler": ["scheduler@0.26.0", "", {}, "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA=="],
+ "semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="],
+
+ "set-cookie-parser": ["set-cookie-parser@2.7.1", "", {}, "sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ=="],
+
"siginfo": ["siginfo@2.0.0", "", {}, "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g=="],
"signal-exit": ["signal-exit@3.0.7", "", {}, "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="],
@@ -289,12 +390,18 @@
"tinyspy": ["tinyspy@4.0.4", "", {}, "sha512-azl+t0z7pw/z958Gy9svOTuzqIk6xq+NSheJzn5MMWtWTFywIacg2wUlzKFGtt3cthx0r2SxMK0yzJOR0IES7Q=="],
+ "tslib": ["tslib@2.7.0", "", {}, "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA=="],
+
+ "tweetnacl": ["tweetnacl@1.0.3", "", {}, "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw=="],
+
"type-fest": ["type-fest@4.41.0", "", {}, "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA=="],
"typescript": ["typescript@5.9.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A=="],
"undici-types": ["undici-types@7.12.0", "", {}, "sha512-goOacqME2GYyOZZfb5Lgtu+1IDmAlAEu5xnD3+xTzS10hT0vzpf0SPjkXwAw9Jm+4n/mQGDP3LO8CPbYROeBfQ=="],
+ "uuid": ["uuid@9.0.1", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="],
+
"vite": ["vite@7.1.7", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-VbA8ScMvAISJNJVbRDTJdCwqQoAareR/wutevKanhR2/1EkoXVZVkkORaYm/tNVCjP/UDTKtcw3bAkwOUdedmA=="],
"vite-node": ["vite-node@3.2.4", "", { "dependencies": { "cac": "^6.7.14", "debug": "^4.4.1", "es-module-lexer": "^1.7.0", "pathe": "^2.0.3", "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" }, "bin": { "vite-node": "vite-node.mjs" } }, "sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg=="],
@@ -311,8 +418,24 @@
"yoga-layout": ["yoga-layout@3.2.1", "", {}, "sha512-0LPOt3AxKqMdFBZA3HBAt/t/8vIKq7VaQYbuA8WxCgung+p9TVyKRYdpvCb80HcdTN2NkbIKbhNwKUfm3tQywQ=="],
+ "@scure/bip32/@noble/curves": ["@noble/curves@1.4.2", "", { "dependencies": { "@noble/hashes": "1.4.0" } }, "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw=="],
+
+ "@scure/bip32/@noble/hashes": ["@noble/hashes@1.4.0", "", {}, "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg=="],
+
+ "@scure/bip39/@noble/hashes": ["@noble/hashes@1.4.0", "", {}, "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg=="],
+
"cli-truncate/slice-ansi": ["slice-ansi@5.0.0", "", { "dependencies": { "ansi-styles": "^6.0.0", "is-fullwidth-code-point": "^4.0.0" } }, "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ=="],
+ "ethereum-cryptography/@noble/curves": ["@noble/curves@1.4.2", "", { "dependencies": { "@noble/hashes": "1.4.0" } }, "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw=="],
+
+ "ethereum-cryptography/@noble/hashes": ["@noble/hashes@1.4.0", "", {}, "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg=="],
+
+ "ethers/@types/node": ["@types/node@22.7.5", "", { "dependencies": { "undici-types": "~6.19.2" } }, "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ=="],
+
+ "ethers/ws": ["ws@8.17.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ=="],
+
"cli-truncate/slice-ansi/is-fullwidth-code-point": ["is-fullwidth-code-point@4.0.0", "", {}, "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ=="],
+
+ "ethers/@types/node/undici-types": ["undici-types@6.19.8", "", {}, "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="],
}
}
diff --git a/docs/v2-api.md b/docs/aster/v2-api.md
similarity index 100%
rename from docs/v2-api.md
rename to docs/aster/v2-api.md
diff --git a/docs/grvt/market_data_api.md b/docs/grvt/market_data_api.md
new file mode 100644
index 0000000..40de90d
--- /dev/null
+++ b/docs/grvt/market_data_api.md
@@ -0,0 +1,3636 @@
+# MarketData APIs
+All requests should be made using the `POST` HTTP method.
+
+## Instrument
+### Get Instrument
+```
+FULL ENDPOINT: full/v1/instrument
+LITE ENDPOINT: lite/v1/instrument
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_get_instrument_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "instrument": "BTC_USDT_Perp"
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "i": "BTC_USDT_Perp"
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_get_instrument_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": {
+ "instrument": "BTC_USDT_Perp",
+ "instrument_hash": "0x030501",
+ "base": "BTC",
+ "quote": "USDT",
+ "kind": "PERPETUAL",
+ "venues": ["ORDERBOOK"],
+ "settlement_period": "PERPETUAL",
+ "base_decimals": 3,
+ "quote_decimals": 3,
+ "tick_size": "0.01",
+ "min_size": "0.01",
+ "create_time": "1697788800000000000",
+ "max_position_size": "100.0"
+ }
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": {
+ "i": "BTC_USDT_Perp",
+ "ih": "0x030501",
+ "b": "BTC",
+ "q": "USDT",
+ "k": "PERPETUAL",
+ "v": ["ORDERBOOK"],
+ "sp1": "PERPETUAL",
+ "bd": 3,
+ "qd": 3,
+ "ts": "0.01",
+ "ms": "0.01",
+ "ct": "1697788800000000000",
+ "mp": "100.0"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1004|404|Data Not Found|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1002,
+ "message":"Internal Server Error",
+ "status":500
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1002,
+ "m":"Internal Server Error",
+ "s":500
+ }
+ ```
+
+=== "Try it out"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/full/v1/instrument' \
+ --data '{
+ "instrument": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/instrument",
+ "params": {
+ "instrument": "BTC_USDT_Perp"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/lite/v1/instrument' \
+ --data '{
+ "i": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/instrument",
+ "p": {
+ "i": "BTC_USDT_Perp"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/full/v1/instrument' \
+ --data '{
+ "instrument": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/instrument",
+ "params": {
+ "instrument": "BTC_USDT_Perp"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/lite/v1/instrument' \
+ --data '{
+ "i": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/instrument",
+ "p": {
+ "i": "BTC_USDT_Perp"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/full/v1/instrument' \
+ --data '{
+ "instrument": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/instrument",
+ "params": {
+ "instrument": "BTC_USDT_Perp"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/lite/v1/instrument' \
+ --data '{
+ "i": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/instrument",
+ "p": {
+ "i": "BTC_USDT_Perp"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/full/v1/instrument' \
+ --data '{
+ "instrument": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/instrument",
+ "params": {
+ "instrument": "BTC_USDT_Perp"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/lite/v1/instrument' \
+ --data '{
+ "i": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/instrument",
+ "p": {
+ "i": "BTC_USDT_Perp"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Get All Instruments
+```
+FULL ENDPOINT: full/v1/all_instruments
+LITE ENDPOINT: lite/v1/all_instruments
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_get_all_instruments_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "is_active": true
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "ia": true
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_get_all_instruments_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": [{
+ "instrument": "BTC_USDT_Perp",
+ "instrument_hash": "0x030501",
+ "base": "BTC",
+ "quote": "USDT",
+ "kind": "PERPETUAL",
+ "venues": ["ORDERBOOK"],
+ "settlement_period": "PERPETUAL",
+ "base_decimals": 3,
+ "quote_decimals": 3,
+ "tick_size": "0.01",
+ "min_size": "0.01",
+ "create_time": "1697788800000000000",
+ "max_position_size": "100.0"
+ }]
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "i": "BTC_USDT_Perp",
+ "ih": "0x030501",
+ "b": "BTC",
+ "q": "USDT",
+ "k": "PERPETUAL",
+ "v": ["ORDERBOOK"],
+ "sp1": "PERPETUAL",
+ "bd": 3,
+ "qd": 3,
+ "ts": "0.01",
+ "ms": "0.01",
+ "ct": "1697788800000000000",
+ "mp": "100.0"
+ }]
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1002,
+ "message":"Internal Server Error",
+ "status":500
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1002,
+ "m":"Internal Server Error",
+ "s":500
+ }
+ ```
+
+=== "Try it out"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/full/v1/all_instruments' \
+ --data '{
+ "is_active": true
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/all_instruments",
+ "params": {
+ "is_active": true
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/lite/v1/all_instruments' \
+ --data '{
+ "ia": true
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/all_instruments",
+ "p": {
+ "ia": true
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/full/v1/all_instruments' \
+ --data '{
+ "is_active": true
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/all_instruments",
+ "params": {
+ "is_active": true
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/lite/v1/all_instruments' \
+ --data '{
+ "ia": true
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/all_instruments",
+ "p": {
+ "ia": true
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/full/v1/all_instruments' \
+ --data '{
+ "is_active": true
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/all_instruments",
+ "params": {
+ "is_active": true
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/lite/v1/all_instruments' \
+ --data '{
+ "ia": true
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/all_instruments",
+ "p": {
+ "ia": true
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/full/v1/all_instruments' \
+ --data '{
+ "is_active": true
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/all_instruments",
+ "params": {
+ "is_active": true
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/lite/v1/all_instruments' \
+ --data '{
+ "ia": true
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/all_instruments",
+ "p": {
+ "ia": true
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Get Filtered Instruments
+```
+FULL ENDPOINT: full/v1/instruments
+LITE ENDPOINT: lite/v1/instruments
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_get_filtered_instruments_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "is_active": true,
+ "limit": 500
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "ia": true,
+ "l": 500
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_get_filtered_instruments_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": [{
+ "instrument": "BTC_USDT_Perp",
+ "instrument_hash": "0x030501",
+ "base": "BTC",
+ "quote": "USDT",
+ "kind": "PERPETUAL",
+ "venues": ["ORDERBOOK"],
+ "settlement_period": "PERPETUAL",
+ "base_decimals": 3,
+ "quote_decimals": 3,
+ "tick_size": "0.01",
+ "min_size": "0.01",
+ "create_time": "1697788800000000000",
+ "max_position_size": "100.0"
+ }]
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "i": "BTC_USDT_Perp",
+ "ih": "0x030501",
+ "b": "BTC",
+ "q": "USDT",
+ "k": "PERPETUAL",
+ "v": ["ORDERBOOK"],
+ "sp1": "PERPETUAL",
+ "bd": 3,
+ "qd": 3,
+ "ts": "0.01",
+ "ms": "0.01",
+ "ct": "1697788800000000000",
+ "mp": "100.0"
+ }]
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1002,
+ "message":"Internal Server Error",
+ "status":500
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1002,
+ "m":"Internal Server Error",
+ "s":500
+ }
+ ```
+
+=== "Try it out"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/full/v1/instruments' \
+ --data '{
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "is_active": true,
+ "limit": 500
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/instruments",
+ "params": {
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "is_active": true,
+ "limit": 500
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/lite/v1/instruments' \
+ --data '{
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "ia": true,
+ "l": 500
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/instruments",
+ "p": {
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "ia": true,
+ "l": 500
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/full/v1/instruments' \
+ --data '{
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "is_active": true,
+ "limit": 500
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/instruments",
+ "params": {
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "is_active": true,
+ "limit": 500
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/lite/v1/instruments' \
+ --data '{
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "ia": true,
+ "l": 500
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/instruments",
+ "p": {
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "ia": true,
+ "l": 500
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/full/v1/instruments' \
+ --data '{
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "is_active": true,
+ "limit": 500
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/instruments",
+ "params": {
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "is_active": true,
+ "limit": 500
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/lite/v1/instruments' \
+ --data '{
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "ia": true,
+ "l": 500
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/instruments",
+ "p": {
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "ia": true,
+ "l": 500
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/full/v1/instruments' \
+ --data '{
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "is_active": true,
+ "limit": 500
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/instruments",
+ "params": {
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "is_active": true,
+ "limit": 500
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/lite/v1/instruments' \
+ --data '{
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "ia": true,
+ "l": 500
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/instruments",
+ "p": {
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "ia": true,
+ "l": 500
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Get Currency
+```
+FULL ENDPOINT: full/v1/currency
+LITE ENDPOINT: lite/v1/currency
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_get_currency_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_get_currency_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": [{
+ "id": 3,
+ "symbol": "USDT",
+ "balance_decimals": 6,
+ "quantity_multiplier": 1000000
+ }]
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "i": 3,
+ "s": "USDT",
+ "bd": 6,
+ "qm": 1000000
+ }]
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1004|404|Data Not Found|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1002,
+ "message":"Internal Server Error",
+ "status":500
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1002,
+ "m":"Internal Server Error",
+ "s":500
+ }
+ ```
+
+=== "Try it out"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/full/v1/currency' \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/currency",
+ "params": {
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/lite/v1/currency' \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/currency",
+ "p": {
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/full/v1/currency' \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/currency",
+ "params": {
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/lite/v1/currency' \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/currency",
+ "p": {
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/full/v1/currency' \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/currency",
+ "params": {
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/lite/v1/currency' \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/currency",
+ "p": {
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/full/v1/currency' \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/currency",
+ "params": {
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/lite/v1/currency' \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/currency",
+ "p": {
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+## Ticker
+### Mini Ticker
+```
+FULL ENDPOINT: full/v1/mini
+LITE ENDPOINT: lite/v1/mini
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_mini_ticker_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "instrument": "BTC_USDT_Perp"
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "i": "BTC_USDT_Perp"
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_mini_ticker_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": {
+ "event_time": "1697788800000000000",
+ "instrument": "BTC_USDT_Perp",
+ "mark_price": "65038.01",
+ "index_price": "65038.01",
+ "last_price": "65038.01",
+ "last_size": "123456.78",
+ "mid_price": "65038.01",
+ "best_bid_price": "65038.01",
+ "best_bid_size": "123456.78",
+ "best_ask_price": "65038.01",
+ "best_ask_size": "123456.78"
+ }
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": {
+ "et": "1697788800000000000",
+ "i": "BTC_USDT_Perp",
+ "mp": "65038.01",
+ "ip": "65038.01",
+ "lp": "65038.01",
+ "ls": "123456.78",
+ "mp1": "65038.01",
+ "bb": "65038.01",
+ "bb1": "123456.78",
+ "ba": "65038.01",
+ "ba1": "123456.78"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1004|404|Data Not Found|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1002,
+ "message":"Internal Server Error",
+ "status":500
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1002,
+ "m":"Internal Server Error",
+ "s":500
+ }
+ ```
+
+=== "Try it out"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/full/v1/mini' \
+ --data '{
+ "instrument": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/mini",
+ "params": {
+ "instrument": "BTC_USDT_Perp"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/lite/v1/mini' \
+ --data '{
+ "i": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/mini",
+ "p": {
+ "i": "BTC_USDT_Perp"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/full/v1/mini' \
+ --data '{
+ "instrument": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/mini",
+ "params": {
+ "instrument": "BTC_USDT_Perp"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/lite/v1/mini' \
+ --data '{
+ "i": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/mini",
+ "p": {
+ "i": "BTC_USDT_Perp"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/full/v1/mini' \
+ --data '{
+ "instrument": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/mini",
+ "params": {
+ "instrument": "BTC_USDT_Perp"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/lite/v1/mini' \
+ --data '{
+ "i": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/mini",
+ "p": {
+ "i": "BTC_USDT_Perp"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/full/v1/mini' \
+ --data '{
+ "instrument": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/mini",
+ "params": {
+ "instrument": "BTC_USDT_Perp"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/lite/v1/mini' \
+ --data '{
+ "i": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/mini",
+ "p": {
+ "i": "BTC_USDT_Perp"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Ticker
+```
+FULL ENDPOINT: full/v1/ticker
+LITE ENDPOINT: lite/v1/ticker
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_ticker_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "instrument": "BTC_USDT_Perp"
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "i": "BTC_USDT_Perp"
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_ticker_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": {
+ "event_time": "1697788800000000000",
+ "instrument": "BTC_USDT_Perp",
+ "mark_price": "65038.01",
+ "index_price": "65038.01",
+ "last_price": "65038.01",
+ "last_size": "123456.78",
+ "mid_price": "65038.01",
+ "best_bid_price": "65038.01",
+ "best_bid_size": "123456.78",
+ "best_ask_price": "65038.01",
+ "best_ask_size": "123456.78",
+ "funding_rate_8h_curr": 0.0003,
+ "funding_rate_8h_avg": 0.0003,
+ "interest_rate": 0.0003,
+ "forward_price": "65038.01",
+ "buy_volume_24h_b": "123456.78",
+ "sell_volume_24h_b": "123456.78",
+ "buy_volume_24h_q": "123456.78",
+ "sell_volume_24h_q": "123456.78",
+ "high_price": "65038.01",
+ "low_price": "65038.01",
+ "open_price": "65038.01",
+ "open_interest": "123456.78",
+ "long_short_ratio": "0.5"
+ }
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": {
+ "et": "1697788800000000000",
+ "i": "BTC_USDT_Perp",
+ "mp": "65038.01",
+ "ip": "65038.01",
+ "lp": "65038.01",
+ "ls": "123456.78",
+ "mp1": "65038.01",
+ "bb": "65038.01",
+ "bb1": "123456.78",
+ "ba": "65038.01",
+ "ba1": "123456.78",
+ "fr": 0.0003,
+ "fr1": 0.0003,
+ "ir": 0.0003,
+ "fp": "65038.01",
+ "bv": "123456.78",
+ "sv": "123456.78",
+ "bv1": "123456.78",
+ "sv1": "123456.78",
+ "hp": "65038.01",
+ "lp1": "65038.01",
+ "op": "65038.01",
+ "oi": "123456.78",
+ "ls1": "0.5"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1004|404|Data Not Found|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1002,
+ "message":"Internal Server Error",
+ "status":500
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1002,
+ "m":"Internal Server Error",
+ "s":500
+ }
+ ```
+
+=== "Try it out"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/full/v1/ticker' \
+ --data '{
+ "instrument": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/ticker",
+ "params": {
+ "instrument": "BTC_USDT_Perp"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/lite/v1/ticker' \
+ --data '{
+ "i": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/ticker",
+ "p": {
+ "i": "BTC_USDT_Perp"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/full/v1/ticker' \
+ --data '{
+ "instrument": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/ticker",
+ "params": {
+ "instrument": "BTC_USDT_Perp"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/lite/v1/ticker' \
+ --data '{
+ "i": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/ticker",
+ "p": {
+ "i": "BTC_USDT_Perp"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/full/v1/ticker' \
+ --data '{
+ "instrument": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/ticker",
+ "params": {
+ "instrument": "BTC_USDT_Perp"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/lite/v1/ticker' \
+ --data '{
+ "i": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/ticker",
+ "p": {
+ "i": "BTC_USDT_Perp"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/full/v1/ticker' \
+ --data '{
+ "instrument": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/ticker",
+ "params": {
+ "instrument": "BTC_USDT_Perp"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/lite/v1/ticker' \
+ --data '{
+ "i": "BTC_USDT_Perp"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/ticker",
+ "p": {
+ "i": "BTC_USDT_Perp"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+## Orderbook
+### Orderbook Levels
+```
+FULL ENDPOINT: full/v1/book
+LITE ENDPOINT: lite/v1/book
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_orderbook_levels_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "instrument": "BTC_USDT_Perp",
+ "depth": 50
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "i": "BTC_USDT_Perp",
+ "d": 50
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_orderbook_levels_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": {
+ "event_time": "1697788800000000000",
+ "instrument": "BTC_USDT_Perp",
+ "bids": [{
+ "price": "65038.01",
+ "size": "3456.78",
+ "num_orders": 123
+ }],
+ "asks": [{
+ "price": "65038.01",
+ "size": "3456.78",
+ "num_orders": 123
+ }]
+ }
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": {
+ "et": "1697788800000000000",
+ "i": "BTC_USDT_Perp",
+ "b": [{
+ "p": "65038.01",
+ "s": "3456.78",
+ "no": 123
+ }],
+ "a": [{
+ "p": "65038.01",
+ "s": "3456.78",
+ "no": 123
+ }]
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1004|404|Data Not Found|
+ |3000|400|Instrument is invalid|
+ |3031|400|Depth is invalid|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1002,
+ "message":"Internal Server Error",
+ "status":500
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1002,
+ "m":"Internal Server Error",
+ "s":500
+ }
+ ```
+
+=== "Try it out"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/full/v1/book' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "depth": 50
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/book",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "depth": 50
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/lite/v1/book' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "d": 50
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/book",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "d": 50
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/full/v1/book' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "depth": 50
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/book",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "depth": 50
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/lite/v1/book' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "d": 50
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/book",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "d": 50
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/full/v1/book' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "depth": 50
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/book",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "depth": 50
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/lite/v1/book' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "d": 50
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/book",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "d": 50
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/full/v1/book' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "depth": 50
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/book",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "depth": 50
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/lite/v1/book' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "d": 50
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/book",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "d": 50
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+## Trade
+### Trade
+```
+FULL ENDPOINT: full/v1/trade
+LITE ENDPOINT: lite/v1/trade
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_trade_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "instrument": "BTC_USDT_Perp",
+ "limit": 500
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "i": "BTC_USDT_Perp",
+ "l": 500
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_trade_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": [{
+ "event_time": "1697788800000000000",
+ "instrument": "BTC_USDT_Perp",
+ "is_taker_buyer": true,
+ "size": "123456.78",
+ "price": "65038.01",
+ "mark_price": "65038.01",
+ "index_price": "65038.01",
+ "interest_rate": 0.0003,
+ "forward_price": "65038.01",
+ "trade_id": "209358-2",
+ "venue": "ORDERBOOK",
+ "is_rpi": false
+ }]
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "et": "1697788800000000000",
+ "i": "BTC_USDT_Perp",
+ "it": true,
+ "s": "123456.78",
+ "p": "65038.01",
+ "mp": "65038.01",
+ "ip": "65038.01",
+ "ir": 0.0003,
+ "fp": "65038.01",
+ "ti": "209358-2",
+ "v": "ORDERBOOK",
+ "ir1": false
+ }]
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1002,
+ "message":"Internal Server Error",
+ "status":500
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1002,
+ "m":"Internal Server Error",
+ "s":500
+ }
+ ```
+
+=== "Try it out"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/full/v1/trade' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "limit": 500
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/trade",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "limit": 500
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/lite/v1/trade' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "l": 500
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/trade",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "l": 500
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/full/v1/trade' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "limit": 500
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/trade",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "limit": 500
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/lite/v1/trade' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "l": 500
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/trade",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "l": 500
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/full/v1/trade' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "limit": 500
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/trade",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "limit": 500
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/lite/v1/trade' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "l": 500
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/trade",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "l": 500
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/full/v1/trade' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "limit": 500
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/trade",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "limit": 500
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/lite/v1/trade' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "l": 500
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/trade",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "l": 500
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Trade History
+```
+FULL ENDPOINT: full/v1/trade_history
+LITE ENDPOINT: lite/v1/trade_history
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_trade_history_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_trade_history_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": [{
+ "event_time": "1697788800000000000",
+ "instrument": "BTC_USDT_Perp",
+ "is_taker_buyer": true,
+ "size": "123456.78",
+ "price": "65038.01",
+ "mark_price": "65038.01",
+ "index_price": "65038.01",
+ "interest_rate": 0.0003,
+ "forward_price": "65038.01",
+ "trade_id": "209358-2",
+ "venue": "ORDERBOOK",
+ "is_rpi": false
+ }],
+ "next": "Qw0918="
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "et": "1697788800000000000",
+ "i": "BTC_USDT_Perp",
+ "it": true,
+ "s": "123456.78",
+ "p": "65038.01",
+ "mp": "65038.01",
+ "ip": "65038.01",
+ "ir": 0.0003,
+ "fp": "65038.01",
+ "ti": "209358-2",
+ "v": "ORDERBOOK",
+ "ir1": false
+ }],
+ "n": "Qw0918="
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1002,
+ "message":"Internal Server Error",
+ "status":500
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1002,
+ "m":"Internal Server Error",
+ "s":500
+ }
+ ```
+
+=== "Try it out"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/full/v1/trade_history' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/trade_history",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/lite/v1/trade_history' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/trade_history",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/full/v1/trade_history' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/trade_history",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/lite/v1/trade_history' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/trade_history",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/full/v1/trade_history' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/trade_history",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/lite/v1/trade_history' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/trade_history",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/full/v1/trade_history' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/trade_history",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/lite/v1/trade_history' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/trade_history",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+## Candlestick
+### Candlestick
+```
+FULL ENDPOINT: full/v1/kline
+LITE ENDPOINT: lite/v1/kline
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_candlestick_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "instrument": "BTC_USDT_Perp",
+ "interval": "CI_1_M",
+ "type": "TRADE",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "i": "BTC_USDT_Perp",
+ "i1": "CI_1_M",
+ "t": "TRADE",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_candlestick_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": [{
+ "open_time": "1697788800000000000",
+ "close_time": "1697788800000000000",
+ "open": "123456.78",
+ "close": "123456.78",
+ "high": "123456.78",
+ "low": "123456.78",
+ "volume_b": "123456.78",
+ "volume_q": "123456.78",
+ "trades": 123456,
+ "instrument": "BTC_USDT_Perp"
+ }],
+ "next": "Qw0918="
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "ot": "1697788800000000000",
+ "ct": "1697788800000000000",
+ "o": "123456.78",
+ "c": "123456.78",
+ "h": "123456.78",
+ "l": "123456.78",
+ "vb": "123456.78",
+ "vq": "123456.78",
+ "t": 123456,
+ "i": "BTC_USDT_Perp"
+ }],
+ "n": "Qw0918="
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1002,
+ "message":"Internal Server Error",
+ "status":500
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1002,
+ "m":"Internal Server Error",
+ "s":500
+ }
+ ```
+
+=== "Try it out"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/full/v1/kline' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "interval": "CI_1_M",
+ "type": "TRADE",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/kline",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "interval": "CI_1_M",
+ "type": "TRADE",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/lite/v1/kline' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "i1": "CI_1_M",
+ "t": "TRADE",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/kline",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "i1": "CI_1_M",
+ "t": "TRADE",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/full/v1/kline' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "interval": "CI_1_M",
+ "type": "TRADE",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/kline",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "interval": "CI_1_M",
+ "type": "TRADE",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/lite/v1/kline' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "i1": "CI_1_M",
+ "t": "TRADE",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/kline",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "i1": "CI_1_M",
+ "t": "TRADE",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/full/v1/kline' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "interval": "CI_1_M",
+ "type": "TRADE",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/kline",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "interval": "CI_1_M",
+ "type": "TRADE",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/lite/v1/kline' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "i1": "CI_1_M",
+ "t": "TRADE",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/kline",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "i1": "CI_1_M",
+ "t": "TRADE",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/full/v1/kline' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "interval": "CI_1_M",
+ "type": "TRADE",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/kline",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "interval": "CI_1_M",
+ "type": "TRADE",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/lite/v1/kline' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "i1": "CI_1_M",
+ "t": "TRADE",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/kline",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "i1": "CI_1_M",
+ "t": "TRADE",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+## Settlement
+### Funding Rate
+```
+FULL ENDPOINT: full/v1/funding
+LITE ENDPOINT: lite/v1/funding
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_funding_rate_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_funding_rate_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": [{
+ "instrument": "BTC_USDT_Perp",
+ "funding_rate": 0.0003,
+ "funding_time": "1697788800000000000",
+ "mark_price": "65038.01",
+ "funding_rate_8_h_avg": 0.0003
+ }],
+ "next": "Qw0918="
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "i": "BTC_USDT_Perp",
+ "fr": 0.0003,
+ "ft": "1697788800000000000",
+ "mp": "65038.01",
+ "fr1": 0.0003
+ }],
+ "n": "Qw0918="
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1002,
+ "message":"Internal Server Error",
+ "status":500
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1002,
+ "m":"Internal Server Error",
+ "s":500
+ }
+ ```
+
+=== "Try it out"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/full/v1/funding' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/funding",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.dev.gravitymarkets.io/lite/v1/funding' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/funding",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/full/v1/funding' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/funding",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.staging.gravitymarkets.io/lite/v1/funding' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/funding",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/full/v1/funding' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/funding",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.testnet.grvt.io/lite/v1/funding' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/funding",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/full/v1/funding' \
+ --data '{
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/funding",
+ "params": {
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://market-data.grvt.io/lite/v1/funding' \
+ --data '{
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/funding",
+ "p": {
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
diff --git a/docs/grvt/market_data_streams.md b/docs/grvt/market_data_streams.md
new file mode 100644
index 0000000..235b6ed
--- /dev/null
+++ b/docs/grvt/market_data_streams.md
@@ -0,0 +1,4535 @@
+# MarketData Websocket Streams
+
+## Ticker
+### Mini Ticker Snap
+```
+STREAM: v1.mini.s
+```
+
+=== "Feed Selector"
+
+ -8<- "docs/schemas/ws_mini_ticker_feed_selector_v1.md"
+ ??? info "JSONRPC Wrappers"
+ -8<- "docs/schemas/jsonrpc_request.md"
+ -8<- "docs/schemas/jsonrpc_response.md"
+ -8<- "docs/schemas/ws_subscribe_params.md"
+ -8<- "docs/schemas/ws_subscribe_result.md"
+ -8<- "docs/schemas/ws_unsubscribe_params.md"
+ -8<- "docs/schemas/ws_unsubscribe_result.md"
+ -8<- "docs/schemas/ws_subscribe_request_v1_legacy.md"
+ -8<- "docs/schemas/ws_subscribe_response_v1_legacy.md"
+
+
+ ???+ question "Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.mini.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.mini.s",
+ "subs": ["BTC_USDT_Perp@500"],
+ "unsubs": [],
+ "num_snapshots": [10],
+ "first_sequence_number": [872634876]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Unsubscribe"
+ **Full Unsubscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.mini.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Unsubscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.mini.s",
+ "unsubs": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Legacy Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.mini.s",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.mini.s",
+ "subs":["BTC_USDT_Perp@500"],
+ "unsubs":[],
+ "num_snapshots":[1],
+ "first_sequence_number":[2813]
+ }
+ ```
+
+=== "Feed Data"
+
+ -8<- "docs/schemas/ws_mini_ticker_feed_data_v1.md"
+
+
+ !!! success
+ **Full Feed Response**
+ ``` { .json .copy }
+ {
+ "stream": "v1.mini.s",
+ "selector": "BTC_USDT_Perp",
+ "sequence_number": "872634876",
+ "feed": {
+ "event_time": "1697788800000000000",
+ "instrument": "BTC_USDT_Perp",
+ "mark_price": "65038.01",
+ "index_price": "65038.01",
+ "last_price": "65038.01",
+ "last_size": "123456.78",
+ "mid_price": "65038.01",
+ "best_bid_price": "65038.01",
+ "best_bid_size": "123456.78",
+ "best_ask_price": "65038.01",
+ "best_ask_size": "123456.78"
+ }
+ }
+ ```
+ **Lite Feed Response**
+ ``` { .json .copy }
+ {
+ "s": "v1.mini.s",
+ "s1": "BTC_USDT_Perp",
+ "sn": "872634876",
+ "f": {
+ "et": "1697788800000000000",
+ "i": "BTC_USDT_Perp",
+ "mp": "65038.01",
+ "ip": "65038.01",
+ "lp": "65038.01",
+ "ls": "123456.78",
+ "mp1": "65038.01",
+ "bb": "65038.01",
+ "bb1": "123456.78",
+ "ba": "65038.01",
+ "ba1": "123456.78"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1002|500|Internal Server Error|
+ |1004|404|Data Not Found|
+ |1101|400|Feed Format must be in the format of @|
+ |1102|400|Wrong number of primary selectors|
+ |1103|400|Wrong number of secondary selectors|
+ |3000|400|Instrument is invalid|
+ |3030|400|Feed rate is invalid|
+ -8<- "docs/schemas/jsonrpc_response.md"
+
+
+ !!! failure "Error"
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "error": {
+ "code": 1002,
+ "message": "Internal Server Error"
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "j": "2.0",
+ "e": {
+ "c": 1002,
+ "m": "Internal Server Error"
+ },
+ "i": 123,
+ "m": "subscribe"
+ }
+ ```
+ **Legacy Error Response**
+ ``` { .json .copy }
+ {
+ "code":1002,
+ "message":"Internal Server Error",
+ "status":500
+ }
+ ```
+
+=== "Try it out"
+ === "DEV"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.mini.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.mini.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.mini.s",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.mini.s",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.mini.s",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.mini.s",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.mini.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.mini.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.mini.s",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.mini.s",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.mini.s",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.mini.s",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.mini.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.mini.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.mini.s",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.mini.s",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.mini.s",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.mini.s",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.mini.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.mini.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.mini.s",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.mini.s",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.mini.s",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.mini.s",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+
+### Mini Ticker Delta
+```
+STREAM: v1.mini.d
+```
+
+=== "Feed Selector"
+
+ -8<- "docs/schemas/ws_mini_ticker_feed_selector_v1.md"
+ ??? info "JSONRPC Wrappers"
+ -8<- "docs/schemas/jsonrpc_request.md"
+ -8<- "docs/schemas/jsonrpc_response.md"
+ -8<- "docs/schemas/ws_subscribe_params.md"
+ -8<- "docs/schemas/ws_subscribe_result.md"
+ -8<- "docs/schemas/ws_unsubscribe_params.md"
+ -8<- "docs/schemas/ws_unsubscribe_result.md"
+ -8<- "docs/schemas/ws_subscribe_request_v1_legacy.md"
+ -8<- "docs/schemas/ws_subscribe_response_v1_legacy.md"
+
+
+ ???+ question "Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.mini.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.mini.d",
+ "subs": ["BTC_USDT_Perp@500"],
+ "unsubs": [],
+ "num_snapshots": [10],
+ "first_sequence_number": [872634876]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Unsubscribe"
+ **Full Unsubscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.mini.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Unsubscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.mini.d",
+ "unsubs": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Legacy Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.mini.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.mini.d",
+ "subs":["BTC_USDT_Perp@500"],
+ "unsubs":[],
+ "num_snapshots":[1],
+ "first_sequence_number":[2813]
+ }
+ ```
+
+=== "Feed Data"
+
+ -8<- "docs/schemas/ws_mini_ticker_feed_data_v1.md"
+
+
+ !!! success
+ **Full Feed Response**
+ ``` { .json .copy }
+ {
+ "stream": "v1.mini.d",
+ "selector": "BTC_USDT_Perp",
+ "sequence_number": "872634876",
+ "feed": {
+ "event_time": "1697788800000000000",
+ "instrument": "BTC_USDT_Perp",
+ "mark_price": "65038.01",
+ "index_price": "65038.01",
+ "last_price": "65038.01",
+ "last_size": "123456.78",
+ "mid_price": "65038.01",
+ "best_bid_price": "65038.01",
+ "best_bid_size": "123456.78",
+ "best_ask_price": "65038.01",
+ "best_ask_size": "123456.78"
+ }
+ }
+ ```
+ **Lite Feed Response**
+ ``` { .json .copy }
+ {
+ "s": "v1.mini.d",
+ "s1": "BTC_USDT_Perp",
+ "sn": "872634876",
+ "f": {
+ "et": "1697788800000000000",
+ "i": "BTC_USDT_Perp",
+ "mp": "65038.01",
+ "ip": "65038.01",
+ "lp": "65038.01",
+ "ls": "123456.78",
+ "mp1": "65038.01",
+ "bb": "65038.01",
+ "bb1": "123456.78",
+ "ba": "65038.01",
+ "ba1": "123456.78"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1002|500|Internal Server Error|
+ |1004|404|Data Not Found|
+ |1101|400|Feed Format must be in the format of @|
+ |1102|400|Wrong number of primary selectors|
+ |1103|400|Wrong number of secondary selectors|
+ |3000|400|Instrument is invalid|
+ |3030|400|Feed rate is invalid|
+ -8<- "docs/schemas/jsonrpc_response.md"
+
+
+ !!! failure "Error"
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "error": {
+ "code": 1002,
+ "message": "Internal Server Error"
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "j": "2.0",
+ "e": {
+ "c": 1002,
+ "m": "Internal Server Error"
+ },
+ "i": 123,
+ "m": "subscribe"
+ }
+ ```
+ **Legacy Error Response**
+ ``` { .json .copy }
+ {
+ "code":1002,
+ "message":"Internal Server Error",
+ "status":500
+ }
+ ```
+
+=== "Try it out"
+ === "DEV"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.mini.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.mini.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.mini.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.mini.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.mini.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.mini.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.mini.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.mini.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.mini.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.mini.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.mini.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.mini.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.mini.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.mini.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.mini.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.mini.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.mini.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.mini.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.mini.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.mini.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.mini.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.mini.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.mini.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.mini.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+
+### Ticker Snap
+```
+STREAM: v1.ticker.s
+```
+
+=== "Feed Selector"
+
+ -8<- "docs/schemas/ws_ticker_feed_selector_v1.md"
+ ??? info "JSONRPC Wrappers"
+ -8<- "docs/schemas/jsonrpc_request.md"
+ -8<- "docs/schemas/jsonrpc_response.md"
+ -8<- "docs/schemas/ws_subscribe_params.md"
+ -8<- "docs/schemas/ws_subscribe_result.md"
+ -8<- "docs/schemas/ws_unsubscribe_params.md"
+ -8<- "docs/schemas/ws_unsubscribe_result.md"
+ -8<- "docs/schemas/ws_subscribe_request_v1_legacy.md"
+ -8<- "docs/schemas/ws_subscribe_response_v1_legacy.md"
+
+
+ ???+ question "Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.ticker.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.ticker.s",
+ "subs": ["BTC_USDT_Perp@500"],
+ "unsubs": [],
+ "num_snapshots": [10],
+ "first_sequence_number": [872634876]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Unsubscribe"
+ **Full Unsubscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.ticker.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Unsubscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.ticker.s",
+ "unsubs": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Legacy Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.ticker.s",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.ticker.s",
+ "subs":["BTC_USDT_Perp@500"],
+ "unsubs":[],
+ "num_snapshots":[1],
+ "first_sequence_number":[2813]
+ }
+ ```
+
+=== "Feed Data"
+
+ -8<- "docs/schemas/ws_ticker_feed_data_v1.md"
+
+
+ !!! success
+ **Full Feed Response**
+ ``` { .json .copy }
+ {
+ "stream": "v1.ticker.s",
+ "selector": "BTC_USDT_Perp",
+ "sequence_number": "872634876",
+ "feed": {
+ "event_time": "1697788800000000000",
+ "instrument": "BTC_USDT_Perp",
+ "mark_price": "65038.01",
+ "index_price": "65038.01",
+ "last_price": "65038.01",
+ "last_size": "123456.78",
+ "mid_price": "65038.01",
+ "best_bid_price": "65038.01",
+ "best_bid_size": "123456.78",
+ "best_ask_price": "65038.01",
+ "best_ask_size": "123456.78",
+ "funding_rate_8h_curr": 0.0003,
+ "funding_rate_8h_avg": 0.0003,
+ "interest_rate": 0.0003,
+ "forward_price": "65038.01",
+ "buy_volume_24h_b": "123456.78",
+ "sell_volume_24h_b": "123456.78",
+ "buy_volume_24h_q": "123456.78",
+ "sell_volume_24h_q": "123456.78",
+ "high_price": "65038.01",
+ "low_price": "65038.01",
+ "open_price": "65038.01",
+ "open_interest": "123456.78",
+ "long_short_ratio": "0.5"
+ }
+ }
+ ```
+ **Lite Feed Response**
+ ``` { .json .copy }
+ {
+ "s": "v1.ticker.s",
+ "s1": "BTC_USDT_Perp",
+ "sn": "872634876",
+ "f": {
+ "et": "1697788800000000000",
+ "i": "BTC_USDT_Perp",
+ "mp": "65038.01",
+ "ip": "65038.01",
+ "lp": "65038.01",
+ "ls": "123456.78",
+ "mp1": "65038.01",
+ "bb": "65038.01",
+ "bb1": "123456.78",
+ "ba": "65038.01",
+ "ba1": "123456.78",
+ "fr": 0.0003,
+ "fr1": 0.0003,
+ "ir": 0.0003,
+ "fp": "65038.01",
+ "bv": "123456.78",
+ "sv": "123456.78",
+ "bv1": "123456.78",
+ "sv1": "123456.78",
+ "hp": "65038.01",
+ "lp1": "65038.01",
+ "op": "65038.01",
+ "oi": "123456.78",
+ "ls1": "0.5"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1002|500|Internal Server Error|
+ |1004|404|Data Not Found|
+ |1101|400|Feed Format must be in the format of @|
+ |1102|400|Wrong number of primary selectors|
+ |1103|400|Wrong number of secondary selectors|
+ |3000|400|Instrument is invalid|
+ |3030|400|Feed rate is invalid|
+ -8<- "docs/schemas/jsonrpc_response.md"
+
+
+ !!! failure "Error"
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "error": {
+ "code": 1002,
+ "message": "Internal Server Error"
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "j": "2.0",
+ "e": {
+ "c": 1002,
+ "m": "Internal Server Error"
+ },
+ "i": 123,
+ "m": "subscribe"
+ }
+ ```
+ **Legacy Error Response**
+ ``` { .json .copy }
+ {
+ "code":1002,
+ "message":"Internal Server Error",
+ "status":500
+ }
+ ```
+
+=== "Try it out"
+ === "DEV"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.ticker.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.ticker.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.ticker.s",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.ticker.s",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.ticker.s",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.ticker.s",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.ticker.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.ticker.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.ticker.s",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.ticker.s",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.ticker.s",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.ticker.s",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.ticker.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.ticker.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.ticker.s",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.ticker.s",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.ticker.s",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.ticker.s",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.ticker.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.ticker.s",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.ticker.s",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.ticker.s",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.ticker.s",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.ticker.s",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+
+### Ticker Delta
+```
+STREAM: v1.ticker.d
+```
+
+=== "Feed Selector"
+
+ -8<- "docs/schemas/ws_ticker_feed_selector_v1.md"
+ ??? info "JSONRPC Wrappers"
+ -8<- "docs/schemas/jsonrpc_request.md"
+ -8<- "docs/schemas/jsonrpc_response.md"
+ -8<- "docs/schemas/ws_subscribe_params.md"
+ -8<- "docs/schemas/ws_subscribe_result.md"
+ -8<- "docs/schemas/ws_unsubscribe_params.md"
+ -8<- "docs/schemas/ws_unsubscribe_result.md"
+ -8<- "docs/schemas/ws_subscribe_request_v1_legacy.md"
+ -8<- "docs/schemas/ws_subscribe_response_v1_legacy.md"
+
+
+ ???+ question "Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.ticker.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.ticker.d",
+ "subs": ["BTC_USDT_Perp@500"],
+ "unsubs": [],
+ "num_snapshots": [10],
+ "first_sequence_number": [872634876]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Unsubscribe"
+ **Full Unsubscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.ticker.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Unsubscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.ticker.d",
+ "unsubs": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Legacy Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.ticker.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.ticker.d",
+ "subs":["BTC_USDT_Perp@500"],
+ "unsubs":[],
+ "num_snapshots":[1],
+ "first_sequence_number":[2813]
+ }
+ ```
+
+=== "Feed Data"
+
+ -8<- "docs/schemas/ws_ticker_feed_data_v1.md"
+
+
+ !!! success
+ **Full Feed Response**
+ ``` { .json .copy }
+ {
+ "stream": "v1.ticker.d",
+ "selector": "BTC_USDT_Perp",
+ "sequence_number": "872634876",
+ "feed": {
+ "event_time": "1697788800000000000",
+ "instrument": "BTC_USDT_Perp",
+ "mark_price": "65038.01",
+ "index_price": "65038.01",
+ "last_price": "65038.01",
+ "last_size": "123456.78",
+ "mid_price": "65038.01",
+ "best_bid_price": "65038.01",
+ "best_bid_size": "123456.78",
+ "best_ask_price": "65038.01",
+ "best_ask_size": "123456.78",
+ "funding_rate_8h_curr": 0.0003,
+ "funding_rate_8h_avg": 0.0003,
+ "interest_rate": 0.0003,
+ "forward_price": "65038.01",
+ "buy_volume_24h_b": "123456.78",
+ "sell_volume_24h_b": "123456.78",
+ "buy_volume_24h_q": "123456.78",
+ "sell_volume_24h_q": "123456.78",
+ "high_price": "65038.01",
+ "low_price": "65038.01",
+ "open_price": "65038.01",
+ "open_interest": "123456.78",
+ "long_short_ratio": "0.5"
+ }
+ }
+ ```
+ **Lite Feed Response**
+ ``` { .json .copy }
+ {
+ "s": "v1.ticker.d",
+ "s1": "BTC_USDT_Perp",
+ "sn": "872634876",
+ "f": {
+ "et": "1697788800000000000",
+ "i": "BTC_USDT_Perp",
+ "mp": "65038.01",
+ "ip": "65038.01",
+ "lp": "65038.01",
+ "ls": "123456.78",
+ "mp1": "65038.01",
+ "bb": "65038.01",
+ "bb1": "123456.78",
+ "ba": "65038.01",
+ "ba1": "123456.78",
+ "fr": 0.0003,
+ "fr1": 0.0003,
+ "ir": 0.0003,
+ "fp": "65038.01",
+ "bv": "123456.78",
+ "sv": "123456.78",
+ "bv1": "123456.78",
+ "sv1": "123456.78",
+ "hp": "65038.01",
+ "lp1": "65038.01",
+ "op": "65038.01",
+ "oi": "123456.78",
+ "ls1": "0.5"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1002|500|Internal Server Error|
+ |1004|404|Data Not Found|
+ |1101|400|Feed Format must be in the format of @|
+ |1102|400|Wrong number of primary selectors|
+ |1103|400|Wrong number of secondary selectors|
+ |3000|400|Instrument is invalid|
+ |3030|400|Feed rate is invalid|
+ -8<- "docs/schemas/jsonrpc_response.md"
+
+
+ !!! failure "Error"
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "error": {
+ "code": 1002,
+ "message": "Internal Server Error"
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "j": "2.0",
+ "e": {
+ "c": 1002,
+ "m": "Internal Server Error"
+ },
+ "i": 123,
+ "m": "subscribe"
+ }
+ ```
+ **Legacy Error Response**
+ ``` { .json .copy }
+ {
+ "code":1002,
+ "message":"Internal Server Error",
+ "status":500
+ }
+ ```
+
+=== "Try it out"
+ === "DEV"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.ticker.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.ticker.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.ticker.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.ticker.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.ticker.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.ticker.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.ticker.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.ticker.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.ticker.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.ticker.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.ticker.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.ticker.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.ticker.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.ticker.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.ticker.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.ticker.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.ticker.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.ticker.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.ticker.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.ticker.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.ticker.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.ticker.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.ticker.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.ticker.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+
+## Orderbook
+### Orderbook Snap
+```
+STREAM: v1.book.s
+```
+
+=== "Feed Selector"
+
+ -8<- "docs/schemas/ws_orderbook_levels_feed_selector_v1.md"
+ ??? info "JSONRPC Wrappers"
+ -8<- "docs/schemas/jsonrpc_request.md"
+ -8<- "docs/schemas/jsonrpc_response.md"
+ -8<- "docs/schemas/ws_subscribe_params.md"
+ -8<- "docs/schemas/ws_subscribe_result.md"
+ -8<- "docs/schemas/ws_unsubscribe_params.md"
+ -8<- "docs/schemas/ws_unsubscribe_result.md"
+ -8<- "docs/schemas/ws_subscribe_request_v1_legacy.md"
+ -8<- "docs/schemas/ws_subscribe_response_v1_legacy.md"
+
+
+ ???+ question "Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.book.s",
+ "selectors": ["BTC_USDT_Perp@500-50"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.book.s",
+ "subs": ["BTC_USDT_Perp@500-50"],
+ "unsubs": [],
+ "num_snapshots": [10],
+ "first_sequence_number": [872634876]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Unsubscribe"
+ **Full Unsubscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.book.s",
+ "selectors": ["BTC_USDT_Perp@500-50"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Unsubscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.book.s",
+ "unsubs": ["BTC_USDT_Perp@500-50"]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Legacy Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.book.s",
+ "feed":["BTC_USDT_Perp@500-50"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.book.s",
+ "subs":["BTC_USDT_Perp@500-50"],
+ "unsubs":[],
+ "num_snapshots":[1],
+ "first_sequence_number":[2813]
+ }
+ ```
+
+=== "Feed Data"
+
+ -8<- "docs/schemas/ws_orderbook_levels_feed_data_v1.md"
+
+
+ !!! success
+ **Full Feed Response**
+ ``` { .json .copy }
+ {
+ "stream": "v1.book.s",
+ "selector": "BTC_USDT_Perp",
+ "sequence_number": "872634876",
+ "feed": {
+ "event_time": "1697788800000000000",
+ "instrument": "BTC_USDT_Perp",
+ "bids": [{
+ "price": "65038.01",
+ "size": "3456.78",
+ "num_orders": 123
+ }],
+ "asks": [{
+ "price": "65038.01",
+ "size": "3456.78",
+ "num_orders": 123
+ }]
+ }
+ }
+ ```
+ **Lite Feed Response**
+ ``` { .json .copy }
+ {
+ "s": "v1.book.s",
+ "s1": "BTC_USDT_Perp",
+ "sn": "872634876",
+ "f": {
+ "et": "1697788800000000000",
+ "i": "BTC_USDT_Perp",
+ "b": [{
+ "p": "65038.01",
+ "s": "3456.78",
+ "no": 123
+ }],
+ "a": [{
+ "p": "65038.01",
+ "s": "3456.78",
+ "no": 123
+ }]
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1002|500|Internal Server Error|
+ |1004|404|Data Not Found|
+ |1101|400|Feed Format must be in the format of @|
+ |1102|400|Wrong number of primary selectors|
+ |1103|400|Wrong number of secondary selectors|
+ |3000|400|Instrument is invalid|
+ |3030|400|Feed rate is invalid|
+ |3031|400|Depth is invalid|
+ -8<- "docs/schemas/jsonrpc_response.md"
+
+
+ !!! failure "Error"
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "error": {
+ "code": 1002,
+ "message": "Internal Server Error"
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "j": "2.0",
+ "e": {
+ "c": 1002,
+ "m": "Internal Server Error"
+ },
+ "i": 123,
+ "m": "subscribe"
+ }
+ ```
+ **Legacy Error Response**
+ ``` { .json .copy }
+ {
+ "code":1002,
+ "message":"Internal Server Error",
+ "status":500
+ }
+ ```
+
+=== "Try it out"
+ === "DEV"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.book.s",
+ "selectors": ["BTC_USDT_Perp@500-50"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.book.s",
+ "selectors": ["BTC_USDT_Perp@500-50"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.book.s",
+ "feed":["BTC_USDT_Perp@500-50"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.book.s",
+ "s1": ["BTC_USDT_Perp@500-50"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.book.s",
+ "s1": ["BTC_USDT_Perp@500-50"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.book.s",
+ "feed":["BTC_USDT_Perp@500-50"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.book.s",
+ "selectors": ["BTC_USDT_Perp@500-50"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.book.s",
+ "selectors": ["BTC_USDT_Perp@500-50"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.book.s",
+ "feed":["BTC_USDT_Perp@500-50"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.book.s",
+ "s1": ["BTC_USDT_Perp@500-50"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.book.s",
+ "s1": ["BTC_USDT_Perp@500-50"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.book.s",
+ "feed":["BTC_USDT_Perp@500-50"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.book.s",
+ "selectors": ["BTC_USDT_Perp@500-50"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.book.s",
+ "selectors": ["BTC_USDT_Perp@500-50"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.book.s",
+ "feed":["BTC_USDT_Perp@500-50"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.book.s",
+ "s1": ["BTC_USDT_Perp@500-50"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.book.s",
+ "s1": ["BTC_USDT_Perp@500-50"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.book.s",
+ "feed":["BTC_USDT_Perp@500-50"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.book.s",
+ "selectors": ["BTC_USDT_Perp@500-50"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.book.s",
+ "selectors": ["BTC_USDT_Perp@500-50"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.book.s",
+ "feed":["BTC_USDT_Perp@500-50"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.book.s",
+ "s1": ["BTC_USDT_Perp@500-50"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.book.s",
+ "s1": ["BTC_USDT_Perp@500-50"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.book.s",
+ "feed":["BTC_USDT_Perp@500-50"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+
+### Orderbook Delta
+```
+STREAM: v1.book.d
+```
+
+=== "Feed Selector"
+
+ -8<- "docs/schemas/ws_orderbook_levels_feed_selector_v1.md"
+ ??? info "JSONRPC Wrappers"
+ -8<- "docs/schemas/jsonrpc_request.md"
+ -8<- "docs/schemas/jsonrpc_response.md"
+ -8<- "docs/schemas/ws_subscribe_params.md"
+ -8<- "docs/schemas/ws_subscribe_result.md"
+ -8<- "docs/schemas/ws_unsubscribe_params.md"
+ -8<- "docs/schemas/ws_unsubscribe_result.md"
+ -8<- "docs/schemas/ws_subscribe_request_v1_legacy.md"
+ -8<- "docs/schemas/ws_subscribe_response_v1_legacy.md"
+
+
+ ???+ question "Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.book.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.book.d",
+ "subs": ["BTC_USDT_Perp@500"],
+ "unsubs": [],
+ "num_snapshots": [10],
+ "first_sequence_number": [872634876]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Unsubscribe"
+ **Full Unsubscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.book.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Unsubscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.book.d",
+ "unsubs": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Legacy Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.book.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.book.d",
+ "subs":["BTC_USDT_Perp@500"],
+ "unsubs":[],
+ "num_snapshots":[1],
+ "first_sequence_number":[2813]
+ }
+ ```
+
+=== "Feed Data"
+
+ -8<- "docs/schemas/ws_orderbook_levels_feed_data_v1.md"
+
+
+ !!! success
+ **Full Feed Response**
+ ``` { .json .copy }
+ {
+ "stream": "v1.book.d",
+ "selector": "BTC_USDT_Perp",
+ "sequence_number": "872634876",
+ "feed": {
+ "event_time": "1697788800000000000",
+ "instrument": "BTC_USDT_Perp",
+ "bids": [{
+ "price": "65038.01",
+ "size": "3456.78",
+ "num_orders": 123
+ }],
+ "asks": [{
+ "price": "65038.01",
+ "size": "3456.78",
+ "num_orders": 123
+ }]
+ }
+ }
+ ```
+ **Lite Feed Response**
+ ``` { .json .copy }
+ {
+ "s": "v1.book.d",
+ "s1": "BTC_USDT_Perp",
+ "sn": "872634876",
+ "f": {
+ "et": "1697788800000000000",
+ "i": "BTC_USDT_Perp",
+ "b": [{
+ "p": "65038.01",
+ "s": "3456.78",
+ "no": 123
+ }],
+ "a": [{
+ "p": "65038.01",
+ "s": "3456.78",
+ "no": 123
+ }]
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1002|500|Internal Server Error|
+ |1004|404|Data Not Found|
+ |1101|400|Feed Format must be in the format of @|
+ |1102|400|Wrong number of primary selectors|
+ |1103|400|Wrong number of secondary selectors|
+ |3000|400|Instrument is invalid|
+ |3030|400|Feed rate is invalid|
+ -8<- "docs/schemas/jsonrpc_response.md"
+
+
+ !!! failure "Error"
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "error": {
+ "code": 1002,
+ "message": "Internal Server Error"
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "j": "2.0",
+ "e": {
+ "c": 1002,
+ "m": "Internal Server Error"
+ },
+ "i": 123,
+ "m": "subscribe"
+ }
+ ```
+ **Legacy Error Response**
+ ``` { .json .copy }
+ {
+ "code":1002,
+ "message":"Internal Server Error",
+ "status":500
+ }
+ ```
+
+=== "Try it out"
+ === "DEV"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.book.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.book.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.book.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.book.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.book.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.book.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.book.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.book.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.book.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.book.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.book.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.book.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.book.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.book.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.book.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.book.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.book.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.book.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.book.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.book.d",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.book.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.book.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.book.d",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.book.d",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+
+## Trade
+### Trade
+```
+STREAM: v1.trade
+```
+
+=== "Feed Selector"
+
+ -8<- "docs/schemas/ws_trade_feed_selector_v1.md"
+ ??? info "JSONRPC Wrappers"
+ -8<- "docs/schemas/jsonrpc_request.md"
+ -8<- "docs/schemas/jsonrpc_response.md"
+ -8<- "docs/schemas/ws_subscribe_params.md"
+ -8<- "docs/schemas/ws_subscribe_result.md"
+ -8<- "docs/schemas/ws_unsubscribe_params.md"
+ -8<- "docs/schemas/ws_unsubscribe_result.md"
+ -8<- "docs/schemas/ws_subscribe_request_v1_legacy.md"
+ -8<- "docs/schemas/ws_subscribe_response_v1_legacy.md"
+
+
+ ???+ question "Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.trade",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.trade",
+ "subs": ["BTC_USDT_Perp@500"],
+ "unsubs": [],
+ "num_snapshots": [10],
+ "first_sequence_number": [872634876]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Unsubscribe"
+ **Full Unsubscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.trade",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Unsubscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.trade",
+ "unsubs": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Legacy Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.trade",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.trade",
+ "subs":["BTC_USDT_Perp@500"],
+ "unsubs":[],
+ "num_snapshots":[1],
+ "first_sequence_number":[2813]
+ }
+ ```
+
+=== "Feed Data"
+
+ -8<- "docs/schemas/ws_trade_feed_data_v1.md"
+
+
+ !!! success
+ **Full Feed Response**
+ ``` { .json .copy }
+ {
+ "stream": "v1.trade",
+ "selector": "BTC_USDT_Perp",
+ "sequence_number": "872634876",
+ "feed": {
+ "event_time": "1697788800000000000",
+ "instrument": "BTC_USDT_Perp",
+ "is_taker_buyer": true,
+ "size": "123456.78",
+ "price": "65038.01",
+ "mark_price": "65038.01",
+ "index_price": "65038.01",
+ "interest_rate": 0.0003,
+ "forward_price": "65038.01",
+ "trade_id": "209358-2",
+ "venue": "ORDERBOOK",
+ "is_rpi": false
+ }
+ }
+ ```
+ **Lite Feed Response**
+ ``` { .json .copy }
+ {
+ "s": "v1.trade",
+ "s1": "BTC_USDT_Perp",
+ "sn": "872634876",
+ "f": {
+ "et": "1697788800000000000",
+ "i": "BTC_USDT_Perp",
+ "it": true,
+ "s": "123456.78",
+ "p": "65038.01",
+ "mp": "65038.01",
+ "ip": "65038.01",
+ "ir": 0.0003,
+ "fp": "65038.01",
+ "ti": "209358-2",
+ "v": "ORDERBOOK",
+ "ir1": false
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1002|500|Internal Server Error|
+ |1101|400|Feed Format must be in the format of @|
+ |1102|400|Wrong number of primary selectors|
+ |1103|400|Wrong number of secondary selectors|
+ |3000|400|Instrument is invalid|
+ |3011|400|Limit exceeds min or max value|
+ |3013|400|Exact limit value is not supported|
+ -8<- "docs/schemas/jsonrpc_response.md"
+
+
+ !!! failure "Error"
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "error": {
+ "code": 1002,
+ "message": "Internal Server Error"
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "j": "2.0",
+ "e": {
+ "c": 1002,
+ "m": "Internal Server Error"
+ },
+ "i": 123,
+ "m": "subscribe"
+ }
+ ```
+ **Legacy Error Response**
+ ``` { .json .copy }
+ {
+ "code":1002,
+ "message":"Internal Server Error",
+ "status":500
+ }
+ ```
+
+=== "Try it out"
+ === "DEV"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.trade",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.trade",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.trade",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.trade",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.trade",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.trade",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.trade",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.trade",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.trade",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.trade",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.trade",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.trade",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.trade",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.trade",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.trade",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.trade",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.trade",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.trade",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.trade",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.trade",
+ "selectors": ["BTC_USDT_Perp@500"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.trade",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.trade",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.trade",
+ "s1": ["BTC_USDT_Perp@500"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.trade",
+ "feed":["BTC_USDT_Perp@500"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+
+## Candlestick
+### Candlestick
+```
+STREAM: v1.candle
+```
+
+=== "Feed Selector"
+
+ -8<- "docs/schemas/ws_candlestick_feed_selector_v1.md"
+ ??? info "JSONRPC Wrappers"
+ -8<- "docs/schemas/jsonrpc_request.md"
+ -8<- "docs/schemas/jsonrpc_response.md"
+ -8<- "docs/schemas/ws_subscribe_params.md"
+ -8<- "docs/schemas/ws_subscribe_result.md"
+ -8<- "docs/schemas/ws_unsubscribe_params.md"
+ -8<- "docs/schemas/ws_unsubscribe_result.md"
+ -8<- "docs/schemas/ws_subscribe_request_v1_legacy.md"
+ -8<- "docs/schemas/ws_subscribe_response_v1_legacy.md"
+
+
+ ???+ question "Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.candle",
+ "selectors": ["BTC_USDT_Perp@CI_1_M-TRADE"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.candle",
+ "subs": ["BTC_USDT_Perp@CI_1_M-TRADE"],
+ "unsubs": [],
+ "num_snapshots": [10],
+ "first_sequence_number": [872634876]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Unsubscribe"
+ **Full Unsubscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.candle",
+ "selectors": ["BTC_USDT_Perp@CI_1_M-TRADE"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Unsubscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.candle",
+ "unsubs": ["BTC_USDT_Perp@CI_1_M-TRADE"]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Legacy Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.candle",
+ "feed":["BTC_USDT_Perp@CI_1_M-TRADE"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.candle",
+ "subs":["BTC_USDT_Perp@CI_1_M-TRADE"],
+ "unsubs":[],
+ "num_snapshots":[1],
+ "first_sequence_number":[2813]
+ }
+ ```
+
+=== "Feed Data"
+
+ -8<- "docs/schemas/ws_candlestick_feed_data_v1.md"
+
+
+ !!! success
+ **Full Feed Response**
+ ``` { .json .copy }
+ {
+ "stream": "v1.candle",
+ "selector": "BTC_USDT_Perp",
+ "sequence_number": "872634876",
+ "feed": {
+ "open_time": "1697788800000000000",
+ "close_time": "1697788800000000000",
+ "open": "123456.78",
+ "close": "123456.78",
+ "high": "123456.78",
+ "low": "123456.78",
+ "volume_b": "123456.78",
+ "volume_q": "123456.78",
+ "trades": 123456,
+ "instrument": "BTC_USDT_Perp"
+ }
+ }
+ ```
+ **Lite Feed Response**
+ ``` { .json .copy }
+ {
+ "s": "v1.candle",
+ "s1": "BTC_USDT_Perp",
+ "sn": "872634876",
+ "f": {
+ "ot": "1697788800000000000",
+ "ct": "1697788800000000000",
+ "o": "123456.78",
+ "c": "123456.78",
+ "h": "123456.78",
+ "l": "123456.78",
+ "vb": "123456.78",
+ "vq": "123456.78",
+ "t": 123456,
+ "i": "BTC_USDT_Perp"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1002|500|Internal Server Error|
+ |1101|400|Feed Format must be in the format of @|
+ |1102|400|Wrong number of primary selectors|
+ |1103|400|Wrong number of secondary selectors|
+ |3000|400|Instrument is invalid|
+ |3040|400|Candlestick interval is invalid|
+ |3041|400|Candlestick type is invalid|
+ -8<- "docs/schemas/jsonrpc_response.md"
+
+
+ !!! failure "Error"
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "error": {
+ "code": 1002,
+ "message": "Internal Server Error"
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "j": "2.0",
+ "e": {
+ "c": 1002,
+ "m": "Internal Server Error"
+ },
+ "i": 123,
+ "m": "subscribe"
+ }
+ ```
+ **Legacy Error Response**
+ ``` { .json .copy }
+ {
+ "code":1002,
+ "message":"Internal Server Error",
+ "status":500
+ }
+ ```
+
+=== "Try it out"
+ === "DEV"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.candle",
+ "selectors": ["BTC_USDT_Perp@CI_1_M-TRADE"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.candle",
+ "selectors": ["BTC_USDT_Perp@CI_1_M-TRADE"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.candle",
+ "feed":["BTC_USDT_Perp@CI_1_M-TRADE"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.candle",
+ "s1": ["BTC_USDT_Perp@CI_1_M-TRADE"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.candle",
+ "s1": ["BTC_USDT_Perp@CI_1_M-TRADE"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.dev.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.candle",
+ "feed":["BTC_USDT_Perp@CI_1_M-TRADE"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.candle",
+ "selectors": ["BTC_USDT_Perp@CI_1_M-TRADE"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.candle",
+ "selectors": ["BTC_USDT_Perp@CI_1_M-TRADE"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.candle",
+ "feed":["BTC_USDT_Perp@CI_1_M-TRADE"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.candle",
+ "s1": ["BTC_USDT_Perp@CI_1_M-TRADE"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.candle",
+ "s1": ["BTC_USDT_Perp@CI_1_M-TRADE"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.staging.gravitymarkets.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.candle",
+ "feed":["BTC_USDT_Perp@CI_1_M-TRADE"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.candle",
+ "selectors": ["BTC_USDT_Perp@CI_1_M-TRADE"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.candle",
+ "selectors": ["BTC_USDT_Perp@CI_1_M-TRADE"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.candle",
+ "feed":["BTC_USDT_Perp@CI_1_M-TRADE"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.candle",
+ "s1": ["BTC_USDT_Perp@CI_1_M-TRADE"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.candle",
+ "s1": ["BTC_USDT_Perp@CI_1_M-TRADE"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.testnet.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.candle",
+ "feed":["BTC_USDT_Perp@CI_1_M-TRADE"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.candle",
+ "selectors": ["BTC_USDT_Perp@CI_1_M-TRADE"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/full" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.candle",
+ "selectors": ["BTC_USDT_Perp@CI_1_M-TRADE"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.candle",
+ "feed":["BTC_USDT_Perp@CI_1_M-TRADE"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.candle",
+ "s1": ["BTC_USDT_Perp@CI_1_M-TRADE"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws/lite" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.candle",
+ "s1": ["BTC_USDT_Perp@CI_1_M-TRADE"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://market-data.grvt.io/ws" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.candle",
+ "feed":["BTC_USDT_Perp@CI_1_M-TRADE"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+
diff --git a/docs/grvt/schemas/ack.md b/docs/grvt/schemas/ack.md
new file mode 100644
index 0000000..1bf0092
--- /dev/null
+++ b/docs/grvt/schemas/ack.md
@@ -0,0 +1,4 @@
+!!! info "[Ack](/../../schemas/ack)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |ack
`a` |boolean|True|Gravity has acknowledged that the request has been successfully received and it will process it in the backend|
diff --git a/docs/grvt/schemas/ack_response.md b/docs/grvt/schemas/ack_response.md
new file mode 100644
index 0000000..69f7a8b
--- /dev/null
+++ b/docs/grvt/schemas/ack_response.md
@@ -0,0 +1,10 @@
+!!! info "[AckResponse](/../../schemas/ack_response)"
+ Used to acknowledge a request has been received and will be processed
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |Ack|True|The Ack Object|
+ ??? info "[Ack](/../../schemas/ack)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |ack
`a` |boolean|True|Gravity has acknowledged that the request has been successfully received and it will process it in the backend|
diff --git a/docs/grvt/schemas/aggregated_account_summary.md b/docs/grvt/schemas/aggregated_account_summary.md
new file mode 100644
index 0000000..13b93fa
--- /dev/null
+++ b/docs/grvt/schemas/aggregated_account_summary.md
@@ -0,0 +1,21 @@
+!!! info "[AggregatedAccountSummary](/../../schemas/aggregated_account_summary)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |main_account_id
`ma` |string|True|The main account ID of the account to which the summary belongs|
+ |total_equity
`te` |string|True|Total equity of the main (+ sub) account, denominated in USD|
+ |spot_balances
`sb` |[SpotBalance]|True|The list of spot assets owned by this main (+ sub) account, and their balances|
+ |vault_investments
`vi` |[VaultInvestment]|True|The list of vault investments held by this main account|
+ ??? info "[SpotBalance](/../../schemas/spot_balance)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |currency
`c` |string|True|The currency you hold a spot balance in|
+ |balance
`b` |string|True|This currency's balance in this trading account.|
+ |index_price
`ip` |string|True|The index price of this currency. (reported in `USD`)|
+ ??? info "[VaultInvestment](/../../schemas/vault_investment)"
+ Summarizes a vault investment held by a funding account
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |vault_id
`vi` |string|True|The trading account ID of the vault invested in.|
+ |num_lp_tokens
`nl` |string|True|The number of shares held by the investor.|
+ |share_price
`sp` |string|True|The current share price (in USD) of this vault investment.|
diff --git a/docs/grvt/schemas/api_aggregated_account_summary_response.md b/docs/grvt/schemas/api_aggregated_account_summary_response.md
new file mode 100644
index 0000000..6fd3180
--- /dev/null
+++ b/docs/grvt/schemas/api_aggregated_account_summary_response.md
@@ -0,0 +1,27 @@
+!!! info "[ApiAggregatedAccountSummaryResponse](/../../schemas/api_aggregated_account_summary_response)"
+ The aggregated account summary, that reports the total equity and spot balances of a funding (main) account, and its constituent trading (sub) accounts
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |AggregatedAccountSummary|True|The aggregated account summary|
+ ??? info "[AggregatedAccountSummary](/../../schemas/aggregated_account_summary)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |main_account_id
`ma` |string|True|The main account ID of the account to which the summary belongs|
+ |total_equity
`te` |string|True|Total equity of the main (+ sub) account, denominated in USD|
+ |spot_balances
`sb` |[SpotBalance]|True|The list of spot assets owned by this main (+ sub) account, and their balances|
+ |vault_investments
`vi` |[VaultInvestment]|True|The list of vault investments held by this main account|
+ ??? info "[SpotBalance](/../../schemas/spot_balance)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |currency
`c` |string|True|The currency you hold a spot balance in|
+ |balance
`b` |string|True|This currency's balance in this trading account.|
+ |index_price
`ip` |string|True|The index price of this currency. (reported in `USD`)|
+ ??? info "[VaultInvestment](/../../schemas/vault_investment)"
+ Summarizes a vault investment held by a funding account
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |vault_id
`vi` |string|True|The trading account ID of the vault invested in.|
+ |num_lp_tokens
`nl` |string|True|The number of shares held by the investor.|
+ |share_price
`sp` |string|True|The current share price (in USD) of this vault investment.|
diff --git a/docs/grvt/schemas/api_cancel_all_orders_request.md b/docs/grvt/schemas/api_cancel_all_orders_request.md
new file mode 100644
index 0000000..aa5422b
--- /dev/null
+++ b/docs/grvt/schemas/api_cancel_all_orders_request.md
@@ -0,0 +1,18 @@
+!!! info "[ApiCancelAllOrdersRequest](/../../schemas/api_cancel_all_orders_request)"
+ Cancel all orders on the orderbook for this trading account. This may not match new orders in flight.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The subaccount ID cancelling all orders|
+ |kind
`k` |[Kind]|False
`all`|The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be cancelled|
+ |base
`b` |[string]|False
`all`|The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be cancelled|
+ |quote
`q` |[string]|False
`all`|The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be cancelled|
+ ??? info "[Kind](/../../schemas/kind)"
+ The list of asset kinds that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|the perpetual asset kind|
+ |`FUTURE` = 2|the future asset kind|
+ |`CALL` = 3|the call option asset kind|
+ |`PUT` = 4|the put option asset kind|
diff --git a/docs/grvt/schemas/api_cancel_all_orders_response.md b/docs/grvt/schemas/api_cancel_all_orders_response.md
new file mode 100644
index 0000000..8894694
--- /dev/null
+++ b/docs/grvt/schemas/api_cancel_all_orders_response.md
@@ -0,0 +1,4 @@
+!!! info "[ApiCancelAllOrdersResponse](/../../schemas/api_cancel_all_orders_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |integer|True|The number of orders cancelled|
diff --git a/docs/grvt/schemas/api_cancel_on_disconnect_request.md b/docs/grvt/schemas/api_cancel_on_disconnect_request.md
new file mode 100644
index 0000000..2fdc090
--- /dev/null
+++ b/docs/grvt/schemas/api_cancel_on_disconnect_request.md
@@ -0,0 +1,7 @@
+!!! info "[ApiCancelOnDisconnectRequest](/../../schemas/api_cancel_on_disconnect_request)"
+ Auto-Cancel All Open Orders when the countdown time hits zero.
Market Maker inputs a countdown time parameter in milliseconds (e.g. 120000 for 120s) rounded down to the smallest second follows the following logic:
- Market Maker initially entered a value between 0 -> 1000, which is rounded to 0: will result in termination of their COD
- Market Maker initially entered a value between 1001 -> 300_000, which is rounded to the nearest second: will result in refresh of their COD
- Market Maker initially entered a value bigger than 300_000, which will result in error (upper bound)
Market Maker will send a heartbeat message by calling the endpoint at specific intervals (ex. every 30 seconds) to the server to refresh the count down.
If the server does not receive a heartbeat message within the countdown time, it will cancel all open orders for the specified Sub Account ID.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The subaccount ID cancelling the orders for|
+ |countdown_time
`ct` |string|False
`1000`|Countdown time in milliseconds (ex. 120000 for 120s).
0 to disable the timer.
Does not accept negative values.
Minimum acceptable value is 1,000.
Maximum acceptable value is 300,000|
diff --git a/docs/grvt/schemas/api_cancel_order_request.md b/docs/grvt/schemas/api_cancel_order_request.md
new file mode 100644
index 0000000..45d90fe
--- /dev/null
+++ b/docs/grvt/schemas/api_cancel_order_request.md
@@ -0,0 +1,9 @@
+!!! info "[ApiCancelOrderRequest](/../../schemas/api_cancel_order_request)"
+ Cancel an order on the orderbook for this trading account. Either `order_id` or `client_order_id` must be provided.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The subaccount ID cancelling the order|
+ |order_id
`oi` |string|False
`0`|Cancel the order with this `order_id`|
+ |client_order_id
`co` |string|False
`0`|Cancel the order with this `client_order_id`|
+ |time_to_live_ms
`tt` |string|False
`100`|Specifies the time-to-live (in milliseconds) for this cancellation.
During this period, any order creation with a matching `client_order_id` will be cancelled and not be added to the GRVT matching engine.
This mechanism helps mitigate time-of-flight issues where cancellations might arrive before the corresponding orders.
Hence, cancellation by `order_id` ignores this field as the exchange can only assign `order_id`s to already-processed order creations.
The duration cannot be negative, is rounded down to the nearest 100ms (e.g., `'670'` -> `'600'`, `'30'` -> `'0'`) and capped at 5 seconds (i.e., `'5000'`).
Value of `'0'` or omission results in the default time-to-live value being applied.
If the caller requests multiple successive cancellations for a given order, such that the time-to-live windows overlap, only the first request will be considered.
|
diff --git a/docs/grvt/schemas/api_cancel_order_response.md b/docs/grvt/schemas/api_cancel_order_response.md
new file mode 100644
index 0000000..12c6d0e
--- /dev/null
+++ b/docs/grvt/schemas/api_cancel_order_response.md
@@ -0,0 +1,147 @@
+!!! info "[ApiCancelOrderResponse](/../../schemas/api_cancel_order_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |Order|True|The cancelled order|
+ ??? info "[Order](/../../schemas/order)"
+ Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.
GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.
This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.
Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.
All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.
This minimizes the amount of trust users have to offer to GRVT
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |order_id
`oi` |string|False
`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
+ |sub_account_id
`sa` |string|True|The subaccount initiating the order|
+ |is_market
`im` |boolean|False
`false`|If the order is a market order
Market Orders do not have a limit price, and are always executed according to the maker order price.
Market Orders must always be taker orders|
+ |time_in_force
`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:
- PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg
- FULL EXECUTION = AON / FOK - only allows full size execution on all legs
- TAKER ONLY = IOC / FOK - only allows taker orders
- MAKER OR TAKER = GTT / AON - allows maker or taker orders
Exchange only supports (GTT, IOC, FOK)
RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
+ |post_only
`po` |boolean|False
`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.
If False, Order can be either a maker or taker order. In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.
| | Must Fill All | Can Fill Partial |
| - | - | - |
| Must Be Taker | FOK + False | IOC + False |
| Can Be Either | AON + False | GTC + False |
| Must Be Maker | AON + True | GTC + True |
|
+ |reduce_only
`ro` |boolean|False
`false`|If True, Order must reduce the position size, or be cancelled|
+ |legs
`l` |[OrderLeg]|True|The legs present in this order
The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
+ |signature
`s` |Signature|True|The signature approving this order|
+ |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
+ |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client|
+ ??? info "[TimeInForce](/../../schemas/time_in_force)"
+ | | Must Fill All | Can Fill Partial |
+ | - | - | - |
+ | Must Fill Immediately | FOK | IOC |
+ | Can Fill Till Time | AON | GTC |
+
+
+ |Value| Description |
+ |-|-|
+ |`GOOD_TILL_TIME` = 1|GTT - Remains open until it is cancelled, or expired|
+ |`ALL_OR_NONE` = 2|AON - Either fill the whole order or none of it (Block Trades Only)|
+ |`IMMEDIATE_OR_CANCEL` = 3|IOC - Fill the order as much as possible, when hitting the orderbook. Then cancel it|
+ |`FILL_OR_KILL` = 4|FOK - Both AoN and IoC. Either fill the full order when hitting the orderbook, or cancel it|
+ ??? info "[OrderLeg](/../../schemas/order_leg)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The instrument to trade in this leg|
+ |size
`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
+ |limit_price
`lp` |string|False
`0`|The limit price of the order leg, expressed in `9` decimals.
This is the number of quote currency units to pay/receive for this leg.
This should be `null/0` if the order is a market order|
+ |is_buying_asset
`ib` |boolean|True|Specifies if the order leg is a buy or sell|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
+ ??? info "[OrderMetadata](/../../schemas/order_metadata)"
+ Metadata fields are used to support Backend only operations. These operations are not trustless by nature.
Hence, fields in here are never signed, and is never transmitted to the smart contract.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
+ |create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|False
``|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0||
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
+ ??? info "[OrderState](/../../schemas/order_state)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |status
`s` |OrderStatus|True|The status of the order|
+ |reject_reason
`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
+ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
+ |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
+ |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
+ |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs|
+ ??? info "[OrderStatus](/../../schemas/order_status)"
+ |Value| Description |
+ |-|-|
+ |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.|
+ |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.|
+ |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.|
+ |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.|
+ |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.|
+ ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/docs/grvt/schemas/api_candlestick_request.md b/docs/grvt/schemas/api_candlestick_request.md
new file mode 100644
index 0000000..03c8474
--- /dev/null
+++ b/docs/grvt/schemas/api_candlestick_request.md
@@ -0,0 +1,40 @@
+!!! info "[ApiCandlestickRequest](/../../schemas/api_candlestick_request)"
+ Kline/Candlestick bars for an instrument. Klines are uniquely identified by their instrument, type, interval, and open time.
Pagination works as follows:- We perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.
- The lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.
- If a `cursor` is provided, it will be used to fetch results from that point onwards.
- Pagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |interval
`i1` |CandlestickInterval|True|The interval of each candlestick|
+ |type
`t` |CandlestickType|True|The type of candlestick data to retrieve|
+ |start_time
`st` |string|False
`0`|Start time of kline data in unix nanoseconds|
+ |end_time
`et` |string|False
`now()`|End time of kline data in unix nanoseconds|
+ |limit
`l` |integer|False
`500`|The limit to query for. Defaults to 500; Max 1000|
+ |cursor
`c` |string|False
`''`|The cursor to indicate when to start the query from|
+ ??? info "[CandlestickInterval](/../../schemas/candlestick_interval)"
+ |Value| Description |
+ |-|-|
+ |`CI_1_M` = 1|1 minute|
+ |`CI_3_M` = 2|3 minutes|
+ |`CI_5_M` = 3|5 minutes|
+ |`CI_15_M` = 4|15 minutes|
+ |`CI_30_M` = 5|30 minutes|
+ |`CI_1_H` = 6|1 hour|
+ |`CI_2_H` = 7|2 hour|
+ |`CI_4_H` = 8|4 hour|
+ |`CI_6_H` = 9|6 hour|
+ |`CI_8_H` = 10|8 hour|
+ |`CI_12_H` = 11|12 hour|
+ |`CI_1_D` = 12|1 day|
+ |`CI_3_D` = 13|3 days|
+ |`CI_5_D` = 14|5 days|
+ |`CI_1_W` = 15|1 week|
+ |`CI_2_W` = 16|2 weeks|
+ |`CI_3_W` = 17|3 weeks|
+ |`CI_4_W` = 18|4 weeks|
+ ??? info "[CandlestickType](/../../schemas/candlestick_type)"
+ |Value| Description |
+ |-|-|
+ |`TRADE` = 1|Tracks traded prices|
+ |`MARK` = 2|Tracks mark prices|
+ |`INDEX` = 3|Tracks index prices|
+ |`MID` = 4|Tracks book mid prices|
diff --git a/docs/grvt/schemas/api_candlestick_response.md b/docs/grvt/schemas/api_candlestick_response.md
new file mode 100644
index 0000000..4f69d76
--- /dev/null
+++ b/docs/grvt/schemas/api_candlestick_response.md
@@ -0,0 +1,20 @@
+!!! info "[ApiCandlestickResponse](/../../schemas/api_candlestick_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[Candlestick]|True|The candlestick result set for given interval|
+ |next
`n` |string|False
`''`|The cursor to indicate when to start the next query from|
+ ??? info "[Candlestick](/../../schemas/candlestick)"
+
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |open_time
`ot` |string|True|Open time of kline bar in unix nanoseconds|
+ |close_time
`ct` |string|True|Close time of kline bar in unix nanosecond|
+ |open
`o` |string|True|The open price, expressed in underlying currency resolution units|
+ |close
`c` |string|True|The close price, expressed in underlying currency resolution units|
+ |high
`h` |string|True|The high price, expressed in underlying currency resolution units|
+ |low
`l` |string|True|The low price, expressed in underlying currency resolution units|
+ |volume_b
`vb` |string|True|The underlying volume transacted, expressed in base asset decimal units|
+ |volume_q
`vq` |string|True|The quote volume transacted, expressed in quote asset decimal units|
+ |trades
`t` |integer|True|The number of trades transacted|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
diff --git a/docs/grvt/schemas/api_category_affinity_score_request.md b/docs/grvt/schemas/api_category_affinity_score_request.md
new file mode 100644
index 0000000..a4a95e0
--- /dev/null
+++ b/docs/grvt/schemas/api_category_affinity_score_request.md
@@ -0,0 +1,5 @@
+!!! info "[ApiCategoryAffinityScoreRequest](/../../schemas/api_category_affinity_score_request)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |start_time
`st` |string|True|The start time of query. Can leave empty to query from the beginning|
+ |end_time
`et` |string|True|The end time of query. Can leave empty to query until now|
diff --git a/docs/grvt/schemas/api_category_affinity_score_response.md b/docs/grvt/schemas/api_category_affinity_score_response.md
new file mode 100644
index 0000000..fece118
--- /dev/null
+++ b/docs/grvt/schemas/api_category_affinity_score_response.md
@@ -0,0 +1,12 @@
+!!! info "[ApiCategoryAffinityScoreResponse](/../../schemas/api_category_affinity_score_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[UserCategoryAffinityScore]|True|The list of categoryAffinities score|
+ ??? info "[UserCategoryAffinityScore](/../../schemas/user_category_affinity_score)"
+
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id|
+ |category_id
`ci` |string|True|target category|
+ |affinity_score
`as` |number|True|affinity score|
diff --git a/docs/grvt/schemas/api_create_bulk_orders_request.md b/docs/grvt/schemas/api_create_bulk_orders_request.md
new file mode 100644
index 0000000..868451e
--- /dev/null
+++ b/docs/grvt/schemas/api_create_bulk_orders_request.md
@@ -0,0 +1,149 @@
+!!! info "[ApiCreateBulkOrdersRequest](/../../schemas/api_create_bulk_orders_request)"
+ Create multiple orders simultaneously for this trading account.
This endpoint supports the following order scenarios:
- One-Cancels-Other (OCO) orders combining TP/SL
- One-Sends-Other (OSO) orders
Usage:
- For OCO (TP/SL pair): Send exactly 2 orders in the same request - one Take Profit and one Stop Loss order
- For OSO: Send exactly one main order and one contingent order (TP and/or SL)
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |orders
`o` |[Order]|True|The orders to create|
+ ??? info "[Order](/../../schemas/order)"
+ Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.
GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.
This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.
Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.
All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.
This minimizes the amount of trust users have to offer to GRVT
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |order_id
`oi` |string|False
`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
+ |sub_account_id
`sa` |string|True|The subaccount initiating the order|
+ |is_market
`im` |boolean|False
`false`|If the order is a market order
Market Orders do not have a limit price, and are always executed according to the maker order price.
Market Orders must always be taker orders|
+ |time_in_force
`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:
- PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg
- FULL EXECUTION = AON / FOK - only allows full size execution on all legs
- TAKER ONLY = IOC / FOK - only allows taker orders
- MAKER OR TAKER = GTT / AON - allows maker or taker orders
Exchange only supports (GTT, IOC, FOK)
RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
+ |post_only
`po` |boolean|False
`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.
If False, Order can be either a maker or taker order. In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.
| | Must Fill All | Can Fill Partial |
| - | - | - |
| Must Be Taker | FOK + False | IOC + False |
| Can Be Either | AON + False | GTC + False |
| Must Be Maker | AON + True | GTC + True |
|
+ |reduce_only
`ro` |boolean|False
`false`|If True, Order must reduce the position size, or be cancelled|
+ |legs
`l` |[OrderLeg]|True|The legs present in this order
The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
+ |signature
`s` |Signature|True|The signature approving this order|
+ |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
+ |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client|
+ ??? info "[TimeInForce](/../../schemas/time_in_force)"
+ | | Must Fill All | Can Fill Partial |
+ | - | - | - |
+ | Must Fill Immediately | FOK | IOC |
+ | Can Fill Till Time | AON | GTC |
+
+
+ |Value| Description |
+ |-|-|
+ |`GOOD_TILL_TIME` = 1|GTT - Remains open until it is cancelled, or expired|
+ |`ALL_OR_NONE` = 2|AON - Either fill the whole order or none of it (Block Trades Only)|
+ |`IMMEDIATE_OR_CANCEL` = 3|IOC - Fill the order as much as possible, when hitting the orderbook. Then cancel it|
+ |`FILL_OR_KILL` = 4|FOK - Both AoN and IoC. Either fill the full order when hitting the orderbook, or cancel it|
+ ??? info "[OrderLeg](/../../schemas/order_leg)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The instrument to trade in this leg|
+ |size
`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
+ |limit_price
`lp` |string|False
`0`|The limit price of the order leg, expressed in `9` decimals.
This is the number of quote currency units to pay/receive for this leg.
This should be `null/0` if the order is a market order|
+ |is_buying_asset
`ib` |boolean|True|Specifies if the order leg is a buy or sell|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
+ ??? info "[OrderMetadata](/../../schemas/order_metadata)"
+ Metadata fields are used to support Backend only operations. These operations are not trustless by nature.
Hence, fields in here are never signed, and is never transmitted to the smart contract.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
+ |create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|False
``|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0||
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
+ ??? info "[OrderState](/../../schemas/order_state)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |status
`s` |OrderStatus|True|The status of the order|
+ |reject_reason
`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
+ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
+ |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
+ |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
+ |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs|
+ ??? info "[OrderStatus](/../../schemas/order_status)"
+ |Value| Description |
+ |-|-|
+ |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.|
+ |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.|
+ |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.|
+ |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.|
+ |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.|
+ ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/docs/grvt/schemas/api_create_bulk_orders_response.md b/docs/grvt/schemas/api_create_bulk_orders_response.md
new file mode 100644
index 0000000..7d29ae3
--- /dev/null
+++ b/docs/grvt/schemas/api_create_bulk_orders_response.md
@@ -0,0 +1,147 @@
+!!! info "[ApiCreateBulkOrdersResponse](/../../schemas/api_create_bulk_orders_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[Order]|True|The created orders in same order as requested|
+ ??? info "[Order](/../../schemas/order)"
+ Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.
GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.
This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.
Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.
All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.
This minimizes the amount of trust users have to offer to GRVT
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |order_id
`oi` |string|False
`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
+ |sub_account_id
`sa` |string|True|The subaccount initiating the order|
+ |is_market
`im` |boolean|False
`false`|If the order is a market order
Market Orders do not have a limit price, and are always executed according to the maker order price.
Market Orders must always be taker orders|
+ |time_in_force
`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:
- PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg
- FULL EXECUTION = AON / FOK - only allows full size execution on all legs
- TAKER ONLY = IOC / FOK - only allows taker orders
- MAKER OR TAKER = GTT / AON - allows maker or taker orders
Exchange only supports (GTT, IOC, FOK)
RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
+ |post_only
`po` |boolean|False
`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.
If False, Order can be either a maker or taker order. In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.
| | Must Fill All | Can Fill Partial |
| - | - | - |
| Must Be Taker | FOK + False | IOC + False |
| Can Be Either | AON + False | GTC + False |
| Must Be Maker | AON + True | GTC + True |
|
+ |reduce_only
`ro` |boolean|False
`false`|If True, Order must reduce the position size, or be cancelled|
+ |legs
`l` |[OrderLeg]|True|The legs present in this order
The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
+ |signature
`s` |Signature|True|The signature approving this order|
+ |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
+ |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client|
+ ??? info "[TimeInForce](/../../schemas/time_in_force)"
+ | | Must Fill All | Can Fill Partial |
+ | - | - | - |
+ | Must Fill Immediately | FOK | IOC |
+ | Can Fill Till Time | AON | GTC |
+
+
+ |Value| Description |
+ |-|-|
+ |`GOOD_TILL_TIME` = 1|GTT - Remains open until it is cancelled, or expired|
+ |`ALL_OR_NONE` = 2|AON - Either fill the whole order or none of it (Block Trades Only)|
+ |`IMMEDIATE_OR_CANCEL` = 3|IOC - Fill the order as much as possible, when hitting the orderbook. Then cancel it|
+ |`FILL_OR_KILL` = 4|FOK - Both AoN and IoC. Either fill the full order when hitting the orderbook, or cancel it|
+ ??? info "[OrderLeg](/../../schemas/order_leg)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The instrument to trade in this leg|
+ |size
`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
+ |limit_price
`lp` |string|False
`0`|The limit price of the order leg, expressed in `9` decimals.
This is the number of quote currency units to pay/receive for this leg.
This should be `null/0` if the order is a market order|
+ |is_buying_asset
`ib` |boolean|True|Specifies if the order leg is a buy or sell|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
+ ??? info "[OrderMetadata](/../../schemas/order_metadata)"
+ Metadata fields are used to support Backend only operations. These operations are not trustless by nature.
Hence, fields in here are never signed, and is never transmitted to the smart contract.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
+ |create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|False
``|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0||
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
+ ??? info "[OrderState](/../../schemas/order_state)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |status
`s` |OrderStatus|True|The status of the order|
+ |reject_reason
`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
+ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
+ |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
+ |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
+ |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs|
+ ??? info "[OrderStatus](/../../schemas/order_status)"
+ |Value| Description |
+ |-|-|
+ |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.|
+ |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.|
+ |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.|
+ |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.|
+ |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.|
+ ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/docs/grvt/schemas/api_create_order_request.md b/docs/grvt/schemas/api_create_order_request.md
new file mode 100644
index 0000000..b4b5b41
--- /dev/null
+++ b/docs/grvt/schemas/api_create_order_request.md
@@ -0,0 +1,160 @@
+!!! info "[ApiCreateOrderRequest](/../../schemas/api_create_order_request)"
+ Create an order on the orderbook for this trading account.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |order
`o` |Order|True|The order to create|
+ ??? info "[Order](/../../schemas/order)"
+ Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.
GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.
This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.
Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.
All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.
This minimizes the amount of trust users have to offer to GRVT
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |order_id
`oi` |string|False
`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
+ |sub_account_id
`sa` |string|True|The subaccount initiating the order|
+ |is_market
`im` |boolean|False
`false`|If the order is a market order
Market Orders do not have a limit price, and are always executed according to the maker order price.
Market Orders must always be taker orders|
+ |time_in_force
`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:
- PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg
- FULL EXECUTION = AON / FOK - only allows full size execution on all legs
- TAKER ONLY = IOC / FOK - only allows taker orders
- MAKER OR TAKER = GTT / AON - allows maker or taker orders
Exchange only supports (GTT, IOC, FOK)
RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
+ |post_only
`po` |boolean|False
`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.
If False, Order can be either a maker or taker order. In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.
| | Must Fill All | Can Fill Partial |
| - | - | - |
| Must Be Taker | FOK + False | IOC + False |
| Can Be Either | AON + False | GTC + False |
| Must Be Maker | AON + True | GTC + True |
|
+ |reduce_only
`ro` |boolean|False
`false`|If True, Order must reduce the position size, or be cancelled|
+ |legs
`l` |[OrderLeg]|True|The legs present in this order
The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
+ |signature
`s` |Signature|True|The signature approving this order|
+ |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
+ |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client|
+ ??? info "[TimeInForce](/../../schemas/time_in_force)"
+ | | Must Fill All | Can Fill Partial |
+ | - | - | - |
+ | Must Fill Immediately | FOK | IOC |
+ | Can Fill Till Time | AON | GTC |
+
+
+ |Value| Description |
+ |-|-|
+ |`GOOD_TILL_TIME` = 1|GTT - Remains open until it is cancelled, or expired|
+ |`ALL_OR_NONE` = 2|AON - Either fill the whole order or none of it (Block Trades Only)|
+ |`IMMEDIATE_OR_CANCEL` = 3|IOC - Fill the order as much as possible, when hitting the orderbook. Then cancel it|
+ |`FILL_OR_KILL` = 4|FOK - Both AoN and IoC. Either fill the full order when hitting the orderbook, or cancel it|
+ |`RETAIL_PRICE_IMPROVEMENT` = 5|RPI - A GTT + PostOnly maker order, that can only be taken by non-algorithmic UI users.|
+ ??? info "[OrderLeg](/../../schemas/order_leg)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The instrument to trade in this leg|
+ |size
`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
+ |limit_price
`lp` |string|False
`0`|The limit price of the order leg, expressed in `9` decimals.
This is the number of quote currency units to pay/receive for this leg.
This should be `null/0` if the order is a market order|
+ |is_buying_asset
`ib` |boolean|True|Specifies if the order leg is a buy or sell|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
+ ??? info "[OrderMetadata](/../../schemas/order_metadata)"
+ Metadata fields are used to support Backend only operations. These operations are not trustless by nature.
Hence, fields in here are never signed, and is never transmitted to the smart contract.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
+ |create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|False
``|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ |close_position
`cp` |boolean|True|If True, the order will close the position when the trigger price is reached|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ |`MID` = 3|MID - Order is activated when the mid price reaches the trigger price|
+ |`MARK` = 4|MARK - Order is activated when the mark price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0||
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
+ ??? info "[OrderState](/../../schemas/order_state)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |status
`s` |OrderStatus|True|The status of the order|
+ |reject_reason
`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
+ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
+ |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
+ |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
+ |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs|
+ ??? info "[OrderStatus](/../../schemas/order_status)"
+ |Value| Description |
+ |-|-|
+ |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.|
+ |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.|
+ |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.|
+ |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.|
+ |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.|
+ ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
+ |`REDUCE_ONLY_LIMIT` = 31|the remaining order size was cancelled because it exceeded current position size|
+ |`CLIENT_REPLACE` = 32|the order was replaced by a client replace request|
+ |`DERISK_MUST_BE_IOC` = 33|the derisk order must be an IOC order|
+ |`DERISK_MUST_BE_REDUCE_ONLY` = 34|the derisk order must be a reduce-only order|
+ |`DERISK_NOT_SUPPORTED` = 35|derisk is not supported|
+ |`INVALID_ORDER_TYPE` = 36|the order type is invalid|
+ |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined|
diff --git a/docs/grvt/schemas/api_create_order_response.md b/docs/grvt/schemas/api_create_order_response.md
new file mode 100644
index 0000000..cc84988
--- /dev/null
+++ b/docs/grvt/schemas/api_create_order_response.md
@@ -0,0 +1,158 @@
+!!! info "[ApiCreateOrderResponse](/../../schemas/api_create_order_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |Order|True|The created order|
+ ??? info "[Order](/../../schemas/order)"
+ Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.
GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.
This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.
Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.
All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.
This minimizes the amount of trust users have to offer to GRVT
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |order_id
`oi` |string|False
`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
+ |sub_account_id
`sa` |string|True|The subaccount initiating the order|
+ |is_market
`im` |boolean|False
`false`|If the order is a market order
Market Orders do not have a limit price, and are always executed according to the maker order price.
Market Orders must always be taker orders|
+ |time_in_force
`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:
- PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg
- FULL EXECUTION = AON / FOK - only allows full size execution on all legs
- TAKER ONLY = IOC / FOK - only allows taker orders
- MAKER OR TAKER = GTT / AON - allows maker or taker orders
Exchange only supports (GTT, IOC, FOK)
RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
+ |post_only
`po` |boolean|False
`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.
If False, Order can be either a maker or taker order. In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.
| | Must Fill All | Can Fill Partial |
| - | - | - |
| Must Be Taker | FOK + False | IOC + False |
| Can Be Either | AON + False | GTC + False |
| Must Be Maker | AON + True | GTC + True |
|
+ |reduce_only
`ro` |boolean|False
`false`|If True, Order must reduce the position size, or be cancelled|
+ |legs
`l` |[OrderLeg]|True|The legs present in this order
The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
+ |signature
`s` |Signature|True|The signature approving this order|
+ |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
+ |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client|
+ ??? info "[TimeInForce](/../../schemas/time_in_force)"
+ | | Must Fill All | Can Fill Partial |
+ | - | - | - |
+ | Must Fill Immediately | FOK | IOC |
+ | Can Fill Till Time | AON | GTC |
+
+
+ |Value| Description |
+ |-|-|
+ |`GOOD_TILL_TIME` = 1|GTT - Remains open until it is cancelled, or expired|
+ |`ALL_OR_NONE` = 2|AON - Either fill the whole order or none of it (Block Trades Only)|
+ |`IMMEDIATE_OR_CANCEL` = 3|IOC - Fill the order as much as possible, when hitting the orderbook. Then cancel it|
+ |`FILL_OR_KILL` = 4|FOK - Both AoN and IoC. Either fill the full order when hitting the orderbook, or cancel it|
+ |`RETAIL_PRICE_IMPROVEMENT` = 5|RPI - A GTT + PostOnly maker order, that can only be taken by non-algorithmic UI users.|
+ ??? info "[OrderLeg](/../../schemas/order_leg)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The instrument to trade in this leg|
+ |size
`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
+ |limit_price
`lp` |string|False
`0`|The limit price of the order leg, expressed in `9` decimals.
This is the number of quote currency units to pay/receive for this leg.
This should be `null/0` if the order is a market order|
+ |is_buying_asset
`ib` |boolean|True|Specifies if the order leg is a buy or sell|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
+ ??? info "[OrderMetadata](/../../schemas/order_metadata)"
+ Metadata fields are used to support Backend only operations. These operations are not trustless by nature.
Hence, fields in here are never signed, and is never transmitted to the smart contract.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
+ |create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|False
``|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ |close_position
`cp` |boolean|True|If True, the order will close the position when the trigger price is reached|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ |`MID` = 3|MID - Order is activated when the mid price reaches the trigger price|
+ |`MARK` = 4|MARK - Order is activated when the mark price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0||
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
+ ??? info "[OrderState](/../../schemas/order_state)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |status
`s` |OrderStatus|True|The status of the order|
+ |reject_reason
`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
+ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
+ |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
+ |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
+ |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs|
+ ??? info "[OrderStatus](/../../schemas/order_status)"
+ |Value| Description |
+ |-|-|
+ |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.|
+ |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.|
+ |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.|
+ |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.|
+ |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.|
+ ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
+ |`REDUCE_ONLY_LIMIT` = 31|the remaining order size was cancelled because it exceeded current position size|
+ |`CLIENT_REPLACE` = 32|the order was replaced by a client replace request|
+ |`DERISK_MUST_BE_IOC` = 33|the derisk order must be an IOC order|
+ |`DERISK_MUST_BE_REDUCE_ONLY` = 34|the derisk order must be a reduce-only order|
+ |`DERISK_NOT_SUPPORTED` = 35|derisk is not supported|
+ |`INVALID_ORDER_TYPE` = 36|the order type is invalid|
+ |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined|
diff --git a/docs/grvt/schemas/api_dedust_position_request.md b/docs/grvt/schemas/api_dedust_position_request.md
new file mode 100644
index 0000000..e69de29
diff --git a/docs/grvt/schemas/api_dedust_position_response.md b/docs/grvt/schemas/api_dedust_position_response.md
new file mode 100644
index 0000000..e69de29
diff --git a/docs/grvt/schemas/api_deposit_history_request.md b/docs/grvt/schemas/api_deposit_history_request.md
new file mode 100644
index 0000000..f5159be
--- /dev/null
+++ b/docs/grvt/schemas/api_deposit_history_request.md
@@ -0,0 +1,11 @@
+!!! info "[ApiDepositHistoryRequest](/../../schemas/api_deposit_history_request)"
+ The request to get the historical deposits of an account
The history is returned in reverse chronological order
Pagination works as follows:- We perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.
- The lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.
- If a `cursor` is provided, it will be used to fetch results from that point onwards.
- Pagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |currency
`c` |[string]|True|The token currency to query for, if nil or empty, return all deposits. Otherwise, only entries matching the filter will be returned|
+ |start_time
`st` |string|False
`0`|The start time to query for in unix nanoseconds|
+ |end_time
`et` |string|False
`now()`|The end time to query for in unix nanoseconds|
+ |limit
`l` |integer|False
`500`|The limit to query for. Defaults to 500; Max 1000|
+ |cursor
`c1` |string|False
`''`|The cursor to indicate when to start the next query from|
+ |main_account_id
`ma` |string|False
``|Main account ID being queried. By default, applies the requestor's main account ID.|
diff --git a/docs/grvt/schemas/api_deposit_history_response.md b/docs/grvt/schemas/api_deposit_history_response.md
new file mode 100644
index 0000000..6246bd9
--- /dev/null
+++ b/docs/grvt/schemas/api_deposit_history_response.md
@@ -0,0 +1,16 @@
+!!! info "[ApiDepositHistoryResponse](/../../schemas/api_deposit_history_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[DepositHistory]|True|The deposit history matching the request account|
+ |next
`n` |string|False
`''`|The cursor to indicate when to start the next query from|
+ ??? info "[DepositHistory](/../../schemas/deposit_history)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |l_1_hash
`l1` |string|True|The L1 txHash of the deposit|
+ |l_2_hash
`l2` |string|True|The L2 txHash of the deposit|
+ |to_account_id
`ta` |string|True|The account to deposit into|
+ |currency
`c` |string|True|The token currency to deposit|
+ |num_tokens
`nt` |string|True|The number of tokens to deposit|
+ |initiated_time
`it` |string|True|The timestamp when the deposit was initiated on L1 in unix nanoseconds|
+ |confirmed_time
`ct` |string|True|The timestamp when the deposit was confirmed on L2 in unix nanoseconds|
+ |from_address
`fa` |string|True|The address of the sender|
diff --git a/docs/grvt/schemas/api_deposit_request.md b/docs/grvt/schemas/api_deposit_request.md
new file mode 100644
index 0000000..b90862a
--- /dev/null
+++ b/docs/grvt/schemas/api_deposit_request.md
@@ -0,0 +1,18 @@
+!!! info "[ApiDepositRequest](/../../schemas/api_deposit_request)"
+ GRVT runs on a ZKSync Hyperchain which settles directly onto Ethereum.
To Deposit funds from your L1 wallet into a GRVT SubAccount, you will be required to submit a deposit transaction directly to Ethereum.
GRVT's bridge verifier will scan Ethereum from time to time. Once it receives proof that your deposit has been confirmed on Ethereum, it will initiate the deposit process.
This current payload is used for alpha testing only.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |to_account_id
`ta` |string|True|The main account to deposit into|
+ |currency
`c` |Currency|True|The token currency to deposit|
+ |num_tokens
`nt` |string|True|The number of tokens to deposit, quoted in token_currency decimals|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
diff --git a/docs/grvt/schemas/api_drop_client_ws_request.md b/docs/grvt/schemas/api_drop_client_ws_request.md
new file mode 100644
index 0000000..4fdfe35
--- /dev/null
+++ b/docs/grvt/schemas/api_drop_client_ws_request.md
@@ -0,0 +1,4 @@
+!!! info "[ApiDropClientWsRequest](/../../schemas/api_drop_client_ws_request)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |main_account_id
`ma` |string|True||
diff --git a/docs/grvt/schemas/api_drop_client_ws_response.md b/docs/grvt/schemas/api_drop_client_ws_response.md
new file mode 100644
index 0000000..8e7b4b5
--- /dev/null
+++ b/docs/grvt/schemas/api_drop_client_ws_response.md
@@ -0,0 +1,4 @@
+!!! info "[ApiDropClientWsResponse](/../../schemas/api_drop_client_ws_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |num_dropped
`nd` |integer|True||
diff --git a/docs/grvt/schemas/api_fill_history_request.md b/docs/grvt/schemas/api_fill_history_request.md
new file mode 100644
index 0000000..760368c
--- /dev/null
+++ b/docs/grvt/schemas/api_fill_history_request.md
@@ -0,0 +1,22 @@
+!!! info "[ApiFillHistoryRequest](/../../schemas/api_fill_history_request)"
+ Query for all historical fills made by a single account. A single order can be matched multiple times, hence there is no real way to uniquely identify a trade.
Pagination works as follows:- We perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.
- The lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.
- If a `cursor` is provided, it will be used to fetch results from that point onwards.
- Pagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The sub account ID to request for|
+ |kind
`k` |[Kind]|False
`all`|The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned|
+ |base
`b` |[string]|False
`all`|The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned|
+ |quote
`q` |[string]|False
`all`|The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned|
+ |start_time
`st` |string|False
`0`|The start time to apply in unix nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned|
+ |end_time
`et` |string|False
`now()`|The end time to apply in unix nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned|
+ |limit
`l` |integer|False
`500`|The limit to query for. Defaults to 500; Max 1000|
+ |cursor
`c` |string|False
`''`|The cursor to indicate when to start the query from|
+ ??? info "[Kind](/../../schemas/kind)"
+ The list of asset kinds that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|the perpetual asset kind|
+ |`FUTURE` = 2|the future asset kind|
+ |`CALL` = 3|the call option asset kind|
+ |`PUT` = 4|the put option asset kind|
diff --git a/docs/grvt/schemas/api_fill_history_response.md b/docs/grvt/schemas/api_fill_history_response.md
new file mode 100644
index 0000000..65a847a
--- /dev/null
+++ b/docs/grvt/schemas/api_fill_history_response.md
@@ -0,0 +1,45 @@
+!!! info "[ApiFillHistoryResponse](/../../schemas/api_fill_history_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[Fill]|True|The private trades matching the request asset|
+ |next
`n` |string|True|The cursor to indicate when to start the query from|
+ ??? info "[Fill](/../../schemas/fill)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |sub_account_id
`sa` |string|True|The sub account ID that participated in the trade|
+ |instrument
`i` |string|True|The instrument being represented|
+ |is_buyer
`ib` |boolean|True|The side that the subaccount took on the trade|
+ |is_taker
`it` |boolean|True|The role that the subaccount took on the trade|
+ |size
`s` |string|True|The number of assets being traded, expressed in base asset decimal units|
+ |price
`p` |string|True|The traded price, expressed in `9` decimals|
+ |mark_price
`mp` |string|True|The mark price of the instrument at point of trade, expressed in `9` decimals|
+ |index_price
`ip` |string|True|The index price of the instrument at point of trade, expressed in `9` decimals|
+ |interest_rate
`ir` |string|True|The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point)|
+ |forward_price
`fp` |string|True|[Options] The forward price of the option at point of trade, expressed in `9` decimals|
+ |realized_pnl
`rp` |string|True|The realized PnL of the trade, expressed in quote asset decimal units (0 if increasing position size)|
+ |fee
`f` |string|True|The fees paid on the trade, expressed in quote asset decimal unit (negative if maker rebate applied)|
+ |fee_rate
`fr` |string|True|The fee rate paid on the trade|
+ |trade_id
`ti` |string|True|A trade identifier, globally unique, and monotonically increasing (not by `1`).
All trades sharing a single taker execution share the same first component (before `-`), and `event_time`.
`trade_id` is guaranteed to be consistent across MarketData `Trade` and Trading `Fill`.|
+ |order_id
`oi` |string|True|An order identifier|
+ |venue
`v` |Venue|True|The venue where the trade occurred|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
+ |signer
`s1` |string|True|The address (public key) of the wallet signing the payload|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ |is_rpi
`ir1` |boolean|True|If the trade is a RPI trade|
+ ??? info "[Venue](/../../schemas/venue)"
+ The list of Trading Venues that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`ORDERBOOK` = 1|the trade is cleared on the orderbook venue|
+ |`RFQ` = 2|the trade is cleared on the RFQ venue|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0||
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
diff --git a/docs/grvt/schemas/api_find_ecosystem_epoch_metric_response.md b/docs/grvt/schemas/api_find_ecosystem_epoch_metric_response.md
new file mode 100644
index 0000000..c48ebd4
--- /dev/null
+++ b/docs/grvt/schemas/api_find_ecosystem_epoch_metric_response.md
@@ -0,0 +1,17 @@
+!!! info "[ApiFindEcosystemEpochMetricResponse](/../../schemas/api_find_ecosystem_epoch_metric_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |metric
`m` |EcosystemMetric|True|The epoch metric|
+ |rank
`r` |integer|True|The rank of the account in the ecosystem|
+ |total
`t` |integer|True|The total number of accounts in the ecosystem|
+ |last_calculated_at
`lc` |string|True|The time when the ecosystem points were last calculated|
+ |total_direct_invite_count
`td` |integer|True|Direct invite count without relying on epochs|
+ |total_indirect_invite_count
`ti` |integer|True|Indirect invite count without relying on epochs|
+ ??? info "[EcosystemMetric](/../../schemas/ecosystem_metric)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |direct_invite_count
`di` |integer|True|Direct invite count|
+ |indirect_invite_count
`ii` |integer|True|Indirect invite count|
+ |direct_invite_trading_volume
`di1` |string|True|Direct invite trading volume|
+ |indirect_invite_trading_volume
`ii1` |string|True|Indirect invite trading volume|
+ |total_point
`tp` |string|True|Total ecosystem point of this epoch/phase|
diff --git a/docs/grvt/schemas/api_find_ecosystem_leaderboard_response.md b/docs/grvt/schemas/api_find_ecosystem_leaderboard_response.md
new file mode 100644
index 0000000..a4399ef
--- /dev/null
+++ b/docs/grvt/schemas/api_find_ecosystem_leaderboard_response.md
@@ -0,0 +1,11 @@
+!!! info "[ApiFindEcosystemLeaderboardResponse](/../../schemas/api_find_ecosystem_leaderboard_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |users
`u` |[EcosystemLeaderboardUser]|True|The list of ecosystem leaderboard users|
+ ??? info "[EcosystemLeaderboardUser](/../../schemas/ecosystem_leaderboard_user)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id|
+ |rank
`r` |integer|True|The rank of the account in the ecosystem|
+ |total_point
`tp` |string|True|Total ecosystem point|
+ |twitter_username
`tu` |string|True|The twitter username of the account|
diff --git a/docs/grvt/schemas/api_find_first_epoch_metric_response.md b/docs/grvt/schemas/api_find_first_epoch_metric_response.md
new file mode 100644
index 0000000..a5788a9
--- /dev/null
+++ b/docs/grvt/schemas/api_find_first_epoch_metric_response.md
@@ -0,0 +1,25 @@
+!!! info "[ApiFindFirstEpochMetricResponse](/../../schemas/api_find_first_epoch_metric_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |phase_zero_metric
`pz` |EcosystemMetric|True|Phase zero metric|
+ |phase_one_metric
`po` |EcosystemMetric|True|Phase one metric|
+ |rank
`r` |integer|True|The rank of the account in the ecosystem|
+ |total
`t` |integer|True|The total number of accounts in the ecosystem|
+ |total_point
`tp` |string|True|Total ecosystem point of the first epoch|
+ |last_calculated_at
`lc` |string|True|The time when the ecosystem points were last calculated|
+ ??? info "[EcosystemMetric](/../../schemas/ecosystem_metric)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |direct_invite_count
`di` |integer|True|Direct invite count|
+ |indirect_invite_count
`ii` |integer|True|Indirect invite count|
+ |direct_invite_trading_volume
`di1` |string|True|Direct invite trading volume|
+ |indirect_invite_trading_volume
`ii1` |string|True|Indirect invite trading volume|
+ |total_point
`tp` |string|True|Total ecosystem point of this epoch/phase|
+ ??? info "[EcosystemMetric](/../../schemas/ecosystem_metric)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |direct_invite_count
`di` |integer|True|Direct invite count|
+ |indirect_invite_count
`ii` |integer|True|Indirect invite count|
+ |direct_invite_trading_volume
`di1` |string|True|Direct invite trading volume|
+ |indirect_invite_trading_volume
`ii1` |string|True|Indirect invite trading volume|
+ |total_point
`tp` |string|True|Total ecosystem point of this epoch/phase|
diff --git a/docs/grvt/schemas/api_find_trader_epoch_metric_response.md b/docs/grvt/schemas/api_find_trader_epoch_metric_response.md
new file mode 100644
index 0000000..912603d
--- /dev/null
+++ b/docs/grvt/schemas/api_find_trader_epoch_metric_response.md
@@ -0,0 +1,12 @@
+!!! info "[ApiFindTraderEpochMetricResponse](/../../schemas/api_find_trader_epoch_metric_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |metric
`m` |TraderMetric|True|Phase zero metric|
+ |rank
`r` |integer|True|The rank of the account in the trader|
+ |total
`t` |integer|True|The total number of accounts in the trader|
+ |last_calculated_at
`lc` |string|True|The time when the trader points were last calculated|
+ ??? info "[TraderMetric](/../../schemas/trader_metric)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |total_fee
`tf` |string|True|Total fee paid|
+ |total_point
`tp` |number|True|Total trader point of this epoch/phase|
diff --git a/docs/grvt/schemas/api_find_trader_leaderboard_response.md b/docs/grvt/schemas/api_find_trader_leaderboard_response.md
new file mode 100644
index 0000000..7e17222
--- /dev/null
+++ b/docs/grvt/schemas/api_find_trader_leaderboard_response.md
@@ -0,0 +1,11 @@
+!!! info "[ApiFindTraderLeaderboardResponse](/../../schemas/api_find_trader_leaderboard_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |users
`u` |[TraderLeaderboardUser]|True|The list of trader leaderboard users|
+ ??? info "[TraderLeaderboardUser](/../../schemas/trader_leaderboard_user)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id|
+ |rank
`r` |integer|True|The rank of the account in the Trader|
+ |total_point
`tp` |number|True|Total Trader point|
+ |twitter_username
`tu` |string|True|The twitter username of the account|
diff --git a/docs/grvt/schemas/api_funding_account_summary_response.md b/docs/grvt/schemas/api_funding_account_summary_response.md
new file mode 100644
index 0000000..74d6b4b
--- /dev/null
+++ b/docs/grvt/schemas/api_funding_account_summary_response.md
@@ -0,0 +1,38 @@
+!!! info "[ApiFundingAccountSummaryResponse](/../../schemas/api_funding_account_summary_response)"
+ The funding account summary, that reports the total equity and spot balances of a funding (main) account
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |FundingAccountSummary|True|The funding account summary|
+ |tier
`t` |ClientTier|True|Client fee tier at the time of query|
+ ??? info "[FundingAccountSummary](/../../schemas/funding_account_summary)"
+ The funding account summary, that reports the total equity and spot balances of a funding (main) account
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |main_account_id
`ma` |string|True|The main account ID of the account to which the summary belongs|
+ |total_equity
`te` |string|True|Total equity of the main account, denominated in USD|
+ |spot_balances
`sb` |[SpotBalance]|True|The list of spot assets owned by this main account, and their balances|
+ |vault_investments
`vi` |[VaultInvestment]|True|The list of vault investments held by this main account|
+ ??? info "[SpotBalance](/../../schemas/spot_balance)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |currency
`c` |string|True|The currency you hold a spot balance in|
+ |balance
`b` |string|True|This currency's balance in this trading account.|
+ |index_price
`ip` |string|True|The index price of this currency. (reported in `USD`)|
+ ??? info "[VaultInvestment](/../../schemas/vault_investment)"
+ Summarizes a vault investment held by a funding account
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |vault_id
`vi` |string|True|The trading account ID of the vault invested in.|
+ |num_lp_tokens
`nl` |string|True|The number of shares held by the investor.|
+ |share_price
`sp` |string|True|The current share price (in USD) of this vault investment.|
+ ??? info "[ClientTier](/../../schemas/client_tier)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |tier
`t` |integer|True||
+ |futures_taker_fee
`ft` |integer|True||
+ |futures_maker_fee
`fm` |integer|True||
+ |options_taker_fee
`ot` |integer|True||
+ |options_maker_fee
`om` |integer|True||
diff --git a/docs/grvt/schemas/api_funding_payment_history_request.md b/docs/grvt/schemas/api_funding_payment_history_request.md
new file mode 100644
index 0000000..33f4166
--- /dev/null
+++ b/docs/grvt/schemas/api_funding_payment_history_request.md
@@ -0,0 +1,11 @@
+!!! info "[ApiFundingPaymentHistoryRequest](/../../schemas/api_funding_payment_history_request)"
+ Query for all historical funding payments made by a single account.
Pagination works as follows:- We perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.
- The lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.
- If a `cursor` is provided, it will be used to fetch results from that point onwards.
- Pagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The sub account ID to request for|
+ |instrument
`i` |string|False
`all`|The perpetual instrument to filter for|
+ |start_time
`st` |string|False
`0`|The start time to apply in unix nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned|
+ |end_time
`et` |string|False
`now()`|The end time to apply in unix nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned|
+ |limit
`l` |integer|False
`500`|The limit to query for. Defaults to 500; Max 1000|
+ |cursor
`c` |string|False
`''`|The cursor to indicate when to start the query from|
diff --git a/docs/grvt/schemas/api_funding_payment_history_response.md b/docs/grvt/schemas/api_funding_payment_history_response.md
new file mode 100644
index 0000000..4d807cb
--- /dev/null
+++ b/docs/grvt/schemas/api_funding_payment_history_response.md
@@ -0,0 +1,14 @@
+!!! info "[ApiFundingPaymentHistoryResponse](/../../schemas/api_funding_payment_history_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[FundingPayment]|True|The funding payments matching the request asset|
+ |next
`n` |string|True|The cursor to indicate when to start the query from|
+ ??? info "[FundingPayment](/../../schemas/funding_payment)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |sub_account_id
`sa` |string|True|The sub account ID that made the funding payment|
+ |instrument
`i` |string|True|The perpetual instrument being funded|
+ |currency
`c` |string|True|The currency of the funding payment|
+ |amount
`a` |string|True|The amount of the funding payment. Positive if paid, negative if received|
+ |tx_id
`ti` |string|True|The transaction ID of the funding payment.
Funding payments can be triggered by a trade, transfer, or liquidation.
The `tx_id` will match the corresponding `trade_id` or `tx_id`.|
diff --git a/docs/grvt/schemas/api_funding_rate_request.md b/docs/grvt/schemas/api_funding_rate_request.md
new file mode 100644
index 0000000..6389aa5
--- /dev/null
+++ b/docs/grvt/schemas/api_funding_rate_request.md
@@ -0,0 +1,10 @@
+!!! info "[ApiFundingRateRequest](/../../schemas/api_funding_rate_request)"
+ Lookup the historical funding rate of a perpetual future.
Pagination works as follows:- We perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.
- The lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.
- If a `cursor` is provided, it will be used to fetch results from that point onwards.
- Pagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |start_time
`st` |string|False
`0`|Start time of funding rate in unix nanoseconds|
+ |end_time
`et` |string|False
`now()`|End time of funding rate in unix nanoseconds|
+ |limit
`l` |integer|False
`500`|The limit to query for. Defaults to 500; Max 1000|
+ |cursor
`c` |string|False
`''`|The cursor to indicate when to start the query from|
diff --git a/docs/grvt/schemas/api_funding_rate_response.md b/docs/grvt/schemas/api_funding_rate_response.md
new file mode 100644
index 0000000..01e2a1c
--- /dev/null
+++ b/docs/grvt/schemas/api_funding_rate_response.md
@@ -0,0 +1,13 @@
+!!! info "[ApiFundingRateResponse](/../../schemas/api_funding_rate_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[FundingRate]|True|The funding rate result set for given interval|
+ |next
`n` |string|False
`''`|The cursor to indicate when to start the next query from|
+ ??? info "[FundingRate](/../../schemas/funding_rate)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |funding_rate
`fr` |string|True|The funding rate of the instrument, expressed in percentage points|
+ |funding_time
`ft` |string|True|The funding timestamp of the funding rate, expressed in unix nanoseconds|
+ |mark_price
`mp` |string|True|The mark price of the instrument at funding timestamp, expressed in `9` decimals|
+ |funding_rate_8_h_avg
`fr1` |string|True|The 8h average funding rate of the instrument, expressed in percentage points|
diff --git a/docs/grvt/schemas/api_get_all_initial_leverage_request.md b/docs/grvt/schemas/api_get_all_initial_leverage_request.md
new file mode 100644
index 0000000..e09d435
--- /dev/null
+++ b/docs/grvt/schemas/api_get_all_initial_leverage_request.md
@@ -0,0 +1,6 @@
+!!! info "[ApiGetAllInitialLeverageRequest](/../../schemas/api_get_all_initial_leverage_request)"
+ The request to get the initial leverage of a sub account
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The sub account ID to get the leverage for|
diff --git a/docs/grvt/schemas/api_get_all_initial_leverage_response.md b/docs/grvt/schemas/api_get_all_initial_leverage_response.md
new file mode 100644
index 0000000..55a1e63
--- /dev/null
+++ b/docs/grvt/schemas/api_get_all_initial_leverage_response.md
@@ -0,0 +1,13 @@
+!!! info "[ApiGetAllInitialLeverageResponse](/../../schemas/api_get_all_initial_leverage_response)"
+ The response to get the initial leverage of a sub account
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |results
`r` |[InitialLeverageResult]|True|The initial leverage of the sub account|
+ ??? info "[InitialLeverageResult](/../../schemas/initial_leverage_result)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The instrument to get the leverage for|
+ |leverage
`l` |string|True|The initial leverage of the sub account|
+ |min_leverage
`ml` |string|True|The min leverage this sub account can set|
+ |max_leverage
`ml1` |string|True|The max leverage this sub account can set|
diff --git a/docs/grvt/schemas/api_get_all_instruments_request.md b/docs/grvt/schemas/api_get_all_instruments_request.md
new file mode 100644
index 0000000..c13510d
--- /dev/null
+++ b/docs/grvt/schemas/api_get_all_instruments_request.md
@@ -0,0 +1,6 @@
+!!! info "[ApiGetAllInstrumentsRequest](/../../schemas/api_get_all_instruments_request)"
+ Fetch all instruments
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |is_active
`ia` |boolean|False
`false`|Fetch only active instruments|
diff --git a/docs/grvt/schemas/api_get_all_instruments_response.md b/docs/grvt/schemas/api_get_all_instruments_response.md
new file mode 100644
index 0000000..855cfa6
--- /dev/null
+++ b/docs/grvt/schemas/api_get_all_instruments_response.md
@@ -0,0 +1,44 @@
+!!! info "[ApiGetAllInstrumentsResponse](/../../schemas/api_get_all_instruments_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[Instrument]|True|List of instruments|
+ ??? info "[Instrument](/../../schemas/instrument)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |instrument_hash
`ih` |string|True|The asset ID used for instrument signing.|
+ |base
`b` |string|True|The base currency|
+ |quote
`q` |string|True|The quote currency|
+ |kind
`k` |Kind|True|The kind of instrument|
+ |venues
`v` |[Venue]|True|Venues that this instrument can be traded at|
+ |settlement_period
`sp1` |InstrumentSettlementPeriod|True|The settlement period of the instrument|
+ |base_decimals
`bd` |integer|True|The smallest denomination of the base asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)|
+ |quote_decimals
`qd` |integer|True|The smallest denomination of the quote asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)|
+ |tick_size
`ts` |string|True|The size of a single tick, expressed in price decimal units|
+ |min_size
`ms` |string|True|The minimum contract size, expressed in base asset decimal units|
+ |create_time
`ct` |string|True|Creation time in unix nanoseconds|
+ |max_position_size
`mp` |string|True|The maximum position size, expressed in base asset decimal units|
+ ??? info "[Kind](/../../schemas/kind)"
+ The list of asset kinds that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|the perpetual asset kind|
+ |`FUTURE` = 2|the future asset kind|
+ |`CALL` = 3|the call option asset kind|
+ |`PUT` = 4|the put option asset kind|
+ ??? info "[Venue](/../../schemas/venue)"
+ The list of Trading Venues that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`ORDERBOOK` = 1|the trade is cleared on the orderbook venue|
+ |`RFQ` = 2|the trade is cleared on the RFQ venue|
+ ??? info "[InstrumentSettlementPeriod](/../../schemas/instrument_settlement_period)"
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|Instrument settles through perpetual funding cycles|
+ |`DAILY` = 2|Instrument settles at an expiry date, marked as a daily instrument|
+ |`WEEKLY` = 3|Instrument settles at an expiry date, marked as a weekly instrument|
+ |`MONTHLY` = 4|Instrument settles at an expiry date, marked as a monthly instrument|
+ |`QUARTERLY` = 5|Instrument settles at an expiry date, marked as a quarterly instrument|
diff --git a/docs/grvt/schemas/api_get_currency_request.md b/docs/grvt/schemas/api_get_currency_request.md
new file mode 100644
index 0000000..3f1e496
--- /dev/null
+++ b/docs/grvt/schemas/api_get_currency_request.md
@@ -0,0 +1,5 @@
+!!! info "[ApiGetCurrencyRequest](/../../schemas/api_get_currency_request)"
+ Fetch all currencies
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
diff --git a/docs/grvt/schemas/api_get_currency_response.md b/docs/grvt/schemas/api_get_currency_response.md
new file mode 100644
index 0000000..4ef131c
--- /dev/null
+++ b/docs/grvt/schemas/api_get_currency_response.md
@@ -0,0 +1,13 @@
+!!! info "[ApiGetCurrencyResponse](/../../schemas/api_get_currency_response)"
+ The list of currencies
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[CurrencyDetail]|True|The list of currencies|
+ ??? info "[CurrencyDetail](/../../schemas/currency_detail)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |id
`i` |integer|True|The integer value of the currency|
+ |symbol
`s` |string|True|The name of the currency|
+ |balance_decimals
`bd` |integer|True|The balance decimals of the currency|
+ |quantity_multiplier
`qm` |string|True|The quantity multiplier of the currency|
diff --git a/docs/grvt/schemas/api_get_ecosystem_leaderboard_request.md b/docs/grvt/schemas/api_get_ecosystem_leaderboard_request.md
new file mode 100644
index 0000000..209678b
--- /dev/null
+++ b/docs/grvt/schemas/api_get_ecosystem_leaderboard_request.md
@@ -0,0 +1,5 @@
+!!! info "[ApiGetEcosystemLeaderboardRequest](/../../schemas/api_get_ecosystem_leaderboard_request)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |calculate_from
`cf` |string|True|Start time of the epoch - phase|
+ |limit
`l` |integer|True|The number of accounts to return|
diff --git a/docs/grvt/schemas/api_get_ecosystem_leaderboard_response.md b/docs/grvt/schemas/api_get_ecosystem_leaderboard_response.md
new file mode 100644
index 0000000..32f12c8
--- /dev/null
+++ b/docs/grvt/schemas/api_get_ecosystem_leaderboard_response.md
@@ -0,0 +1,25 @@
+!!! info "[ApiGetEcosystemLeaderboardResponse](/../../schemas/api_get_ecosystem_leaderboard_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |points
`p` |[EcosystemPoint]|True|The list of ecosystem points|
+ ??? info "[EcosystemPoint](/../../schemas/ecosystem_point)"
+
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id|
+ |main_account_id
`ma` |string|True|The main account id|
+ |total_point
`tp` |string|True|Total ecosystem point|
+ |direct_invite_count
`di` |integer|True|Direct invite count|
+ |indirect_invite_count
`ii` |integer|True|Indirect invite count|
+ |direct_invite_trading_volume
`di1` |string|True|Direct invite trading volume|
+ |indirect_invite_trading_volume
`ii1` |string|True|Indirect invite trading volume|
+ |calculate_at
`ca` |string|True|The time when the ecosystem point is calculated|
+ |calculate_from
`cf` |string|True|Start time of the epoch - phase|
+ |calculate_to
`ct` |string|True|End time of the epoch - phase|
+ |rank
`r` |integer|True|The rank of the account in the ecosystem|
+ |epoch
`e` |integer|True|The epoch number of the ecosystem point|
+ |brokered_trading_volume
`bt` |string|True|Brokered trading volume|
+ |brokered_trading_point
`bt1` |string|True|Brokered trading point|
+ |referee_kyc_point
`rk` |string|True|Referee KYC point|
+ |referrer_kyc_point
`rk1` |string|True|Referrer KYC point|
diff --git a/docs/grvt/schemas/api_get_ecosystem_referral_stat_response.md b/docs/grvt/schemas/api_get_ecosystem_referral_stat_response.md
new file mode 100644
index 0000000..a8c80f0
--- /dev/null
+++ b/docs/grvt/schemas/api_get_ecosystem_referral_stat_response.md
@@ -0,0 +1,7 @@
+!!! info "[ApiGetEcosystemReferralStatResponse](/../../schemas/api_get_ecosystem_referral_stat_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |direct_invite_count
`di` |integer|True|Direct invite count|
+ |indirect_invite_count
`ii` |integer|True|Indirect invite count|
+ |direct_invite_trading_volume
`di1` |string|True|Total volume traded by direct invites multiple by 1e9|
+ |indirect_invite_trading_volume
`ii1` |string|True|Total volume traded by indirect invites multiple by 1e9|
diff --git a/docs/grvt/schemas/api_get_filtered_instruments_request.md b/docs/grvt/schemas/api_get_filtered_instruments_request.md
new file mode 100644
index 0000000..4df33a8
--- /dev/null
+++ b/docs/grvt/schemas/api_get_filtered_instruments_request.md
@@ -0,0 +1,19 @@
+!!! info "[ApiGetFilteredInstrumentsRequest](/../../schemas/api_get_filtered_instruments_request)"
+ Fetch a list of instruments based on the filters provided
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |kind
`k` |[Kind]|False
`all`|The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned|
+ |base
`b` |[string]|False
`all`|The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned|
+ |quote
`q` |[string]|False
`all`|The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned|
+ |is_active
`ia` |boolean|False
`false`|Request for active instruments only|
+ |limit
`l` |integer|False
`500`|The limit to query for. Defaults to 500; Max 100000|
+ ??? info "[Kind](/../../schemas/kind)"
+ The list of asset kinds that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|the perpetual asset kind|
+ |`FUTURE` = 2|the future asset kind|
+ |`CALL` = 3|the call option asset kind|
+ |`PUT` = 4|the put option asset kind|
diff --git a/docs/grvt/schemas/api_get_filtered_instruments_response.md b/docs/grvt/schemas/api_get_filtered_instruments_response.md
new file mode 100644
index 0000000..954ee2f
--- /dev/null
+++ b/docs/grvt/schemas/api_get_filtered_instruments_response.md
@@ -0,0 +1,44 @@
+!!! info "[ApiGetFilteredInstrumentsResponse](/../../schemas/api_get_filtered_instruments_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[Instrument]|True|The instruments matching the request filter|
+ ??? info "[Instrument](/../../schemas/instrument)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |instrument_hash
`ih` |string|True|The asset ID used for instrument signing.|
+ |base
`b` |string|True|The base currency|
+ |quote
`q` |string|True|The quote currency|
+ |kind
`k` |Kind|True|The kind of instrument|
+ |venues
`v` |[Venue]|True|Venues that this instrument can be traded at|
+ |settlement_period
`sp1` |InstrumentSettlementPeriod|True|The settlement period of the instrument|
+ |base_decimals
`bd` |integer|True|The smallest denomination of the base asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)|
+ |quote_decimals
`qd` |integer|True|The smallest denomination of the quote asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)|
+ |tick_size
`ts` |string|True|The size of a single tick, expressed in price decimal units|
+ |min_size
`ms` |string|True|The minimum contract size, expressed in base asset decimal units|
+ |create_time
`ct` |string|True|Creation time in unix nanoseconds|
+ |max_position_size
`mp` |string|True|The maximum position size, expressed in base asset decimal units|
+ ??? info "[Kind](/../../schemas/kind)"
+ The list of asset kinds that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|the perpetual asset kind|
+ |`FUTURE` = 2|the future asset kind|
+ |`CALL` = 3|the call option asset kind|
+ |`PUT` = 4|the put option asset kind|
+ ??? info "[Venue](/../../schemas/venue)"
+ The list of Trading Venues that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`ORDERBOOK` = 1|the trade is cleared on the orderbook venue|
+ |`RFQ` = 2|the trade is cleared on the RFQ venue|
+ ??? info "[InstrumentSettlementPeriod](/../../schemas/instrument_settlement_period)"
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|Instrument settles through perpetual funding cycles|
+ |`DAILY` = 2|Instrument settles at an expiry date, marked as a daily instrument|
+ |`WEEKLY` = 3|Instrument settles at an expiry date, marked as a weekly instrument|
+ |`MONTHLY` = 4|Instrument settles at an expiry date, marked as a monthly instrument|
+ |`QUARTERLY` = 5|Instrument settles at an expiry date, marked as a quarterly instrument|
diff --git a/docs/grvt/schemas/api_get_instrument_request.md b/docs/grvt/schemas/api_get_instrument_request.md
new file mode 100644
index 0000000..a54cf3f
--- /dev/null
+++ b/docs/grvt/schemas/api_get_instrument_request.md
@@ -0,0 +1,6 @@
+!!! info "[ApiGetInstrumentRequest](/../../schemas/api_get_instrument_request)"
+ Fetch a single instrument by supplying the asset or instrument name
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
diff --git a/docs/grvt/schemas/api_get_instrument_response.md b/docs/grvt/schemas/api_get_instrument_response.md
new file mode 100644
index 0000000..a5b2bed
--- /dev/null
+++ b/docs/grvt/schemas/api_get_instrument_response.md
@@ -0,0 +1,44 @@
+!!! info "[ApiGetInstrumentResponse](/../../schemas/api_get_instrument_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |Instrument|True|The instrument matching the request asset|
+ ??? info "[Instrument](/../../schemas/instrument)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |instrument_hash
`ih` |string|True|The asset ID used for instrument signing.|
+ |base
`b` |string|True|The base currency|
+ |quote
`q` |string|True|The quote currency|
+ |kind
`k` |Kind|True|The kind of instrument|
+ |venues
`v` |[Venue]|True|Venues that this instrument can be traded at|
+ |settlement_period
`sp1` |InstrumentSettlementPeriod|True|The settlement period of the instrument|
+ |base_decimals
`bd` |integer|True|The smallest denomination of the base asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)|
+ |quote_decimals
`qd` |integer|True|The smallest denomination of the quote asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)|
+ |tick_size
`ts` |string|True|The size of a single tick, expressed in price decimal units|
+ |min_size
`ms` |string|True|The minimum contract size, expressed in base asset decimal units|
+ |create_time
`ct` |string|True|Creation time in unix nanoseconds|
+ |max_position_size
`mp` |string|True|The maximum position size, expressed in base asset decimal units|
+ ??? info "[Kind](/../../schemas/kind)"
+ The list of asset kinds that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|the perpetual asset kind|
+ |`FUTURE` = 2|the future asset kind|
+ |`CALL` = 3|the call option asset kind|
+ |`PUT` = 4|the put option asset kind|
+ ??? info "[Venue](/../../schemas/venue)"
+ The list of Trading Venues that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`ORDERBOOK` = 1|the trade is cleared on the orderbook venue|
+ |`RFQ` = 2|the trade is cleared on the RFQ venue|
+ ??? info "[InstrumentSettlementPeriod](/../../schemas/instrument_settlement_period)"
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|Instrument settles through perpetual funding cycles|
+ |`DAILY` = 2|Instrument settles at an expiry date, marked as a daily instrument|
+ |`WEEKLY` = 3|Instrument settles at an expiry date, marked as a weekly instrument|
+ |`MONTHLY` = 4|Instrument settles at an expiry date, marked as a monthly instrument|
+ |`QUARTERLY` = 5|Instrument settles at an expiry date, marked as a quarterly instrument|
diff --git a/docs/grvt/schemas/api_get_latest_lp_snapshot_request.md b/docs/grvt/schemas/api_get_latest_lp_snapshot_request.md
new file mode 100644
index 0000000..7862abb
--- /dev/null
+++ b/docs/grvt/schemas/api_get_latest_lp_snapshot_request.md
@@ -0,0 +1,45 @@
+!!! info "[ApiGetLatestLPSnapshotRequest](/../../schemas/api_get_latest_lp_snapshot_request)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |kind
`k` |Kind|False
`0`|The kind filter to apply|
+ |base
`b` |Currency|False
`0`|The base filter to apply|
+ ??? info "[Kind](/../../schemas/kind)"
+ The list of asset kinds that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|the perpetual asset kind|
+ |`FUTURE` = 2|the future asset kind|
+ |`CALL` = 3|the call option asset kind|
+ |`PUT` = 4|the put option asset kind|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ |`XRP` = 15|the XRP token|
+ |`TRUMP` = 20|the TRUMP token|
+ |`SUI` = 21|the SUI token|
+ |`LINK` = 25|the LINK token|
+ |`JUP` = 27|the JUP token|
+ |`FARTCOIN` = 28|the FARTCOIN token|
+ |`ENA` = 29|the ENA token|
+ |`DOGE` = 30|the DOGE token|
+ |`ADA` = 33|the ADA token|
+ |`AAVE` = 34|the AAVE token|
+ |`BERA` = 35|the BERA token|
+ |`IP` = 40|the IP token|
diff --git a/docs/grvt/schemas/api_get_latest_lp_snapshot_response.md b/docs/grvt/schemas/api_get_latest_lp_snapshot_response.md
new file mode 100644
index 0000000..fecc350
--- /dev/null
+++ b/docs/grvt/schemas/api_get_latest_lp_snapshot_response.md
@@ -0,0 +1,14 @@
+!!! info "[ApiGetLatestLPSnapshotResponse](/../../schemas/api_get_latest_lp_snapshot_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |snapshot
`s` |ApproximateLPSnapshot|True|The latest LP snapshot|
+ ??? info "[ApproximateLPSnapshot](/../../schemas/approximate_lp_snapshot)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |main_account_id
`ma` |string|True|The main account id|
+ |underlying_multiplier
`um` |string|True|Underlying multiplier|
+ |market_share_multiplier
`ms` |string|True|Market share multiplier|
+ |bid_fast_market_multiplier
`bf` |integer|True|Fast market multiplier|
+ |ask_fast_market_multiplier
`af` |integer|True|Fast market multiplier|
+ |liquidity_score
`ls` |string|True|Liquidity score|
+ |calculate_at
`ca` |string|True|The time when the snapshot was calculated|
diff --git a/docs/grvt/schemas/api_get_list_epoch_badge_response.md b/docs/grvt/schemas/api_get_list_epoch_badge_response.md
new file mode 100644
index 0000000..115d6d5
--- /dev/null
+++ b/docs/grvt/schemas/api_get_list_epoch_badge_response.md
@@ -0,0 +1,54 @@
+!!! info "[ApiGetListEpochBadgeResponse](/../../schemas/api_get_list_epoch_badge_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[EpochBadge]|True|The list of epoch badges|
+ ??? info "[EpochBadge](/../../schemas/epoch_badge)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id|
+ |main_account_id
`ma` |string|True|The account ID|
+ |type
`t` |RewardProgramType|True|The type of the reward program|
+ |epoch
`e` |integer|True|The epoch number|
+ |epoch_start_time
`es` |string|True|The start time of the epoch|
+ |epoch_end_time
`ee` |string|True|The end time of the epoch|
+ |badge
`b` |EpochBadgeType|True|The type of the badge|
+ |distributed_badges
`db` |[EpochBadgeType]|True|The distributed badges|
+ |total_point
`tp` |string|True|Total point|
+ |rank
`r` |integer|True|Rank|
+ |claimed_at
`ca` |string|True|The time when the badge was claimed, or the epoch end time if the user has already completed the KYC process|
+ ??? info "[RewardProgramType](/../../schemas/reward_program_type)"
+ |Value| Description |
+ |-|-|
+ |`ECOSYSTEM` = 1||
+ |`TRADER` = 2||
+ |`LP` = 3||
+ ??? info "[EpochBadgeType](/../../schemas/epoch_badge_type)"
+ |Value| Description |
+ |-|-|
+ |`CHAMPION` = 1|Champion|
+ |`LEGEND` = 2|Legend|
+ |`VETERAN` = 3|Veteran|
+ |`ELITE` = 4|Elite|
+ |`MASTER` = 5|Master|
+ |`EXPERT` = 6|Expert|
+ |`WARRIOR` = 7|Warrior|
+ |`SERGEANT` = 8|Sergeant|
+ |`RANGER` = 9|Ranger|
+ |`CHALLENGER` = 10|Challenger|
+ |`APPRENTICE` = 11|Apprentice|
+ |`ROOKIE` = 12|Rookie|
+ ??? info "[EpochBadgeType](/../../schemas/epoch_badge_type)"
+ |Value| Description |
+ |-|-|
+ |`CHAMPION` = 1|Champion|
+ |`LEGEND` = 2|Legend|
+ |`VETERAN` = 3|Veteran|
+ |`ELITE` = 4|Elite|
+ |`MASTER` = 5|Master|
+ |`EXPERT` = 6|Expert|
+ |`WARRIOR` = 7|Warrior|
+ |`SERGEANT` = 8|Sergeant|
+ |`RANGER` = 9|Ranger|
+ |`CHALLENGER` = 10|Challenger|
+ |`APPRENTICE` = 11|Apprentice|
+ |`ROOKIE` = 12|Rookie|
diff --git a/docs/grvt/schemas/api_get_list_flat_referral_request.md b/docs/grvt/schemas/api_get_list_flat_referral_request.md
new file mode 100644
index 0000000..c67e647
--- /dev/null
+++ b/docs/grvt/schemas/api_get_list_flat_referral_request.md
@@ -0,0 +1,9 @@
+!!! info "[ApiGetListFlatReferralRequest](/../../schemas/api_get_list_flat_referral_request)"
+ startTime and endTime are optional parameters. The semantics of these parameters are as follows:
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |referral_id
`ri` |string|True|The off chain referrer account id to get all flat referrals|
+ |start_time
`st` |string|False
`0`|Optional. Start time in unix nanoseconds|
+ |end_time
`et` |string|False
`now()`|Optional. End time in unix nanoseconds|
+ |account_id
`ai` |string|True|The off chain account id to get all user's referrers|
diff --git a/docs/grvt/schemas/api_get_list_flat_referral_response.md b/docs/grvt/schemas/api_get_list_flat_referral_response.md
new file mode 100644
index 0000000..a8a914d
--- /dev/null
+++ b/docs/grvt/schemas/api_get_list_flat_referral_response.md
@@ -0,0 +1,20 @@
+!!! info "[ApiGetListFlatReferralResponse](/../../schemas/api_get_list_flat_referral_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |flat_referrals
`fr` |[FlatReferral]|True|The list of flat referrals|
+ ??? info "[FlatReferral](/../../schemas/flat_referral)"
+
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id|
+ |referrer_id
`ri` |string|True|The off chain referrer account id|
+ |referrer_level
`rl` |integer|True|The referrer level; 1: direct referrer, 2: indirect referrer|
+ |account_create_time
`ac` |string|True|The account creation time|
+ |main_account_id
`ma` |string|True|The main account id|
+ |referrer_main_account_id
`rm` |string|True|The referrer main account id|
+ |is_business
`ib` |boolean|True|The account is a business account or not|
+ |is_kyc_completed
`ik` |boolean|True|The account is KYC verified or not|
+ |kyc_completed_at
`kc` |string|True|The KYC completed time|
+ |kyc_type
`kt` |string|True|The KYC type, can be 'individual' or 'business'|
+ |kyc_first_completed_at
`kf` |string|True|The first KYC completed time|
diff --git a/docs/grvt/schemas/api_get_list_reward_epoch_response.md b/docs/grvt/schemas/api_get_list_reward_epoch_response.md
new file mode 100644
index 0000000..6d1f1ff
--- /dev/null
+++ b/docs/grvt/schemas/api_get_list_reward_epoch_response.md
@@ -0,0 +1,31 @@
+!!! info "[ApiGetListRewardEpochResponse](/../../schemas/api_get_list_reward_epoch_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |ecosystem_epochs
`ee` |[RewardEpochInfo]|True|The list of epoch for ecosystem reward|
+ |trading_epochs
`te` |[RewardEpochInfo]|True|The list of epoch for trader reward and lp reward|
+ ??? info "[RewardEpochInfo](/../../schemas/reward_epoch_info)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |epoch
`e` |integer|True|The epoch number|
+ |epoch_start_time
`es` |string|True|The start time of the epoch|
+ |epoch_end_time
`ee` |string|True|The end time of the epoch|
+ |status
`s` |RewardEpochStatus|True|The status of the epoch|
+ ??? info "[RewardEpochStatus](/../../schemas/reward_epoch_status)"
+ |Value| Description |
+ |-|-|
+ |`PAST` = 1|Past|
+ |`CURRENT` = 2|Current|
+ |`FUTURE` = 3|Future|
+ ??? info "[RewardEpochInfo](/../../schemas/reward_epoch_info)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |epoch
`e` |integer|True|The epoch number|
+ |epoch_start_time
`es` |string|True|The start time of the epoch|
+ |epoch_end_time
`ee` |string|True|The end time of the epoch|
+ |status
`s` |RewardEpochStatus|True|The status of the epoch|
+ ??? info "[RewardEpochStatus](/../../schemas/reward_epoch_status)"
+ |Value| Description |
+ |-|-|
+ |`PAST` = 1|Past|
+ |`CURRENT` = 2|Current|
+ |`FUTURE` = 3|Future|
diff --git a/docs/grvt/schemas/api_get_lp_config_request.md b/docs/grvt/schemas/api_get_lp_config_request.md
new file mode 100644
index 0000000..24f1395
--- /dev/null
+++ b/docs/grvt/schemas/api_get_lp_config_request.md
@@ -0,0 +1,24 @@
+!!! info "[ApiGetLPConfigRequest](/../../schemas/api_get_lp_config_request)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |kind
`k` |Kind|True|The kind filter to apply|
+ |base
`b` |Currency|True|The base filter to apply|
+ ??? info "[Kind](/../../schemas/kind)"
+ The list of asset kinds that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|the perpetual asset kind|
+ |`FUTURE` = 2|the future asset kind|
+ |`CALL` = 3|the call option asset kind|
+ |`PUT` = 4|the put option asset kind|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
diff --git a/docs/grvt/schemas/api_get_lp_config_response.md b/docs/grvt/schemas/api_get_lp_config_response.md
new file mode 100644
index 0000000..dce4243
--- /dev/null
+++ b/docs/grvt/schemas/api_get_lp_config_response.md
@@ -0,0 +1,7 @@
+!!! info "[ApiGetLPConfigResponse](/../../schemas/api_get_lp_config_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |spread_score_multiplier
`ss` |string|True|The spread score multiplier|
+ |depth_score_multiplier
`ds` |string|True|The depth score multiplier|
+ |market_share_multiplier
`ms` |string|True|The market share multiplier|
+ |is_lp_maker
`il` |boolean|True|Is LP maker|
diff --git a/docs/grvt/schemas/api_get_lp_info_request.md b/docs/grvt/schemas/api_get_lp_info_request.md
new file mode 100644
index 0000000..5766137
--- /dev/null
+++ b/docs/grvt/schemas/api_get_lp_info_request.md
@@ -0,0 +1,45 @@
+!!! info "[ApiGetLPInfoRequest](/../../schemas/api_get_lp_info_request)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |kind
`k` |Kind|True|The kind filter to apply|
+ |base
`b` |Currency|False
`0`|The base filter to apply|
+ ??? info "[Kind](/../../schemas/kind)"
+ The list of asset kinds that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|the perpetual asset kind|
+ |`FUTURE` = 2|the future asset kind|
+ |`CALL` = 3|the call option asset kind|
+ |`PUT` = 4|the put option asset kind|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ |`XRP` = 15|the XRP token|
+ |`TRUMP` = 20|the TRUMP token|
+ |`SUI` = 21|the SUI token|
+ |`LINK` = 25|the LINK token|
+ |`JUP` = 27|the JUP token|
+ |`FARTCOIN` = 28|the FARTCOIN token|
+ |`ENA` = 29|the ENA token|
+ |`DOGE` = 30|the DOGE token|
+ |`ADA` = 33|the ADA token|
+ |`AAVE` = 34|the AAVE token|
+ |`BERA` = 35|the BERA token|
+ |`IP` = 40|the IP token|
diff --git a/docs/grvt/schemas/api_get_lp_info_response.md b/docs/grvt/schemas/api_get_lp_info_response.md
new file mode 100644
index 0000000..fe27632
--- /dev/null
+++ b/docs/grvt/schemas/api_get_lp_info_response.md
@@ -0,0 +1,11 @@
+!!! info "[ApiGetLPInfoResponse](/../../schemas/api_get_lp_info_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |is_lp_maker
`il` |boolean|True|Is LP maker|
+ |spread_score_value_multiplier
`ss` |string|True|The spread score value multiplier|
+ |depth_score_value_multiplier
`ds` |string|True|The depth score value multiplier|
+ |market_share_value_multiplier
`ms` |string|True|The market share value multiplier|
+ |underlying_multiplier
`um` |string|True|Underlying multiplier|
+ |market_share_multiplier
`ms1` |string|True|The market share multiplier, equal to the maker trading volume in the past 2 hours|
+ |ask_fast_market_multiplier
`af` |integer|True|Ask fast market multiplier|
+ |bid_fast_market_multiplier
`bf` |integer|True|Bid fast market multiplier|
diff --git a/docs/grvt/schemas/api_get_lp_leaderboard_request.md b/docs/grvt/schemas/api_get_lp_leaderboard_request.md
new file mode 100644
index 0000000..9d59aa7
--- /dev/null
+++ b/docs/grvt/schemas/api_get_lp_leaderboard_request.md
@@ -0,0 +1,47 @@
+!!! info "[ApiGetLPLeaderboardRequest](/../../schemas/api_get_lp_leaderboard_request)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |epoch
`e` |integer|False
`0`|The epoch to filter|
+ |limit
`l` |integer|True|The number of accounts to return|
+ |kind
`k` |Kind|True|The kind filter to apply|
+ |base
`b` |Currency|True|The base filter to apply|
+ ??? info "[Kind](/../../schemas/kind)"
+ The list of asset kinds that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|the perpetual asset kind|
+ |`FUTURE` = 2|the future asset kind|
+ |`CALL` = 3|the call option asset kind|
+ |`PUT` = 4|the put option asset kind|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ |`XRP` = 15|the XRP token|
+ |`TRUMP` = 20|the TRUMP token|
+ |`SUI` = 21|the SUI token|
+ |`LINK` = 25|the LINK token|
+ |`JUP` = 27|the JUP token|
+ |`FARTCOIN` = 28|the FARTCOIN token|
+ |`ENA` = 29|the ENA token|
+ |`DOGE` = 30|the DOGE token|
+ |`ADA` = 33|the ADA token|
+ |`AAVE` = 34|the AAVE token|
+ |`BERA` = 35|the BERA token|
+ |`IP` = 40|the IP token|
diff --git a/docs/grvt/schemas/api_get_lp_leaderboard_response.md b/docs/grvt/schemas/api_get_lp_leaderboard_response.md
new file mode 100644
index 0000000..be6b445
--- /dev/null
+++ b/docs/grvt/schemas/api_get_lp_leaderboard_response.md
@@ -0,0 +1,10 @@
+!!! info "[ApiGetLPLeaderboardResponse](/../../schemas/api_get_lp_leaderboard_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |points
`p` |[ApproximateLPPoint]|True|The list of LP points|
+ ??? info "[ApproximateLPPoint](/../../schemas/approximate_lp_point)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |off_chain_account_id
`oc` |string|True|The off chain account id|
+ |liquidity_score
`ls` |string|True|Liquidity score|
+ |rank
`r` |integer|True|The rank of user in the LP leaderboard|
diff --git a/docs/grvt/schemas/api_get_lp_point_request.md b/docs/grvt/schemas/api_get_lp_point_request.md
new file mode 100644
index 0000000..03b57d7
--- /dev/null
+++ b/docs/grvt/schemas/api_get_lp_point_request.md
@@ -0,0 +1,46 @@
+!!! info "[ApiGetLPPointRequest](/../../schemas/api_get_lp_point_request)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |epoch
`e` |integer|False
`0`|The epoch to filter|
+ |kind
`k` |Kind|False
`0`|Optional. The kind filter to apply|
+ |base
`b` |Currency|False
`0`|Optional. The base filter to apply|
+ ??? info "[Kind](/../../schemas/kind)"
+ The list of asset kinds that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|the perpetual asset kind|
+ |`FUTURE` = 2|the future asset kind|
+ |`CALL` = 3|the call option asset kind|
+ |`PUT` = 4|the put option asset kind|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ |`XRP` = 15|the XRP token|
+ |`TRUMP` = 20|the TRUMP token|
+ |`SUI` = 21|the SUI token|
+ |`LINK` = 25|the LINK token|
+ |`JUP` = 27|the JUP token|
+ |`FARTCOIN` = 28|the FARTCOIN token|
+ |`ENA` = 29|the ENA token|
+ |`DOGE` = 30|the DOGE token|
+ |`ADA` = 33|the ADA token|
+ |`AAVE` = 34|the AAVE token|
+ |`BERA` = 35|the BERA token|
+ |`IP` = 40|the IP token|
diff --git a/docs/grvt/schemas/api_get_lp_point_response.md b/docs/grvt/schemas/api_get_lp_point_response.md
new file mode 100644
index 0000000..c1443f6
--- /dev/null
+++ b/docs/grvt/schemas/api_get_lp_point_response.md
@@ -0,0 +1,11 @@
+!!! info "[ApiGetLPPointResponse](/../../schemas/api_get_lp_point_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |point
`p` |LPPoint|True|LP points of user|
+ |maker_count
`mc` |integer|True|The number of maker|
+ ??? info "[LPPoint](/../../schemas/lp_point)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |main_account_id
`ma` |string|True|The main account id|
+ |liquidity_score
`ls` |string|True|Liquidity score|
+ |rank
`r` |integer|True|The rank of user in the LP leaderboard|
diff --git a/docs/grvt/schemas/api_get_margin_tiers_response.md b/docs/grvt/schemas/api_get_margin_tiers_response.md
new file mode 100644
index 0000000..636c01e
--- /dev/null
+++ b/docs/grvt/schemas/api_get_margin_tiers_response.md
@@ -0,0 +1,14 @@
+!!! info "[ApiGetMarginTiersResponse](/../../schemas/api_get_margin_tiers_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |results
`r` |[AssetMarginTierResponse]|True||
+ ??? info "[AssetMarginTierResponse](/../../schemas/asset_margin_tier_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |asset
`a` |string|True||
+ |tiers
`t` |[MarginTierResponse]|True||
+ ??? info "[MarginTierResponse](/../../schemas/margin_tier_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |lower_bound
`lb` |string|True||
+ |rate
`r` |string|True||
diff --git a/docs/grvt/schemas/api_get_order_group_request.md b/docs/grvt/schemas/api_get_order_group_request.md
new file mode 100644
index 0000000..455548f
--- /dev/null
+++ b/docs/grvt/schemas/api_get_order_group_request.md
@@ -0,0 +1,6 @@
+!!! info "[ApiGetOrderGroupRequest](/../../schemas/api_get_order_group_request)"
+ Retrieves the grouping of non-cancelled, non-filled client orders for a given subaccount when the grouping exist.
helping to identify TP/SL pairs or other order relationships within the account.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The subaccount ID for which the order groups should be retrieved.|
diff --git a/docs/grvt/schemas/api_get_order_group_response.md b/docs/grvt/schemas/api_get_order_group_response.md
new file mode 100644
index 0000000..026f886
--- /dev/null
+++ b/docs/grvt/schemas/api_get_order_group_response.md
@@ -0,0 +1,12 @@
+!!! info "[ApiGetOrderGroupResponse](/../../schemas/api_get_order_group_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[ClientOrderIDsByGroup]|True|A list of client orders grouped by their associated order group.
Each entry in the list contains a `groupID` and the corresponding `clientOrderID`s
that belong to that group.|
+ ??? info "[ClientOrderIDsByGroup](/../../schemas/client_order_i_ds_by_group)"
+ Grouping for the client order id and their associated groups.
This is used to define TP/SL pairs or other order groupings after loading the list of Open Orders.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |group_id
`gi` |string|True|The group this order belongs to. It can be used to define TP/SL pairs or other order groupings|
+ |client_order_id
`co` |[string]|True|List of client order IDs in the group|
+ |sub_account_id
`sa` |string|True|The sub account ID that these orders belong to|
diff --git a/docs/grvt/schemas/api_get_order_request.md b/docs/grvt/schemas/api_get_order_request.md
new file mode 100644
index 0000000..57d9c79
--- /dev/null
+++ b/docs/grvt/schemas/api_get_order_request.md
@@ -0,0 +1,8 @@
+!!! info "[ApiGetOrderRequest](/../../schemas/api_get_order_request)"
+ Retrieve the order for the account. Either `order_id` or `client_order_id` must be provided.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The subaccount ID to filter by|
+ |order_id
`oi` |string|False
`0`|Filter for `order_id`|
+ |client_order_id
`co` |string|False
`0`|Filter for `client_order_id`|
diff --git a/docs/grvt/schemas/api_get_order_response.md b/docs/grvt/schemas/api_get_order_response.md
new file mode 100644
index 0000000..93ddd51
--- /dev/null
+++ b/docs/grvt/schemas/api_get_order_response.md
@@ -0,0 +1,158 @@
+!!! info "[ApiGetOrderResponse](/../../schemas/api_get_order_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |Order|True|The order object for the requested filter|
+ ??? info "[Order](/../../schemas/order)"
+ Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.
GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.
This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.
Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.
All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.
This minimizes the amount of trust users have to offer to GRVT
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |order_id
`oi` |string|False
`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
+ |sub_account_id
`sa` |string|True|The subaccount initiating the order|
+ |is_market
`im` |boolean|False
`false`|If the order is a market order
Market Orders do not have a limit price, and are always executed according to the maker order price.
Market Orders must always be taker orders|
+ |time_in_force
`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:
- PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg
- FULL EXECUTION = AON / FOK - only allows full size execution on all legs
- TAKER ONLY = IOC / FOK - only allows taker orders
- MAKER OR TAKER = GTT / AON - allows maker or taker orders
Exchange only supports (GTT, IOC, FOK)
RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
+ |post_only
`po` |boolean|False
`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.
If False, Order can be either a maker or taker order. In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.
| | Must Fill All | Can Fill Partial |
| - | - | - |
| Must Be Taker | FOK + False | IOC + False |
| Can Be Either | AON + False | GTC + False |
| Must Be Maker | AON + True | GTC + True |
|
+ |reduce_only
`ro` |boolean|False
`false`|If True, Order must reduce the position size, or be cancelled|
+ |legs
`l` |[OrderLeg]|True|The legs present in this order
The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
+ |signature
`s` |Signature|True|The signature approving this order|
+ |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
+ |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client|
+ ??? info "[TimeInForce](/../../schemas/time_in_force)"
+ | | Must Fill All | Can Fill Partial |
+ | - | - | - |
+ | Must Fill Immediately | FOK | IOC |
+ | Can Fill Till Time | AON | GTC |
+
+
+ |Value| Description |
+ |-|-|
+ |`GOOD_TILL_TIME` = 1|GTT - Remains open until it is cancelled, or expired|
+ |`ALL_OR_NONE` = 2|AON - Either fill the whole order or none of it (Block Trades Only)|
+ |`IMMEDIATE_OR_CANCEL` = 3|IOC - Fill the order as much as possible, when hitting the orderbook. Then cancel it|
+ |`FILL_OR_KILL` = 4|FOK - Both AoN and IoC. Either fill the full order when hitting the orderbook, or cancel it|
+ |`RETAIL_PRICE_IMPROVEMENT` = 5|RPI - A GTT + PostOnly maker order, that can only be taken by non-algorithmic UI users.|
+ ??? info "[OrderLeg](/../../schemas/order_leg)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The instrument to trade in this leg|
+ |size
`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
+ |limit_price
`lp` |string|False
`0`|The limit price of the order leg, expressed in `9` decimals.
This is the number of quote currency units to pay/receive for this leg.
This should be `null/0` if the order is a market order|
+ |is_buying_asset
`ib` |boolean|True|Specifies if the order leg is a buy or sell|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
+ ??? info "[OrderMetadata](/../../schemas/order_metadata)"
+ Metadata fields are used to support Backend only operations. These operations are not trustless by nature.
Hence, fields in here are never signed, and is never transmitted to the smart contract.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
+ |create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|False
``|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ |close_position
`cp` |boolean|True|If True, the order will close the position when the trigger price is reached|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ |`MID` = 3|MID - Order is activated when the mid price reaches the trigger price|
+ |`MARK` = 4|MARK - Order is activated when the mark price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0||
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
+ ??? info "[OrderState](/../../schemas/order_state)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |status
`s` |OrderStatus|True|The status of the order|
+ |reject_reason
`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
+ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
+ |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
+ |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
+ |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs|
+ ??? info "[OrderStatus](/../../schemas/order_status)"
+ |Value| Description |
+ |-|-|
+ |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.|
+ |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.|
+ |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.|
+ |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.|
+ |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.|
+ ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
+ |`REDUCE_ONLY_LIMIT` = 31|the remaining order size was cancelled because it exceeded current position size|
+ |`CLIENT_REPLACE` = 32|the order was replaced by a client replace request|
+ |`DERISK_MUST_BE_IOC` = 33|the derisk order must be an IOC order|
+ |`DERISK_MUST_BE_REDUCE_ONLY` = 34|the derisk order must be a reduce-only order|
+ |`DERISK_NOT_SUPPORTED` = 35|derisk is not supported|
+ |`INVALID_ORDER_TYPE` = 36|the order type is invalid|
+ |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined|
diff --git a/docs/grvt/schemas/api_get_trader_stat_response.md b/docs/grvt/schemas/api_get_trader_stat_response.md
new file mode 100644
index 0000000..d833474
--- /dev/null
+++ b/docs/grvt/schemas/api_get_trader_stat_response.md
@@ -0,0 +1,4 @@
+!!! info "[ApiGetTraderStatResponse](/../../schemas/api_get_trader_stat_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |total_fee
`tf` |string|True|Total fee paid|
diff --git a/docs/grvt/schemas/api_get_user_ecosystem_point_request.md b/docs/grvt/schemas/api_get_user_ecosystem_point_request.md
new file mode 100644
index 0000000..ca73086
--- /dev/null
+++ b/docs/grvt/schemas/api_get_user_ecosystem_point_request.md
@@ -0,0 +1,6 @@
+!!! info "[ApiGetUserEcosystemPointRequest](/../../schemas/api_get_user_ecosystem_point_request)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id|
+ |calculate_from
`cf` |string|True|Start time of the epoch - phase|
+ |include_user_rank
`iu` |boolean|True|Include user rank in the response|
diff --git a/docs/grvt/schemas/api_get_user_ecosystem_point_response.md b/docs/grvt/schemas/api_get_user_ecosystem_point_response.md
new file mode 100644
index 0000000..69dc27e
--- /dev/null
+++ b/docs/grvt/schemas/api_get_user_ecosystem_point_response.md
@@ -0,0 +1,25 @@
+!!! info "[ApiGetUserEcosystemPointResponse](/../../schemas/api_get_user_ecosystem_point_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |points
`p` |[EcosystemPoint]|True|The list of ecosystem points|
+ ??? info "[EcosystemPoint](/../../schemas/ecosystem_point)"
+
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id|
+ |main_account_id
`ma` |string|True|The main account id|
+ |total_point
`tp` |string|True|Total ecosystem point|
+ |direct_invite_count
`di` |integer|True|Direct invite count|
+ |indirect_invite_count
`ii` |integer|True|Indirect invite count|
+ |direct_invite_trading_volume
`di1` |string|True|Direct invite trading volume|
+ |indirect_invite_trading_volume
`ii1` |string|True|Indirect invite trading volume|
+ |calculate_at
`ca` |string|True|The time when the ecosystem point is calculated|
+ |calculate_from
`cf` |string|True|Start time of the epoch - phase|
+ |calculate_to
`ct` |string|True|End time of the epoch - phase|
+ |rank
`r` |integer|True|The rank of the account in the ecosystem|
+ |epoch
`e` |integer|True|The epoch number of the ecosystem point|
+ |brokered_trading_volume
`bt` |string|True|Brokered trading volume|
+ |brokered_trading_point
`bt1` |string|True|Brokered trading point|
+ |referee_kyc_point
`rk` |string|True|Referee KYC point|
+ |referrer_kyc_point
`rk1` |string|True|Referrer KYC point|
diff --git a/docs/grvt/schemas/api_get_verified_ecosystem_leaderboard_request.md b/docs/grvt/schemas/api_get_verified_ecosystem_leaderboard_request.md
new file mode 100644
index 0000000..6604e10
--- /dev/null
+++ b/docs/grvt/schemas/api_get_verified_ecosystem_leaderboard_request.md
@@ -0,0 +1,5 @@
+!!! info "[ApiGetVerifiedEcosystemLeaderboardRequest](/../../schemas/api_get_verified_ecosystem_leaderboard_request)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |calculate_from
`cf` |string|True|Start time of the epoch|
+ |completed_kyc_before
`ck` |string|True|Completed KYC before this time|
diff --git a/docs/grvt/schemas/api_latest_snap_sub_accounts_request.md b/docs/grvt/schemas/api_latest_snap_sub_accounts_request.md
new file mode 100644
index 0000000..69ec03a
--- /dev/null
+++ b/docs/grvt/schemas/api_latest_snap_sub_accounts_request.md
@@ -0,0 +1,6 @@
+!!! info "[ApiLatestSnapSubAccountsRequest](/../../schemas/api_latest_snap_sub_accounts_request)"
+ The request to get the latest snapshot of list sub account
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_i_ds
`sa` |[string]|True|The list of sub account ids to query|
diff --git a/docs/grvt/schemas/api_latest_snap_sub_accounts_response.md b/docs/grvt/schemas/api_latest_snap_sub_accounts_response.md
new file mode 100644
index 0000000..35257e1
--- /dev/null
+++ b/docs/grvt/schemas/api_latest_snap_sub_accounts_response.md
@@ -0,0 +1,110 @@
+!!! info "[ApiLatestSnapSubAccountsResponse](/../../schemas/api_latest_snap_sub_accounts_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[SubAccount]|True|The sub account history matching the request sub account|
+ ??? info "[SubAccount](/../../schemas/sub_account)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |sub_account_id
`sa` |string|True|The sub account ID this entry refers to|
+ |margin_type
`mt` |MarginType|True|The type of margin algorithm this subaccount uses|
+ |settle_currency
`sc` |Currency|True|The settlement, margin, and reporting currency of this account.
This subaccount can only open positions quoted in this currency
In the future, when users select a Multi-Currency Margin Type, this will be USD
All other assets are converted to this currency for the purpose of calculating margin|
+ |unrealized_pnl
`up` |string|True|The total unrealized PnL of all positions owned by this subaccount, denominated in quote currency decimal units.
`unrealized_pnl = sum(position.unrealized_pnl * position.quote_index_price) / settle_index_price`|
+ |total_equity
`te` |string|True|The notional value of your account if all positions are closed, excluding trading fees (reported in `settle_currency`).
`total_equity = sum(spot_balance.balance * spot_balance.index_price) / settle_index_price + unrealized_pnl`|
+ |initial_margin
`im` |string|True|The `total_equity` required to open positions in the account (reported in `settle_currency`).
Computation is different depending on account's `margin_type`|
+ |maintenance_margin
`mm` |string|True|The `total_equity` required to avoid liquidation of positions in the account (reported in `settle_currency`).
Computation is different depending on account's `margin_type`|
+ |available_balance
`ab` |string|True|The notional value available to transfer out of the trading account into the funding account (reported in `settle_currency`).
`available_balance = total_equity - initial_margin - min(unrealized_pnl, 0)`|
+ |spot_balances
`sb` |[SpotBalance]|True|The list of spot assets owned by this sub account, and their balances|
+ |positions
`p` |[Positions]|True|The list of positions owned by this sub account|
+ |settle_index_price
`si` |string|True|The index price of the settle currency. (reported in `USD`)|
+ ??? info "[MarginType](/../../schemas/margin_type)"
+ |Value| Description |
+ |-|-|
+ |`SIMPLE_CROSS_MARGIN` = 2|Simple Cross Margin Mode: all assets have a predictable margin impact, the whole subaccount shares a single margin|
+ |`PORTFOLIO_CROSS_MARGIN` = 3|Portfolio Cross Margin Mode: asset margin impact is analysed on portfolio level, the whole subaccount shares a single margin|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ |`XRP` = 15|the XRP token|
+ |`TRUMP` = 20|the TRUMP token|
+ |`SUI` = 21|the SUI token|
+ |`LINK` = 25|the LINK token|
+ |`JUP` = 27|the JUP token|
+ |`FARTCOIN` = 28|the FARTCOIN token|
+ |`ENA` = 29|the ENA token|
+ |`DOGE` = 30|the DOGE token|
+ |`ADA` = 33|the ADA token|
+ |`AAVE` = 34|the AAVE token|
+ |`BERA` = 35|the BERA token|
+ |`IP` = 40|the IP token|
+ ??? info "[SpotBalance](/../../schemas/spot_balance)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |currency
`c` |Currency|True|The currency you hold a spot balance in|
+ |balance
`b` |string|True|This currency's balance in this trading account.|
+ |index_price
`ip` |string|True|The index price of this currency. (reported in `USD`)|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ |`XRP` = 15|the XRP token|
+ |`TRUMP` = 20|the TRUMP token|
+ |`SUI` = 21|the SUI token|
+ |`LINK` = 25|the LINK token|
+ |`JUP` = 27|the JUP token|
+ |`FARTCOIN` = 28|the FARTCOIN token|
+ |`ENA` = 29|the ENA token|
+ |`DOGE` = 30|the DOGE token|
+ |`ADA` = 33|the ADA token|
+ |`AAVE` = 34|the AAVE token|
+ |`BERA` = 35|the BERA token|
+ |`IP` = 40|the IP token|
+ ??? info "[Positions](/../../schemas/positions)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |sub_account_id
`sa` |string|True|The sub account ID that participated in the trade|
+ |instrument
`i` |string|True|The instrument being represented|
+ |size
`s` |string|True|The size of the position, expressed in base asset decimal units. Negative for short positions|
+ |notional
`n` |string|True|The notional value of the position, negative for short assets, expressed in quote asset decimal units|
+ |entry_price
`ep` |string|True|The entry price of the position, expressed in `9` decimals
Whenever increasing the size of a position, the entry price is updated to the new average entry price
`new_entry_price = (old_entry_price * old_size + trade_price * trade_size) / (old_size + trade_size)`|
+ |exit_price
`ep1` |string|True|The exit price of the position, expressed in `9` decimals
Whenever decreasing the size of a position, the exit price is updated to the new average exit price
`new_exit_price = (old_exit_price * old_exit_trade_size + trade_price * trade_size) / (old_exit_trade_size + trade_size)`|
+ |mark_price
`mp` |string|True|The mark price of the position, expressed in `9` decimals|
+ |unrealized_pnl
`up` |string|True|The unrealized PnL of the position, expressed in quote asset decimal units
`unrealized_pnl = (mark_price - entry_price) * size`|
+ |realized_pnl
`rp` |string|True|The realized PnL of the position, expressed in quote asset decimal units
`realized_pnl = (exit_price - entry_price) * exit_trade_size`|
+ |total_pnl
`tp` |string|True|The total PnL of the position, expressed in quote asset decimal units
`total_pnl = realized_pnl + unrealized_pnl`|
+ |roi
`r` |string|True|The ROI of the position, expressed as a percentage
`roi = (total_pnl / (entry_price * abs(size))) * 100^`|
+ |quote_index_price
`qi` |string|True|The index price of the quote currency. (reported in `USD`)|
+ |est_liquidation_price
`el` |string|True|The estimated liquidation price|
+ |leverage
`l` |string|True|The current leverage value for this position|
diff --git a/docs/grvt/schemas/api_list_aggregated_account_summary_request.md b/docs/grvt/schemas/api_list_aggregated_account_summary_request.md
new file mode 100644
index 0000000..4902964
--- /dev/null
+++ b/docs/grvt/schemas/api_list_aggregated_account_summary_request.md
@@ -0,0 +1,4 @@
+!!! info "[ApiListAggregatedAccountSummaryRequest](/../../schemas/api_list_aggregated_account_summary_request)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |main_account_ids
`ma` |[unknown]|True|The list of main account ID to request for|
diff --git a/docs/grvt/schemas/api_list_aggregated_account_summary_response.md b/docs/grvt/schemas/api_list_aggregated_account_summary_response.md
new file mode 100644
index 0000000..3b09a9d
--- /dev/null
+++ b/docs/grvt/schemas/api_list_aggregated_account_summary_response.md
@@ -0,0 +1,53 @@
+!!! info "[ApiListAggregatedAccountSummaryResponse](/../../schemas/api_list_aggregated_account_summary_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_summaries
`as` |[ApiAggregatedAccountSummaryResponse]|True|The list of aggregated account summaries of requested main accounts|
+ ??? info "[ApiAggregatedAccountSummaryResponse](/../../schemas/api_aggregated_account_summary_response)"
+ The aggregated account summary, that reports the total equity and spot balances of a funding (main) account, and its constituent trading (sub) accounts
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |AggregatedAccountSummary|True|The aggregated account summary|
+ ??? info "[AggregatedAccountSummary](/../../schemas/aggregated_account_summary)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |main_account_id
`ma` |string|True|The main account ID of the account to which the summary belongs|
+ |total_equity
`te` |string|True|Total equity of the main (+ sub) account, denominated in USD|
+ |spot_balances
`sb` |[SpotBalance]|True|The list of spot assets owned by this main (+ sub) account, and their balances|
+ ??? info "[SpotBalance](/../../schemas/spot_balance)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |currency
`c` |Currency|True|The currency you hold a spot balance in|
+ |balance
`b` |string|True|This currency's balance in this trading account.|
+ |index_price
`ip` |string|True|The index price of this currency. (reported in `USD`)|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ |`XRP` = 15|the XRP token|
+ |`TRUMP` = 20|the TRUMP token|
+ |`SUI` = 21|the SUI token|
+ |`LINK` = 25|the LINK token|
+ |`JUP` = 27|the JUP token|
+ |`FARTCOIN` = 28|the FARTCOIN token|
+ |`ENA` = 29|the ENA token|
+ |`DOGE` = 30|the DOGE token|
+ |`ADA` = 33|the ADA token|
+ |`AAVE` = 34|the AAVE token|
+ |`BERA` = 35|the BERA token|
+ |`IP` = 40|the IP token|
diff --git a/docs/grvt/schemas/api_mini_ticker_request.md b/docs/grvt/schemas/api_mini_ticker_request.md
new file mode 100644
index 0000000..e9b4cc6
--- /dev/null
+++ b/docs/grvt/schemas/api_mini_ticker_request.md
@@ -0,0 +1,6 @@
+!!! info "[ApiMiniTickerRequest](/../../schemas/api_mini_ticker_request)"
+ Retrieves a single mini ticker value for a single instrument. Please do not use this to repeatedly poll for data -- a websocket subscription is much more performant, and useful.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
diff --git a/docs/grvt/schemas/api_mini_ticker_response.md b/docs/grvt/schemas/api_mini_ticker_response.md
new file mode 100644
index 0000000..dd22cdc
--- /dev/null
+++ b/docs/grvt/schemas/api_mini_ticker_response.md
@@ -0,0 +1,18 @@
+!!! info "[ApiMiniTickerResponse](/../../schemas/api_mini_ticker_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |MiniTicker|True|The mini ticker matching the request asset|
+ ??? info "[MiniTicker](/../../schemas/mini_ticker)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|False
`None`|Time at which the event was emitted in unix nanoseconds|
+ |instrument
`i` |string|False
`None`|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |mark_price
`mp` |string|False
`None`|The mark price of the instrument, expressed in `9` decimals|
+ |index_price
`ip` |string|False
`None`|The index price of the instrument, expressed in `9` decimals|
+ |last_price
`lp` |string|False
`None`|The last traded price of the instrument (also close price), expressed in `9` decimals|
+ |last_size
`ls` |string|False
`None`|The number of assets traded in the last trade, expressed in base asset decimal units|
+ |mid_price
`mp1` |string|False
`None`|The mid price of the instrument, expressed in `9` decimals|
+ |best_bid_price
`bb` |string|False
`None`|The best bid price of the instrument, expressed in `9` decimals|
+ |best_bid_size
`bb1` |string|False
`None`|The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units|
+ |best_ask_price
`ba` |string|False
`None`|The best ask price of the instrument, expressed in `9` decimals|
+ |best_ask_size
`ba1` |string|False
`None`|The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units|
diff --git a/docs/grvt/schemas/api_open_orders_request.md b/docs/grvt/schemas/api_open_orders_request.md
new file mode 100644
index 0000000..5c95214
--- /dev/null
+++ b/docs/grvt/schemas/api_open_orders_request.md
@@ -0,0 +1,16 @@
+!!! info "[ApiOpenOrdersRequest](/../../schemas/api_open_orders_request)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The subaccount ID to filter by|
+ |kind
`k` |[Kind]|False
`all`|The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned|
+ |base
`b` |[string]|False
`all`|The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned|
+ |quote
`q` |[string]|False
`all`|The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned|
+ ??? info "[Kind](/../../schemas/kind)"
+ The list of asset kinds that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|the perpetual asset kind|
+ |`FUTURE` = 2|the future asset kind|
+ |`CALL` = 3|the call option asset kind|
+ |`PUT` = 4|the put option asset kind|
diff --git a/docs/grvt/schemas/api_open_orders_response.md b/docs/grvt/schemas/api_open_orders_response.md
new file mode 100644
index 0000000..688704b
--- /dev/null
+++ b/docs/grvt/schemas/api_open_orders_response.md
@@ -0,0 +1,160 @@
+!!! info "[ApiOpenOrdersResponse](/../../schemas/api_open_orders_response)"
+ Retrieves all open orders for the account. This may not match new orders in flight.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[Order]|True|The Open Orders matching the request filter|
+ ??? info "[Order](/../../schemas/order)"
+ Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.
GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.
This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.
Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.
All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.
This minimizes the amount of trust users have to offer to GRVT
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |order_id
`oi` |string|False
`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
+ |sub_account_id
`sa` |string|True|The subaccount initiating the order|
+ |is_market
`im` |boolean|False
`false`|If the order is a market order
Market Orders do not have a limit price, and are always executed according to the maker order price.
Market Orders must always be taker orders|
+ |time_in_force
`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:
- PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg
- FULL EXECUTION = AON / FOK - only allows full size execution on all legs
- TAKER ONLY = IOC / FOK - only allows taker orders
- MAKER OR TAKER = GTT / AON - allows maker or taker orders
Exchange only supports (GTT, IOC, FOK)
RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
+ |post_only
`po` |boolean|False
`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.
If False, Order can be either a maker or taker order. In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.
| | Must Fill All | Can Fill Partial |
| - | - | - |
| Must Be Taker | FOK + False | IOC + False |
| Can Be Either | AON + False | GTC + False |
| Must Be Maker | AON + True | GTC + True |
|
+ |reduce_only
`ro` |boolean|False
`false`|If True, Order must reduce the position size, or be cancelled|
+ |legs
`l` |[OrderLeg]|True|The legs present in this order
The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
+ |signature
`s` |Signature|True|The signature approving this order|
+ |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
+ |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client|
+ ??? info "[TimeInForce](/../../schemas/time_in_force)"
+ | | Must Fill All | Can Fill Partial |
+ | - | - | - |
+ | Must Fill Immediately | FOK | IOC |
+ | Can Fill Till Time | AON | GTC |
+
+
+ |Value| Description |
+ |-|-|
+ |`GOOD_TILL_TIME` = 1|GTT - Remains open until it is cancelled, or expired|
+ |`ALL_OR_NONE` = 2|AON - Either fill the whole order or none of it (Block Trades Only)|
+ |`IMMEDIATE_OR_CANCEL` = 3|IOC - Fill the order as much as possible, when hitting the orderbook. Then cancel it|
+ |`FILL_OR_KILL` = 4|FOK - Both AoN and IoC. Either fill the full order when hitting the orderbook, or cancel it|
+ |`RETAIL_PRICE_IMPROVEMENT` = 5|RPI - A GTT + PostOnly maker order, that can only be taken by non-algorithmic UI users.|
+ ??? info "[OrderLeg](/../../schemas/order_leg)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The instrument to trade in this leg|
+ |size
`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
+ |limit_price
`lp` |string|False
`0`|The limit price of the order leg, expressed in `9` decimals.
This is the number of quote currency units to pay/receive for this leg.
This should be `null/0` if the order is a market order|
+ |is_buying_asset
`ib` |boolean|True|Specifies if the order leg is a buy or sell|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
+ ??? info "[OrderMetadata](/../../schemas/order_metadata)"
+ Metadata fields are used to support Backend only operations. These operations are not trustless by nature.
Hence, fields in here are never signed, and is never transmitted to the smart contract.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
+ |create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|False
``|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ |close_position
`cp` |boolean|True|If True, the order will close the position when the trigger price is reached|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ |`MID` = 3|MID - Order is activated when the mid price reaches the trigger price|
+ |`MARK` = 4|MARK - Order is activated when the mark price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0||
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
+ ??? info "[OrderState](/../../schemas/order_state)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |status
`s` |OrderStatus|True|The status of the order|
+ |reject_reason
`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
+ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
+ |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
+ |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
+ |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs|
+ ??? info "[OrderStatus](/../../schemas/order_status)"
+ |Value| Description |
+ |-|-|
+ |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.|
+ |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.|
+ |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.|
+ |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.|
+ |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.|
+ ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
+ |`REDUCE_ONLY_LIMIT` = 31|the remaining order size was cancelled because it exceeded current position size|
+ |`CLIENT_REPLACE` = 32|the order was replaced by a client replace request|
+ |`DERISK_MUST_BE_IOC` = 33|the derisk order must be an IOC order|
+ |`DERISK_MUST_BE_REDUCE_ONLY` = 34|the derisk order must be a reduce-only order|
+ |`DERISK_NOT_SUPPORTED` = 35|derisk is not supported|
+ |`INVALID_ORDER_TYPE` = 36|the order type is invalid|
+ |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined|
diff --git a/docs/grvt/schemas/api_order_history_request.md b/docs/grvt/schemas/api_order_history_request.md
new file mode 100644
index 0000000..c5a2115
--- /dev/null
+++ b/docs/grvt/schemas/api_order_history_request.md
@@ -0,0 +1,22 @@
+!!! info "[ApiOrderHistoryRequest](/../../schemas/api_order_history_request)"
+ Retrieves the order history for the account.
Pagination works as follows:- We perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.
- The lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.
- If a `cursor` is provided, it will be used to fetch results from that point onwards.
- Pagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The subaccount ID to filter by|
+ |kind
`k` |[Kind]|False
`all`|The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned|
+ |base
`b` |[string]|False
`all`|The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned|
+ |quote
`q` |[string]|False
`all`|The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned|
+ |start_time
`st` |string|False
`0`|The start time to apply in nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned|
+ |end_time
`et` |string|False
`now()`|The end time to apply in nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned|
+ |limit
`l` |integer|False
`500`|The limit to query for. Defaults to 500; Max 1000|
+ |cursor
`c` |string|False
`''`|The cursor to indicate when to start the query from|
+ ??? info "[Kind](/../../schemas/kind)"
+ The list of asset kinds that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|the perpetual asset kind|
+ |`FUTURE` = 2|the future asset kind|
+ |`CALL` = 3|the call option asset kind|
+ |`PUT` = 4|the put option asset kind|
diff --git a/docs/grvt/schemas/api_order_history_response.md b/docs/grvt/schemas/api_order_history_response.md
new file mode 100644
index 0000000..1ea4cf2
--- /dev/null
+++ b/docs/grvt/schemas/api_order_history_response.md
@@ -0,0 +1,159 @@
+!!! info "[ApiOrderHistoryResponse](/../../schemas/api_order_history_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[Order]|True|The Open Orders matching the request filter|
+ |next
`n` |string|True|The cursor to indicate when to start the query from|
+ ??? info "[Order](/../../schemas/order)"
+ Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.
GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.
This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.
Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.
All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.
This minimizes the amount of trust users have to offer to GRVT
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |order_id
`oi` |string|False
`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
+ |sub_account_id
`sa` |string|True|The subaccount initiating the order|
+ |is_market
`im` |boolean|False
`false`|If the order is a market order
Market Orders do not have a limit price, and are always executed according to the maker order price.
Market Orders must always be taker orders|
+ |time_in_force
`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:
- PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg
- FULL EXECUTION = AON / FOK - only allows full size execution on all legs
- TAKER ONLY = IOC / FOK - only allows taker orders
- MAKER OR TAKER = GTT / AON - allows maker or taker orders
Exchange only supports (GTT, IOC, FOK)
RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
+ |post_only
`po` |boolean|False
`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.
If False, Order can be either a maker or taker order. In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.
| | Must Fill All | Can Fill Partial |
| - | - | - |
| Must Be Taker | FOK + False | IOC + False |
| Can Be Either | AON + False | GTC + False |
| Must Be Maker | AON + True | GTC + True |
|
+ |reduce_only
`ro` |boolean|False
`false`|If True, Order must reduce the position size, or be cancelled|
+ |legs
`l` |[OrderLeg]|True|The legs present in this order
The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
+ |signature
`s` |Signature|True|The signature approving this order|
+ |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
+ |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client|
+ ??? info "[TimeInForce](/../../schemas/time_in_force)"
+ | | Must Fill All | Can Fill Partial |
+ | - | - | - |
+ | Must Fill Immediately | FOK | IOC |
+ | Can Fill Till Time | AON | GTC |
+
+
+ |Value| Description |
+ |-|-|
+ |`GOOD_TILL_TIME` = 1|GTT - Remains open until it is cancelled, or expired|
+ |`ALL_OR_NONE` = 2|AON - Either fill the whole order or none of it (Block Trades Only)|
+ |`IMMEDIATE_OR_CANCEL` = 3|IOC - Fill the order as much as possible, when hitting the orderbook. Then cancel it|
+ |`FILL_OR_KILL` = 4|FOK - Both AoN and IoC. Either fill the full order when hitting the orderbook, or cancel it|
+ |`RETAIL_PRICE_IMPROVEMENT` = 5|RPI - A GTT + PostOnly maker order, that can only be taken by non-algorithmic UI users.|
+ ??? info "[OrderLeg](/../../schemas/order_leg)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The instrument to trade in this leg|
+ |size
`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
+ |limit_price
`lp` |string|False
`0`|The limit price of the order leg, expressed in `9` decimals.
This is the number of quote currency units to pay/receive for this leg.
This should be `null/0` if the order is a market order|
+ |is_buying_asset
`ib` |boolean|True|Specifies if the order leg is a buy or sell|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
+ ??? info "[OrderMetadata](/../../schemas/order_metadata)"
+ Metadata fields are used to support Backend only operations. These operations are not trustless by nature.
Hence, fields in here are never signed, and is never transmitted to the smart contract.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
+ |create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|False
``|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ |close_position
`cp` |boolean|True|If True, the order will close the position when the trigger price is reached|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ |`MID` = 3|MID - Order is activated when the mid price reaches the trigger price|
+ |`MARK` = 4|MARK - Order is activated when the mark price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0||
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
+ ??? info "[OrderState](/../../schemas/order_state)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |status
`s` |OrderStatus|True|The status of the order|
+ |reject_reason
`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
+ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
+ |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
+ |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
+ |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs|
+ ??? info "[OrderStatus](/../../schemas/order_status)"
+ |Value| Description |
+ |-|-|
+ |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.|
+ |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.|
+ |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.|
+ |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.|
+ |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.|
+ ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
+ |`REDUCE_ONLY_LIMIT` = 31|the remaining order size was cancelled because it exceeded current position size|
+ |`CLIENT_REPLACE` = 32|the order was replaced by a client replace request|
+ |`DERISK_MUST_BE_IOC` = 33|the derisk order must be an IOC order|
+ |`DERISK_MUST_BE_REDUCE_ONLY` = 34|the derisk order must be a reduce-only order|
+ |`DERISK_NOT_SUPPORTED` = 35|derisk is not supported|
+ |`INVALID_ORDER_TYPE` = 36|the order type is invalid|
+ |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined|
diff --git a/docs/grvt/schemas/api_order_state_request.md b/docs/grvt/schemas/api_order_state_request.md
new file mode 100644
index 0000000..56b8bef
--- /dev/null
+++ b/docs/grvt/schemas/api_order_state_request.md
@@ -0,0 +1,8 @@
+!!! info "[ApiOrderStateRequest](/../../schemas/api_order_state_request)"
+ Retrieve the order state for the account. Either `order_id` or `client_order_id` must be provided.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The subaccount ID to filter by|
+ |order_id
`oi` |string|False
`0`|Filter for `order_id`|
+ |client_order_id
`co` |string|False
`0`|Filter for `client_order_id`|
diff --git a/docs/grvt/schemas/api_order_state_response.md b/docs/grvt/schemas/api_order_state_response.md
new file mode 100644
index 0000000..05407ad
--- /dev/null
+++ b/docs/grvt/schemas/api_order_state_response.md
@@ -0,0 +1,55 @@
+!!! info "[ApiOrderStateResponse](/../../schemas/api_order_state_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |state
`s` |OrderState|True|The order state for the requested filter|
+ ??? info "[OrderState](/../../schemas/order_state)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |status
`s` |OrderStatus|True|The status of the order|
+ |reject_reason
`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
+ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
+ |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
+ |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
+ |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs|
+ ??? info "[OrderStatus](/../../schemas/order_status)"
+ |Value| Description |
+ |-|-|
+ |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.|
+ |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.|
+ |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.|
+ |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.|
+ |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.|
+ ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/docs/grvt/schemas/api_orderbook_levels_request.md b/docs/grvt/schemas/api_orderbook_levels_request.md
new file mode 100644
index 0000000..5c97be7
--- /dev/null
+++ b/docs/grvt/schemas/api_orderbook_levels_request.md
@@ -0,0 +1,7 @@
+!!! info "[ApiOrderbookLevelsRequest](/../../schemas/api_orderbook_levels_request)"
+ Retrieves aggregated price depth for a single instrument, with a maximum depth of 10 levels. Do not use this to poll for data -- a websocket subscription is much more performant, and useful.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |depth
`d` |integer|True|Depth of the order book to be retrieved (10, 50, 100, 500)|
diff --git a/docs/grvt/schemas/api_orderbook_levels_response.md b/docs/grvt/schemas/api_orderbook_levels_response.md
new file mode 100644
index 0000000..01ac8f2
--- /dev/null
+++ b/docs/grvt/schemas/api_orderbook_levels_response.md
@@ -0,0 +1,23 @@
+!!! info "[ApiOrderbookLevelsResponse](/../../schemas/api_orderbook_levels_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |OrderbookLevels|True|The orderbook levels objects matching the request asset|
+ ??? info "[OrderbookLevels](/../../schemas/orderbook_levels)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |bids
`b` |[OrderbookLevel]|True|The list of best bids up till query depth|
+ |asks
`a` |[OrderbookLevel]|True|The list of best asks up till query depth|
+ ??? info "[OrderbookLevel](/../../schemas/orderbook_level)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |price
`p` |string|True|The price of the level, expressed in `9` decimals|
+ |size
`s` |string|True|The number of assets offered, expressed in base asset decimal units|
+ |num_orders
`no` |integer|True|The number of open orders at this level|
+ ??? info "[OrderbookLevel](/../../schemas/orderbook_level)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |price
`p` |string|True|The price of the level, expressed in `9` decimals|
+ |size
`s` |string|True|The number of assets offered, expressed in base asset decimal units|
+ |num_orders
`no` |integer|True|The number of open orders at this level|
diff --git a/docs/grvt/schemas/api_positions_request.md b/docs/grvt/schemas/api_positions_request.md
new file mode 100644
index 0000000..2ee3093
--- /dev/null
+++ b/docs/grvt/schemas/api_positions_request.md
@@ -0,0 +1,18 @@
+!!! info "[ApiPositionsRequest](/../../schemas/api_positions_request)"
+ Query the positions of a sub account
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The sub account ID to request for|
+ |kind
`k` |[Kind]|False
`all`|The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned|
+ |base
`b` |[string]|False
`all`|The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned|
+ |quote
`q` |[string]|False
`all`|The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned|
+ ??? info "[Kind](/../../schemas/kind)"
+ The list of asset kinds that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|the perpetual asset kind|
+ |`FUTURE` = 2|the future asset kind|
+ |`CALL` = 3|the call option asset kind|
+ |`PUT` = 4|the put option asset kind|
diff --git a/docs/grvt/schemas/api_positions_response.md b/docs/grvt/schemas/api_positions_response.md
new file mode 100644
index 0000000..eeb43e5
--- /dev/null
+++ b/docs/grvt/schemas/api_positions_response.md
@@ -0,0 +1,22 @@
+!!! info "[ApiPositionsResponse](/../../schemas/api_positions_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[Positions]|True|The positions matching the request filter|
+ ??? info "[Positions](/../../schemas/positions)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |sub_account_id
`sa` |string|True|The sub account ID that participated in the trade|
+ |instrument
`i` |string|True|The instrument being represented|
+ |size
`s` |string|True|The size of the position, expressed in base asset decimal units. Negative for short positions|
+ |notional
`n` |string|True|The notional value of the position, negative for short assets, expressed in quote asset decimal units|
+ |entry_price
`ep` |string|True|The entry price of the position, expressed in `9` decimals
Whenever increasing the size of a position, the entry price is updated to the new average entry price
`new_entry_price = (old_entry_price * old_size + trade_price * trade_size) / (old_size + trade_size)`|
+ |exit_price
`ep1` |string|True|The exit price of the position, expressed in `9` decimals
Whenever decreasing the size of a position, the exit price is updated to the new average exit price
`new_exit_price = (old_exit_price * old_exit_trade_size + trade_price * trade_size) / (old_exit_trade_size + trade_size)`|
+ |mark_price
`mp` |string|True|The mark price of the position, expressed in `9` decimals|
+ |unrealized_pnl
`up` |string|True|The unrealized PnL of the position, expressed in quote asset decimal units
`unrealized_pnl = (mark_price - entry_price) * size`|
+ |realized_pnl
`rp` |string|True|The realized PnL of the position, expressed in quote asset decimal units
`realized_pnl = (exit_price - entry_price) * exit_trade_size`|
+ |total_pnl
`tp` |string|True|The total PnL of the position, expressed in quote asset decimal units
`total_pnl = realized_pnl + unrealized_pnl`|
+ |roi
`r` |string|True|The ROI of the position, expressed as a percentage
`roi = (total_pnl / (entry_price * abs(size))) * 100^`|
+ |quote_index_price
`qi` |string|True|The index price of the quote currency. (reported in `USD`)|
+ |est_liquidation_price
`el` |string|True|The estimated liquidation price|
+ |leverage
`l` |string|True|The current leverage value for this position|
diff --git a/docs/grvt/schemas/api_pre_deposit_check_request.md b/docs/grvt/schemas/api_pre_deposit_check_request.md
new file mode 100644
index 0000000..9b8471a
--- /dev/null
+++ b/docs/grvt/schemas/api_pre_deposit_check_request.md
@@ -0,0 +1,42 @@
+!!! info "[ApiPreDepositCheckRequest](/../../schemas/api_pre_deposit_check_request)"
+ UI only for bridge deposits through non native bridge. Currently only supports XY Finance bridge account.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |currency
`c` |Currency|True|The currency you hold the deposit in|
+ |bridge
`b` |BridgeType|True|The bridge type to conduct checks for|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ |`XRP` = 15|the XRP token|
+ |`TRUMP` = 20|the TRUMP token|
+ |`SUI` = 21|the SUI token|
+ |`LINK` = 25|the LINK token|
+ |`JUP` = 27|the JUP token|
+ |`FARTCOIN` = 28|the FARTCOIN token|
+ |`ENA` = 29|the ENA token|
+ |`DOGE` = 30|the DOGE token|
+ |`ADA` = 33|the ADA token|
+ |`AAVE` = 34|the AAVE token|
+ |`BERA` = 35|the BERA token|
+ |`IP` = 40|the IP token|
+ ??? info "[BridgeType](/../../schemas/bridge_type)"
+ |Value| Description |
+ |-|-|
+ |`XY` = 1|XY Bridge type|
diff --git a/docs/grvt/schemas/api_pre_deposit_check_response.md b/docs/grvt/schemas/api_pre_deposit_check_response.md
new file mode 100644
index 0000000..5777522
--- /dev/null
+++ b/docs/grvt/schemas/api_pre_deposit_check_response.md
@@ -0,0 +1,36 @@
+!!! info "[ApiPreDepositCheckResponse](/../../schemas/api_pre_deposit_check_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |max_deposit_limit
`md` |string|True|Max Deposit Limit reported for the Bridge Account reported in the currency balance|
+ |currency
`c` |Currency|True|The currency you hold the deposit in|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ |`XRP` = 15|the XRP token|
+ |`TRUMP` = 20|the TRUMP token|
+ |`SUI` = 21|the SUI token|
+ |`LINK` = 25|the LINK token|
+ |`JUP` = 27|the JUP token|
+ |`FARTCOIN` = 28|the FARTCOIN token|
+ |`ENA` = 29|the ENA token|
+ |`DOGE` = 30|the DOGE token|
+ |`ADA` = 33|the ADA token|
+ |`AAVE` = 34|the AAVE token|
+ |`BERA` = 35|the BERA token|
+ |`IP` = 40|the IP token|
diff --git a/docs/grvt/schemas/api_pre_order_check_request.md b/docs/grvt/schemas/api_pre_order_check_request.md
new file mode 100644
index 0000000..cb05d52
--- /dev/null
+++ b/docs/grvt/schemas/api_pre_order_check_request.md
@@ -0,0 +1,150 @@
+!!! info "[ApiPreOrderCheckRequest](/../../schemas/api_pre_order_check_request)"
+ Get pre-order check information for a new order
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The subaccount ID of orders to query|
+ |orders
`o` |[Order]|True|The order to do pre-order check|
+ ??? info "[Order](/../../schemas/order)"
+ Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.
GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.
This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.
Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.
All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.
This minimizes the amount of trust users have to offer to GRVT
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |order_id
`oi` |string|False
`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
+ |sub_account_id
`sa` |string|True|The subaccount initiating the order|
+ |is_market
`im` |boolean|False
`false`|If the order is a market order
Market Orders do not have a limit price, and are always executed according to the maker order price.
Market Orders must always be taker orders|
+ |time_in_force
`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:
- PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg
- FULL EXECUTION = AON / FOK - only allows full size execution on all legs
- TAKER ONLY = IOC / FOK - only allows taker orders
- MAKER OR TAKER = GTT / AON - allows maker or taker orders
Exchange only supports (GTT, IOC, FOK)
RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
+ |post_only
`po` |boolean|False
`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.
If False, Order can be either a maker or taker order. In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.
| | Must Fill All | Can Fill Partial |
| - | - | - |
| Must Be Taker | FOK + False | IOC + False |
| Can Be Either | AON + False | GTC + False |
| Must Be Maker | AON + True | GTC + True |
|
+ |reduce_only
`ro` |boolean|False
`false`|If True, Order must reduce the position size, or be cancelled|
+ |legs
`l` |[OrderLeg]|True|The legs present in this order
The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
+ |signature
`s` |Signature|True|The signature approving this order|
+ |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
+ |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client|
+ ??? info "[TimeInForce](/../../schemas/time_in_force)"
+ | | Must Fill All | Can Fill Partial |
+ | - | - | - |
+ | Must Fill Immediately | FOK | IOC |
+ | Can Fill Till Time | AON | GTC |
+
+
+ |Value| Description |
+ |-|-|
+ |`GOOD_TILL_TIME` = 1|GTT - Remains open until it is cancelled, or expired|
+ |`ALL_OR_NONE` = 2|AON - Either fill the whole order or none of it (Block Trades Only)|
+ |`IMMEDIATE_OR_CANCEL` = 3|IOC - Fill the order as much as possible, when hitting the orderbook. Then cancel it|
+ |`FILL_OR_KILL` = 4|FOK - Both AoN and IoC. Either fill the full order when hitting the orderbook, or cancel it|
+ ??? info "[OrderLeg](/../../schemas/order_leg)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The instrument to trade in this leg|
+ |size
`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
+ |limit_price
`lp` |string|False
`0`|The limit price of the order leg, expressed in `9` decimals.
This is the number of quote currency units to pay/receive for this leg.
This should be `null/0` if the order is a market order|
+ |is_buying_asset
`ib` |boolean|True|Specifies if the order leg is a buy or sell|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
+ ??? info "[OrderMetadata](/../../schemas/order_metadata)"
+ Metadata fields are used to support Backend only operations. These operations are not trustless by nature.
Hence, fields in here are never signed, and is never transmitted to the smart contract.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
+ |create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|False
``|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0||
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
+ ??? info "[OrderState](/../../schemas/order_state)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |status
`s` |OrderStatus|True|The status of the order|
+ |reject_reason
`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
+ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
+ |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
+ |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
+ |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs|
+ ??? info "[OrderStatus](/../../schemas/order_status)"
+ |Value| Description |
+ |-|-|
+ |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.|
+ |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.|
+ |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.|
+ |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.|
+ |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.|
+ ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/docs/grvt/schemas/api_pre_order_check_response.md b/docs/grvt/schemas/api_pre_order_check_response.md
new file mode 100644
index 0000000..b4afa37
--- /dev/null
+++ b/docs/grvt/schemas/api_pre_order_check_response.md
@@ -0,0 +1,49 @@
+!!! info "[ApiPreOrderCheckResponse](/../../schemas/api_pre_order_check_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |results
`r` |[PreOrderCheckResult]|True|Pre order check for each new order in the request|
+ ??? info "[PreOrderCheckResult](/../../schemas/pre_order_check_result)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |max_qty
`mq` |[AssetMaxQty]|True|The maximum quantity for each leg|
+ |margin_required
`mr` |string|True|The margin required for the order (reported in `settle_currency`)|
+ |order_valid
`ov` |boolean|True|Whether the order is valid|
+ |reason
`r` |string|True|The reason the order is invalid, if any|
+ |settle_currency
`sc` |Currency|True|The subAccount settle currency|
+ ??? info "[AssetMaxQty](/../../schemas/asset_max_qty)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |asset
`a` |string|True|The asset associated with the max quantity|
+ |max_buy_qty
`mb` |string|True|The maximum buy quantity|
+ |max_sell_qty
`ms` |string|True|The maximum sell quantity|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ |`XRP` = 15|the XRP token|
+ |`TRUMP` = 20|the TRUMP token|
+ |`SUI` = 21|the SUI token|
+ |`LINK` = 25|the LINK token|
+ |`JUP` = 27|the JUP token|
+ |`FARTCOIN` = 28|the FARTCOIN token|
+ |`ENA` = 29|the ENA token|
+ |`DOGE` = 30|the DOGE token|
+ |`ADA` = 33|the ADA token|
+ |`AAVE` = 34|the AAVE token|
+ |`BERA` = 35|the BERA token|
+ |`IP` = 40|the IP token|
diff --git a/docs/grvt/schemas/api_query_flat_referral_stat_request.md b/docs/grvt/schemas/api_query_flat_referral_stat_request.md
new file mode 100644
index 0000000..f3361f8
--- /dev/null
+++ b/docs/grvt/schemas/api_query_flat_referral_stat_request.md
@@ -0,0 +1,6 @@
+!!! info "[ApiQueryFlatReferralStatRequest](/../../schemas/api_query_flat_referral_stat_request)"
+ Query flat referral stats
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id to get referral stats|
diff --git a/docs/grvt/schemas/api_query_flat_referral_stat_response.md b/docs/grvt/schemas/api_query_flat_referral_stat_response.md
new file mode 100644
index 0000000..57e80c0
--- /dev/null
+++ b/docs/grvt/schemas/api_query_flat_referral_stat_response.md
@@ -0,0 +1,5 @@
+!!! info "[ApiQueryFlatReferralStatResponse](/../../schemas/api_query_flat_referral_stat_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |direct_invite_count
`di` |integer|True|Direct invite count|
+ |indirect_invite_count
`ii` |integer|True|Indirect invite count|
diff --git a/docs/grvt/schemas/api_query_trading_performance_request.md b/docs/grvt/schemas/api_query_trading_performance_request.md
new file mode 100644
index 0000000..33a192f
--- /dev/null
+++ b/docs/grvt/schemas/api_query_trading_performance_request.md
@@ -0,0 +1,7 @@
+!!! info "[ApiQueryTradingPerformanceRequest](/../../schemas/api_query_trading_performance_request)"
+ Request to retrieve the trading volume
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|False
`all`|Optional: The subaccount ID to filter by|
+ |asset
`a` |unknown|True|The asset to filter by|
diff --git a/docs/grvt/schemas/api_query_trading_performance_response.md b/docs/grvt/schemas/api_query_trading_performance_response.md
new file mode 100644
index 0000000..7facd67
--- /dev/null
+++ b/docs/grvt/schemas/api_query_trading_performance_response.md
@@ -0,0 +1,7 @@
+!!! info "[ApiQueryTradingPerformanceResponse](/../../schemas/api_query_trading_performance_response)"
+ Response to retrieve the trading volume
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trading_volume
`tv` |string|True|Trading volume in USDT|
+ |realized_pnl
`rp` |string|True|Realized PnL in USDT|
diff --git a/docs/grvt/schemas/api_query_vault_manager_investor_history_request.md b/docs/grvt/schemas/api_query_vault_manager_investor_history_request.md
new file mode 100644
index 0000000..881dbf0
--- /dev/null
+++ b/docs/grvt/schemas/api_query_vault_manager_investor_history_request.md
@@ -0,0 +1,7 @@
+!!! info "[ApiQueryVaultManagerInvestorHistoryRequest](/../../schemas/api_query_vault_manager_investor_history_request)"
+ Request for the manager to retrieve the vault investor history for their vault
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |vault_id
`vi` |string|True|The unique identifier of the vault to filter by|
+ |only_own_investments
`oo` |boolean|True|Whether to only return investments made by the manager|
diff --git a/docs/grvt/schemas/api_query_vault_manager_investor_history_response.md b/docs/grvt/schemas/api_query_vault_manager_investor_history_response.md
new file mode 100644
index 0000000..0669290
--- /dev/null
+++ b/docs/grvt/schemas/api_query_vault_manager_investor_history_response.md
@@ -0,0 +1,26 @@
+!!! info "[ApiQueryVaultManagerInvestorHistoryResponse](/../../schemas/api_query_vault_manager_investor_history_response)"
+ Response to retrieve the vault summary for a given vault
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[ApiVaultInvestorHistory]|True|The list of vault investor history belong to the manager|
+ ??? info "[ApiVaultInvestorHistory](/../../schemas/api_vault_investor_history)"
+ The vault investor history returned by the service to client
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |off_chain_account_id
`oc` |string|True|The off chain account id of the investor, only visible to the manager|
+ |vault_id
`vi` |string|True|The unique identifier of the vault.|
+ |type
`t` |VaultInvestorAction|True|The type of transaction that occurred. List of types: vaultInvest, vaultBurnLpToken, vaultRedeem|
+ |price
`p` |string|True|The price of the vault LP tokens at the time of the event.|
+ |size
`s` |string|True|The amount of Vault LP tokens invested or redeemed.|
+ |realized_pnl
`rp` |string|True|The realized PnL of the vault.|
+ |performance_fee
`pf` |string|True|The performance fee of the vault.|
+ ??? info "[VaultInvestorAction](/../../schemas/vault_investor_action)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0||
+ |`VAULT_INVEST` = 1||
+ |`VAULT_BURN_LP_TOKEN` = 2||
+ |`VAULT_REDEEM` = 3||
diff --git a/docs/grvt/schemas/api_resolve_epoch_ecosystem_metric_response.md b/docs/grvt/schemas/api_resolve_epoch_ecosystem_metric_response.md
new file mode 100644
index 0000000..6c408f5
--- /dev/null
+++ b/docs/grvt/schemas/api_resolve_epoch_ecosystem_metric_response.md
@@ -0,0 +1,6 @@
+!!! info "[ApiResolveEpochEcosystemMetricResponse](/../../schemas/api_resolve_epoch_ecosystem_metric_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |epoch_name
`en` |string|True|The name of the epoch|
+ |point
`p` |integer|True|Ecosystem points up to the most recently calculated time within this epoch|
+ |last_calculated_time
`lc` |string|True|The time in unix nanoseconds when the ecosystem points were last calculated|
diff --git a/docs/grvt/schemas/api_set_derisk_to_maintenance_margin_ratio_request.md b/docs/grvt/schemas/api_set_derisk_to_maintenance_margin_ratio_request.md
new file mode 100644
index 0000000..9cbf79e
--- /dev/null
+++ b/docs/grvt/schemas/api_set_derisk_to_maintenance_margin_ratio_request.md
@@ -0,0 +1,17 @@
+!!! info "[ApiSetDeriskToMaintenanceMarginRatioRequest](/../../schemas/api_set_derisk_to_maintenance_margin_ratio_request)"
+ The request to set the derisk margin to maintenance margin ratio of a sub account
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The sub account ID to set the leverage for|
+ |ratio
`r` |string|True|The derisk margin to maintenance margin ratio of this sub account|
+ |signature
`s` |Signature|True|The signature of this operation|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
diff --git a/docs/grvt/schemas/api_set_derisk_to_maintenance_margin_ratio_response.md b/docs/grvt/schemas/api_set_derisk_to_maintenance_margin_ratio_response.md
new file mode 100644
index 0000000..d6de8e6
--- /dev/null
+++ b/docs/grvt/schemas/api_set_derisk_to_maintenance_margin_ratio_response.md
@@ -0,0 +1,6 @@
+!!! info "[ApiSetDeriskToMaintenanceMarginRatioResponse](/../../schemas/api_set_derisk_to_maintenance_margin_ratio_response)"
+ The response to set the derisk margin to maintenance margin ratio of a sub account
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |success
`s` |boolean|True|Whether the derisk margin to maintenance margin ratio was set successfully|
diff --git a/docs/grvt/schemas/api_set_initial_leverage_request.md b/docs/grvt/schemas/api_set_initial_leverage_request.md
new file mode 100644
index 0000000..10e6027
--- /dev/null
+++ b/docs/grvt/schemas/api_set_initial_leverage_request.md
@@ -0,0 +1,8 @@
+!!! info "[ApiSetInitialLeverageRequest](/../../schemas/api_set_initial_leverage_request)"
+ The request to set the initial leverage of a sub account
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The sub account ID to set the leverage for|
+ |instrument
`i` |string|True|The instrument to set the leverage for|
+ |leverage
`l` |string|True|The leverage to set for the sub account|
diff --git a/docs/grvt/schemas/api_set_initial_leverage_response.md b/docs/grvt/schemas/api_set_initial_leverage_response.md
new file mode 100644
index 0000000..415d0cc
--- /dev/null
+++ b/docs/grvt/schemas/api_set_initial_leverage_response.md
@@ -0,0 +1,6 @@
+!!! info "[ApiSetInitialLeverageResponse](/../../schemas/api_set_initial_leverage_response)"
+ The response to set the initial leverage of a sub account
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |success
`s` |boolean|True|Whether the leverage was set successfully|
diff --git a/docs/grvt/schemas/api_settlement_price.md b/docs/grvt/schemas/api_settlement_price.md
new file mode 100644
index 0000000..d71e4de
--- /dev/null
+++ b/docs/grvt/schemas/api_settlement_price.md
@@ -0,0 +1,69 @@
+!!! info "[APISettlementPrice](/../../schemas/api_settlement_price)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |base
`b` |Currency|True|The base currency of the settlement price|
+ |quote
`q` |Currency|True|The quote currency of the settlement price|
+ |settlement_time
`st` |string|True|The settlement timestamp of the settlement price, expressed in unix nanoseconds|
+ |settlement_price
`sp` |string|True|The settlement price, expressed in `9` decimals|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ |`XRP` = 15|the XRP token|
+ |`TRUMP` = 20|the TRUMP token|
+ |`SUI` = 21|the SUI token|
+ |`LINK` = 25|the LINK token|
+ |`JUP` = 27|the JUP token|
+ |`FARTCOIN` = 28|the FARTCOIN token|
+ |`ENA` = 29|the ENA token|
+ |`DOGE` = 30|the DOGE token|
+ |`ADA` = 33|the ADA token|
+ |`AAVE` = 34|the AAVE token|
+ |`BERA` = 35|the BERA token|
+ |`IP` = 40|the IP token|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ |`XRP` = 15|the XRP token|
+ |`TRUMP` = 20|the TRUMP token|
+ |`SUI` = 21|the SUI token|
+ |`LINK` = 25|the LINK token|
+ |`JUP` = 27|the JUP token|
+ |`FARTCOIN` = 28|the FARTCOIN token|
+ |`ENA` = 29|the ENA token|
+ |`DOGE` = 30|the DOGE token|
+ |`ADA` = 33|the ADA token|
+ |`AAVE` = 34|the AAVE token|
+ |`BERA` = 35|the BERA token|
+ |`IP` = 40|the IP token|
diff --git a/docs/grvt/schemas/api_settlement_price_request.md b/docs/grvt/schemas/api_settlement_price_request.md
new file mode 100644
index 0000000..22a7633
--- /dev/null
+++ b/docs/grvt/schemas/api_settlement_price_request.md
@@ -0,0 +1,73 @@
+!!! info "[ApiSettlementPriceRequest](/../../schemas/api_settlement_price_request)"
+ Lookup the historical settlement price of various pairs.
Pagination works as follows:- We perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.
- The lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.
- If a `cursor` is provided, it will be used to fetch results from that point onwards.
- Pagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |base
`b` |Currency|True|The base currency to select|
+ |quote
`q` |Currency|True|The quote currency to select|
+ |start_time
`st` |string|False
`0`|Start time of settlement price in unix nanoseconds|
+ |end_time
`et` |string|False
`now()`|End time of settlement price in unix nanoseconds|
+ |limit
`l` |integer|False
`30`|The limit to query for. Defaults to 500; Max 1000|
+ |cursor
`c` |string|False
`''`|The cursor to indicate when to start the query from|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ |`XRP` = 15|the XRP token|
+ |`TRUMP` = 20|the TRUMP token|
+ |`SUI` = 21|the SUI token|
+ |`LINK` = 25|the LINK token|
+ |`JUP` = 27|the JUP token|
+ |`FARTCOIN` = 28|the FARTCOIN token|
+ |`ENA` = 29|the ENA token|
+ |`DOGE` = 30|the DOGE token|
+ |`ADA` = 33|the ADA token|
+ |`AAVE` = 34|the AAVE token|
+ |`BERA` = 35|the BERA token|
+ |`IP` = 40|the IP token|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ |`XRP` = 15|the XRP token|
+ |`TRUMP` = 20|the TRUMP token|
+ |`SUI` = 21|the SUI token|
+ |`LINK` = 25|the LINK token|
+ |`JUP` = 27|the JUP token|
+ |`FARTCOIN` = 28|the FARTCOIN token|
+ |`ENA` = 29|the ENA token|
+ |`DOGE` = 30|the DOGE token|
+ |`ADA` = 33|the ADA token|
+ |`AAVE` = 34|the AAVE token|
+ |`BERA` = 35|the BERA token|
+ |`IP` = 40|the IP token|
diff --git a/docs/grvt/schemas/api_settlement_price_response.md b/docs/grvt/schemas/api_settlement_price_response.md
new file mode 100644
index 0000000..f1628b9
--- /dev/null
+++ b/docs/grvt/schemas/api_settlement_price_response.md
@@ -0,0 +1,74 @@
+!!! info "[ApiSettlementPriceResponse](/../../schemas/api_settlement_price_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[APISettlementPrice]|True|The funding rate result set for given interval|
+ |next
`n` |string|False
`''`|The cursor to indicate when to start the next query from|
+ ??? info "[APISettlementPrice](/../../schemas/api_settlement_price)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |base
`b` |Currency|True|The base currency of the settlement price|
+ |quote
`q` |Currency|True|The quote currency of the settlement price|
+ |settlement_time
`st` |string|True|The settlement timestamp of the settlement price, expressed in unix nanoseconds|
+ |settlement_price
`sp` |string|True|The settlement price, expressed in `9` decimals|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ |`XRP` = 15|the XRP token|
+ |`TRUMP` = 20|the TRUMP token|
+ |`SUI` = 21|the SUI token|
+ |`LINK` = 25|the LINK token|
+ |`JUP` = 27|the JUP token|
+ |`FARTCOIN` = 28|the FARTCOIN token|
+ |`ENA` = 29|the ENA token|
+ |`DOGE` = 30|the DOGE token|
+ |`ADA` = 33|the ADA token|
+ |`AAVE` = 34|the AAVE token|
+ |`BERA` = 35|the BERA token|
+ |`IP` = 40|the IP token|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ |`XRP` = 15|the XRP token|
+ |`TRUMP` = 20|the TRUMP token|
+ |`SUI` = 21|the SUI token|
+ |`LINK` = 25|the LINK token|
+ |`JUP` = 27|the JUP token|
+ |`FARTCOIN` = 28|the FARTCOIN token|
+ |`ENA` = 29|the ENA token|
+ |`DOGE` = 30|the DOGE token|
+ |`ADA` = 33|the ADA token|
+ |`AAVE` = 34|the AAVE token|
+ |`BERA` = 35|the BERA token|
+ |`IP` = 40|the IP token|
diff --git a/docs/grvt/schemas/api_socialized_loss_status_response.md b/docs/grvt/schemas/api_socialized_loss_status_response.md
new file mode 100644
index 0000000..a57e0bc
--- /dev/null
+++ b/docs/grvt/schemas/api_socialized_loss_status_response.md
@@ -0,0 +1,7 @@
+!!! info "[ApiSocializedLossStatusResponse](/../../schemas/api_socialized_loss_status_response)"
+ The socialized loss status.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |is_active
`ia` |boolean|True|Whether the socialized loss is active|
+ |haircut_ratio
`hr` |string|True|The socialized loss haircut ratio in centi-beeps|
diff --git a/docs/grvt/schemas/api_sub_account_history_request.md b/docs/grvt/schemas/api_sub_account_history_request.md
new file mode 100644
index 0000000..8162539
--- /dev/null
+++ b/docs/grvt/schemas/api_sub_account_history_request.md
@@ -0,0 +1,10 @@
+!!! info "[ApiSubAccountHistoryRequest](/../../schemas/api_sub_account_history_request)"
+ The request to get the history of a sub account
SubAccount Summary values are snapshotted once every hour
No snapshots are taken if the sub account has no activity in the hourly window
History is preserved only for the last 30 days
Pagination works as follows:- We perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.
- The lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.
- If a `cursor` is provided, it will be used to fetch results from that point onwards.
- Pagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The sub account ID to request for|
+ |start_time
`st` |string|False
`0`|Start time of sub account history in unix nanoseconds|
+ |end_time
`et` |string|False
`now()`|End time of sub account history in unix nanoseconds|
+ |limit
`l` |integer|False
`500`|The limit to query for. Defaults to 500; Max 1000|
+ |cursor
`c` |string|False
`''`|The cursor to indicate when to start the next query from|
diff --git a/docs/grvt/schemas/api_sub_account_history_response.md b/docs/grvt/schemas/api_sub_account_history_response.md
new file mode 100644
index 0000000..ae55d3d
--- /dev/null
+++ b/docs/grvt/schemas/api_sub_account_history_response.md
@@ -0,0 +1,53 @@
+!!! info "[ApiSubAccountHistoryResponse](/../../schemas/api_sub_account_history_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[SubAccount]|True|The sub account history matching the request sub account|
+ |next
`n` |string|True|The cursor to indicate when to start the next query from|
+ ??? info "[SubAccount](/../../schemas/sub_account)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |sub_account_id
`sa` |string|True|The sub account ID this entry refers to|
+ |margin_type
`mt` |MarginType|True|The type of margin algorithm this subaccount uses|
+ |settle_currency
`sc` |string|True|The settlement, margin, and reporting currency of this account.
This subaccount can only open positions quoted in this currency
In the future, when users select a Multi-Currency Margin Type, this will be USD
All other assets are converted to this currency for the purpose of calculating margin|
+ |unrealized_pnl
`up` |string|True|The total unrealized PnL of all positions owned by this subaccount, denominated in quote currency decimal units.
`unrealized_pnl = sum(position.unrealized_pnl * position.quote_index_price) / settle_index_price`|
+ |total_equity
`te` |string|True|The notional value of your account if all positions are closed, excluding trading fees (reported in `settle_currency`).
`total_equity = sum(spot_balance.balance * spot_balance.index_price) / settle_index_price + unrealized_pnl`|
+ |initial_margin
`im` |string|True|The `total_equity` required to open positions in the account (reported in `settle_currency`).
Computation is different depending on account's `margin_type`|
+ |maintenance_margin
`mm` |string|True|The `total_equity` required to avoid liquidation of positions in the account (reported in `settle_currency`).
Computation is different depending on account's `margin_type`|
+ |available_balance
`ab` |string|True|The notional value available to transfer out of the trading account into the funding account (reported in `settle_currency`).
`available_balance = total_equity - initial_margin - min(unrealized_pnl, 0)`|
+ |spot_balances
`sb` |[SpotBalance]|True|The list of spot assets owned by this sub account, and their balances|
+ |positions
`p` |[Positions]|True|The list of positions owned by this sub account|
+ |settle_index_price
`si` |string|True|The index price of the settle currency. (reported in `USD`)|
+ |is_vault
`iv` |boolean|False
`None`|Whether this sub account is a vault|
+ |vault_im_additions
`vi` |string|False
`None`|Total amount of IM (reported in `settle_currency`) deducted from the vault due to redemptions nearing the end of their redemption period|
+ |derisk_margin
`dm` |string|True|The derisk margin of this sub account|
+ |derisk_to_maintenance_margin_ratio
`dt` |string|True|The derisk margin to maintenance margin ratio of this sub account|
+ ??? info "[MarginType](/../../schemas/margin_type)"
+ |Value| Description |
+ |-|-|
+ |`SIMPLE_CROSS_MARGIN` = 2|Simple Cross Margin Mode: all assets have a predictable margin impact, the whole subaccount shares a single margin|
+ |`PORTFOLIO_CROSS_MARGIN` = 3|Portfolio Cross Margin Mode: asset margin impact is analysed on portfolio level, the whole subaccount shares a single margin|
+ ??? info "[SpotBalance](/../../schemas/spot_balance)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |currency
`c` |string|True|The currency you hold a spot balance in|
+ |balance
`b` |string|True|This currency's balance in this trading account.|
+ |index_price
`ip` |string|True|The index price of this currency. (reported in `USD`)|
+ ??? info "[Positions](/../../schemas/positions)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |sub_account_id
`sa` |string|True|The sub account ID that participated in the trade|
+ |instrument
`i` |string|True|The instrument being represented|
+ |size
`s` |string|True|The size of the position, expressed in base asset decimal units. Negative for short positions|
+ |notional
`n` |string|True|The notional value of the position, negative for short assets, expressed in quote asset decimal units|
+ |entry_price
`ep` |string|True|The entry price of the position, expressed in `9` decimals
Whenever increasing the size of a position, the entry price is updated to the new average entry price
`new_entry_price = (old_entry_price * old_size + trade_price * trade_size) / (old_size + trade_size)`|
+ |exit_price
`ep1` |string|True|The exit price of the position, expressed in `9` decimals
Whenever decreasing the size of a position, the exit price is updated to the new average exit price
`new_exit_price = (old_exit_price * old_exit_trade_size + trade_price * trade_size) / (old_exit_trade_size + trade_size)`|
+ |mark_price
`mp` |string|True|The mark price of the position, expressed in `9` decimals|
+ |unrealized_pnl
`up` |string|True|The unrealized PnL of the position, expressed in quote asset decimal units
`unrealized_pnl = (mark_price - entry_price) * size`|
+ |realized_pnl
`rp` |string|True|The realized PnL of the position, expressed in quote asset decimal units
`realized_pnl = (exit_price - entry_price) * exit_trade_size`|
+ |total_pnl
`tp` |string|True|The total PnL of the position, expressed in quote asset decimal units
`total_pnl = realized_pnl + unrealized_pnl`|
+ |roi
`r` |string|True|The ROI of the position, expressed as a percentage
`roi = (total_pnl / (entry_price * abs(size))) * 100^`|
+ |quote_index_price
`qi` |string|True|The index price of the quote currency. (reported in `USD`)|
+ |est_liquidation_price
`el` |string|True|The estimated liquidation price|
+ |leverage
`l` |string|True|The current leverage value for this position|
diff --git a/docs/grvt/schemas/api_sub_account_summary_request.md b/docs/grvt/schemas/api_sub_account_summary_request.md
new file mode 100644
index 0000000..870e4f3
--- /dev/null
+++ b/docs/grvt/schemas/api_sub_account_summary_request.md
@@ -0,0 +1,4 @@
+!!! info "[ApiSubAccountSummaryRequest](/../../schemas/api_sub_account_summary_request)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The subaccount ID to filter by|
diff --git a/docs/grvt/schemas/api_sub_account_summary_response.md b/docs/grvt/schemas/api_sub_account_summary_response.md
new file mode 100644
index 0000000..e7b3750
--- /dev/null
+++ b/docs/grvt/schemas/api_sub_account_summary_response.md
@@ -0,0 +1,54 @@
+!!! info "[ApiSubAccountSummaryResponse](/../../schemas/api_sub_account_summary_response)"
+ Query for sub-account details, including base currency balance, all derivative positions, margin levels, and P&L.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |SubAccount|True|The sub account matching the request sub account|
+ ??? info "[SubAccount](/../../schemas/sub_account)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |sub_account_id
`sa` |string|True|The sub account ID this entry refers to|
+ |margin_type
`mt` |MarginType|True|The type of margin algorithm this subaccount uses|
+ |settle_currency
`sc` |string|True|The settlement, margin, and reporting currency of this account.
This subaccount can only open positions quoted in this currency
In the future, when users select a Multi-Currency Margin Type, this will be USD
All other assets are converted to this currency for the purpose of calculating margin|
+ |unrealized_pnl
`up` |string|True|The total unrealized PnL of all positions owned by this subaccount, denominated in quote currency decimal units.
`unrealized_pnl = sum(position.unrealized_pnl * position.quote_index_price) / settle_index_price`|
+ |total_equity
`te` |string|True|The notional value of your account if all positions are closed, excluding trading fees (reported in `settle_currency`).
`total_equity = sum(spot_balance.balance * spot_balance.index_price) / settle_index_price + unrealized_pnl`|
+ |initial_margin
`im` |string|True|The `total_equity` required to open positions in the account (reported in `settle_currency`).
Computation is different depending on account's `margin_type`|
+ |maintenance_margin
`mm` |string|True|The `total_equity` required to avoid liquidation of positions in the account (reported in `settle_currency`).
Computation is different depending on account's `margin_type`|
+ |available_balance
`ab` |string|True|The notional value available to transfer out of the trading account into the funding account (reported in `settle_currency`).
`available_balance = total_equity - initial_margin - min(unrealized_pnl, 0)`|
+ |spot_balances
`sb` |[SpotBalance]|True|The list of spot assets owned by this sub account, and their balances|
+ |positions
`p` |[Positions]|True|The list of positions owned by this sub account|
+ |settle_index_price
`si` |string|True|The index price of the settle currency. (reported in `USD`)|
+ |is_vault
`iv` |boolean|False
`None`|Whether this sub account is a vault|
+ |vault_im_additions
`vi` |string|False
`None`|Total amount of IM (reported in `settle_currency`) deducted from the vault due to redemptions nearing the end of their redemption period|
+ |derisk_margin
`dm` |string|True|The derisk margin of this sub account|
+ |derisk_to_maintenance_margin_ratio
`dt` |string|True|The derisk margin to maintenance margin ratio of this sub account|
+ ??? info "[MarginType](/../../schemas/margin_type)"
+ |Value| Description |
+ |-|-|
+ |`SIMPLE_CROSS_MARGIN` = 2|Simple Cross Margin Mode: all assets have a predictable margin impact, the whole subaccount shares a single margin|
+ |`PORTFOLIO_CROSS_MARGIN` = 3|Portfolio Cross Margin Mode: asset margin impact is analysed on portfolio level, the whole subaccount shares a single margin|
+ ??? info "[SpotBalance](/../../schemas/spot_balance)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |currency
`c` |string|True|The currency you hold a spot balance in|
+ |balance
`b` |string|True|This currency's balance in this trading account.|
+ |index_price
`ip` |string|True|The index price of this currency. (reported in `USD`)|
+ ??? info "[Positions](/../../schemas/positions)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |sub_account_id
`sa` |string|True|The sub account ID that participated in the trade|
+ |instrument
`i` |string|True|The instrument being represented|
+ |size
`s` |string|True|The size of the position, expressed in base asset decimal units. Negative for short positions|
+ |notional
`n` |string|True|The notional value of the position, negative for short assets, expressed in quote asset decimal units|
+ |entry_price
`ep` |string|True|The entry price of the position, expressed in `9` decimals
Whenever increasing the size of a position, the entry price is updated to the new average entry price
`new_entry_price = (old_entry_price * old_size + trade_price * trade_size) / (old_size + trade_size)`|
+ |exit_price
`ep1` |string|True|The exit price of the position, expressed in `9` decimals
Whenever decreasing the size of a position, the exit price is updated to the new average exit price
`new_exit_price = (old_exit_price * old_exit_trade_size + trade_price * trade_size) / (old_exit_trade_size + trade_size)`|
+ |mark_price
`mp` |string|True|The mark price of the position, expressed in `9` decimals|
+ |unrealized_pnl
`up` |string|True|The unrealized PnL of the position, expressed in quote asset decimal units
`unrealized_pnl = (mark_price - entry_price) * size`|
+ |realized_pnl
`rp` |string|True|The realized PnL of the position, expressed in quote asset decimal units
`realized_pnl = (exit_price - entry_price) * exit_trade_size`|
+ |total_pnl
`tp` |string|True|The total PnL of the position, expressed in quote asset decimal units
`total_pnl = realized_pnl + unrealized_pnl`|
+ |roi
`r` |string|True|The ROI of the position, expressed as a percentage
`roi = (total_pnl / (entry_price * abs(size))) * 100^`|
+ |quote_index_price
`qi` |string|True|The index price of the quote currency. (reported in `USD`)|
+ |est_liquidation_price
`el` |string|True|The estimated liquidation price|
+ |leverage
`l` |string|True|The current leverage value for this position|
diff --git a/docs/grvt/schemas/api_sub_account_trade_aggregation_request.md b/docs/grvt/schemas/api_sub_account_trade_aggregation_request.md
new file mode 100644
index 0000000..e627924
--- /dev/null
+++ b/docs/grvt/schemas/api_sub_account_trade_aggregation_request.md
@@ -0,0 +1,22 @@
+!!! info "[ApiSubAccountTradeAggregationRequest](/../../schemas/api_sub_account_trade_aggregation_request)"
+ startTime are optional parameters. The semantics of these parameters are as follows:
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |limit
`l` |integer|True|Optional. The limit of the number of results to return|
+ |interval
`i` |SubAccountTradeInterval|True|The interval of each sub account trade|
+ |sub_account_i_ds
`sa` |[string]|True|The list of sub account ids to query|
+ |start_interval
`si` |string|True|Optional. The starting time in unix nanoseconds of a specific interval to query|
+ |start_time
`st` |string|False
`0`|Optional. Start time in unix nanoseconds|
+ |end_time
`et` |string|False
`now()`|Optional. End time in unix nanoseconds|
+ |is_maker
`im` |boolean|True|Filter on the maker of the trade|
+ |is_taker
`it` |boolean|True|Filter on the taker of the trade|
+ |cursor
`c` |string|False
``|The cursor to indicate when to start the next query from|
+ |group_by_signer
`gb` |boolean|True|Whether to group trades by signer per sub account|
+ ??? info "[SubAccountTradeInterval](/../../schemas/sub_account_trade_interval)"
+ |Value| Description |
+ |-|-|
+ |`SAT_1_MO` = 1|1 month|
+ |`SAT_1_D` = 2|1 day|
+ |`SAT_1_H` = 3|1 hour|
+ |`SAT_4_H` = 4|4 hour|
diff --git a/docs/grvt/schemas/api_sub_account_trade_aggregation_response.md b/docs/grvt/schemas/api_sub_account_trade_aggregation_response.md
new file mode 100644
index 0000000..afda476
--- /dev/null
+++ b/docs/grvt/schemas/api_sub_account_trade_aggregation_response.md
@@ -0,0 +1,17 @@
+!!! info "[ApiSubAccountTradeAggregationResponse](/../../schemas/api_sub_account_trade_aggregation_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[SubAccountTradeAggregation]|True|The sub account trade aggregation result set for given interval|
+ |next
`n` |string|False
`''`|The cursor to indicate when to start the next query from|
+ ??? info "[SubAccountTradeAggregation](/../../schemas/sub_account_trade_aggregation)"
+ Similar to sub-account trade, but not divided by individual assets.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The sub account id|
+ |total_fee
`tf` |string|True|Total fee paid|
+ |total_trade_volume
`tt` |string|True|Total volume traded|
+ |num_traded
`nt` |string|True|Number of trades|
+ |positive_fee
`pf` |string|True|Total positive fee paid by user|
+ |signer
`s` |string|True|The signer of the trade|
+ |realized_pnl
`rp` |string|True|Realized PnL|
diff --git a/docs/grvt/schemas/api_sub_account_trade_request.md b/docs/grvt/schemas/api_sub_account_trade_request.md
new file mode 100644
index 0000000..216932d
--- /dev/null
+++ b/docs/grvt/schemas/api_sub_account_trade_request.md
@@ -0,0 +1,16 @@
+!!! info "[ApiSubAccountTradeRequest](/../../schemas/api_sub_account_trade_request)"
+ startTime are optional parameters. The semantics of these parameters are as follows:
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |interval
`i1` |SubAccountTradeInterval|True|The interval of each sub account trade|
+ |sub_account_i_ds
`sa` |[string]|True|The list of sub account ids to query|
+ |start_interval
`si` |string|True|Optional. The starting time in unix nanoseconds of a specific interval to query|
+ |start_time
`st` |string|False
`0`|Optional. Start time in unix nanoseconds|
+ |end_time
`et` |string|False
`now()`|Optional. End time in unix nanoseconds|
+ ??? info "[SubAccountTradeInterval](/../../schemas/sub_account_trade_interval)"
+ |Value| Description |
+ |-|-|
+ |`SAT_1_MO` = 1|1 month|
+ |`SAT_1_D` = 2|1 day|
diff --git a/docs/grvt/schemas/api_sub_account_trade_response.md b/docs/grvt/schemas/api_sub_account_trade_response.md
new file mode 100644
index 0000000..b496430
--- /dev/null
+++ b/docs/grvt/schemas/api_sub_account_trade_response.md
@@ -0,0 +1,14 @@
+!!! info "[ApiSubAccountTradeResponse](/../../schemas/api_sub_account_trade_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[SubAccountTrade]|True|The sub account trade result set for given interval|
+ ??? info "[SubAccountTrade](/../../schemas/sub_account_trade)"
+
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |start_interval
`si` |string|True|Start of calculation epoch|
+ |sub_account_id
`sa` |string|True|The sub account id|
+ |instrument
`i` |string|True|The instrument being represented|
+ |total_fee
`tf` |string|True|Total fee paid|
+ |total_trade_volume
`tt` |string|True|Total volume traded|
diff --git a/docs/grvt/schemas/api_ticker_feed_data_v1.md b/docs/grvt/schemas/api_ticker_feed_data_v1.md
new file mode 100644
index 0000000..1ec949c
--- /dev/null
+++ b/docs/grvt/schemas/api_ticker_feed_data_v1.md
@@ -0,0 +1,33 @@
+!!! info "[ApiTickerFeedDataV1](/../../schemas/api_ticker_feed_data_v1)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |Ticker|True|The mini ticker matching the request asset|
+ ??? info "[Ticker](/../../schemas/ticker)"
+ Derived data such as the below, will not be included by default:
- 24 hour volume (`buyVolume + sellVolume`)
- 24 hour taker buy/sell ratio (`buyVolume / sellVolume`)
- 24 hour average trade price (`volumeQ / volumeU`)
- 24 hour average trade volume (`volume / trades`)
- 24 hour percentage change (`24hStatChange / 24hStat`)
- 48 hour statistics (`2 * 24hStat - 24hStatChange`)
To query for an extended ticker payload, leverage the `greeks` and the `derived` flags.
Ticker extensions are currently under design to offer you more convenience.
These flags are only supported on the `Ticker Snapshot` WS endpoint, and on the `Ticker` API endpoint.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|False
`None`|Time at which the event was emitted in unix nanoseconds|
+ |instrument
`i` |string|False
`None`|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |mark_price
`mp` |string|False
`None`|The mark price of the instrument, expressed in `9` decimals|
+ |index_price
`ip` |string|False
`None`|The index price of the instrument, expressed in `9` decimals|
+ |last_price
`lp` |string|False
`None`|The last traded price of the instrument (also close price), expressed in `9` decimals|
+ |last_size
`ls` |string|False
`None`|The number of assets traded in the last trade, expressed in base asset decimal units|
+ |mid_price
`mp1` |string|False
`None`|The mid price of the instrument, expressed in `9` decimals|
+ |best_bid_price
`bb` |string|False
`None`|The best bid price of the instrument, expressed in `9` decimals|
+ |best_bid_size
`bb1` |string|False
`None`|The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units|
+ |best_ask_price
`ba` |string|False
`None`|The best ask price of the instrument, expressed in `9` decimals|
+ |best_ask_size
`ba1` |string|False
`None`|The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units|
+ |funding_rate_8h_curr
`fr` |string|False
`None`|The current funding rate of the instrument, expressed in percentage points|
+ |funding_rate_8h_avg
`fr1` |string|False
`None`|The average funding rate of the instrument (over last 8h), expressed in percentage points|
+ |interest_rate
`ir` |string|False
`None`|The interest rate of the underlying, expressed in centibeeps (1/100th of a basis point)|
+ |forward_price
`fp` |string|False
`None`|[Options] The forward price of the option, expressed in `9` decimals|
+ |buy_volume_24h_b
`bv` |string|False
`None`|The 24 hour taker buy volume of the instrument, expressed in base asset decimal units|
+ |sell_volume_24h_b
`sv` |string|False
`None`|The 24 hour taker sell volume of the instrument, expressed in base asset decimal units|
+ |buy_volume_24h_q
`bv1` |string|False
`None`|The 24 hour taker buy volume of the instrument, expressed in quote asset decimal units|
+ |sell_volume_24h_q
`sv1` |string|False
`None`|The 24 hour taker sell volume of the instrument, expressed in quote asset decimal units|
+ |high_price
`hp` |string|False
`None`|The 24 hour highest traded price of the instrument, expressed in `9` decimals|
+ |low_price
`lp1` |string|False
`None`|The 24 hour lowest traded price of the instrument, expressed in `9` decimals|
+ |open_price
`op` |string|False
`None`|The 24 hour first traded price of the instrument, expressed in `9` decimals|
+ |open_interest
`oi` |string|False
`None`|The open interest in the instrument, expressed in base asset decimal units|
+ |long_short_ratio
`ls1` |string|False
`None`|The ratio of accounts that are net long vs net short on this instrument|
diff --git a/docs/grvt/schemas/api_ticker_request.md b/docs/grvt/schemas/api_ticker_request.md
new file mode 100644
index 0000000..19d60d5
--- /dev/null
+++ b/docs/grvt/schemas/api_ticker_request.md
@@ -0,0 +1,6 @@
+!!! info "[ApiTickerRequest](/../../schemas/api_ticker_request)"
+ Retrieves a single ticker value for a single instrument. Please do not use this to repeatedly poll for data -- a websocket subscription is much more performant, and useful.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
diff --git a/docs/grvt/schemas/api_ticker_response.md b/docs/grvt/schemas/api_ticker_response.md
new file mode 100644
index 0000000..86fb1f4
--- /dev/null
+++ b/docs/grvt/schemas/api_ticker_response.md
@@ -0,0 +1,33 @@
+!!! info "[ApiTickerResponse](/../../schemas/api_ticker_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |Ticker|True|The mini ticker matching the request asset|
+ ??? info "[Ticker](/../../schemas/ticker)"
+ Derived data such as the below, will not be included by default:
- 24 hour volume (`buyVolume + sellVolume`)
- 24 hour taker buy/sell ratio (`buyVolume / sellVolume`)
- 24 hour average trade price (`volumeQ / volumeU`)
- 24 hour average trade volume (`volume / trades`)
- 24 hour percentage change (`24hStatChange / 24hStat`)
- 48 hour statistics (`2 * 24hStat - 24hStatChange`)
To query for an extended ticker payload, leverage the `greeks` and the `derived` flags.
Ticker extensions are currently under design to offer you more convenience.
These flags are only supported on the `Ticker Snapshot` WS endpoint, and on the `Ticker` API endpoint.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|False
`None`|Time at which the event was emitted in unix nanoseconds|
+ |instrument
`i` |string|False
`None`|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |mark_price
`mp` |string|False
`None`|The mark price of the instrument, expressed in `9` decimals|
+ |index_price
`ip` |string|False
`None`|The index price of the instrument, expressed in `9` decimals|
+ |last_price
`lp` |string|False
`None`|The last traded price of the instrument (also close price), expressed in `9` decimals|
+ |last_size
`ls` |string|False
`None`|The number of assets traded in the last trade, expressed in base asset decimal units|
+ |mid_price
`mp1` |string|False
`None`|The mid price of the instrument, expressed in `9` decimals|
+ |best_bid_price
`bb` |string|False
`None`|The best bid price of the instrument, expressed in `9` decimals|
+ |best_bid_size
`bb1` |string|False
`None`|The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units|
+ |best_ask_price
`ba` |string|False
`None`|The best ask price of the instrument, expressed in `9` decimals|
+ |best_ask_size
`ba1` |string|False
`None`|The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units|
+ |funding_rate_8h_curr
`fr` |string|False
`None`|The current funding rate of the instrument, expressed in percentage points|
+ |funding_rate_8h_avg
`fr1` |string|False
`None`|The average funding rate of the instrument (over last 8h), expressed in percentage points|
+ |interest_rate
`ir` |string|False
`None`|The interest rate of the underlying, expressed in centibeeps (1/100th of a basis point)|
+ |forward_price
`fp` |string|False
`None`|[Options] The forward price of the option, expressed in `9` decimals|
+ |buy_volume_24h_b
`bv` |string|False
`None`|The 24 hour taker buy volume of the instrument, expressed in base asset decimal units|
+ |sell_volume_24h_b
`sv` |string|False
`None`|The 24 hour taker sell volume of the instrument, expressed in base asset decimal units|
+ |buy_volume_24h_q
`bv1` |string|False
`None`|The 24 hour taker buy volume of the instrument, expressed in quote asset decimal units|
+ |sell_volume_24h_q
`sv1` |string|False
`None`|The 24 hour taker sell volume of the instrument, expressed in quote asset decimal units|
+ |high_price
`hp` |string|False
`None`|The 24 hour highest traded price of the instrument, expressed in `9` decimals|
+ |low_price
`lp1` |string|False
`None`|The 24 hour lowest traded price of the instrument, expressed in `9` decimals|
+ |open_price
`op` |string|False
`None`|The 24 hour first traded price of the instrument, expressed in `9` decimals|
+ |open_interest
`oi` |string|False
`None`|The open interest in the instrument, expressed in base asset decimal units|
+ |long_short_ratio
`ls1` |string|False
`None`|The ratio of accounts that are net long vs net short on this instrument|
diff --git a/docs/grvt/schemas/api_trade_history_request.md b/docs/grvt/schemas/api_trade_history_request.md
new file mode 100644
index 0000000..274e8db
--- /dev/null
+++ b/docs/grvt/schemas/api_trade_history_request.md
@@ -0,0 +1,10 @@
+!!! info "[ApiTradeHistoryRequest](/../../schemas/api_trade_history_request)"
+ Perform historical lookup of public trades in any given instrument.
This endpoint offers public trading data, use the Trading APIs instead to query for your personalized trade tape.
Only data from the last three months will be retained.
Pagination works as follows:- We perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.
- The lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.
- If a `cursor` is provided, it will be used to fetch results from that point onwards.
- Pagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |start_time
`st` |string|False
`0`|The start time to apply in nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned|
+ |end_time
`et` |string|False
`now()`|The end time to apply in nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned|
+ |limit
`l` |integer|False
`500`|The limit to query for. Defaults to 500; Max 1000|
+ |cursor
`c` |string|False
`''`|The cursor to indicate when to start the query from|
diff --git a/docs/grvt/schemas/api_trade_history_response.md b/docs/grvt/schemas/api_trade_history_response.md
new file mode 100644
index 0000000..4128825
--- /dev/null
+++ b/docs/grvt/schemas/api_trade_history_response.md
@@ -0,0 +1,29 @@
+!!! info "[ApiTradeHistoryResponse](/../../schemas/api_trade_history_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[Trade]|True|The public trades matching the request asset|
+ |next
`n` |string|False
`''`|The cursor to indicate when to start the next query from|
+ ??? info "[Trade](/../../schemas/trade)"
+ All private RFQs and Private AXEs will be filtered out from the responses
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |is_taker_buyer
`it` |boolean|True|If taker was the buyer on the trade|
+ |size
`s` |string|True|The number of assets being traded, expressed in base asset decimal units|
+ |price
`p` |string|True|The traded price, expressed in `9` decimals|
+ |mark_price
`mp` |string|True|The mark price of the instrument at point of trade, expressed in `9` decimals|
+ |index_price
`ip` |string|True|The index price of the instrument at point of trade, expressed in `9` decimals|
+ |interest_rate
`ir` |string|True|The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point)|
+ |forward_price
`fp` |string|True|[Options] The forward price of the option at point of trade, expressed in `9` decimals|
+ |trade_id
`ti` |string|True|A trade identifier, globally unique, and monotonically increasing (not by `1`).
All trades sharing a single taker execution share the same first component (before `-`), and `event_time`.
`trade_id` is guaranteed to be consistent across MarketData `Trade` and Trading `Fill`.|
+ |venue
`v` |Venue|True|The venue where the trade occurred|
+ |is_rpi
`ir1` |boolean|True|If the trade is a RPI trade|
+ ??? info "[Venue](/../../schemas/venue)"
+ The list of Trading Venues that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`ORDERBOOK` = 1|the trade is cleared on the orderbook venue|
+ |`RFQ` = 2|the trade is cleared on the RFQ venue|
diff --git a/docs/grvt/schemas/api_trade_request.md b/docs/grvt/schemas/api_trade_request.md
new file mode 100644
index 0000000..dcb5e48
--- /dev/null
+++ b/docs/grvt/schemas/api_trade_request.md
@@ -0,0 +1,7 @@
+!!! info "[ApiTradeRequest](/../../schemas/api_trade_request)"
+ Retrieves up to 1000 of the most recent trades in any given instrument. Do not use this to poll for data -- a websocket subscription is much more performant, and useful.
This endpoint offers public trading data, use the Trading APIs instead to query for your personalized trade tape.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |limit
`l` |integer|True|The limit to query for. Defaults to 500; Max 1000|
diff --git a/docs/grvt/schemas/api_trade_response.md b/docs/grvt/schemas/api_trade_response.md
new file mode 100644
index 0000000..f16f396
--- /dev/null
+++ b/docs/grvt/schemas/api_trade_response.md
@@ -0,0 +1,28 @@
+!!! info "[ApiTradeResponse](/../../schemas/api_trade_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[Trade]|True|The public trades matching the request asset|
+ ??? info "[Trade](/../../schemas/trade)"
+ All private RFQs and Private AXEs will be filtered out from the responses
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |is_taker_buyer
`it` |boolean|True|If taker was the buyer on the trade|
+ |size
`s` |string|True|The number of assets being traded, expressed in base asset decimal units|
+ |price
`p` |string|True|The traded price, expressed in `9` decimals|
+ |mark_price
`mp` |string|True|The mark price of the instrument at point of trade, expressed in `9` decimals|
+ |index_price
`ip` |string|True|The index price of the instrument at point of trade, expressed in `9` decimals|
+ |interest_rate
`ir` |string|True|The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point)|
+ |forward_price
`fp` |string|True|[Options] The forward price of the option at point of trade, expressed in `9` decimals|
+ |trade_id
`ti` |string|True|A trade identifier, globally unique, and monotonically increasing (not by `1`).
All trades sharing a single taker execution share the same first component (before `-`), and `event_time`.
`trade_id` is guaranteed to be consistent across MarketData `Trade` and Trading `Fill`.|
+ |venue
`v` |Venue|True|The venue where the trade occurred|
+ |is_rpi
`ir1` |boolean|True|If the trade is a RPI trade|
+ ??? info "[Venue](/../../schemas/venue)"
+ The list of Trading Venues that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`ORDERBOOK` = 1|the trade is cleared on the orderbook venue|
+ |`RFQ` = 2|the trade is cleared on the RFQ venue|
diff --git a/docs/grvt/schemas/api_transfer_ack.md b/docs/grvt/schemas/api_transfer_ack.md
new file mode 100644
index 0000000..d98ee1d
--- /dev/null
+++ b/docs/grvt/schemas/api_transfer_ack.md
@@ -0,0 +1,5 @@
+!!! info "[ApiTransferAck](/../../schemas/api_transfer_ack)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |ack
`a` |boolean|True|Gravity has acknowledged that the transfer has been successfully processed. If true, a `tx_id` will be returned. If false, an error will be returned.|
+ |tx_id
`ti` |string|True|The transaction ID of the transfer. This is only returned if the transfer is successful.|
diff --git a/docs/grvt/schemas/api_transfer_history_request.md b/docs/grvt/schemas/api_transfer_history_request.md
new file mode 100644
index 0000000..6650c3a
--- /dev/null
+++ b/docs/grvt/schemas/api_transfer_history_request.md
@@ -0,0 +1,12 @@
+!!! info "[ApiTransferHistoryRequest](/../../schemas/api_transfer_history_request)"
+ The request to get the historical transfers of an account
The history is returned in reverse chronological order
Pagination works as follows:- We perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.
- The lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.
- If a `cursor` is provided, it will be used to fetch results from that point onwards.
- Pagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |currency
`c` |[string]|True|The token currency to query for, if nil or empty, return all transfers. Otherwise, only entries matching the filter will be returned|
+ |start_time
`st` |string|False
`0`|The start time to query for in unix nanoseconds|
+ |end_time
`et` |string|False
`now()`|The end time to query for in unix nanoseconds|
+ |limit
`l` |integer|False
`500`|The limit to query for. Defaults to 500; Max 1000|
+ |cursor
`c1` |string|False
`''`|The cursor to indicate when to start the next query from|
+ |tx_id
`ti` |string|False
`0`|The transaction ID to query for|
+ |main_account_id
`ma` |string|False
``|Main account ID being queried. By default, applies the requestor's main account ID.|
diff --git a/docs/grvt/schemas/api_transfer_history_response.md b/docs/grvt/schemas/api_transfer_history_response.md
new file mode 100644
index 0000000..f045bce
--- /dev/null
+++ b/docs/grvt/schemas/api_transfer_history_response.md
@@ -0,0 +1,37 @@
+!!! info "[ApiTransferHistoryResponse](/../../schemas/api_transfer_history_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[TransferHistory]|True|The transfer history matching the request account|
+ |next
`n` |string|False
`''`|The cursor to indicate when to start the next query from|
+ ??? info "[TransferHistory](/../../schemas/transfer_history)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |tx_id
`ti` |string|True|The transaction ID of the transfer|
+ |from_account_id
`fa` |string|True|The account to transfer from|
+ |from_sub_account_id
`fs` |string|True|The subaccount to transfer from (0 if transferring from main account)|
+ |to_account_id
`ta` |string|True|The account to deposit into|
+ |to_sub_account_id
`ts` |string|True|The subaccount to transfer to (0 if transferring to main account)|
+ |currency
`c` |string|True|The token currency to transfer|
+ |num_tokens
`nt` |string|True|The number of tokens to transfer|
+ |signature
`s` |Signature|True|The signature of the transfer|
+ |event_time
`et` |string|True|The timestamp of the transfer in unix nanoseconds|
+ |transfer_type
`tt` |TransferType|True|The type of transfer|
+ |transfer_metadata
`tm` |string|True|The metadata of the transfer|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
+ ??? info "[TransferType](/../../schemas/transfer_type)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Default transfer that has nothing to do with bridging|
+ |`STANDARD` = 1|Standard transfer that has nothing to do with bridging|
+ |`FAST_ARB_DEPOSIT` = 2|Fast Arb Deposit Metadata type|
+ |`FAST_ARB_WITHDRAWAL` = 3|Fast Arb Withdrawal Metadata type|
+ |`NON_NATIVE_BRIDGE_DEPOSIT` = 4|Transfer type for non native bridging deposit|
+ |`NON_NATIVE_BRIDGE_WITHDRAWAL` = 5|Transfer type for non native bridging withdrawal|
diff --git a/docs/grvt/schemas/api_transfer_request.md b/docs/grvt/schemas/api_transfer_request.md
new file mode 100644
index 0000000..dfcd6be
--- /dev/null
+++ b/docs/grvt/schemas/api_transfer_request.md
@@ -0,0 +1,32 @@
+!!! info "[ApiTransferRequest](/../../schemas/api_transfer_request)"
+ This API allows you to transfer funds in multiple different ways
- Between SubAccounts within your Main Account
- Between your MainAccount and your SubAccounts
- To other MainAccounts that you have previously allowlisted
Fast Withdrawal Funding Address
For fast withdrawals, funds must be sent to the designated funding account address. Please ensure you use the correct address based on the environment:
Production Environment Address:
[To be updated, not ready yet]
This address should be specified as the to_account_id in your API requests for transferring funds using the transfer API. Ensure accurate input to avoid loss of funds or use the UI.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |from_account_id
`fa` |string|True|The main account to transfer from|
+ |from_sub_account_id
`fs` |string|True|The subaccount to transfer from (0 if transferring from main account)|
+ |to_account_id
`ta` |string|True|The main account to deposit into|
+ |to_sub_account_id
`ts` |string|True|The subaccount to transfer to (0 if transferring to main account)|
+ |currency
`c` |string|True|The token currency to transfer|
+ |num_tokens
`nt` |string|True|The number of tokens to transfer, quoted in tokenCurrency decimal units|
+ |signature
`s` |Signature|True|The signature of the transfer|
+ |transfer_type
`tt` |TransferType|True|The type of transfer|
+ |transfer_metadata
`tm` |string|True|The metadata of the transfer|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
+ ??? info "[TransferType](/../../schemas/transfer_type)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Default transfer that has nothing to do with bridging|
+ |`STANDARD` = 1|Standard transfer that has nothing to do with bridging|
+ |`FAST_ARB_DEPOSIT` = 2|Fast Arb Deposit Metadata type|
+ |`FAST_ARB_WITHDRAWAL` = 3|Fast Arb Withdrawal Metadata type|
+ |`NON_NATIVE_BRIDGE_DEPOSIT` = 4|Transfer type for non native bridging deposit|
+ |`NON_NATIVE_BRIDGE_WITHDRAWAL` = 5|Transfer type for non native bridging withdrawal|
diff --git a/docs/grvt/schemas/api_transfer_response.md b/docs/grvt/schemas/api_transfer_response.md
new file mode 100644
index 0000000..85fae34
--- /dev/null
+++ b/docs/grvt/schemas/api_transfer_response.md
@@ -0,0 +1,11 @@
+!!! info "[ApiTransferResponse](/../../schemas/api_transfer_response)"
+ Used to acknowledge a transfer request outcome
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |ApiTransferAck|True|The Transfer response object|
+ ??? info "[ApiTransferAck](/../../schemas/api_transfer_ack)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |ack
`a` |boolean|True|Gravity has acknowledged that the transfer has been successfully processed. If true, a `tx_id` will be returned. If false, an error will be returned.|
+ |tx_id
`ti` |string|True|The transaction ID of the transfer. This is only returned if the transfer is successful.|
diff --git a/docs/grvt/schemas/api_user_category_affinity_score_request.md b/docs/grvt/schemas/api_user_category_affinity_score_request.md
new file mode 100644
index 0000000..0dab406
--- /dev/null
+++ b/docs/grvt/schemas/api_user_category_affinity_score_request.md
@@ -0,0 +1,6 @@
+!!! info "[ApiUserCategoryAffinityScoreRequest](/../../schemas/api_user_category_affinity_score_request)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id|
+ |start_time
`st` |string|True|The start time of query. Can leave empty to query from the beginning|
+ |end_time
`et` |string|True|The end time of query. Can leave empty to query until now|
diff --git a/docs/grvt/schemas/api_user_category_affinity_score_response.md b/docs/grvt/schemas/api_user_category_affinity_score_response.md
new file mode 100644
index 0000000..169bb7a
--- /dev/null
+++ b/docs/grvt/schemas/api_user_category_affinity_score_response.md
@@ -0,0 +1,12 @@
+!!! info "[ApiUserCategoryAffinityScoreResponse](/../../schemas/api_user_category_affinity_score_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[UserCategoryAffinityScore]|True|The list of categoryAffinities score|
+ ??? info "[UserCategoryAffinityScore](/../../schemas/user_category_affinity_score)"
+
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id|
+ |category_id
`ci` |string|True|target category|
+ |affinity_score
`as` |number|True|affinity score|
diff --git a/docs/grvt/schemas/api_vault_burn_tokens_request.md b/docs/grvt/schemas/api_vault_burn_tokens_request.md
new file mode 100644
index 0000000..fc2f848
--- /dev/null
+++ b/docs/grvt/schemas/api_vault_burn_tokens_request.md
@@ -0,0 +1,18 @@
+!!! info "[ApiVaultBurnTokensRequest](/../../schemas/api_vault_burn_tokens_request)"
+ Request payload for burning tokens in a vault.
This API allows a client to burn a specified amount of tokens in a particular vault.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |vault_id
`vi` |string|True|The unique identifier of the vault to burn tokens from.|
+ |currency
`c` |string|True|The currency used for the burn. This should be the vault's quote currency.|
+ |num_tokens
`nt` |string|True|The number of tokens to burn.|
+ |signature
`s` |Signature|True|The digital signature from the investing account.
This signature must be generated by the main account ID and is used to verify the authenticity of the request.
The signature must comply with AccountPermExternalTransfer permission.|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
diff --git a/docs/grvt/schemas/api_vault_invest_request.md b/docs/grvt/schemas/api_vault_invest_request.md
new file mode 100644
index 0000000..0628b5f
--- /dev/null
+++ b/docs/grvt/schemas/api_vault_invest_request.md
@@ -0,0 +1,18 @@
+!!! info "[ApiVaultInvestRequest](/../../schemas/api_vault_invest_request)"
+ Request payload for investing in a vault.
This API allows a client to invest a specified amount of tokens in a particular vault.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |vault_id
`vi` |string|True|The unique identifier of the vault to invest in.|
+ |currency
`c` |string|True|The currency used for the investment. This should be the vault's quote currency.|
+ |num_tokens
`nt` |string|True|The investment sum, in terms of the token currency specified (i.e., `numTokens` of '1000' with `tokenCurrency` of 'USDT' denotes investment of 1,000 USDT).|
+ |signature
`s` |Signature|True|The digital signature from the investing account.
This signature must be generated by the main account ID and is used to verify the authenticity of the request.
The signature must comply with AccountPermExternalTransfer permission.|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
diff --git a/docs/grvt/schemas/api_vault_investor_history.md b/docs/grvt/schemas/api_vault_investor_history.md
new file mode 100644
index 0000000..71aa765
--- /dev/null
+++ b/docs/grvt/schemas/api_vault_investor_history.md
@@ -0,0 +1,20 @@
+!!! info "[ApiVaultInvestorHistory](/../../schemas/api_vault_investor_history)"
+ The vault investor history returned by the service to client
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |off_chain_account_id
`oc` |string|True|The off chain account id of the investor, only visible to the manager|
+ |vault_id
`vi` |string|True|The unique identifier of the vault.|
+ |type
`t` |VaultInvestorAction|True|The type of transaction that occurred. List of types: vaultInvest, vaultBurnLpToken, vaultRedeem|
+ |price
`p` |string|True|The price of the vault LP tokens at the time of the event.|
+ |size
`s` |string|True|The amount of Vault LP tokens invested or redeemed.|
+ |realized_pnl
`rp` |string|True|The realized PnL of the vault.|
+ |performance_fee
`pf` |string|True|The performance fee of the vault.|
+ ??? info "[VaultInvestorAction](/../../schemas/vault_investor_action)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0||
+ |`VAULT_INVEST` = 1||
+ |`VAULT_BURN_LP_TOKEN` = 2||
+ |`VAULT_REDEEM` = 3||
diff --git a/docs/grvt/schemas/api_vault_investor_summary_request.md b/docs/grvt/schemas/api_vault_investor_summary_request.md
new file mode 100644
index 0000000..7d93f33
--- /dev/null
+++ b/docs/grvt/schemas/api_vault_investor_summary_request.md
@@ -0,0 +1,6 @@
+!!! info "[ApiVaultInvestorSummaryRequest](/../../schemas/api_vault_investor_summary_request)"
+ Request payload for fetching the summary of a vault investor.
This API allows a client to retrieve the summary of investments in a specific vault.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |vault_id
`vi` |string|True|The unique identifier of the vault to fetch the summary for.|
diff --git a/docs/grvt/schemas/api_vault_investor_summary_response.md b/docs/grvt/schemas/api_vault_investor_summary_response.md
new file mode 100644
index 0000000..f9b1976
--- /dev/null
+++ b/docs/grvt/schemas/api_vault_investor_summary_response.md
@@ -0,0 +1,28 @@
+!!! info "[ApiVaultInvestorSummaryResponse](/../../schemas/api_vault_investor_summary_response)"
+ Response payload for the summary of a vault investor.
This API provides the summary of investments in a specific vault.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |vault_investor_summary
`vi` |[VaultInvestorSummary]|True|The summary of investments in the vault.|
+ ??? info "[VaultInvestorSummary](/../../schemas/vault_investor_summary)"
+ Vault investor summary information.
This struct contains the summary of investments in a vault.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The unique identifier of the vault sub account.|
+ |num_lp_tokens
`nl` |string|True|The number of Vault LP tokens held by the investor.|
+ |avg_entry_price
`ae` |string|True|The average entry price (in USD) of the vault LP tokens.|
+ |current_price
`cp` |string|True|The current price (in USD) of the vault LP tokens.|
+ |total_equity
`te` |string|True|The current valuation (in USD) of all held vault LP tokens.|
+ |all_time_realized_pnl
`at` |string|True|The all-time realized PnL (in USD) that the investor has received from the vault.|
+ |pending_redemption
`pr` |VaultRedemption|False
`None`|The singleton pending redemption (omitted if none).|
+ |can_burn
`cb` |boolean|False
`true`|True if the requesting account is authorized to burn tokens on this vault, omitted otherwise.|
+ ??? info "[VaultRedemption](/../../schemas/vault_redemption)"
+ Vault redemption information.
This struct contains information about a pending redemption from a vault.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |num_lp_tokens
`nl` |string|True|The number of LP Tokens requested for redemption.|
+ |request_valuation
`rv` |string|True|The valuation (in USD) of the redemption request.|
+ |request_time
`rt` |string|True|[Filled by GRVT Backend] Time at which the redemption request was received by GRVT in unix nanoseconds|
+ |max_redemption_period_timestamp
`mr` |string|True|[Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be force-redeemed.|
diff --git a/docs/grvt/schemas/api_vault_redeem_cancel_request.md b/docs/grvt/schemas/api_vault_redeem_cancel_request.md
new file mode 100644
index 0000000..d836177
--- /dev/null
+++ b/docs/grvt/schemas/api_vault_redeem_cancel_request.md
@@ -0,0 +1,6 @@
+!!! info "[ApiVaultRedeemCancelRequest](/../../schemas/api_vault_redeem_cancel_request)"
+ Request payload for canceling a vault redemption.
This API allows a client to cancel a previously initiated redemption from a vault.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |vault_id
`vi` |string|True|The unique identifier of the vault to cancel the redemption from.|
diff --git a/docs/grvt/schemas/api_vault_redeem_request.md b/docs/grvt/schemas/api_vault_redeem_request.md
new file mode 100644
index 0000000..7e1d1b3
--- /dev/null
+++ b/docs/grvt/schemas/api_vault_redeem_request.md
@@ -0,0 +1,18 @@
+!!! info "[ApiVaultRedeemRequest](/../../schemas/api_vault_redeem_request)"
+ Request payload for redeeming from a vault.
This API allows a client to redeem a specified amount of tokens from a particular vault.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |vault_id
`vi` |string|True|The unique identifier of the vault to redeem from.|
+ |currency
`c` |string|True|The currency used for the redemption. This should be the vault's quote currency.|
+ |num_tokens
`nt` |string|True|The number of shares to redeem.|
+ |signature
`s` |Signature|True|The digital signature from the investing account.
This signature must be generated by the main account ID and is used to verify the authenticity of the request.
The signature must comply with AccountPermExternalTransfer permission.|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
diff --git a/docs/grvt/schemas/api_vault_view_redemption_queue_request.md b/docs/grvt/schemas/api_vault_view_redemption_queue_request.md
new file mode 100644
index 0000000..cb4654a
--- /dev/null
+++ b/docs/grvt/schemas/api_vault_view_redemption_queue_request.md
@@ -0,0 +1,6 @@
+!!! info "[ApiVaultViewRedemptionQueueRequest](/../../schemas/api_vault_view_redemption_queue_request)"
+ Request payload for a vault manager to view the redemption queue for their vault.
Fetches the redemption queue for a vault, ordered by descending priority.
Urgent redemption requests, defined as having been pending >90% of the manager-defined maximum redemption period, have top priority (following insertion order).
Non-urgent redemption requests are otherwise prioritized by insertion order, unless they are >5x the size of the smallest redemption request.
E.g., If FIFO ordering (all non-urgent) is 1k -> 50k -> 100k -> 20k -> 10k -> 25k, then priority ordering is 1k -> 10k -> 50k -> 20k -> 100k -> 25k.
Only displays redemption requests that are eligible for automated redemption, i.e., have been pending for the manager-defined minimum redemption period.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |vault_id
`vi` |string|True|The unique identifier of the vault to fetch the redemption queue for.|
diff --git a/docs/grvt/schemas/api_vault_view_redemption_queue_response.md b/docs/grvt/schemas/api_vault_view_redemption_queue_response.md
new file mode 100644
index 0000000..b0b54b2
--- /dev/null
+++ b/docs/grvt/schemas/api_vault_view_redemption_queue_response.md
@@ -0,0 +1,58 @@
+!!! info "[ApiVaultViewRedemptionQueueResponse](/../../schemas/api_vault_view_redemption_queue_response)"
+ Response payload for a vault manager to view the redemption queue for their vault, ordered by descending priority.
Also includes counters for total redemption sizes pending as well as urgent (refer to API integration guide for more detail on redemption request classifications).
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |redemption_queue
`rq` |[VaultRedemptionRequest]|True|Outstanding vault redemption requests, ordered by descending priority. Excludes requests that have not yet aged past the minimum redemption period.|
+ |pending_redemption_token_count
`pr` |string|True|Number of shares eligible for automated redemption (held in queue for at least the minimum redemption period).|
+ |urgent_redemption_token_count
`ur` |string|True|Number of shares nearing the maximum redemption period (>= 90% of maximum redemption period).|
+ |auto_redeemable_balance
`ar` |string|True|Amount available for automated redemption request servicing (in USD).|
+ |share_price
`sp` |string|True|Current share price (in USD).|
+ |pre_min
`pm` |PreMinRedemptions|True|Dedicated section for requests yet to wait at least the minimum redemption period.|
+ ??? info "[VaultRedemptionRequest](/../../schemas/vault_redemption_request)"
+ Representation of a pending redemption request for a given vault.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |request_time
`rt` |string|True|[Filled by GRVT Backend] Time at which the redemption request was received by GRVT in unix nanoseconds|
+ |num_lp_tokens
`nl` |string|True|The number of shares to redeem|
+ |max_redemption_period_timestamp
`mr` |string|True|[Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be force-redeemed.|
+ |age_category
`ac` |VaultRedemptionReqAgeCategory|True|Age category of this redemption request.|
+ |is_manager
`im` |boolean|False
`None`|`true` if this request belongs to the vault manager, omitted otherwise.|
+ |eligible_for_auto_redemption_timestamp
`ef` |string|True|[Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be eligible for automated redemption.|
+ ??? info "[VaultRedemptionReqAgeCategory](/../../schemas/vault_redemption_req_age_category)"
+ Denotes the age category of a given redemption request.
+
+ |Value| Description |
+ |-|-|
+ |`NORMAL` = 1|This request is at least as old as the minimum redemption period, and is eligible for automated redemption.|
+ |`URGENT` = 2|This request is nearing the maxmimum redemption period and will be factored into pre-order check margin requirements.|
+ |`OVERDUE` = 3|This request has exceeded the maximum redemption period and will be considered for forced redemptions.|
+ |`PRE_MIN` = 4|This request has yet to exceed the minimum redemption period, and is not yet eligible for automated redemption.|
+ ??? info "[PreMinRedemptions](/../../schemas/pre_min_redemptions)"
+ Vault redemption queue section hidden from main view. All requests here have yet to age past the vault's minimum redemption period.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |requests
`r` |[VaultRedemptionRequest]|True|Pre-minimum-age redemption requests, ordered by age (first element is the oldest request that is pre-minimum-age).|
+ |token_count
`tc` |string|True|Number of shares in the pre-minimum-age section of the vault's redemption queue.|
+ ??? info "[VaultRedemptionRequest](/../../schemas/vault_redemption_request)"
+ Representation of a pending redemption request for a given vault.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |request_time
`rt` |string|True|[Filled by GRVT Backend] Time at which the redemption request was received by GRVT in unix nanoseconds|
+ |num_lp_tokens
`nl` |string|True|The number of shares to redeem|
+ |max_redemption_period_timestamp
`mr` |string|True|[Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be force-redeemed.|
+ |age_category
`ac` |VaultRedemptionReqAgeCategory|True|Age category of this redemption request.|
+ |is_manager
`im` |boolean|False
`None`|`true` if this request belongs to the vault manager, omitted otherwise.|
+ |eligible_for_auto_redemption_timestamp
`ef` |string|True|[Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be eligible for automated redemption.|
+ ??? info "[VaultRedemptionReqAgeCategory](/../../schemas/vault_redemption_req_age_category)"
+ Denotes the age category of a given redemption request.
+
+ |Value| Description |
+ |-|-|
+ |`NORMAL` = 1|This request is at least as old as the minimum redemption period, and is eligible for automated redemption.|
+ |`URGENT` = 2|This request is nearing the maxmimum redemption period and will be factored into pre-order check margin requirements.|
+ |`OVERDUE` = 3|This request has exceeded the maximum redemption period and will be considered for forced redemptions.|
+ |`PRE_MIN` = 4|This request has yet to exceed the minimum redemption period, and is not yet eligible for automated redemption.|
diff --git a/docs/grvt/schemas/api_withdrawal_history_request.md b/docs/grvt/schemas/api_withdrawal_history_request.md
new file mode 100644
index 0000000..346c5bb
--- /dev/null
+++ b/docs/grvt/schemas/api_withdrawal_history_request.md
@@ -0,0 +1,11 @@
+!!! info "[ApiWithdrawalHistoryRequest](/../../schemas/api_withdrawal_history_request)"
+ The request to get the historical withdrawals of an account
The history is returned in reverse chronological order
Pagination works as follows:- We perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.
- The lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.
- If a `cursor` is provided, it will be used to fetch results from that point onwards.
- Pagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |currency
`c` |[string]|True|The token currency to query for, if nil or empty, return all withdrawals. Otherwise, only entries matching the filter will be returned|
+ |start_time
`st` |string|False
`0`|The start time to query for in unix nanoseconds|
+ |end_time
`et` |string|False
`now()`|The end time to query for in unix nanoseconds|
+ |limit
`l` |integer|False
`500`|The limit to query for. Defaults to 500; Max 1000|
+ |cursor
`c1` |string|False
`''`|The cursor to indicate when to start the next query from|
+ |main_account_id
`ma` |string|False
``|Main account ID being queried. By default, applies the requestor's main account ID.|
diff --git a/docs/grvt/schemas/api_withdrawal_history_response.md b/docs/grvt/schemas/api_withdrawal_history_response.md
new file mode 100644
index 0000000..0b5f0dd
--- /dev/null
+++ b/docs/grvt/schemas/api_withdrawal_history_response.md
@@ -0,0 +1,24 @@
+!!! info "[ApiWithdrawalHistoryResponse](/../../schemas/api_withdrawal_history_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[WithdrawalHistory]|True|The withdrawals history matching the request account|
+ |next
`n` |string|False
`''`|The cursor to indicate when to start the next query from|
+ ??? info "[WithdrawalHistory](/../../schemas/withdrawal_history)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |tx_id
`ti` |string|True|The transaction ID of the withdrawal|
+ |from_account_id
`fa` |string|True|The subaccount to withdraw from|
+ |to_eth_address
`te` |string|True|The ethereum address to withdraw to|
+ |currency
`c` |string|True|The token currency to withdraw|
+ |num_tokens
`nt` |string|True|The number of tokens to withdraw|
+ |signature
`s` |Signature|True|The signature of the withdrawal|
+ |event_time
`et` |string|True|The timestamp of the withdrawal in unix nanoseconds|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
diff --git a/docs/grvt/schemas/api_withdrawal_request.md b/docs/grvt/schemas/api_withdrawal_request.md
new file mode 100644
index 0000000..872f688
--- /dev/null
+++ b/docs/grvt/schemas/api_withdrawal_request.md
@@ -0,0 +1,19 @@
+!!! info "[ApiWithdrawalRequest](/../../schemas/api_withdrawal_request)"
+ Leverage this API to initialize a withdrawal from GRVT's Hyperchain onto Ethereum.
Do take note that the bridging process does take time. The GRVT UI will help you keep track of bridging progress, and notify you once its complete.
If not withdrawing the entirety of your balance, there is a minimum withdrawal amount. Currently that amount is ~25 USDT.
Withdrawal fees also apply to cover the cost of the Ethereum transaction.
Note that your funds will always remain in self-custory throughout the withdrawal process. At no stage does GRVT gain control over your funds.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |from_account_id
`fa` |string|True|The main account to withdraw from|
+ |to_eth_address
`te` |string|True|The Ethereum wallet to withdraw into|
+ |currency
`c` |string|True|The token currency to withdraw|
+ |num_tokens
`nt` |string|True|The number of tokens to withdraw, quoted in tokenCurrency decimal units|
+ |signature
`s` |Signature|True|The signature of the withdrawal|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
diff --git a/docs/grvt/schemas/approximate_lp_point.md b/docs/grvt/schemas/approximate_lp_point.md
new file mode 100644
index 0000000..13b9f96
--- /dev/null
+++ b/docs/grvt/schemas/approximate_lp_point.md
@@ -0,0 +1,6 @@
+!!! info "[ApproximateLPPoint](/../../schemas/approximate_lp_point)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |off_chain_account_id
`oc` |string|True|The off chain account id|
+ |liquidity_score
`ls` |string|True|Liquidity score|
+ |rank
`r` |integer|True|The rank of user in the LP leaderboard|
diff --git a/docs/grvt/schemas/approximate_lp_snapshot.md b/docs/grvt/schemas/approximate_lp_snapshot.md
new file mode 100644
index 0000000..53049e6
--- /dev/null
+++ b/docs/grvt/schemas/approximate_lp_snapshot.md
@@ -0,0 +1,10 @@
+!!! info "[ApproximateLPSnapshot](/../../schemas/approximate_lp_snapshot)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |main_account_id
`ma` |string|True|The main account id|
+ |underlying_multiplier
`um` |string|True|Underlying multiplier|
+ |market_share_multiplier
`ms` |string|True|Market share multiplier|
+ |bid_fast_market_multiplier
`bf` |integer|True|Fast market multiplier|
+ |ask_fast_market_multiplier
`af` |integer|True|Fast market multiplier|
+ |liquidity_score
`ls` |string|True|Liquidity score|
+ |calculate_at
`ca` |string|True|The time when the snapshot was calculated|
diff --git a/docs/grvt/schemas/asset_margin_tier_response.md b/docs/grvt/schemas/asset_margin_tier_response.md
new file mode 100644
index 0000000..beb4d88
--- /dev/null
+++ b/docs/grvt/schemas/asset_margin_tier_response.md
@@ -0,0 +1,10 @@
+!!! info "[AssetMarginTierResponse](/../../schemas/asset_margin_tier_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |asset
`a` |string|True||
+ |tiers
`t` |[MarginTierResponse]|True||
+ ??? info "[MarginTierResponse](/../../schemas/margin_tier_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |lower_bound
`lb` |string|True||
+ |rate
`r` |string|True||
diff --git a/docs/grvt/schemas/asset_max_qty.md b/docs/grvt/schemas/asset_max_qty.md
new file mode 100644
index 0000000..4be3de2
--- /dev/null
+++ b/docs/grvt/schemas/asset_max_qty.md
@@ -0,0 +1,6 @@
+!!! info "[AssetMaxQty](/../../schemas/asset_max_qty)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |asset
`a` |string|True|The asset associated with the max quantity|
+ |max_buy_qty
`mb` |string|True|The maximum buy quantity|
+ |max_sell_qty
`ms` |string|True|The maximum sell quantity|
diff --git a/docs/grvt/schemas/bridge_type.md b/docs/grvt/schemas/bridge_type.md
new file mode 100644
index 0000000..f9749cc
--- /dev/null
+++ b/docs/grvt/schemas/bridge_type.md
@@ -0,0 +1,5 @@
+!!! info "[BridgeType](/../../schemas/bridge_type)"
+ |Value| Description |
+ |-|-|
+ |`XY` = 1|XY Bridge type|
+ |`RHINO` = 2|Rhino Bridge type|
diff --git a/docs/grvt/schemas/broker_tag.md b/docs/grvt/schemas/broker_tag.md
new file mode 100644
index 0000000..4a997d5
--- /dev/null
+++ b/docs/grvt/schemas/broker_tag.md
@@ -0,0 +1,9 @@
+!!! info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0||
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
diff --git a/docs/grvt/schemas/cancel_status.md b/docs/grvt/schemas/cancel_status.md
new file mode 100644
index 0000000..9a82da9
--- /dev/null
+++ b/docs/grvt/schemas/cancel_status.md
@@ -0,0 +1,5 @@
+!!! info "[CancelStatus](/../../schemas/cancel_status)"
+ |Value| Description |
+ |-|-|
+ |`EXPIRED` = 1|Cancellation has expired because corresponding order had not arrived within the defined time-to-live window.|
+ |`DROPPED_DUPLICATE` = 2|This cancellation request was dropped because its TTL window overlaps with another cancellation request for the same order.|
diff --git a/docs/grvt/schemas/cancel_status_feed.md b/docs/grvt/schemas/cancel_status_feed.md
new file mode 100644
index 0000000..e94eb60
--- /dev/null
+++ b/docs/grvt/schemas/cancel_status_feed.md
@@ -0,0 +1,55 @@
+!!! info "[CancelStatusFeed](/../../schemas/cancel_status_feed)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The subaccount ID that requested the cancellation|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client|
+ |order_id
`oi` |string|True|A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
+ |reason
`r` |OrderRejectReason|True|The user-provided reason for cancelling the order|
+ |update_time
`ut` |string|False
`0`|[Filled by GRVT Backend] Time at which the cancellation status was updated by GRVT in unix nanoseconds|
+ |cancel_status
`cs` |CancelStatus|True|Status of the cancellation attempt|
+ ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
+ |`REDUCE_ONLY_LIMIT` = 31|the remaining order size was cancelled because it exceeded current position size|
+ |`CLIENT_REPLACE` = 32|the order was replaced by a client replace request|
+ |`DERISK_MUST_BE_IOC` = 33|the derisk order must be an IOC order|
+ |`DERISK_MUST_BE_REDUCE_ONLY` = 34|the derisk order must be a reduce-only order|
+ |`DERISK_NOT_SUPPORTED` = 35|derisk is not supported|
+ |`INVALID_ORDER_TYPE` = 36|the order type is invalid|
+ |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined|
+ ??? info "[CancelStatus](/../../schemas/cancel_status)"
+ |Value| Description |
+ |-|-|
+ |`EXPIRED` = 1|Cancellation has expired because corresponding order had not arrived within the defined time-to-live window.|
+ |`DROPPED_DUPLICATE` = 2|This cancellation request was dropped because its TTL window overlaps with another cancellation request for the same order.|
diff --git a/docs/grvt/schemas/candlestick.md b/docs/grvt/schemas/candlestick.md
new file mode 100644
index 0000000..4db93ec
--- /dev/null
+++ b/docs/grvt/schemas/candlestick.md
@@ -0,0 +1,15 @@
+!!! info "[Candlestick](/../../schemas/candlestick)"
+
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |open_time
`ot` |string|True|Open time of kline bar in unix nanoseconds|
+ |close_time
`ct` |string|True|Close time of kline bar in unix nanosecond|
+ |open
`o` |string|True|The open price, expressed in underlying currency resolution units|
+ |close
`c` |string|True|The close price, expressed in underlying currency resolution units|
+ |high
`h` |string|True|The high price, expressed in underlying currency resolution units|
+ |low
`l` |string|True|The low price, expressed in underlying currency resolution units|
+ |volume_b
`vb` |string|True|The underlying volume transacted, expressed in base asset decimal units|
+ |volume_q
`vq` |string|True|The quote volume transacted, expressed in quote asset decimal units|
+ |trades
`t` |integer|True|The number of trades transacted|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
diff --git a/docs/grvt/schemas/candlestick_interval.md b/docs/grvt/schemas/candlestick_interval.md
new file mode 100644
index 0000000..7d8925c
--- /dev/null
+++ b/docs/grvt/schemas/candlestick_interval.md
@@ -0,0 +1,21 @@
+!!! info "[CandlestickInterval](/../../schemas/candlestick_interval)"
+ |Value| Description |
+ |-|-|
+ |`CI_1_M` = 1|1 minute|
+ |`CI_3_M` = 2|3 minutes|
+ |`CI_5_M` = 3|5 minutes|
+ |`CI_15_M` = 4|15 minutes|
+ |`CI_30_M` = 5|30 minutes|
+ |`CI_1_H` = 6|1 hour|
+ |`CI_2_H` = 7|2 hour|
+ |`CI_4_H` = 8|4 hour|
+ |`CI_6_H` = 9|6 hour|
+ |`CI_8_H` = 10|8 hour|
+ |`CI_12_H` = 11|12 hour|
+ |`CI_1_D` = 12|1 day|
+ |`CI_3_D` = 13|3 days|
+ |`CI_5_D` = 14|5 days|
+ |`CI_1_W` = 15|1 week|
+ |`CI_2_W` = 16|2 weeks|
+ |`CI_3_W` = 17|3 weeks|
+ |`CI_4_W` = 18|4 weeks|
diff --git a/docs/grvt/schemas/candlestick_type.md b/docs/grvt/schemas/candlestick_type.md
new file mode 100644
index 0000000..63a7857
--- /dev/null
+++ b/docs/grvt/schemas/candlestick_type.md
@@ -0,0 +1,7 @@
+!!! info "[CandlestickType](/../../schemas/candlestick_type)"
+ |Value| Description |
+ |-|-|
+ |`TRADE` = 1|Tracks traded prices|
+ |`MARK` = 2|Tracks mark prices|
+ |`INDEX` = 3|Tracks index prices|
+ |`MID` = 4|Tracks book mid prices|
diff --git a/docs/grvt/schemas/claim_ecosystem_badge_response.md b/docs/grvt/schemas/claim_ecosystem_badge_response.md
new file mode 100644
index 0000000..ba155e6
--- /dev/null
+++ b/docs/grvt/schemas/claim_ecosystem_badge_response.md
@@ -0,0 +1,54 @@
+!!! info "[ClaimEcosystemBadgeResponse](/../../schemas/claim_ecosystem_badge_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |badge
`b` |EpochBadge|True|The epoch badge|
+ ??? info "[EpochBadge](/../../schemas/epoch_badge)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id|
+ |main_account_id
`ma` |string|True|The account ID|
+ |type
`t` |RewardProgramType|True|The type of the reward program|
+ |epoch
`e` |integer|True|The epoch number|
+ |epoch_start_time
`es` |string|True|The start time of the epoch|
+ |epoch_end_time
`ee` |string|True|The end time of the epoch|
+ |badge
`b` |EpochBadgeType|True|The type of the badge|
+ |distributed_badges
`db` |[EpochBadgeType]|True|The distributed badges|
+ |total_point
`tp` |string|True|Total point|
+ |rank
`r` |integer|True|Rank|
+ |claimed_at
`ca` |string|True|The time when the badge was claimed, or the epoch end time if the user has already completed the KYC process|
+ ??? info "[RewardProgramType](/../../schemas/reward_program_type)"
+ |Value| Description |
+ |-|-|
+ |`ECOSYSTEM` = 1||
+ |`TRADER` = 2||
+ |`LP` = 3||
+ ??? info "[EpochBadgeType](/../../schemas/epoch_badge_type)"
+ |Value| Description |
+ |-|-|
+ |`CHAMPION` = 1|Champion|
+ |`LEGEND` = 2|Legend|
+ |`VETERAN` = 3|Veteran|
+ |`ELITE` = 4|Elite|
+ |`MASTER` = 5|Master|
+ |`EXPERT` = 6|Expert|
+ |`WARRIOR` = 7|Warrior|
+ |`SERGEANT` = 8|Sergeant|
+ |`RANGER` = 9|Ranger|
+ |`CHALLENGER` = 10|Challenger|
+ |`APPRENTICE` = 11|Apprentice|
+ |`ROOKIE` = 12|Rookie|
+ ??? info "[EpochBadgeType](/../../schemas/epoch_badge_type)"
+ |Value| Description |
+ |-|-|
+ |`CHAMPION` = 1|Champion|
+ |`LEGEND` = 2|Legend|
+ |`VETERAN` = 3|Veteran|
+ |`ELITE` = 4|Elite|
+ |`MASTER` = 5|Master|
+ |`EXPERT` = 6|Expert|
+ |`WARRIOR` = 7|Warrior|
+ |`SERGEANT` = 8|Sergeant|
+ |`RANGER` = 9|Ranger|
+ |`CHALLENGER` = 10|Challenger|
+ |`APPRENTICE` = 11|Apprentice|
+ |`ROOKIE` = 12|Rookie|
diff --git a/docs/grvt/schemas/client_order_i_ds_by_group.md b/docs/grvt/schemas/client_order_i_ds_by_group.md
new file mode 100644
index 0000000..44b94b0
--- /dev/null
+++ b/docs/grvt/schemas/client_order_i_ds_by_group.md
@@ -0,0 +1,8 @@
+!!! info "[ClientOrderIDsByGroup](/../../schemas/client_order_i_ds_by_group)"
+ Grouping for the client order id and their associated groups.
This is used to define TP/SL pairs or other order groupings after loading the list of Open Orders.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |group_id
`gi` |string|True|The group this order belongs to. It can be used to define TP/SL pairs or other order groupings|
+ |client_order_id
`co` |[string]|True|List of client order IDs in the group|
+ |sub_account_id
`sa` |string|True|The sub account ID that these orders belong to|
diff --git a/docs/grvt/schemas/client_tier.md b/docs/grvt/schemas/client_tier.md
new file mode 100644
index 0000000..6fa8719
--- /dev/null
+++ b/docs/grvt/schemas/client_tier.md
@@ -0,0 +1,8 @@
+!!! info "[ClientTier](/../../schemas/client_tier)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |tier
`t` |integer|True||
+ |futures_taker_fee
`ft` |integer|True||
+ |futures_maker_fee
`fm` |integer|True||
+ |options_taker_fee
`ot` |integer|True||
+ |options_maker_fee
`om` |integer|True||
diff --git a/docs/grvt/schemas/currency.md b/docs/grvt/schemas/currency.md
new file mode 100644
index 0000000..73bd283
--- /dev/null
+++ b/docs/grvt/schemas/currency.md
@@ -0,0 +1,31 @@
+!!! info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ |`XRP` = 15|the XRP token|
+ |`TRUMP` = 20|the TRUMP token|
+ |`SUI` = 21|the SUI token|
+ |`LINK` = 25|the LINK token|
+ |`JUP` = 27|the JUP token|
+ |`FARTCOIN` = 28|the FARTCOIN token|
+ |`ENA` = 29|the ENA token|
+ |`DOGE` = 30|the DOGE token|
+ |`ADA` = 33|the ADA token|
+ |`AAVE` = 34|the AAVE token|
+ |`BERA` = 35|the BERA token|
+ |`IP` = 40|the IP token|
diff --git a/docs/grvt/schemas/currency_detail.md b/docs/grvt/schemas/currency_detail.md
new file mode 100644
index 0000000..9fa8260
--- /dev/null
+++ b/docs/grvt/schemas/currency_detail.md
@@ -0,0 +1,7 @@
+!!! info "[CurrencyDetail](/../../schemas/currency_detail)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |id
`i` |integer|True|The integer value of the currency|
+ |symbol
`s` |string|True|The name of the currency|
+ |balance_decimals
`bd` |integer|True|The balance decimals of the currency|
+ |quantity_multiplier
`qm` |string|True|The quantity multiplier of the currency|
diff --git a/docs/grvt/schemas/deposit.md b/docs/grvt/schemas/deposit.md
new file mode 100644
index 0000000..eab6b14
--- /dev/null
+++ b/docs/grvt/schemas/deposit.md
@@ -0,0 +1,7 @@
+!!! info "[Deposit](/../../schemas/deposit)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |tx_hash
`th` |string|True|The hash of the bridgemint event producing the deposit|
+ |to_account_id
`ta` |string|True|The account to deposit into|
+ |currency
`c` |string|True|The token currency to deposit|
+ |num_tokens
`nt` |string|True|The number of tokens to deposit|
diff --git a/docs/grvt/schemas/deposit_history.md b/docs/grvt/schemas/deposit_history.md
new file mode 100644
index 0000000..e24fed3
--- /dev/null
+++ b/docs/grvt/schemas/deposit_history.md
@@ -0,0 +1,11 @@
+!!! info "[DepositHistory](/../../schemas/deposit_history)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |l_1_hash
`l1` |string|True|The L1 txHash of the deposit|
+ |l_2_hash
`l2` |string|True|The L2 txHash of the deposit|
+ |to_account_id
`ta` |string|True|The account to deposit into|
+ |currency
`c` |string|True|The token currency to deposit|
+ |num_tokens
`nt` |string|True|The number of tokens to deposit|
+ |initiated_time
`it` |string|True|The timestamp when the deposit was initiated on L1 in unix nanoseconds|
+ |confirmed_time
`ct` |string|True|The timestamp when the deposit was confirmed on L2 in unix nanoseconds|
+ |from_address
`fa` |string|True|The address of the sender|
diff --git a/docs/grvt/schemas/ecosystem_leaderboard_user.md b/docs/grvt/schemas/ecosystem_leaderboard_user.md
new file mode 100644
index 0000000..aa1101f
--- /dev/null
+++ b/docs/grvt/schemas/ecosystem_leaderboard_user.md
@@ -0,0 +1,7 @@
+!!! info "[EcosystemLeaderboardUser](/../../schemas/ecosystem_leaderboard_user)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id|
+ |rank
`r` |integer|True|The rank of the account in the ecosystem|
+ |total_point
`tp` |string|True|Total ecosystem point|
+ |twitter_username
`tu` |string|True|The twitter username of the account|
diff --git a/docs/grvt/schemas/ecosystem_metric.md b/docs/grvt/schemas/ecosystem_metric.md
new file mode 100644
index 0000000..687d5e6
--- /dev/null
+++ b/docs/grvt/schemas/ecosystem_metric.md
@@ -0,0 +1,8 @@
+!!! info "[EcosystemMetric](/../../schemas/ecosystem_metric)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |direct_invite_count
`di` |integer|True|Direct invite count|
+ |indirect_invite_count
`ii` |integer|True|Indirect invite count|
+ |direct_invite_trading_volume
`di1` |string|True|Direct invite trading volume|
+ |indirect_invite_trading_volume
`ii1` |string|True|Indirect invite trading volume|
+ |total_point
`tp` |string|True|Total ecosystem point of this epoch/phase|
diff --git a/docs/grvt/schemas/ecosystem_point.md b/docs/grvt/schemas/ecosystem_point.md
new file mode 100644
index 0000000..318f5f9
--- /dev/null
+++ b/docs/grvt/schemas/ecosystem_point.md
@@ -0,0 +1,21 @@
+!!! info "[EcosystemPoint](/../../schemas/ecosystem_point)"
+
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id|
+ |main_account_id
`ma` |string|True|The main account id|
+ |total_point
`tp` |string|True|Total ecosystem point|
+ |direct_invite_count
`di` |integer|True|Direct invite count|
+ |indirect_invite_count
`ii` |integer|True|Indirect invite count|
+ |direct_invite_trading_volume
`di1` |string|True|Direct invite trading volume|
+ |indirect_invite_trading_volume
`ii1` |string|True|Indirect invite trading volume|
+ |calculate_at
`ca` |string|True|The time when the ecosystem point is calculated|
+ |calculate_from
`cf` |string|True|Start time of the epoch - phase|
+ |calculate_to
`ct` |string|True|End time of the epoch - phase|
+ |rank
`r` |integer|True|The rank of the account in the ecosystem|
+ |epoch
`e` |integer|True|The epoch number of the ecosystem point|
+ |brokered_trading_volume
`bt` |string|True|Brokered trading volume|
+ |brokered_trading_point
`bt1` |string|True|Brokered trading point|
+ |referee_kyc_point
`rk` |string|True|Referee KYC point|
+ |referrer_kyc_point
`rk1` |string|True|Referrer KYC point|
diff --git a/docs/grvt/schemas/empty_request.md b/docs/grvt/schemas/empty_request.md
new file mode 100644
index 0000000..97f3c00
--- /dev/null
+++ b/docs/grvt/schemas/empty_request.md
@@ -0,0 +1,5 @@
+!!! info "[EmptyRequest](/../../schemas/empty_request)"
+ Used for requests that do not require any parameters
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
diff --git a/docs/grvt/schemas/epoch.md b/docs/grvt/schemas/epoch.md
new file mode 100644
index 0000000..dda79fb
--- /dev/null
+++ b/docs/grvt/schemas/epoch.md
@@ -0,0 +1,6 @@
+!!! info "[Epoch](/../../schemas/epoch)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |epoch
`e` |integer|True|The epoch number|
+ |start_time
`st` |string|True|The start time of the epoch|
+ |end_time
`et` |string|True|The end time of the epoch|
diff --git a/docs/grvt/schemas/epoch_badge.md b/docs/grvt/schemas/epoch_badge.md
new file mode 100644
index 0000000..2827adf
--- /dev/null
+++ b/docs/grvt/schemas/epoch_badge.md
@@ -0,0 +1,50 @@
+!!! info "[EpochBadge](/../../schemas/epoch_badge)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id|
+ |main_account_id
`ma` |string|True|The account ID|
+ |type
`t` |RewardProgramType|True|The type of the reward program|
+ |epoch
`e` |integer|True|The epoch number|
+ |epoch_start_time
`es` |string|True|The start time of the epoch|
+ |epoch_end_time
`ee` |string|True|The end time of the epoch|
+ |badge
`b` |EpochBadgeType|True|The type of the badge|
+ |distributed_badges
`db` |[EpochBadgeType]|True|The distributed badges|
+ |total_point
`tp` |string|True|Total point|
+ |rank
`r` |integer|True|Rank|
+ |claimed_at
`ca` |string|True|The time when the badge was claimed, or the epoch end time if the user has already completed the KYC process|
+ ??? info "[RewardProgramType](/../../schemas/reward_program_type)"
+ |Value| Description |
+ |-|-|
+ |`ECOSYSTEM` = 1||
+ |`TRADER` = 2||
+ |`LP` = 3||
+ ??? info "[EpochBadgeType](/../../schemas/epoch_badge_type)"
+ |Value| Description |
+ |-|-|
+ |`CHAMPION` = 1|Champion|
+ |`LEGEND` = 2|Legend|
+ |`VETERAN` = 3|Veteran|
+ |`ELITE` = 4|Elite|
+ |`MASTER` = 5|Master|
+ |`EXPERT` = 6|Expert|
+ |`WARRIOR` = 7|Warrior|
+ |`SERGEANT` = 8|Sergeant|
+ |`RANGER` = 9|Ranger|
+ |`CHALLENGER` = 10|Challenger|
+ |`APPRENTICE` = 11|Apprentice|
+ |`ROOKIE` = 12|Rookie|
+ ??? info "[EpochBadgeType](/../../schemas/epoch_badge_type)"
+ |Value| Description |
+ |-|-|
+ |`CHAMPION` = 1|Champion|
+ |`LEGEND` = 2|Legend|
+ |`VETERAN` = 3|Veteran|
+ |`ELITE` = 4|Elite|
+ |`MASTER` = 5|Master|
+ |`EXPERT` = 6|Expert|
+ |`WARRIOR` = 7|Warrior|
+ |`SERGEANT` = 8|Sergeant|
+ |`RANGER` = 9|Ranger|
+ |`CHALLENGER` = 10|Challenger|
+ |`APPRENTICE` = 11|Apprentice|
+ |`ROOKIE` = 12|Rookie|
diff --git a/docs/grvt/schemas/epoch_badge_point_distribution.md b/docs/grvt/schemas/epoch_badge_point_distribution.md
new file mode 100644
index 0000000..6f7dede
--- /dev/null
+++ b/docs/grvt/schemas/epoch_badge_point_distribution.md
@@ -0,0 +1,33 @@
+!!! info "[EpochBadgePointDistribution](/../../schemas/epoch_badge_point_distribution)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |badge
`b` |EpochBadgeType|True|The type of the badge|
+ |epoch
`e` |integer|True|The epoch number|
+ |type
`t` |RewardProgramType|True|The type of the reward program|
+ |min_point
`mp` |string|True|The minimum point to get the badge|
+ |max_point
`mp1` |string|True|The maximum point to get the badge|
+ |min_rank
`mr` |integer|True|The minimum rank to get the badge|
+ |max_rank
`mr1` |integer|True|The maximum rank to get the badge|
+ |total_point
`tp` |string|True|The total point to get the badge|
+ |count
`c` |integer|True|The number of users to get the badge|
+ ??? info "[EpochBadgeType](/../../schemas/epoch_badge_type)"
+ |Value| Description |
+ |-|-|
+ |`CHAMPION` = 1|Champion|
+ |`LEGEND` = 2|Legend|
+ |`VETERAN` = 3|Veteran|
+ |`ELITE` = 4|Elite|
+ |`MASTER` = 5|Master|
+ |`EXPERT` = 6|Expert|
+ |`WARRIOR` = 7|Warrior|
+ |`SERGEANT` = 8|Sergeant|
+ |`RANGER` = 9|Ranger|
+ |`CHALLENGER` = 10|Challenger|
+ |`APPRENTICE` = 11|Apprentice|
+ |`ROOKIE` = 12|Rookie|
+ ??? info "[RewardProgramType](/../../schemas/reward_program_type)"
+ |Value| Description |
+ |-|-|
+ |`ECOSYSTEM` = 1||
+ |`TRADER` = 2||
+ |`LP` = 3||
diff --git a/docs/grvt/schemas/epoch_badge_type.md b/docs/grvt/schemas/epoch_badge_type.md
new file mode 100644
index 0000000..623f02b
--- /dev/null
+++ b/docs/grvt/schemas/epoch_badge_type.md
@@ -0,0 +1,15 @@
+!!! info "[EpochBadgeType](/../../schemas/epoch_badge_type)"
+ |Value| Description |
+ |-|-|
+ |`CHAMPION` = 1|Champion|
+ |`LEGEND` = 2|Legend|
+ |`VETERAN` = 3|Veteran|
+ |`ELITE` = 4|Elite|
+ |`MASTER` = 5|Master|
+ |`EXPERT` = 6|Expert|
+ |`WARRIOR` = 7|Warrior|
+ |`SERGEANT` = 8|Sergeant|
+ |`RANGER` = 9|Ranger|
+ |`CHALLENGER` = 10|Challenger|
+ |`APPRENTICE` = 11|Apprentice|
+ |`ROOKIE` = 12|Rookie|
diff --git a/docs/grvt/schemas/error.md b/docs/grvt/schemas/error.md
new file mode 100644
index 0000000..e864262
--- /dev/null
+++ b/docs/grvt/schemas/error.md
@@ -0,0 +1,7 @@
+!!! info "[Error](/../../schemas/error)"
+ An error response
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |code
`c` |integer|True|The error code for the request|
+ |message
`m` |string|True|The error message for the request|
diff --git a/docs/grvt/schemas/fill.md b/docs/grvt/schemas/fill.md
new file mode 100644
index 0000000..f0f4482
--- /dev/null
+++ b/docs/grvt/schemas/fill.md
@@ -0,0 +1,40 @@
+!!! info "[Fill](/../../schemas/fill)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |sub_account_id
`sa` |string|True|The sub account ID that participated in the trade|
+ |instrument
`i` |string|True|The instrument being represented|
+ |is_buyer
`ib` |boolean|True|The side that the subaccount took on the trade|
+ |is_taker
`it` |boolean|True|The role that the subaccount took on the trade|
+ |size
`s` |string|True|The number of assets being traded, expressed in base asset decimal units|
+ |price
`p` |string|True|The traded price, expressed in `9` decimals|
+ |mark_price
`mp` |string|True|The mark price of the instrument at point of trade, expressed in `9` decimals|
+ |index_price
`ip` |string|True|The index price of the instrument at point of trade, expressed in `9` decimals|
+ |interest_rate
`ir` |string|True|The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point)|
+ |forward_price
`fp` |string|True|[Options] The forward price of the option at point of trade, expressed in `9` decimals|
+ |realized_pnl
`rp` |string|True|The realized PnL of the trade, expressed in quote asset decimal units (0 if increasing position size)|
+ |fee
`f` |string|True|The fees paid on the trade, expressed in quote asset decimal unit (negative if maker rebate applied)|
+ |fee_rate
`fr` |string|True|The fee rate paid on the trade|
+ |trade_id
`ti` |string|True|A trade identifier, globally unique, and monotonically increasing (not by `1`).
All trades sharing a single taker execution share the same first component (before `-`), and `event_time`.
`trade_id` is guaranteed to be consistent across MarketData `Trade` and Trading `Fill`.|
+ |order_id
`oi` |string|True|An order identifier|
+ |venue
`v` |Venue|True|The venue where the trade occurred|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
+ |signer
`s1` |string|True|The address (public key) of the wallet signing the payload|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ |is_rpi
`ir1` |boolean|True|If the trade is a RPI trade|
+ ??? info "[Venue](/../../schemas/venue)"
+ The list of Trading Venues that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`ORDERBOOK` = 1|the trade is cleared on the orderbook venue|
+ |`RFQ` = 2|the trade is cleared on the RFQ venue|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0||
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
diff --git a/docs/grvt/schemas/flat_referral.md b/docs/grvt/schemas/flat_referral.md
new file mode 100644
index 0000000..e6fde20
--- /dev/null
+++ b/docs/grvt/schemas/flat_referral.md
@@ -0,0 +1,16 @@
+!!! info "[FlatReferral](/../../schemas/flat_referral)"
+
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id|
+ |referrer_id
`ri` |string|True|The off chain referrer account id|
+ |referrer_level
`rl` |integer|True|The referrer level; 1: direct referrer, 2: indirect referrer|
+ |account_create_time
`ac` |string|True|The account creation time|
+ |main_account_id
`ma` |string|True|The main account id|
+ |referrer_main_account_id
`rm` |string|True|The referrer main account id|
+ |is_business
`ib` |boolean|True|The account is a business account or not|
+ |is_kyc_completed
`ik` |boolean|True|The account is KYC verified or not|
+ |kyc_completed_at
`kc` |string|True|The KYC completed time|
+ |kyc_type
`kt` |string|True|The KYC type, can be 'individual' or 'business'|
+ |kyc_first_completed_at
`kf` |string|True|The first KYC completed time|
diff --git a/docs/grvt/schemas/funding_account_summary.md b/docs/grvt/schemas/funding_account_summary.md
new file mode 100644
index 0000000..4cd1faa
--- /dev/null
+++ b/docs/grvt/schemas/funding_account_summary.md
@@ -0,0 +1,23 @@
+!!! info "[FundingAccountSummary](/../../schemas/funding_account_summary)"
+ The funding account summary, that reports the total equity and spot balances of a funding (main) account
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |main_account_id
`ma` |string|True|The main account ID of the account to which the summary belongs|
+ |total_equity
`te` |string|True|Total equity of the main account, denominated in USD|
+ |spot_balances
`sb` |[SpotBalance]|True|The list of spot assets owned by this main account, and their balances|
+ |vault_investments
`vi` |[VaultInvestment]|True|The list of vault investments held by this main account|
+ ??? info "[SpotBalance](/../../schemas/spot_balance)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |currency
`c` |string|True|The currency you hold a spot balance in|
+ |balance
`b` |string|True|This currency's balance in this trading account.|
+ |index_price
`ip` |string|True|The index price of this currency. (reported in `USD`)|
+ ??? info "[VaultInvestment](/../../schemas/vault_investment)"
+ Summarizes a vault investment held by a funding account
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |vault_id
`vi` |string|True|The trading account ID of the vault invested in.|
+ |num_lp_tokens
`nl` |string|True|The number of shares held by the investor.|
+ |share_price
`sp` |string|True|The current share price (in USD) of this vault investment.|
diff --git a/docs/grvt/schemas/funding_payment.md b/docs/grvt/schemas/funding_payment.md
new file mode 100644
index 0000000..dab0a6e
--- /dev/null
+++ b/docs/grvt/schemas/funding_payment.md
@@ -0,0 +1,9 @@
+!!! info "[FundingPayment](/../../schemas/funding_payment)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |sub_account_id
`sa` |string|True|The sub account ID that made the funding payment|
+ |instrument
`i` |string|True|The perpetual instrument being funded|
+ |currency
`c` |string|True|The currency of the funding payment|
+ |amount
`a` |string|True|The amount of the funding payment. Positive if paid, negative if received|
+ |tx_id
`ti` |string|True|The transaction ID of the funding payment.
Funding payments can be triggered by a trade, transfer, or liquidation.
The `tx_id` will match the corresponding `trade_id` or `tx_id`.|
diff --git a/docs/grvt/schemas/funding_rate.md b/docs/grvt/schemas/funding_rate.md
new file mode 100644
index 0000000..09d883d
--- /dev/null
+++ b/docs/grvt/schemas/funding_rate.md
@@ -0,0 +1,8 @@
+!!! info "[FundingRate](/../../schemas/funding_rate)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |funding_rate
`fr` |string|True|The funding rate of the instrument, expressed in percentage points|
+ |funding_time
`ft` |string|True|The funding timestamp of the funding rate, expressed in unix nanoseconds|
+ |mark_price
`mp` |string|True|The mark price of the instrument at funding timestamp, expressed in `9` decimals|
+ |funding_rate_8_h_avg
`fr1` |string|True|The 8h average funding rate of the instrument, expressed in percentage points|
diff --git a/docs/grvt/schemas/get_claimable_ecosystem_badge_response.md b/docs/grvt/schemas/get_claimable_ecosystem_badge_response.md
new file mode 100644
index 0000000..8572e59
--- /dev/null
+++ b/docs/grvt/schemas/get_claimable_ecosystem_badge_response.md
@@ -0,0 +1,56 @@
+!!! info "[GetClaimableEcosystemBadgeResponse](/../../schemas/get_claimable_ecosystem_badge_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |badge
`b` |EpochBadge|True|The epoch badge|
+ |is_claimable
`ic` |boolean|True|Whether the badge is claimable|
+ |claimable_until
`cu` |string|True|The time when the badge is claimable|
+ ??? info "[EpochBadge](/../../schemas/epoch_badge)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id|
+ |main_account_id
`ma` |string|True|The account ID|
+ |type
`t` |RewardProgramType|True|The type of the reward program|
+ |epoch
`e` |integer|True|The epoch number|
+ |epoch_start_time
`es` |string|True|The start time of the epoch|
+ |epoch_end_time
`ee` |string|True|The end time of the epoch|
+ |badge
`b` |EpochBadgeType|True|The type of the badge|
+ |distributed_badges
`db` |[EpochBadgeType]|True|The distributed badges|
+ |total_point
`tp` |string|True|Total point|
+ |rank
`r` |integer|True|Rank|
+ |claimed_at
`ca` |string|True|The time when the badge was claimed, or the epoch end time if the user has already completed the KYC process|
+ ??? info "[RewardProgramType](/../../schemas/reward_program_type)"
+ |Value| Description |
+ |-|-|
+ |`ECOSYSTEM` = 1||
+ |`TRADER` = 2||
+ |`LP` = 3||
+ ??? info "[EpochBadgeType](/../../schemas/epoch_badge_type)"
+ |Value| Description |
+ |-|-|
+ |`CHAMPION` = 1|Champion|
+ |`LEGEND` = 2|Legend|
+ |`VETERAN` = 3|Veteran|
+ |`ELITE` = 4|Elite|
+ |`MASTER` = 5|Master|
+ |`EXPERT` = 6|Expert|
+ |`WARRIOR` = 7|Warrior|
+ |`SERGEANT` = 8|Sergeant|
+ |`RANGER` = 9|Ranger|
+ |`CHALLENGER` = 10|Challenger|
+ |`APPRENTICE` = 11|Apprentice|
+ |`ROOKIE` = 12|Rookie|
+ ??? info "[EpochBadgeType](/../../schemas/epoch_badge_type)"
+ |Value| Description |
+ |-|-|
+ |`CHAMPION` = 1|Champion|
+ |`LEGEND` = 2|Legend|
+ |`VETERAN` = 3|Veteran|
+ |`ELITE` = 4|Elite|
+ |`MASTER` = 5|Master|
+ |`EXPERT` = 6|Expert|
+ |`WARRIOR` = 7|Warrior|
+ |`SERGEANT` = 8|Sergeant|
+ |`RANGER` = 9|Ranger|
+ |`CHALLENGER` = 10|Challenger|
+ |`APPRENTICE` = 11|Apprentice|
+ |`ROOKIE` = 12|Rookie|
diff --git a/docs/grvt/schemas/initial_leverage_result.md b/docs/grvt/schemas/initial_leverage_result.md
new file mode 100644
index 0000000..f6c5cb0
--- /dev/null
+++ b/docs/grvt/schemas/initial_leverage_result.md
@@ -0,0 +1,7 @@
+!!! info "[InitialLeverageResult](/../../schemas/initial_leverage_result)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The instrument to get the leverage for|
+ |leverage
`l` |string|True|The initial leverage of the sub account|
+ |min_leverage
`ml` |string|True|The min leverage this sub account can set|
+ |max_leverage
`ml1` |string|True|The max leverage this sub account can set|
diff --git a/docs/grvt/schemas/instrument.md b/docs/grvt/schemas/instrument.md
new file mode 100644
index 0000000..8ca9f1c
--- /dev/null
+++ b/docs/grvt/schemas/instrument.md
@@ -0,0 +1,40 @@
+!!! info "[Instrument](/../../schemas/instrument)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |instrument_hash
`ih` |string|True|The asset ID used for instrument signing.|
+ |base
`b` |string|True|The base currency|
+ |quote
`q` |string|True|The quote currency|
+ |kind
`k` |Kind|True|The kind of instrument|
+ |venues
`v` |[Venue]|True|Venues that this instrument can be traded at|
+ |settlement_period
`sp1` |InstrumentSettlementPeriod|True|The settlement period of the instrument|
+ |base_decimals
`bd` |integer|True|The smallest denomination of the base asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)|
+ |quote_decimals
`qd` |integer|True|The smallest denomination of the quote asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)|
+ |tick_size
`ts` |string|True|The size of a single tick, expressed in price decimal units|
+ |min_size
`ms` |string|True|The minimum contract size, expressed in base asset decimal units|
+ |create_time
`ct` |string|True|Creation time in unix nanoseconds|
+ |max_position_size
`mp` |string|True|The maximum position size, expressed in base asset decimal units|
+ ??? info "[Kind](/../../schemas/kind)"
+ The list of asset kinds that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|the perpetual asset kind|
+ |`FUTURE` = 2|the future asset kind|
+ |`CALL` = 3|the call option asset kind|
+ |`PUT` = 4|the put option asset kind|
+ ??? info "[Venue](/../../schemas/venue)"
+ The list of Trading Venues that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`ORDERBOOK` = 1|the trade is cleared on the orderbook venue|
+ |`RFQ` = 2|the trade is cleared on the RFQ venue|
+ ??? info "[InstrumentSettlementPeriod](/../../schemas/instrument_settlement_period)"
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|Instrument settles through perpetual funding cycles|
+ |`DAILY` = 2|Instrument settles at an expiry date, marked as a daily instrument|
+ |`WEEKLY` = 3|Instrument settles at an expiry date, marked as a weekly instrument|
+ |`MONTHLY` = 4|Instrument settles at an expiry date, marked as a monthly instrument|
+ |`QUARTERLY` = 5|Instrument settles at an expiry date, marked as a quarterly instrument|
diff --git a/docs/grvt/schemas/instrument_settlement_period.md b/docs/grvt/schemas/instrument_settlement_period.md
new file mode 100644
index 0000000..5e14279
--- /dev/null
+++ b/docs/grvt/schemas/instrument_settlement_period.md
@@ -0,0 +1,8 @@
+!!! info "[InstrumentSettlementPeriod](/../../schemas/instrument_settlement_period)"
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|Instrument settles through perpetual funding cycles|
+ |`DAILY` = 2|Instrument settles at an expiry date, marked as a daily instrument|
+ |`WEEKLY` = 3|Instrument settles at an expiry date, marked as a weekly instrument|
+ |`MONTHLY` = 4|Instrument settles at an expiry date, marked as a monthly instrument|
+ |`QUARTERLY` = 5|Instrument settles at an expiry date, marked as a quarterly instrument|
diff --git a/docs/grvt/schemas/jsonrpc_request.md b/docs/grvt/schemas/jsonrpc_request.md
new file mode 100644
index 0000000..6f18dc3
--- /dev/null
+++ b/docs/grvt/schemas/jsonrpc_request.md
@@ -0,0 +1,9 @@
+!!! info "[JSONRPCRequest](/../../schemas/jsonrpc_request)"
+ All Websocket JSON RPC Requests are housed in this wrapper. You may specify a stream, and a list of feeds to subscribe to.
If a `request_id` is supplied in this JSON RPC request, it will be propagated back to any relevant JSON RPC responses (including error).
When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |jsonrpc
`j` |string|True|The JSON RPC version to use for the request|
+ |method
`m` |string|True|The method to use for the request (eg: `subscribe` / `unsubscribe` / `v1/instrument` )|
+ |params
`p` |object|True|The parameters for the request|
+ |id
`i` |integer|False
`0`|Optional Field which is used to match the response by the client.
If not passed, this field will not be returned|
diff --git a/docs/grvt/schemas/jsonrpc_response.md b/docs/grvt/schemas/jsonrpc_response.md
new file mode 100644
index 0000000..05dc32f
--- /dev/null
+++ b/docs/grvt/schemas/jsonrpc_response.md
@@ -0,0 +1,17 @@
+!!! info "[JSONRPCResponse](/../../schemas/jsonrpc_response)"
+ All Websocket JSON RPC Responses are housed in this wrapper. It returns a confirmation of the JSON RPC subscribe request.
If a `request_id` is supplied in the JSON RPC request, it will be propagated back in this JSON RPC response.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |jsonrpc
`j` |string|True|The JSON RPC version to use for the request|
+ |result
`r` |object|False
`null`|The result for the request|
+ |error
`e` |Error|False
`null`|The error for the request|
+ |id
`i` |integer|False
`0`|Optional Field which is used to match the response by the client.
If not passed, this field will not be returned|
+ |method
`m` |string|True|The method used in the request for this response (eg: `subscribe` / `unsubscribe` / `v1/instrument` )|
+ ??? info "[Error](/../../schemas/error)"
+ An error response
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |code
`c` |integer|True|The error code for the request|
+ |message
`m` |string|True|The error message for the request|
diff --git a/docs/grvt/schemas/kind.md b/docs/grvt/schemas/kind.md
new file mode 100644
index 0000000..d884c7c
--- /dev/null
+++ b/docs/grvt/schemas/kind.md
@@ -0,0 +1,9 @@
+!!! info "[Kind](/../../schemas/kind)"
+ The list of asset kinds that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`PERPETUAL` = 1|the perpetual asset kind|
+ |`FUTURE` = 2|the future asset kind|
+ |`CALL` = 3|the call option asset kind|
+ |`PUT` = 4|the put option asset kind|
diff --git a/docs/grvt/schemas/lp_point.md b/docs/grvt/schemas/lp_point.md
new file mode 100644
index 0000000..975f3fd
--- /dev/null
+++ b/docs/grvt/schemas/lp_point.md
@@ -0,0 +1,6 @@
+!!! info "[LPPoint](/../../schemas/lp_point)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |main_account_id
`ma` |string|True|The main account id|
+ |liquidity_score
`ls` |string|True|Liquidity score|
+ |rank
`r` |integer|True|The rank of user in the LP leaderboard|
diff --git a/docs/grvt/schemas/lp_snapshot.md b/docs/grvt/schemas/lp_snapshot.md
new file mode 100644
index 0000000..93baebb
--- /dev/null
+++ b/docs/grvt/schemas/lp_snapshot.md
@@ -0,0 +1,11 @@
+!!! info "[LPSnapshot](/../../schemas/lp_snapshot)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |main_account_id
`ma` |string|True|The main account id|
+ |lp_asset
`la` |string|True|The LP Asset|
+ |underlying_multiplier
`um` |string|True|Underlying multiplier|
+ |maker_trading_volume
`mt` |string|True|Maker trading volume|
+ |bid_fast_market_multiplier
`bf` |integer|True|Fast market multiplier|
+ |ask_fast_market_multiplier
`af` |integer|True|Fast market multiplier|
+ |liquidity_score
`ls` |string|True|Liquidity score|
+ |calculate_at
`ca` |string|True|The time when the snapshot was calculated|
diff --git a/docs/grvt/schemas/margin_tier_response.md b/docs/grvt/schemas/margin_tier_response.md
new file mode 100644
index 0000000..faceaa7
--- /dev/null
+++ b/docs/grvt/schemas/margin_tier_response.md
@@ -0,0 +1,5 @@
+!!! info "[MarginTierResponse](/../../schemas/margin_tier_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |lower_bound
`lb` |string|True||
+ |rate
`r` |string|True||
diff --git a/docs/grvt/schemas/margin_type.md b/docs/grvt/schemas/margin_type.md
new file mode 100644
index 0000000..5cc53f5
--- /dev/null
+++ b/docs/grvt/schemas/margin_type.md
@@ -0,0 +1,5 @@
+!!! info "[MarginType](/../../schemas/margin_type)"
+ |Value| Description |
+ |-|-|
+ |`SIMPLE_CROSS_MARGIN` = 2|Simple Cross Margin Mode: all assets have a predictable margin impact, the whole subaccount shares a single margin|
+ |`PORTFOLIO_CROSS_MARGIN` = 3|Portfolio Cross Margin Mode: asset margin impact is analysed on portfolio level, the whole subaccount shares a single margin|
diff --git a/docs/grvt/schemas/mini_ticker.md b/docs/grvt/schemas/mini_ticker.md
new file mode 100644
index 0000000..5825c1d
--- /dev/null
+++ b/docs/grvt/schemas/mini_ticker.md
@@ -0,0 +1,14 @@
+!!! info "[MiniTicker](/../../schemas/mini_ticker)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|False
`None`|Time at which the event was emitted in unix nanoseconds|
+ |instrument
`i` |string|False
`None`|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |mark_price
`mp` |string|False
`None`|The mark price of the instrument, expressed in `9` decimals|
+ |index_price
`ip` |string|False
`None`|The index price of the instrument, expressed in `9` decimals|
+ |last_price
`lp` |string|False
`None`|The last traded price of the instrument (also close price), expressed in `9` decimals|
+ |last_size
`ls` |string|False
`None`|The number of assets traded in the last trade, expressed in base asset decimal units|
+ |mid_price
`mp1` |string|False
`None`|The mid price of the instrument, expressed in `9` decimals|
+ |best_bid_price
`bb` |string|False
`None`|The best bid price of the instrument, expressed in `9` decimals|
+ |best_bid_size
`bb1` |string|False
`None`|The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units|
+ |best_ask_price
`ba` |string|False
`None`|The best ask price of the instrument, expressed in `9` decimals|
+ |best_ask_size
`ba1` |string|False
`None`|The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units|
diff --git a/docs/grvt/schemas/order.md b/docs/grvt/schemas/order.md
new file mode 100644
index 0000000..0fd6c33
--- /dev/null
+++ b/docs/grvt/schemas/order.md
@@ -0,0 +1,154 @@
+!!! info "[Order](/../../schemas/order)"
+ Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.
GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.
This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.
Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.
All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.
This minimizes the amount of trust users have to offer to GRVT
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |order_id
`oi` |string|False
`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
+ |sub_account_id
`sa` |string|True|The subaccount initiating the order|
+ |is_market
`im` |boolean|False
`false`|If the order is a market order
Market Orders do not have a limit price, and are always executed according to the maker order price.
Market Orders must always be taker orders|
+ |time_in_force
`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:
- PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg
- FULL EXECUTION = AON / FOK - only allows full size execution on all legs
- TAKER ONLY = IOC / FOK - only allows taker orders
- MAKER OR TAKER = GTT / AON - allows maker or taker orders
Exchange only supports (GTT, IOC, FOK)
RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
+ |post_only
`po` |boolean|False
`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.
If False, Order can be either a maker or taker order. In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.
| | Must Fill All | Can Fill Partial |
| - | - | - |
| Must Be Taker | FOK + False | IOC + False |
| Can Be Either | AON + False | GTC + False |
| Must Be Maker | AON + True | GTC + True |
|
+ |reduce_only
`ro` |boolean|False
`false`|If True, Order must reduce the position size, or be cancelled|
+ |legs
`l` |[OrderLeg]|True|The legs present in this order
The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
+ |signature
`s` |Signature|True|The signature approving this order|
+ |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
+ |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client|
+ ??? info "[TimeInForce](/../../schemas/time_in_force)"
+ | | Must Fill All | Can Fill Partial |
+ | - | - | - |
+ | Must Fill Immediately | FOK | IOC |
+ | Can Fill Till Time | AON | GTC |
+
+
+ |Value| Description |
+ |-|-|
+ |`GOOD_TILL_TIME` = 1|GTT - Remains open until it is cancelled, or expired|
+ |`ALL_OR_NONE` = 2|AON - Either fill the whole order or none of it (Block Trades Only)|
+ |`IMMEDIATE_OR_CANCEL` = 3|IOC - Fill the order as much as possible, when hitting the orderbook. Then cancel it|
+ |`FILL_OR_KILL` = 4|FOK - Both AoN and IoC. Either fill the full order when hitting the orderbook, or cancel it|
+ |`RETAIL_PRICE_IMPROVEMENT` = 5|RPI - A GTT + PostOnly maker order, that can only be taken by non-algorithmic UI users.|
+ ??? info "[OrderLeg](/../../schemas/order_leg)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The instrument to trade in this leg|
+ |size
`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
+ |limit_price
`lp` |string|False
`0`|The limit price of the order leg, expressed in `9` decimals.
This is the number of quote currency units to pay/receive for this leg.
This should be `null/0` if the order is a market order|
+ |is_buying_asset
`ib` |boolean|True|Specifies if the order leg is a buy or sell|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
+ ??? info "[OrderMetadata](/../../schemas/order_metadata)"
+ Metadata fields are used to support Backend only operations. These operations are not trustless by nature.
Hence, fields in here are never signed, and is never transmitted to the smart contract.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
+ |create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|False
``|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ |close_position
`cp` |boolean|True|If True, the order will close the position when the trigger price is reached|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ |`MID` = 3|MID - Order is activated when the mid price reaches the trigger price|
+ |`MARK` = 4|MARK - Order is activated when the mark price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0||
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
+ ??? info "[OrderState](/../../schemas/order_state)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |status
`s` |OrderStatus|True|The status of the order|
+ |reject_reason
`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
+ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
+ |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
+ |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
+ |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs|
+ ??? info "[OrderStatus](/../../schemas/order_status)"
+ |Value| Description |
+ |-|-|
+ |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.|
+ |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.|
+ |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.|
+ |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.|
+ |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.|
+ ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
+ |`REDUCE_ONLY_LIMIT` = 31|the remaining order size was cancelled because it exceeded current position size|
+ |`CLIENT_REPLACE` = 32|the order was replaced by a client replace request|
+ |`DERISK_MUST_BE_IOC` = 33|the derisk order must be an IOC order|
+ |`DERISK_MUST_BE_REDUCE_ONLY` = 34|the derisk order must be a reduce-only order|
+ |`DERISK_NOT_SUPPORTED` = 35|derisk is not supported|
+ |`INVALID_ORDER_TYPE` = 36|the order type is invalid|
+ |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined|
diff --git a/docs/grvt/schemas/order_leg.md b/docs/grvt/schemas/order_leg.md
new file mode 100644
index 0000000..e708e86
--- /dev/null
+++ b/docs/grvt/schemas/order_leg.md
@@ -0,0 +1,7 @@
+!!! info "[OrderLeg](/../../schemas/order_leg)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The instrument to trade in this leg|
+ |size
`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
+ |limit_price
`lp` |string|False
`0`|The limit price of the order leg, expressed in `9` decimals.
This is the number of quote currency units to pay/receive for this leg.
This should be `null/0` if the order is a market order|
+ |is_buying_asset
`ib` |boolean|True|Specifies if the order leg is a buy or sell|
diff --git a/docs/grvt/schemas/order_metadata.md b/docs/grvt/schemas/order_metadata.md
new file mode 100644
index 0000000..471ce7b
--- /dev/null
+++ b/docs/grvt/schemas/order_metadata.md
@@ -0,0 +1,51 @@
+!!! info "[OrderMetadata](/../../schemas/order_metadata)"
+ Metadata fields are used to support Backend only operations. These operations are not trustless by nature.
Hence, fields in here are never signed, and is never transmitted to the smart contract.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
+ |create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|False
``|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ |close_position
`cp` |boolean|True|If True, the order will close the position when the trigger price is reached|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ |`MID` = 3|MID - Order is activated when the mid price reaches the trigger price|
+ |`MARK` = 4|MARK - Order is activated when the mark price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0||
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
diff --git a/docs/grvt/schemas/order_reject_reason.md b/docs/grvt/schemas/order_reject_reason.md
new file mode 100644
index 0000000..ca48a4e
--- /dev/null
+++ b/docs/grvt/schemas/order_reject_reason.md
@@ -0,0 +1,41 @@
+!!! info "[OrderRejectReason](/../../schemas/order_reject_reason)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
+ |`REDUCE_ONLY_LIMIT` = 31|the remaining order size was cancelled because it exceeded current position size|
+ |`CLIENT_REPLACE` = 32|the order was replaced by a client replace request|
+ |`DERISK_MUST_BE_IOC` = 33|the derisk order must be an IOC order|
+ |`DERISK_MUST_BE_REDUCE_ONLY` = 34|the derisk order must be a reduce-only order|
+ |`DERISK_NOT_SUPPORTED` = 35|derisk is not supported|
+ |`INVALID_ORDER_TYPE` = 36|the order type is invalid|
+ |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined|
diff --git a/docs/grvt/schemas/order_state.md b/docs/grvt/schemas/order_state.md
new file mode 100644
index 0000000..53962ce
--- /dev/null
+++ b/docs/grvt/schemas/order_state.md
@@ -0,0 +1,58 @@
+!!! info "[OrderState](/../../schemas/order_state)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |status
`s` |OrderStatus|True|The status of the order|
+ |reject_reason
`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
+ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
+ |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
+ |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
+ |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs|
+ ??? info "[OrderStatus](/../../schemas/order_status)"
+ |Value| Description |
+ |-|-|
+ |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.|
+ |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.|
+ |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.|
+ |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.|
+ |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.|
+ ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
+ |`REDUCE_ONLY_LIMIT` = 31|the remaining order size was cancelled because it exceeded current position size|
+ |`CLIENT_REPLACE` = 32|the order was replaced by a client replace request|
+ |`DERISK_MUST_BE_IOC` = 33|the derisk order must be an IOC order|
+ |`DERISK_MUST_BE_REDUCE_ONLY` = 34|the derisk order must be a reduce-only order|
+ |`DERISK_NOT_SUPPORTED` = 35|derisk is not supported|
+ |`INVALID_ORDER_TYPE` = 36|the order type is invalid|
+ |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined|
diff --git a/docs/grvt/schemas/order_state_feed.md b/docs/grvt/schemas/order_state_feed.md
new file mode 100644
index 0000000..c6ec767
--- /dev/null
+++ b/docs/grvt/schemas/order_state_feed.md
@@ -0,0 +1,64 @@
+!!! info "[OrderStateFeed](/../../schemas/order_state_feed)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |order_id
`oi` |string|True|A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client|
+ |order_state
`os` |OrderState|True|The order state object being created or updated|
+ ??? info "[OrderState](/../../schemas/order_state)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |status
`s` |OrderStatus|True|The status of the order|
+ |reject_reason
`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
+ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
+ |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
+ |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
+ |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs|
+ ??? info "[OrderStatus](/../../schemas/order_status)"
+ |Value| Description |
+ |-|-|
+ |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.|
+ |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.|
+ |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.|
+ |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.|
+ |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.|
+ ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
+ |`REDUCE_ONLY_LIMIT` = 31|the remaining order size was cancelled because it exceeded current position size|
+ |`CLIENT_REPLACE` = 32|the order was replaced by a client replace request|
+ |`DERISK_MUST_BE_IOC` = 33|the derisk order must be an IOC order|
+ |`DERISK_MUST_BE_REDUCE_ONLY` = 34|the derisk order must be a reduce-only order|
+ |`DERISK_NOT_SUPPORTED` = 35|derisk is not supported|
+ |`INVALID_ORDER_TYPE` = 36|the order type is invalid|
+ |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined|
diff --git a/docs/grvt/schemas/order_status.md b/docs/grvt/schemas/order_status.md
new file mode 100644
index 0000000..998aa7c
--- /dev/null
+++ b/docs/grvt/schemas/order_status.md
@@ -0,0 +1,8 @@
+!!! info "[OrderStatus](/../../schemas/order_status)"
+ |Value| Description |
+ |-|-|
+ |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.|
+ |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.|
+ |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.|
+ |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.|
+ |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.|
diff --git a/docs/grvt/schemas/orderbook_level.md b/docs/grvt/schemas/orderbook_level.md
new file mode 100644
index 0000000..3988d20
--- /dev/null
+++ b/docs/grvt/schemas/orderbook_level.md
@@ -0,0 +1,6 @@
+!!! info "[OrderbookLevel](/../../schemas/orderbook_level)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |price
`p` |string|True|The price of the level, expressed in `9` decimals|
+ |size
`s` |string|True|The number of assets offered, expressed in base asset decimal units|
+ |num_orders
`no` |integer|True|The number of open orders at this level|
diff --git a/docs/grvt/schemas/orderbook_levels.md b/docs/grvt/schemas/orderbook_levels.md
new file mode 100644
index 0000000..413b3b2
--- /dev/null
+++ b/docs/grvt/schemas/orderbook_levels.md
@@ -0,0 +1,19 @@
+!!! info "[OrderbookLevels](/../../schemas/orderbook_levels)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |bids
`b` |[OrderbookLevel]|True|The list of best bids up till query depth|
+ |asks
`a` |[OrderbookLevel]|True|The list of best asks up till query depth|
+ ??? info "[OrderbookLevel](/../../schemas/orderbook_level)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |price
`p` |string|True|The price of the level, expressed in `9` decimals|
+ |size
`s` |string|True|The number of assets offered, expressed in base asset decimal units|
+ |num_orders
`no` |integer|True|The number of open orders at this level|
+ ??? info "[OrderbookLevel](/../../schemas/orderbook_level)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |price
`p` |string|True|The price of the level, expressed in `9` decimals|
+ |size
`s` |string|True|The number of assets offered, expressed in base asset decimal units|
+ |num_orders
`no` |integer|True|The number of open orders at this level|
diff --git a/docs/grvt/schemas/positions.md b/docs/grvt/schemas/positions.md
new file mode 100644
index 0000000..1fa92a4
--- /dev/null
+++ b/docs/grvt/schemas/positions.md
@@ -0,0 +1,18 @@
+!!! info "[Positions](/../../schemas/positions)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |sub_account_id
`sa` |string|True|The sub account ID that participated in the trade|
+ |instrument
`i` |string|True|The instrument being represented|
+ |size
`s` |string|True|The size of the position, expressed in base asset decimal units. Negative for short positions|
+ |notional
`n` |string|True|The notional value of the position, negative for short assets, expressed in quote asset decimal units|
+ |entry_price
`ep` |string|True|The entry price of the position, expressed in `9` decimals
Whenever increasing the size of a position, the entry price is updated to the new average entry price
`new_entry_price = (old_entry_price * old_size + trade_price * trade_size) / (old_size + trade_size)`|
+ |exit_price
`ep1` |string|True|The exit price of the position, expressed in `9` decimals
Whenever decreasing the size of a position, the exit price is updated to the new average exit price
`new_exit_price = (old_exit_price * old_exit_trade_size + trade_price * trade_size) / (old_exit_trade_size + trade_size)`|
+ |mark_price
`mp` |string|True|The mark price of the position, expressed in `9` decimals|
+ |unrealized_pnl
`up` |string|True|The unrealized PnL of the position, expressed in quote asset decimal units
`unrealized_pnl = (mark_price - entry_price) * size`|
+ |realized_pnl
`rp` |string|True|The realized PnL of the position, expressed in quote asset decimal units
`realized_pnl = (exit_price - entry_price) * exit_trade_size`|
+ |total_pnl
`tp` |string|True|The total PnL of the position, expressed in quote asset decimal units
`total_pnl = realized_pnl + unrealized_pnl`|
+ |roi
`r` |string|True|The ROI of the position, expressed as a percentage
`roi = (total_pnl / (entry_price * abs(size))) * 100^`|
+ |quote_index_price
`qi` |string|True|The index price of the quote currency. (reported in `USD`)|
+ |est_liquidation_price
`el` |string|True|The estimated liquidation price|
+ |leverage
`l` |string|True|The current leverage value for this position|
diff --git a/docs/grvt/schemas/pre_min_redemptions.md b/docs/grvt/schemas/pre_min_redemptions.md
new file mode 100644
index 0000000..ed215f6
--- /dev/null
+++ b/docs/grvt/schemas/pre_min_redemptions.md
@@ -0,0 +1,27 @@
+!!! info "[PreMinRedemptions](/../../schemas/pre_min_redemptions)"
+ Vault redemption queue section hidden from main view. All requests here have yet to age past the vault's minimum redemption period.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |requests
`r` |[VaultRedemptionRequest]|True|Pre-minimum-age redemption requests, ordered by age (first element is the oldest request that is pre-minimum-age).|
+ |token_count
`tc` |string|True|Number of shares in the pre-minimum-age section of the vault's redemption queue.|
+ ??? info "[VaultRedemptionRequest](/../../schemas/vault_redemption_request)"
+ Representation of a pending redemption request for a given vault.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |request_time
`rt` |string|True|[Filled by GRVT Backend] Time at which the redemption request was received by GRVT in unix nanoseconds|
+ |num_lp_tokens
`nl` |string|True|The number of shares to redeem|
+ |max_redemption_period_timestamp
`mr` |string|True|[Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be force-redeemed.|
+ |age_category
`ac` |VaultRedemptionReqAgeCategory|True|Age category of this redemption request.|
+ |is_manager
`im` |boolean|False
`None`|`true` if this request belongs to the vault manager, omitted otherwise.|
+ |eligible_for_auto_redemption_timestamp
`ef` |string|True|[Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be eligible for automated redemption.|
+ ??? info "[VaultRedemptionReqAgeCategory](/../../schemas/vault_redemption_req_age_category)"
+ Denotes the age category of a given redemption request.
+
+ |Value| Description |
+ |-|-|
+ |`NORMAL` = 1|This request is at least as old as the minimum redemption period, and is eligible for automated redemption.|
+ |`URGENT` = 2|This request is nearing the maxmimum redemption period and will be factored into pre-order check margin requirements.|
+ |`OVERDUE` = 3|This request has exceeded the maximum redemption period and will be considered for forced redemptions.|
+ |`PRE_MIN` = 4|This request has yet to exceed the minimum redemption period, and is not yet eligible for automated redemption.|
diff --git a/docs/grvt/schemas/pre_order_check_result.md b/docs/grvt/schemas/pre_order_check_result.md
new file mode 100644
index 0000000..a5c736a
--- /dev/null
+++ b/docs/grvt/schemas/pre_order_check_result.md
@@ -0,0 +1,45 @@
+!!! info "[PreOrderCheckResult](/../../schemas/pre_order_check_result)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |max_qty
`mq` |[AssetMaxQty]|True|The maximum quantity for each leg|
+ |margin_required
`mr` |string|True|The margin required for the order (reported in `settle_currency`)|
+ |order_valid
`ov` |boolean|True|Whether the order is valid|
+ |reason
`r` |string|True|The reason the order is invalid, if any|
+ |settle_currency
`sc` |Currency|True|The subAccount settle currency|
+ ??? info "[AssetMaxQty](/../../schemas/asset_max_qty)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |asset
`a` |string|True|The asset associated with the max quantity|
+ |max_buy_qty
`mb` |string|True|The maximum buy quantity|
+ |max_sell_qty
`ms` |string|True|The maximum sell quantity|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ |`XRP` = 15|the XRP token|
+ |`TRUMP` = 20|the TRUMP token|
+ |`SUI` = 21|the SUI token|
+ |`LINK` = 25|the LINK token|
+ |`JUP` = 27|the JUP token|
+ |`FARTCOIN` = 28|the FARTCOIN token|
+ |`ENA` = 29|the ENA token|
+ |`DOGE` = 30|the DOGE token|
+ |`ADA` = 33|the ADA token|
+ |`AAVE` = 34|the AAVE token|
+ |`BERA` = 35|the BERA token|
+ |`IP` = 40|the IP token|
diff --git a/docs/grvt/schemas/query_epoch_badge_point_distribution_request.md b/docs/grvt/schemas/query_epoch_badge_point_distribution_request.md
new file mode 100644
index 0000000..937a21d
--- /dev/null
+++ b/docs/grvt/schemas/query_epoch_badge_point_distribution_request.md
@@ -0,0 +1,13 @@
+!!! info "[QueryEpochBadgePointDistributionRequest](/../../schemas/query_epoch_badge_point_distribution_request)"
+ Query list of epoch badges
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |epoch
`e` |integer|False
`'all'`|The numerical epoch index|
+ |type
`t` |RewardProgramType|True|The type of the reward program|
+ ??? info "[RewardProgramType](/../../schemas/reward_program_type)"
+ |Value| Description |
+ |-|-|
+ |`ECOSYSTEM` = 1||
+ |`TRADER` = 2||
+ |`LP` = 3||
diff --git a/docs/grvt/schemas/query_epoch_badge_point_distribution_response.md b/docs/grvt/schemas/query_epoch_badge_point_distribution_response.md
new file mode 100644
index 0000000..3831ba8
--- /dev/null
+++ b/docs/grvt/schemas/query_epoch_badge_point_distribution_response.md
@@ -0,0 +1,37 @@
+!!! info "[QueryEpochBadgePointDistributionResponse](/../../schemas/query_epoch_badge_point_distribution_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[EpochBadgePointDistribution]|True|The list of epoch badges|
+ ??? info "[EpochBadgePointDistribution](/../../schemas/epoch_badge_point_distribution)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |badge
`b` |EpochBadgeType|True|The type of the badge|
+ |epoch
`e` |integer|True|The epoch number|
+ |type
`t` |RewardProgramType|True|The type of the reward program|
+ |min_point
`mp` |string|True|The minimum point to get the badge|
+ |max_point
`mp1` |string|True|The maximum point to get the badge|
+ |min_rank
`mr` |integer|True|The minimum rank to get the badge|
+ |max_rank
`mr1` |integer|True|The maximum rank to get the badge|
+ |total_point
`tp` |string|True|The total point to get the badge|
+ |count
`c` |integer|True|The number of users to get the badge|
+ ??? info "[EpochBadgeType](/../../schemas/epoch_badge_type)"
+ |Value| Description |
+ |-|-|
+ |`CHAMPION` = 1|Champion|
+ |`LEGEND` = 2|Legend|
+ |`VETERAN` = 3|Veteran|
+ |`ELITE` = 4|Elite|
+ |`MASTER` = 5|Master|
+ |`EXPERT` = 6|Expert|
+ |`WARRIOR` = 7|Warrior|
+ |`SERGEANT` = 8|Sergeant|
+ |`RANGER` = 9|Ranger|
+ |`CHALLENGER` = 10|Challenger|
+ |`APPRENTICE` = 11|Apprentice|
+ |`ROOKIE` = 12|Rookie|
+ ??? info "[RewardProgramType](/../../schemas/reward_program_type)"
+ |Value| Description |
+ |-|-|
+ |`ECOSYSTEM` = 1||
+ |`TRADER` = 2||
+ |`LP` = 3||
diff --git a/docs/grvt/schemas/query_epoch_badge_request.md b/docs/grvt/schemas/query_epoch_badge_request.md
new file mode 100644
index 0000000..6cac69e
--- /dev/null
+++ b/docs/grvt/schemas/query_epoch_badge_request.md
@@ -0,0 +1,16 @@
+!!! info "[QueryEpochBadgeRequest](/../../schemas/query_epoch_badge_request)"
+ Query list of epoch badges
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|False
`'all'`|The off chain account id to get referral stats|
+ |epoch
`e` |integer|False
`'all'`|The numerical epoch index|
+ |type
`t` |RewardProgramType|False
`'all'`|The type of the reward program|
+ |limit
`l` |integer|False
`'500'`|The limit to query for. Defaults to 500; Max 1000|
+ |cursor
`c` |string|False
`'all'`|The cursor to indicate when to start the query from|
+ ??? info "[RewardProgramType](/../../schemas/reward_program_type)"
+ |Value| Description |
+ |-|-|
+ |`ECOSYSTEM` = 1||
+ |`TRADER` = 2||
+ |`LP` = 3||
diff --git a/docs/grvt/schemas/query_epoch_badge_response.md b/docs/grvt/schemas/query_epoch_badge_response.md
new file mode 100644
index 0000000..9700a5a
--- /dev/null
+++ b/docs/grvt/schemas/query_epoch_badge_response.md
@@ -0,0 +1,55 @@
+!!! info "[QueryEpochBadgeResponse](/../../schemas/query_epoch_badge_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[EpochBadge]|True|The list of epoch badges|
+ |next
`n` |string|True|The cursor to indicate when to start the query from|
+ ??? info "[EpochBadge](/../../schemas/epoch_badge)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id|
+ |main_account_id
`ma` |string|True|The account ID|
+ |type
`t` |RewardProgramType|True|The type of the reward program|
+ |epoch
`e` |integer|True|The epoch number|
+ |epoch_start_time
`es` |string|True|The start time of the epoch|
+ |epoch_end_time
`ee` |string|True|The end time of the epoch|
+ |badge
`b` |EpochBadgeType|True|The type of the badge|
+ |distributed_badges
`db` |[EpochBadgeType]|True|The distributed badges|
+ |total_point
`tp` |string|True|Total point|
+ |rank
`r` |integer|True|Rank|
+ |claimed_at
`ca` |string|True|The time when the badge was claimed, or the epoch end time if the user has already completed the KYC process|
+ ??? info "[RewardProgramType](/../../schemas/reward_program_type)"
+ |Value| Description |
+ |-|-|
+ |`ECOSYSTEM` = 1||
+ |`TRADER` = 2||
+ |`LP` = 3||
+ ??? info "[EpochBadgeType](/../../schemas/epoch_badge_type)"
+ |Value| Description |
+ |-|-|
+ |`CHAMPION` = 1|Champion|
+ |`LEGEND` = 2|Legend|
+ |`VETERAN` = 3|Veteran|
+ |`ELITE` = 4|Elite|
+ |`MASTER` = 5|Master|
+ |`EXPERT` = 6|Expert|
+ |`WARRIOR` = 7|Warrior|
+ |`SERGEANT` = 8|Sergeant|
+ |`RANGER` = 9|Ranger|
+ |`CHALLENGER` = 10|Challenger|
+ |`APPRENTICE` = 11|Apprentice|
+ |`ROOKIE` = 12|Rookie|
+ ??? info "[EpochBadgeType](/../../schemas/epoch_badge_type)"
+ |Value| Description |
+ |-|-|
+ |`CHAMPION` = 1|Champion|
+ |`LEGEND` = 2|Legend|
+ |`VETERAN` = 3|Veteran|
+ |`ELITE` = 4|Elite|
+ |`MASTER` = 5|Master|
+ |`EXPERT` = 6|Expert|
+ |`WARRIOR` = 7|Warrior|
+ |`SERGEANT` = 8|Sergeant|
+ |`RANGER` = 9|Ranger|
+ |`CHALLENGER` = 10|Challenger|
+ |`APPRENTICE` = 11|Apprentice|
+ |`ROOKIE` = 12|Rookie|
diff --git a/docs/grvt/schemas/query_find_epoch_request.md b/docs/grvt/schemas/query_find_epoch_request.md
new file mode 100644
index 0000000..9c9f837
--- /dev/null
+++ b/docs/grvt/schemas/query_find_epoch_request.md
@@ -0,0 +1,7 @@
+!!! info "[QueryFindEpochRequest](/../../schemas/query_find_epoch_request)"
+ Query epoch by time or epoch number
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |time
`t` |string|False
`0`|The time to query the epoch|
+ |epoch
`e` |integer|False
`0`|The epoch number|
diff --git a/docs/grvt/schemas/query_find_epoch_response.md b/docs/grvt/schemas/query_find_epoch_response.md
new file mode 100644
index 0000000..2cae015
--- /dev/null
+++ b/docs/grvt/schemas/query_find_epoch_response.md
@@ -0,0 +1,10 @@
+!!! info "[QueryFindEpochResponse](/../../schemas/query_find_epoch_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |epoch
`e` |Epoch|True|The epoch|
+ ??? info "[Epoch](/../../schemas/epoch)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |epoch
`e` |integer|True|The epoch number|
+ |start_time
`st` |string|True|The start time of the epoch|
+ |end_time
`et` |string|True|The end time of the epoch|
diff --git a/docs/grvt/schemas/query_get_latest_lp_snapshot_response.md b/docs/grvt/schemas/query_get_latest_lp_snapshot_response.md
new file mode 100644
index 0000000..97ebfb2
--- /dev/null
+++ b/docs/grvt/schemas/query_get_latest_lp_snapshot_response.md
@@ -0,0 +1,15 @@
+!!! info "[QueryGetLatestLPSnapshotResponse](/../../schemas/query_get_latest_lp_snapshot_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |snapshot
`s` |LPSnapshot|True|The latest LP snapshot|
+ ??? info "[LPSnapshot](/../../schemas/lp_snapshot)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |main_account_id
`ma` |string|True|The main account id|
+ |lp_asset
`la` |string|True|The LP Asset|
+ |underlying_multiplier
`um` |string|True|Underlying multiplier|
+ |maker_trading_volume
`mt` |string|True|Maker trading volume|
+ |bid_fast_market_multiplier
`bf` |integer|True|Fast market multiplier|
+ |ask_fast_market_multiplier
`af` |integer|True|Fast market multiplier|
+ |liquidity_score
`ls` |string|True|Liquidity score|
+ |calculate_at
`ca` |string|True|The time when the snapshot was calculated|
diff --git a/docs/grvt/schemas/query_get_list_epoch_request.md b/docs/grvt/schemas/query_get_list_epoch_request.md
new file mode 100644
index 0000000..aa8fe38
--- /dev/null
+++ b/docs/grvt/schemas/query_get_list_epoch_request.md
@@ -0,0 +1,4 @@
+!!! info "[QueryGetListEpochRequest](/../../schemas/query_get_list_epoch_request)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |limit
`l` |integer|False
`0`|The limit to query for|
diff --git a/docs/grvt/schemas/query_get_list_epoch_response.md b/docs/grvt/schemas/query_get_list_epoch_response.md
new file mode 100644
index 0000000..5dd59fe
--- /dev/null
+++ b/docs/grvt/schemas/query_get_list_epoch_response.md
@@ -0,0 +1,10 @@
+!!! info "[QueryGetListEpochResponse](/../../schemas/query_get_list_epoch_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[Epoch]|True|The list of epochs|
+ ??? info "[Epoch](/../../schemas/epoch)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |epoch
`e` |integer|True|The epoch number|
+ |start_time
`st` |string|True|The start time of the epoch|
+ |end_time
`et` |string|True|The end time of the epoch|
diff --git a/docs/grvt/schemas/reward_epoch_info.md b/docs/grvt/schemas/reward_epoch_info.md
new file mode 100644
index 0000000..e598eaf
--- /dev/null
+++ b/docs/grvt/schemas/reward_epoch_info.md
@@ -0,0 +1,13 @@
+!!! info "[RewardEpochInfo](/../../schemas/reward_epoch_info)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |epoch
`e` |integer|True|The epoch number|
+ |epoch_start_time
`es` |string|True|The start time of the epoch|
+ |epoch_end_time
`ee` |string|True|The end time of the epoch|
+ |status
`s` |RewardEpochStatus|True|The status of the epoch|
+ ??? info "[RewardEpochStatus](/../../schemas/reward_epoch_status)"
+ |Value| Description |
+ |-|-|
+ |`PAST` = 1|Past|
+ |`CURRENT` = 2|Current|
+ |`FUTURE` = 3|Future|
diff --git a/docs/grvt/schemas/reward_epoch_status.md b/docs/grvt/schemas/reward_epoch_status.md
new file mode 100644
index 0000000..8cb3e94
--- /dev/null
+++ b/docs/grvt/schemas/reward_epoch_status.md
@@ -0,0 +1,6 @@
+!!! info "[RewardEpochStatus](/../../schemas/reward_epoch_status)"
+ |Value| Description |
+ |-|-|
+ |`PAST` = 1|Past|
+ |`CURRENT` = 2|Current|
+ |`FUTURE` = 3|Future|
diff --git a/docs/grvt/schemas/reward_program_type.md b/docs/grvt/schemas/reward_program_type.md
new file mode 100644
index 0000000..c9e3094
--- /dev/null
+++ b/docs/grvt/schemas/reward_program_type.md
@@ -0,0 +1,6 @@
+!!! info "[RewardProgramType](/../../schemas/reward_program_type)"
+ |Value| Description |
+ |-|-|
+ |`ECOSYSTEM` = 1||
+ |`TRADER` = 2||
+ |`LP` = 3||
diff --git a/docs/grvt/schemas/session_information.md b/docs/grvt/schemas/session_information.md
new file mode 100644
index 0000000..1db55d6
--- /dev/null
+++ b/docs/grvt/schemas/session_information.md
@@ -0,0 +1,8 @@
+!!! info "[SessionInformation](/../../schemas/session_information)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |country_code
`cc` |string|True|country code of user based on IP address|
+ |client_session_id
`cs` |string|True|unique identity of the session generated from client|
+ |device_screen_size
`ds` |string|True|screen size|
+ |device_os
`do` |string|True|OS of user's device|
+ |device_os_version
`do1` |string|True|OS version of user's device|
diff --git a/docs/grvt/schemas/signature.md b/docs/grvt/schemas/signature.md
new file mode 100644
index 0000000..f896cdf
--- /dev/null
+++ b/docs/grvt/schemas/signature.md
@@ -0,0 +1,9 @@
+!!! info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
diff --git a/docs/grvt/schemas/snap_funding_account_summary.md b/docs/grvt/schemas/snap_funding_account_summary.md
new file mode 100644
index 0000000..1cb26ab
--- /dev/null
+++ b/docs/grvt/schemas/snap_funding_account_summary.md
@@ -0,0 +1,47 @@
+!!! info "[SnapFundingAccountSummary](/../../schemas/snap_funding_account_summary)"
+ The funding account summary, that reports the total equity and spot balances of a funding (main) account
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |start_interval
`si` |string|True|The start of the interval in unix nanoseconds|
+ |main_account_id
`ma` |string|True|The main account ID of the account to which the summary belongs|
+ |total_equity
`te` |string|True|Total equity of the main account, denominated in USD|
+ |spot_balances
`sb` |[SpotBalance]|True|The list of spot assets owned by this main account, and their balances|
+ ??? info "[SpotBalance](/../../schemas/spot_balance)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |currency
`c` |Currency|True|The currency you hold a spot balance in|
+ |balance
`b` |string|True|This currency's balance in this trading account.|
+ |index_price
`ip` |string|True|The index price of this currency. (reported in `USD`)|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ |`XRP` = 15|the XRP token|
+ |`TRUMP` = 20|the TRUMP token|
+ |`SUI` = 21|the SUI token|
+ |`LINK` = 25|the LINK token|
+ |`JUP` = 27|the JUP token|
+ |`FARTCOIN` = 28|the FARTCOIN token|
+ |`ENA` = 29|the ENA token|
+ |`DOGE` = 30|the DOGE token|
+ |`ADA` = 33|the ADA token|
+ |`AAVE` = 34|the AAVE token|
+ |`BERA` = 35|the BERA token|
+ |`IP` = 40|the IP token|
diff --git a/docs/grvt/schemas/spot_balance.md b/docs/grvt/schemas/spot_balance.md
new file mode 100644
index 0000000..b1e6dfb
--- /dev/null
+++ b/docs/grvt/schemas/spot_balance.md
@@ -0,0 +1,6 @@
+!!! info "[SpotBalance](/../../schemas/spot_balance)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |currency
`c` |string|True|The currency you hold a spot balance in|
+ |balance
`b` |string|True|This currency's balance in this trading account.|
+ |index_price
`ip` |string|True|The index price of this currency. (reported in `USD`)|
diff --git a/docs/grvt/schemas/stream_reference.md b/docs/grvt/schemas/stream_reference.md
new file mode 100644
index 0000000..75dc903
--- /dev/null
+++ b/docs/grvt/schemas/stream_reference.md
@@ -0,0 +1,5 @@
+!!! info "[StreamReference](/../../schemas/stream_reference)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|The channel to subscribe to (eg: ticker.s / ticker.d)|
+ |selectors
`s1` |[string]|True|The list of selectors for the stream|
diff --git a/docs/grvt/schemas/sub_account.md b/docs/grvt/schemas/sub_account.md
new file mode 100644
index 0000000..d2201b6
--- /dev/null
+++ b/docs/grvt/schemas/sub_account.md
@@ -0,0 +1,48 @@
+!!! info "[SubAccount](/../../schemas/sub_account)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |sub_account_id
`sa` |string|True|The sub account ID this entry refers to|
+ |margin_type
`mt` |MarginType|True|The type of margin algorithm this subaccount uses|
+ |settle_currency
`sc` |string|True|The settlement, margin, and reporting currency of this account.
This subaccount can only open positions quoted in this currency
In the future, when users select a Multi-Currency Margin Type, this will be USD
All other assets are converted to this currency for the purpose of calculating margin|
+ |unrealized_pnl
`up` |string|True|The total unrealized PnL of all positions owned by this subaccount, denominated in quote currency decimal units.
`unrealized_pnl = sum(position.unrealized_pnl * position.quote_index_price) / settle_index_price`|
+ |total_equity
`te` |string|True|The notional value of your account if all positions are closed, excluding trading fees (reported in `settle_currency`).
`total_equity = sum(spot_balance.balance * spot_balance.index_price) / settle_index_price + unrealized_pnl`|
+ |initial_margin
`im` |string|True|The `total_equity` required to open positions in the account (reported in `settle_currency`).
Computation is different depending on account's `margin_type`|
+ |maintenance_margin
`mm` |string|True|The `total_equity` required to avoid liquidation of positions in the account (reported in `settle_currency`).
Computation is different depending on account's `margin_type`|
+ |available_balance
`ab` |string|True|The notional value available to transfer out of the trading account into the funding account (reported in `settle_currency`).
`available_balance = total_equity - initial_margin - min(unrealized_pnl, 0)`|
+ |spot_balances
`sb` |[SpotBalance]|True|The list of spot assets owned by this sub account, and their balances|
+ |positions
`p` |[Positions]|True|The list of positions owned by this sub account|
+ |settle_index_price
`si` |string|True|The index price of the settle currency. (reported in `USD`)|
+ |is_vault
`iv` |boolean|False
`None`|Whether this sub account is a vault|
+ |vault_im_additions
`vi` |string|False
`None`|Total amount of IM (reported in `settle_currency`) deducted from the vault due to redemptions nearing the end of their redemption period|
+ |derisk_margin
`dm` |string|True|The derisk margin of this sub account|
+ |derisk_to_maintenance_margin_ratio
`dt` |string|True|The derisk margin to maintenance margin ratio of this sub account|
+ ??? info "[MarginType](/../../schemas/margin_type)"
+ |Value| Description |
+ |-|-|
+ |`SIMPLE_CROSS_MARGIN` = 2|Simple Cross Margin Mode: all assets have a predictable margin impact, the whole subaccount shares a single margin|
+ |`PORTFOLIO_CROSS_MARGIN` = 3|Portfolio Cross Margin Mode: asset margin impact is analysed on portfolio level, the whole subaccount shares a single margin|
+ ??? info "[SpotBalance](/../../schemas/spot_balance)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |currency
`c` |string|True|The currency you hold a spot balance in|
+ |balance
`b` |string|True|This currency's balance in this trading account.|
+ |index_price
`ip` |string|True|The index price of this currency. (reported in `USD`)|
+ ??? info "[Positions](/../../schemas/positions)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |sub_account_id
`sa` |string|True|The sub account ID that participated in the trade|
+ |instrument
`i` |string|True|The instrument being represented|
+ |size
`s` |string|True|The size of the position, expressed in base asset decimal units. Negative for short positions|
+ |notional
`n` |string|True|The notional value of the position, negative for short assets, expressed in quote asset decimal units|
+ |entry_price
`ep` |string|True|The entry price of the position, expressed in `9` decimals
Whenever increasing the size of a position, the entry price is updated to the new average entry price
`new_entry_price = (old_entry_price * old_size + trade_price * trade_size) / (old_size + trade_size)`|
+ |exit_price
`ep1` |string|True|The exit price of the position, expressed in `9` decimals
Whenever decreasing the size of a position, the exit price is updated to the new average exit price
`new_exit_price = (old_exit_price * old_exit_trade_size + trade_price * trade_size) / (old_exit_trade_size + trade_size)`|
+ |mark_price
`mp` |string|True|The mark price of the position, expressed in `9` decimals|
+ |unrealized_pnl
`up` |string|True|The unrealized PnL of the position, expressed in quote asset decimal units
`unrealized_pnl = (mark_price - entry_price) * size`|
+ |realized_pnl
`rp` |string|True|The realized PnL of the position, expressed in quote asset decimal units
`realized_pnl = (exit_price - entry_price) * exit_trade_size`|
+ |total_pnl
`tp` |string|True|The total PnL of the position, expressed in quote asset decimal units
`total_pnl = realized_pnl + unrealized_pnl`|
+ |roi
`r` |string|True|The ROI of the position, expressed as a percentage
`roi = (total_pnl / (entry_price * abs(size))) * 100^`|
+ |quote_index_price
`qi` |string|True|The index price of the quote currency. (reported in `USD`)|
+ |est_liquidation_price
`el` |string|True|The estimated liquidation price|
+ |leverage
`l` |string|True|The current leverage value for this position|
diff --git a/docs/grvt/schemas/sub_account_trade.md b/docs/grvt/schemas/sub_account_trade.md
new file mode 100644
index 0000000..47b3753
--- /dev/null
+++ b/docs/grvt/schemas/sub_account_trade.md
@@ -0,0 +1,10 @@
+!!! info "[SubAccountTrade](/../../schemas/sub_account_trade)"
+
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |start_interval
`si` |string|True|Start of calculation epoch|
+ |sub_account_id
`sa` |string|True|The sub account id|
+ |instrument
`i` |string|True|The instrument being represented|
+ |total_fee
`tf` |string|True|Total fee paid|
+ |total_trade_volume
`tt` |string|True|Total volume traded|
diff --git a/docs/grvt/schemas/sub_account_trade_aggregation.md b/docs/grvt/schemas/sub_account_trade_aggregation.md
new file mode 100644
index 0000000..1658d88
--- /dev/null
+++ b/docs/grvt/schemas/sub_account_trade_aggregation.md
@@ -0,0 +1,12 @@
+!!! info "[SubAccountTradeAggregation](/../../schemas/sub_account_trade_aggregation)"
+ Similar to sub-account trade, but not divided by individual assets.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The sub account id|
+ |total_fee
`tf` |string|True|Total fee paid|
+ |total_trade_volume
`tt` |string|True|Total volume traded|
+ |num_traded
`nt` |string|True|Number of trades|
+ |positive_fee
`pf` |string|True|Total positive fee paid by user|
+ |signer
`s` |string|True|The signer of the trade|
+ |realized_pnl
`rp` |string|True|Realized PnL|
diff --git a/docs/grvt/schemas/sub_account_trade_interval.md b/docs/grvt/schemas/sub_account_trade_interval.md
new file mode 100644
index 0000000..7765cb7
--- /dev/null
+++ b/docs/grvt/schemas/sub_account_trade_interval.md
@@ -0,0 +1,7 @@
+!!! info "[SubAccountTradeInterval](/../../schemas/sub_account_trade_interval)"
+ |Value| Description |
+ |-|-|
+ |`SAT_1_MO` = 1|1 month|
+ |`SAT_1_D` = 2|1 day|
+ |`SAT_1_H` = 3|1 hour|
+ |`SAT_4_H` = 4|4 hour|
diff --git a/docs/grvt/schemas/ticker.md b/docs/grvt/schemas/ticker.md
new file mode 100644
index 0000000..d0546a0
--- /dev/null
+++ b/docs/grvt/schemas/ticker.md
@@ -0,0 +1,29 @@
+!!! info "[Ticker](/../../schemas/ticker)"
+ Derived data such as the below, will not be included by default:
- 24 hour volume (`buyVolume + sellVolume`)
- 24 hour taker buy/sell ratio (`buyVolume / sellVolume`)
- 24 hour average trade price (`volumeQ / volumeU`)
- 24 hour average trade volume (`volume / trades`)
- 24 hour percentage change (`24hStatChange / 24hStat`)
- 48 hour statistics (`2 * 24hStat - 24hStatChange`)
To query for an extended ticker payload, leverage the `greeks` and the `derived` flags.
Ticker extensions are currently under design to offer you more convenience.
These flags are only supported on the `Ticker Snapshot` WS endpoint, and on the `Ticker` API endpoint.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|False
`None`|Time at which the event was emitted in unix nanoseconds|
+ |instrument
`i` |string|False
`None`|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |mark_price
`mp` |string|False
`None`|The mark price of the instrument, expressed in `9` decimals|
+ |index_price
`ip` |string|False
`None`|The index price of the instrument, expressed in `9` decimals|
+ |last_price
`lp` |string|False
`None`|The last traded price of the instrument (also close price), expressed in `9` decimals|
+ |last_size
`ls` |string|False
`None`|The number of assets traded in the last trade, expressed in base asset decimal units|
+ |mid_price
`mp1` |string|False
`None`|The mid price of the instrument, expressed in `9` decimals|
+ |best_bid_price
`bb` |string|False
`None`|The best bid price of the instrument, expressed in `9` decimals|
+ |best_bid_size
`bb1` |string|False
`None`|The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units|
+ |best_ask_price
`ba` |string|False
`None`|The best ask price of the instrument, expressed in `9` decimals|
+ |best_ask_size
`ba1` |string|False
`None`|The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units|
+ |funding_rate_8h_curr
`fr` |string|False
`None`|The current funding rate of the instrument, expressed in percentage points|
+ |funding_rate_8h_avg
`fr1` |string|False
`None`|The average funding rate of the instrument (over last 8h), expressed in percentage points|
+ |interest_rate
`ir` |string|False
`None`|The interest rate of the underlying, expressed in centibeeps (1/100th of a basis point)|
+ |forward_price
`fp` |string|False
`None`|[Options] The forward price of the option, expressed in `9` decimals|
+ |buy_volume_24h_b
`bv` |string|False
`None`|The 24 hour taker buy volume of the instrument, expressed in base asset decimal units|
+ |sell_volume_24h_b
`sv` |string|False
`None`|The 24 hour taker sell volume of the instrument, expressed in base asset decimal units|
+ |buy_volume_24h_q
`bv1` |string|False
`None`|The 24 hour taker buy volume of the instrument, expressed in quote asset decimal units|
+ |sell_volume_24h_q
`sv1` |string|False
`None`|The 24 hour taker sell volume of the instrument, expressed in quote asset decimal units|
+ |high_price
`hp` |string|False
`None`|The 24 hour highest traded price of the instrument, expressed in `9` decimals|
+ |low_price
`lp1` |string|False
`None`|The 24 hour lowest traded price of the instrument, expressed in `9` decimals|
+ |open_price
`op` |string|False
`None`|The 24 hour first traded price of the instrument, expressed in `9` decimals|
+ |open_interest
`oi` |string|False
`None`|The open interest in the instrument, expressed in base asset decimal units|
+ |long_short_ratio
`ls1` |string|False
`None`|The ratio of accounts that are net long vs net short on this instrument|
diff --git a/docs/grvt/schemas/time_in_force.md b/docs/grvt/schemas/time_in_force.md
new file mode 100644
index 0000000..b71f052
--- /dev/null
+++ b/docs/grvt/schemas/time_in_force.md
@@ -0,0 +1,14 @@
+!!! info "[TimeInForce](/../../schemas/time_in_force)"
+ | | Must Fill All | Can Fill Partial |
+ | - | - | - |
+ | Must Fill Immediately | FOK | IOC |
+ | Can Fill Till Time | AON | GTC |
+
+
+ |Value| Description |
+ |-|-|
+ |`GOOD_TILL_TIME` = 1|GTT - Remains open until it is cancelled, or expired|
+ |`ALL_OR_NONE` = 2|AON - Either fill the whole order or none of it (Block Trades Only)|
+ |`IMMEDIATE_OR_CANCEL` = 3|IOC - Fill the order as much as possible, when hitting the orderbook. Then cancel it|
+ |`FILL_OR_KILL` = 4|FOK - Both AoN and IoC. Either fill the full order when hitting the orderbook, or cancel it|
+ |`RETAIL_PRICE_IMPROVEMENT` = 5|RPI - A GTT + PostOnly maker order, that can only be taken by non-algorithmic UI users.|
diff --git a/docs/grvt/schemas/time_interval.md b/docs/grvt/schemas/time_interval.md
new file mode 100644
index 0000000..7929ec0
--- /dev/null
+++ b/docs/grvt/schemas/time_interval.md
@@ -0,0 +1,9 @@
+!!! info "[TimeInterval](/../../schemas/time_interval)"
+ Time interval can be used as a filter in metric/portfolio management APIs
+
+ |Value| Description |
+ |-|-|
+ |`INTERVAL_1_D` = 1|1 day|
+ |`INTERVAL_7_D` = 2|7 days|
+ |`INTERVAL_30_D` = 3|30 days|
+ |`INTERVAL_90_D` = 4|90 days|
diff --git a/docs/grvt/schemas/tpsl_order_metadata.md b/docs/grvt/schemas/tpsl_order_metadata.md
new file mode 100644
index 0000000..6fd08e3
--- /dev/null
+++ b/docs/grvt/schemas/tpsl_order_metadata.md
@@ -0,0 +1,18 @@
+!!! info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ |close_position
`cp` |boolean|True|If True, the order will close the position when the trigger price is reached|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ |`MID` = 3|MID - Order is activated when the mid price reaches the trigger price|
+ |`MARK` = 4|MARK - Order is activated when the mark price reaches the trigger price|
diff --git a/docs/grvt/schemas/trade.md b/docs/grvt/schemas/trade.md
new file mode 100644
index 0000000..e41914e
--- /dev/null
+++ b/docs/grvt/schemas/trade.md
@@ -0,0 +1,24 @@
+!!! info "[Trade](/../../schemas/trade)"
+ All private RFQs and Private AXEs will be filtered out from the responses
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |is_taker_buyer
`it` |boolean|True|If taker was the buyer on the trade|
+ |size
`s` |string|True|The number of assets being traded, expressed in base asset decimal units|
+ |price
`p` |string|True|The traded price, expressed in `9` decimals|
+ |mark_price
`mp` |string|True|The mark price of the instrument at point of trade, expressed in `9` decimals|
+ |index_price
`ip` |string|True|The index price of the instrument at point of trade, expressed in `9` decimals|
+ |interest_rate
`ir` |string|True|The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point)|
+ |forward_price
`fp` |string|True|[Options] The forward price of the option at point of trade, expressed in `9` decimals|
+ |trade_id
`ti` |string|True|A trade identifier, globally unique, and monotonically increasing (not by `1`).
All trades sharing a single taker execution share the same first component (before `-`), and `event_time`.
`trade_id` is guaranteed to be consistent across MarketData `Trade` and Trading `Fill`.|
+ |venue
`v` |Venue|True|The venue where the trade occurred|
+ |is_rpi
`ir1` |boolean|True|If the trade is a RPI trade|
+ ??? info "[Venue](/../../schemas/venue)"
+ The list of Trading Venues that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`ORDERBOOK` = 1|the trade is cleared on the orderbook venue|
+ |`RFQ` = 2|the trade is cleared on the RFQ venue|
diff --git a/docs/grvt/schemas/trader_leaderboard_user.md b/docs/grvt/schemas/trader_leaderboard_user.md
new file mode 100644
index 0000000..ca29ba6
--- /dev/null
+++ b/docs/grvt/schemas/trader_leaderboard_user.md
@@ -0,0 +1,7 @@
+!!! info "[TraderLeaderboardUser](/../../schemas/trader_leaderboard_user)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id|
+ |rank
`r` |integer|True|The rank of the account in the Trader|
+ |total_point
`tp` |number|True|Total Trader point|
+ |twitter_username
`tu` |string|True|The twitter username of the account|
diff --git a/docs/grvt/schemas/trader_metric.md b/docs/grvt/schemas/trader_metric.md
new file mode 100644
index 0000000..4530b04
--- /dev/null
+++ b/docs/grvt/schemas/trader_metric.md
@@ -0,0 +1,5 @@
+!!! info "[TraderMetric](/../../schemas/trader_metric)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |total_fee
`tf` |string|True|Total fee paid|
+ |total_point
`tp` |number|True|Total trader point of this epoch/phase|
diff --git a/docs/grvt/schemas/transfer.md b/docs/grvt/schemas/transfer.md
new file mode 100644
index 0000000..1933f2f
--- /dev/null
+++ b/docs/grvt/schemas/transfer.md
@@ -0,0 +1,46 @@
+!!! info "[Transfer](/../../schemas/transfer)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |from_account_id
`fa` |string|True|The account to transfer from|
+ |from_sub_account_id
`fs` |string|True|The subaccount to transfer from (0 if transferring from main account)|
+ |to_account_id
`ta` |string|True|The account to deposit into|
+ |to_sub_account_id
`ts` |string|True|The subaccount to transfer to (0 if transferring to main account)|
+ |currency
`c` |Currency|True|The token currency to transfer|
+ |num_tokens
`nt` |string|True|The number of tokens to transfer|
+ |signature
`s` |Signature|True|The signature of the transfer|
+ |transfer_type
`tt` |TransferType|True|The type of transfer|
+ |transfer_metadata
`tm` |string|True|The metadata of the transfer|
+ ??? info "[Currency](/../../schemas/currency)"
+ The list of Currencies that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`USD` = 1|the USD fiat currency|
+ |`USDC` = 2|the USDC token|
+ |`USDT` = 3|the USDT token|
+ |`ETH` = 4|the ETH token|
+ |`BTC` = 5|the BTC token|
+ |`SOL` = 6|the SOL token|
+ |`ARB` = 7|the ARB token|
+ |`BNB` = 8|the BNB token|
+ |`ZK` = 9|the ZK token|
+ |`POL` = 10|the POL token|
+ |`OP` = 11|the OP token|
+ |`ATOM` = 12|the ATOM token|
+ |`KPEPE` = 13|the 1000PEPE token|
+ |`TON` = 14|the TON token|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
+ ??? info "[TransferType](/../../schemas/transfer_type)"
+ |Value| Description |
+ |-|-|
+ |`STANDARD` = 1|Standard transfer that has nothing to do with bridging|
+ |`FAST_ARB_DEPOSIT` = 2|Fast Arb Deposit Metadata type|
+ |`FAST_ARB_WITHDRAWAL` = 3|Fast Arb Withdrawal Metadata type|
diff --git a/docs/grvt/schemas/transfer_history.md b/docs/grvt/schemas/transfer_history.md
new file mode 100644
index 0000000..c9108e7
--- /dev/null
+++ b/docs/grvt/schemas/transfer_history.md
@@ -0,0 +1,32 @@
+!!! info "[TransferHistory](/../../schemas/transfer_history)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |tx_id
`ti` |string|True|The transaction ID of the transfer|
+ |from_account_id
`fa` |string|True|The account to transfer from|
+ |from_sub_account_id
`fs` |string|True|The subaccount to transfer from (0 if transferring from main account)|
+ |to_account_id
`ta` |string|True|The account to deposit into|
+ |to_sub_account_id
`ts` |string|True|The subaccount to transfer to (0 if transferring to main account)|
+ |currency
`c` |string|True|The token currency to transfer|
+ |num_tokens
`nt` |string|True|The number of tokens to transfer|
+ |signature
`s` |Signature|True|The signature of the transfer|
+ |event_time
`et` |string|True|The timestamp of the transfer in unix nanoseconds|
+ |transfer_type
`tt` |TransferType|True|The type of transfer|
+ |transfer_metadata
`tm` |string|True|The metadata of the transfer|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
+ ??? info "[TransferType](/../../schemas/transfer_type)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Default transfer that has nothing to do with bridging|
+ |`STANDARD` = 1|Standard transfer that has nothing to do with bridging|
+ |`FAST_ARB_DEPOSIT` = 2|Fast Arb Deposit Metadata type|
+ |`FAST_ARB_WITHDRAWAL` = 3|Fast Arb Withdrawal Metadata type|
+ |`NON_NATIVE_BRIDGE_DEPOSIT` = 4|Transfer type for non native bridging deposit|
+ |`NON_NATIVE_BRIDGE_WITHDRAWAL` = 5|Transfer type for non native bridging withdrawal|
diff --git a/docs/grvt/schemas/transfer_type.md b/docs/grvt/schemas/transfer_type.md
new file mode 100644
index 0000000..0885447
--- /dev/null
+++ b/docs/grvt/schemas/transfer_type.md
@@ -0,0 +1,9 @@
+!!! info "[TransferType](/../../schemas/transfer_type)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Default transfer that has nothing to do with bridging|
+ |`STANDARD` = 1|Standard transfer that has nothing to do with bridging|
+ |`FAST_ARB_DEPOSIT` = 2|Fast Arb Deposit Metadata type|
+ |`FAST_ARB_WITHDRAWAL` = 3|Fast Arb Withdrawal Metadata type|
+ |`NON_NATIVE_BRIDGE_DEPOSIT` = 4|Transfer type for non native bridging deposit|
+ |`NON_NATIVE_BRIDGE_WITHDRAWAL` = 5|Transfer type for non native bridging withdrawal|
diff --git a/docs/grvt/schemas/trigger_by.md b/docs/grvt/schemas/trigger_by.md
new file mode 100644
index 0000000..ea8b575
--- /dev/null
+++ b/docs/grvt/schemas/trigger_by.md
@@ -0,0 +1,10 @@
+!!! info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ |`MID` = 3|MID - Order is activated when the mid price reaches the trigger price|
+ |`MARK` = 4|MARK - Order is activated when the mark price reaches the trigger price|
diff --git a/docs/grvt/schemas/trigger_order_metadata.md b/docs/grvt/schemas/trigger_order_metadata.md
new file mode 100644
index 0000000..97dffec
--- /dev/null
+++ b/docs/grvt/schemas/trigger_order_metadata.md
@@ -0,0 +1,33 @@
+!!! info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ |close_position
`cp` |boolean|True|If True, the order will close the position when the trigger price is reached|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ |`MID` = 3|MID - Order is activated when the mid price reaches the trigger price|
+ |`MARK` = 4|MARK - Order is activated when the mark price reaches the trigger price|
diff --git a/docs/grvt/schemas/trigger_type.md b/docs/grvt/schemas/trigger_type.md
new file mode 100644
index 0000000..581ff4e
--- /dev/null
+++ b/docs/grvt/schemas/trigger_type.md
@@ -0,0 +1,8 @@
+!!! info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
diff --git a/docs/grvt/schemas/user_category_affinity_score.md b/docs/grvt/schemas/user_category_affinity_score.md
new file mode 100644
index 0000000..f320c1f
--- /dev/null
+++ b/docs/grvt/schemas/user_category_affinity_score.md
@@ -0,0 +1,8 @@
+!!! info "[UserCategoryAffinityScore](/../../schemas/user_category_affinity_score)"
+
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |account_id
`ai` |string|True|The off chain account id|
+ |category_id
`ci` |string|True|target category|
+ |affinity_score
`as` |number|True|affinity score|
diff --git a/docs/grvt/schemas/user_tracking_event.md b/docs/grvt/schemas/user_tracking_event.md
new file mode 100644
index 0000000..886a5a3
--- /dev/null
+++ b/docs/grvt/schemas/user_tracking_event.md
@@ -0,0 +1,21 @@
+!!! info "[UserTrackingEvent](/../../schemas/user_tracking_event)"
+ event of user
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_id
`ei` |string|True|uuid for event|
+ |tracking_version
`tv` |integer|True|version of tracking|
+ |event_time
`et` |string|True|timestamp of event|
+ |event_type
`et1` |string|True|event type|
+ |event_sub_type
`es` |string|True|event sub type|
+ |client_session_id
`cs` |string|True|unique identity of the session generated from client|
+ |device_os
`do` |string|True|OS of user's device|
+ |device_os_version
`do1` |string|True|OS version of user's device|
+ |sub_account_id
`sa` |string|True|sub account id|
+ |trading_address
`ta` |string|True|trading session key|
+ |screen_size
`ss` |string|True|screen size|
+ |event_data
`ed` |string|True|event data|
+ |user_id
`ui` |string|True|user id|
+ |account_id
`ai` |string|True|account id|
+ |auth_session_hash
`as` |string|True|auth session hash of the authenticated session on backend|
+ |country_code
`cc` |string|True|country code of user based on IP address|
diff --git a/docs/grvt/schemas/user_vault_category_event_pay_load.md b/docs/grvt/schemas/user_vault_category_event_pay_load.md
new file mode 100644
index 0000000..558eec9
--- /dev/null
+++ b/docs/grvt/schemas/user_vault_category_event_pay_load.md
@@ -0,0 +1,7 @@
+!!! info "[UserVaultCategoryEventPayLoad](/../../schemas/user_vault_category_event_pay_load)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |category_id
`ci` |string|True|category ID of event|
+ |vault_id
`vi` |string|True|vault ID|
+ |action
`a` |string|True|action of event. search/filter/invest...|
+ |num_bumps
`nb` |string|True|number of bumps in this event. default 1|
diff --git a/docs/grvt/schemas/vault_investment.md b/docs/grvt/schemas/vault_investment.md
new file mode 100644
index 0000000..7245b44
--- /dev/null
+++ b/docs/grvt/schemas/vault_investment.md
@@ -0,0 +1,8 @@
+!!! info "[VaultInvestment](/../../schemas/vault_investment)"
+ Summarizes a vault investment held by a funding account
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |vault_id
`vi` |string|True|The trading account ID of the vault invested in.|
+ |num_lp_tokens
`nl` |string|True|The number of shares held by the investor.|
+ |share_price
`sp` |string|True|The current share price (in USD) of this vault investment.|
diff --git a/docs/grvt/schemas/vault_investor_action.md b/docs/grvt/schemas/vault_investor_action.md
new file mode 100644
index 0000000..f3c8895
--- /dev/null
+++ b/docs/grvt/schemas/vault_investor_action.md
@@ -0,0 +1,7 @@
+!!! info "[VaultInvestorAction](/../../schemas/vault_investor_action)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0||
+ |`VAULT_INVEST` = 1||
+ |`VAULT_BURN_LP_TOKEN` = 2||
+ |`VAULT_REDEEM` = 3||
diff --git a/docs/grvt/schemas/vault_investor_summary.md b/docs/grvt/schemas/vault_investor_summary.md
new file mode 100644
index 0000000..1109001
--- /dev/null
+++ b/docs/grvt/schemas/vault_investor_summary.md
@@ -0,0 +1,22 @@
+!!! info "[VaultInvestorSummary](/../../schemas/vault_investor_summary)"
+ Vault investor summary information.
This struct contains the summary of investments in a vault.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The unique identifier of the vault sub account.|
+ |num_lp_tokens
`nl` |string|True|The number of Vault LP tokens held by the investor.|
+ |avg_entry_price
`ae` |string|True|The average entry price (in USD) of the vault LP tokens.|
+ |current_price
`cp` |string|True|The current price (in USD) of the vault LP tokens.|
+ |total_equity
`te` |string|True|The current valuation (in USD) of all held vault LP tokens.|
+ |all_time_realized_pnl
`at` |string|True|The all-time realized PnL (in USD) that the investor has received from the vault.|
+ |pending_redemption
`pr` |VaultRedemption|False
`None`|The singleton pending redemption (omitted if none).|
+ |can_burn
`cb` |boolean|False
`true`|True if the requesting account is authorized to burn tokens on this vault, omitted otherwise.|
+ ??? info "[VaultRedemption](/../../schemas/vault_redemption)"
+ Vault redemption information.
This struct contains information about a pending redemption from a vault.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |num_lp_tokens
`nl` |string|True|The number of LP Tokens requested for redemption.|
+ |request_valuation
`rv` |string|True|The valuation (in USD) of the redemption request.|
+ |request_time
`rt` |string|True|[Filled by GRVT Backend] Time at which the redemption request was received by GRVT in unix nanoseconds|
+ |max_redemption_period_timestamp
`mr` |string|True|[Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be force-redeemed.|
diff --git a/docs/grvt/schemas/vault_redemption.md b/docs/grvt/schemas/vault_redemption.md
new file mode 100644
index 0000000..c3a105b
--- /dev/null
+++ b/docs/grvt/schemas/vault_redemption.md
@@ -0,0 +1,9 @@
+!!! info "[VaultRedemption](/../../schemas/vault_redemption)"
+ Vault redemption information.
This struct contains information about a pending redemption from a vault.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |num_lp_tokens
`nl` |string|True|The number of LP Tokens requested for redemption.|
+ |request_valuation
`rv` |string|True|The valuation (in USD) of the redemption request.|
+ |request_time
`rt` |string|True|[Filled by GRVT Backend] Time at which the redemption request was received by GRVT in unix nanoseconds|
+ |max_redemption_period_timestamp
`mr` |string|True|[Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be force-redeemed.|
diff --git a/docs/grvt/schemas/vault_redemption_req_age_category.md b/docs/grvt/schemas/vault_redemption_req_age_category.md
new file mode 100644
index 0000000..974d1e5
--- /dev/null
+++ b/docs/grvt/schemas/vault_redemption_req_age_category.md
@@ -0,0 +1,9 @@
+!!! info "[VaultRedemptionReqAgeCategory](/../../schemas/vault_redemption_req_age_category)"
+ Denotes the age category of a given redemption request.
+
+ |Value| Description |
+ |-|-|
+ |`NORMAL` = 1|This request is at least as old as the minimum redemption period, and is eligible for automated redemption.|
+ |`URGENT` = 2|This request is nearing the maxmimum redemption period and will be factored into pre-order check margin requirements.|
+ |`OVERDUE` = 3|This request has exceeded the maximum redemption period and will be considered for forced redemptions.|
+ |`PRE_MIN` = 4|This request has yet to exceed the minimum redemption period, and is not yet eligible for automated redemption.|
diff --git a/docs/grvt/schemas/vault_redemption_req_view.md b/docs/grvt/schemas/vault_redemption_req_view.md
new file mode 100644
index 0000000..bada783
--- /dev/null
+++ b/docs/grvt/schemas/vault_redemption_req_view.md
@@ -0,0 +1,19 @@
+!!! info "[VaultRedemptionReqView](/../../schemas/vault_redemption_req_view)"
+ Representation of a pending redemption request for a given vault.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |request_time
`rt` |string|True|[Filled by GRVT Backend] Time at which the redemption request was received by GRVT in unix nanoseconds|
+ |num_lp_tokens
`nl` |string|True|The number of shares to redeem|
+ |max_redemption_period_timestamp
`mr` |string|True|[Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be force-redeemed.|
+ |age_category
`ac` |VaultRedemptionReqAgeCategory|True|Age category of this redemption request.|
+ |investor_id
`ii` |string|True|The address of the investor who submitted the request.|
+ ??? info "[VaultRedemptionReqAgeCategory](/../../schemas/vault_redemption_req_age_category)"
+ Denotes the age category of a given redemption request.
+
+ |Value| Description |
+ |-|-|
+ |`NORMAL` = 1|This request is at least as old as the minimum redemption period, and is eligible for automated redemption.|
+ |`URGENT` = 2|This request is nearing the maxmimum redemption period and will be factored into pre-order check margin requirements.|
+ |`OVERDUE` = 3|This request has exceeded the maximum redemption period and will be considered for forced redemptions.|
+ |`PRE_MIN` = 4|This request has yet to exceed the minimum redemption period, and is not yet eligible for automated redemption.|
diff --git a/docs/grvt/schemas/vault_redemption_request.md b/docs/grvt/schemas/vault_redemption_request.md
new file mode 100644
index 0000000..ecfb490
--- /dev/null
+++ b/docs/grvt/schemas/vault_redemption_request.md
@@ -0,0 +1,20 @@
+!!! info "[VaultRedemptionRequest](/../../schemas/vault_redemption_request)"
+ Representation of a pending redemption request for a given vault.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |request_time
`rt` |string|True|[Filled by GRVT Backend] Time at which the redemption request was received by GRVT in unix nanoseconds|
+ |num_lp_tokens
`nl` |string|True|The number of shares to redeem|
+ |max_redemption_period_timestamp
`mr` |string|True|[Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be force-redeemed.|
+ |age_category
`ac` |VaultRedemptionReqAgeCategory|True|Age category of this redemption request.|
+ |is_manager
`im` |boolean|False
`None`|`true` if this request belongs to the vault manager, omitted otherwise.|
+ |eligible_for_auto_redemption_timestamp
`ef` |string|True|[Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be eligible for automated redemption.|
+ ??? info "[VaultRedemptionReqAgeCategory](/../../schemas/vault_redemption_req_age_category)"
+ Denotes the age category of a given redemption request.
+
+ |Value| Description |
+ |-|-|
+ |`NORMAL` = 1|This request is at least as old as the minimum redemption period, and is eligible for automated redemption.|
+ |`URGENT` = 2|This request is nearing the maxmimum redemption period and will be factored into pre-order check margin requirements.|
+ |`OVERDUE` = 3|This request has exceeded the maximum redemption period and will be considered for forced redemptions.|
+ |`PRE_MIN` = 4|This request has yet to exceed the minimum redemption period, and is not yet eligible for automated redemption.|
diff --git a/docs/grvt/schemas/vault_type.md b/docs/grvt/schemas/vault_type.md
new file mode 100644
index 0000000..e49495d
--- /dev/null
+++ b/docs/grvt/schemas/vault_type.md
@@ -0,0 +1,5 @@
+!!! info "[VaultType](/../../schemas/vault_type)"
+ |Value| Description |
+ |-|-|
+ |`PRIME` = 1|Prime vault|
+ |`LAUNCH_PAD` = 2|Launchpad vault|
diff --git a/docs/grvt/schemas/venue.md b/docs/grvt/schemas/venue.md
new file mode 100644
index 0000000..442060f
--- /dev/null
+++ b/docs/grvt/schemas/venue.md
@@ -0,0 +1,7 @@
+!!! info "[Venue](/../../schemas/venue)"
+ The list of Trading Venues that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`ORDERBOOK` = 1|the trade is cleared on the orderbook venue|
+ |`RFQ` = 2|the trade is cleared on the RFQ venue|
diff --git a/docs/grvt/schemas/withdrawal.md b/docs/grvt/schemas/withdrawal.md
new file mode 100644
index 0000000..abfbe28
--- /dev/null
+++ b/docs/grvt/schemas/withdrawal.md
@@ -0,0 +1,17 @@
+!!! info "[Withdrawal](/../../schemas/withdrawal)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |from_account_id
`fa` |string|True|The subaccount to withdraw from|
+ |to_eth_address
`te` |string|True|The ethereum address to withdraw to|
+ |currency
`c` |string|True|The token currency to withdraw|
+ |num_tokens
`nt` |string|True|The number of tokens to withdraw|
+ |signature
`s` |Signature|True|The signature of the withdrawal|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
diff --git a/docs/grvt/schemas/withdrawal_history.md b/docs/grvt/schemas/withdrawal_history.md
new file mode 100644
index 0000000..36b7a18
--- /dev/null
+++ b/docs/grvt/schemas/withdrawal_history.md
@@ -0,0 +1,19 @@
+!!! info "[WithdrawalHistory](/../../schemas/withdrawal_history)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |tx_id
`ti` |string|True|The transaction ID of the withdrawal|
+ |from_account_id
`fa` |string|True|The subaccount to withdraw from|
+ |to_eth_address
`te` |string|True|The ethereum address to withdraw to|
+ |currency
`c` |string|True|The token currency to withdraw|
+ |num_tokens
`nt` |string|True|The number of tokens to withdraw|
+ |signature
`s` |Signature|True|The signature of the withdrawal|
+ |event_time
`et` |string|True|The timestamp of the withdrawal in unix nanoseconds|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
diff --git a/docs/grvt/schemas/ws_cancel_feed_data_v1.md b/docs/grvt/schemas/ws_cancel_feed_data_v1.md
new file mode 100644
index 0000000..908a188
--- /dev/null
+++ b/docs/grvt/schemas/ws_cancel_feed_data_v1.md
@@ -0,0 +1,62 @@
+!!! info "[WSCancelFeedDataV1](/../../schemas/ws_cancel_feed_data_v1)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|Stream name|
+ |selector
`s1` |string|True|Primary selector|
+ |sequence_number
`sn` |string|True|A sequence number used to determine message order within a stream.
- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.
- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.
- A single cluster payload can be multiplexed into multiple stream payloads.
- To distinguish each stream payload, a `dedupCounter` is included.
- The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`.|
+ |feed
`f` |CancelStatusFeed|True|Data relating to the status of the cancellation attempt|
+ ??? info "[CancelStatusFeed](/../../schemas/cancel_status_feed)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The subaccount ID that requested the cancellation|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client|
+ |order_id
`oi` |string|True|A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
+ |reason
`r` |OrderRejectReason|True|The user-provided reason for cancelling the order|
+ |update_time
`ut` |string|False
`0`|[Filled by GRVT Backend] Time at which the cancellation status was updated by GRVT in unix nanoseconds|
+ |cancel_status
`cs` |CancelStatus|True|Status of the cancellation attempt|
+ ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
+ |`REDUCE_ONLY_LIMIT` = 31|the remaining order size was cancelled because it exceeded current position size|
+ |`CLIENT_REPLACE` = 32|the order was replaced by a client replace request|
+ |`DERISK_MUST_BE_IOC` = 33|the derisk order must be an IOC order|
+ |`DERISK_MUST_BE_REDUCE_ONLY` = 34|the derisk order must be a reduce-only order|
+ |`DERISK_NOT_SUPPORTED` = 35|derisk is not supported|
+ |`INVALID_ORDER_TYPE` = 36|the order type is invalid|
+ |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined|
+ ??? info "[CancelStatus](/../../schemas/cancel_status)"
+ |Value| Description |
+ |-|-|
+ |`EXPIRED` = 1|Cancellation has expired because corresponding order had not arrived within the defined time-to-live window.|
+ |`DROPPED_DUPLICATE` = 2|This cancellation request was dropped because its TTL window overlaps with another cancellation request for the same order.|
diff --git a/docs/grvt/schemas/ws_cancel_feed_selector_v1.md b/docs/grvt/schemas/ws_cancel_feed_selector_v1.md
new file mode 100644
index 0000000..155ff86
--- /dev/null
+++ b/docs/grvt/schemas/ws_cancel_feed_selector_v1.md
@@ -0,0 +1,6 @@
+!!! info "[WSCancelFeedSelectorV1](/../../schemas/ws_cancel_feed_selector_v1)"
+ Subscribes to a feed of time-to-live expiry events for order cancellations requested by a given subaccount.
**This stream presently only provides expiry updates for cancel-order requests set with a valid TTL value**.
Successful order cancellations will reflect as updates published to the [order-state stream](https://api-docs.grvt.io/trading_streams/#order-state).
_A future release will expand the functionality of this stream to provide more general status updates on order cancellation requests._
Each Order can be uniquely identified by its `client_order_id`.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The subaccount ID to filter by|
diff --git a/docs/grvt/schemas/ws_candlestick_feed_data_v1.md b/docs/grvt/schemas/ws_candlestick_feed_data_v1.md
new file mode 100644
index 0000000..72d1fd2
--- /dev/null
+++ b/docs/grvt/schemas/ws_candlestick_feed_data_v1.md
@@ -0,0 +1,22 @@
+!!! info "[WSCandlestickFeedDataV1](/../../schemas/ws_candlestick_feed_data_v1)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|Stream name|
+ |selector
`s1` |string|True|Primary selector|
+ |sequence_number
`sn` |string|True|A sequence number used to determine message order within a stream.
- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.
- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.
- A single cluster payload can be multiplexed into multiple stream payloads.
- To distinguish each stream payload, a `dedupCounter` is included.
- The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`.|
+ |feed
`f` |Candlestick|True|A candlestick entry matching the request filters|
+ ??? info "[Candlestick](/../../schemas/candlestick)"
+
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |open_time
`ot` |string|True|Open time of kline bar in unix nanoseconds|
+ |close_time
`ct` |string|True|Close time of kline bar in unix nanosecond|
+ |open
`o` |string|True|The open price, expressed in underlying currency resolution units|
+ |close
`c` |string|True|The close price, expressed in underlying currency resolution units|
+ |high
`h` |string|True|The high price, expressed in underlying currency resolution units|
+ |low
`l` |string|True|The low price, expressed in underlying currency resolution units|
+ |volume_b
`vb` |string|True|The underlying volume transacted, expressed in base asset decimal units|
+ |volume_q
`vq` |string|True|The quote volume transacted, expressed in quote asset decimal units|
+ |trades
`t` |integer|True|The number of trades transacted|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
diff --git a/docs/grvt/schemas/ws_candlestick_feed_selector_v1.md b/docs/grvt/schemas/ws_candlestick_feed_selector_v1.md
new file mode 100644
index 0000000..186e781
--- /dev/null
+++ b/docs/grvt/schemas/ws_candlestick_feed_selector_v1.md
@@ -0,0 +1,36 @@
+!!! info "[WSCandlestickFeedSelectorV1](/../../schemas/ws_candlestick_feed_selector_v1)"
+ Subscribes to a stream of Kline/Candlestick updates for an instrument. A Kline is uniquely identified by its open time.
A new Kline is published every interval (if it exists). Upon subscription, the server will send the 5 most recent Kline for the requested interval.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |interval
`i1` |CandlestickInterval|True|The interval of each candlestick|
+ |type
`t` |CandlestickType|True|The type of candlestick data to retrieve|
+ ??? info "[CandlestickInterval](/../../schemas/candlestick_interval)"
+ |Value| Description |
+ |-|-|
+ |`CI_1_M` = 1|1 minute|
+ |`CI_3_M` = 2|3 minutes|
+ |`CI_5_M` = 3|5 minutes|
+ |`CI_15_M` = 4|15 minutes|
+ |`CI_30_M` = 5|30 minutes|
+ |`CI_1_H` = 6|1 hour|
+ |`CI_2_H` = 7|2 hour|
+ |`CI_4_H` = 8|4 hour|
+ |`CI_6_H` = 9|6 hour|
+ |`CI_8_H` = 10|8 hour|
+ |`CI_12_H` = 11|12 hour|
+ |`CI_1_D` = 12|1 day|
+ |`CI_3_D` = 13|3 days|
+ |`CI_5_D` = 14|5 days|
+ |`CI_1_W` = 15|1 week|
+ |`CI_2_W` = 16|2 weeks|
+ |`CI_3_W` = 17|3 weeks|
+ |`CI_4_W` = 18|4 weeks|
+ ??? info "[CandlestickType](/../../schemas/candlestick_type)"
+ |Value| Description |
+ |-|-|
+ |`TRADE` = 1|Tracks traded prices|
+ |`MARK` = 2|Tracks mark prices|
+ |`INDEX` = 3|Tracks index prices|
+ |`MID` = 4|Tracks book mid prices|
diff --git a/docs/grvt/schemas/ws_deposit_feed_data_v1.md b/docs/grvt/schemas/ws_deposit_feed_data_v1.md
new file mode 100644
index 0000000..758381f
--- /dev/null
+++ b/docs/grvt/schemas/ws_deposit_feed_data_v1.md
@@ -0,0 +1,16 @@
+!!! info "[WSDepositFeedDataV1](/../../schemas/ws_deposit_feed_data_v1)"
+ Subscribes to a feed of deposit updates.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|The websocket channel to which the response is sent|
+ |selector
`s1` |string|True|Primary selector|
+ |sequence_number
`sn` |string|True|A sequence number used to determine message order within a stream.
- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.
- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.
- A single cluster payload can be multiplexed into multiple stream payloads.
- To distinguish each stream payload, a `dedupCounter` is included.
- The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`.|
+ |feed
`f` |Deposit|True|The Deposit object|
+ ??? info "[Deposit](/../../schemas/deposit)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |tx_hash
`th` |string|True|The hash of the bridgemint event producing the deposit|
+ |to_account_id
`ta` |string|True|The account to deposit into|
+ |currency
`c` |string|True|The token currency to deposit|
+ |num_tokens
`nt` |string|True|The number of tokens to deposit|
diff --git a/docs/grvt/schemas/ws_deposit_feed_selector_v1.md b/docs/grvt/schemas/ws_deposit_feed_selector_v1.md
new file mode 100644
index 0000000..9ef7ba4
--- /dev/null
+++ b/docs/grvt/schemas/ws_deposit_feed_selector_v1.md
@@ -0,0 +1,6 @@
+!!! info "[WSDepositFeedSelectorV1](/../../schemas/ws_deposit_feed_selector_v1)"
+ Subscribes to a feed of deposits. This will execute when there is any deposit to selected account.
To subscribe to a main account, specify the account ID (eg. `0x9fe3758b67ce7a2875ee4b452f01a5282d84ed8a`).
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |main_account_id
`ma` |string|True|The main account ID to request for|
diff --git a/docs/grvt/schemas/ws_fill_feed_data_v1.md b/docs/grvt/schemas/ws_fill_feed_data_v1.md
new file mode 100644
index 0000000..c2b42f1
--- /dev/null
+++ b/docs/grvt/schemas/ws_fill_feed_data_v1.md
@@ -0,0 +1,47 @@
+!!! info "[WSFillFeedDataV1](/../../schemas/ws_fill_feed_data_v1)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|The websocket channel to which the response is sent|
+ |selector
`s1` |string|True|Primary selector|
+ |sequence_number
`sn` |string|True|A sequence number used to determine message order within a stream.
- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.
- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.
- A single cluster payload can be multiplexed into multiple stream payloads.
- To distinguish each stream payload, a `dedupCounter` is included.
- The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`.|
+ |feed
`f` |Fill|True|A private trade matching the request filter|
+ ??? info "[Fill](/../../schemas/fill)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |sub_account_id
`sa` |string|True|The sub account ID that participated in the trade|
+ |instrument
`i` |string|True|The instrument being represented|
+ |is_buyer
`ib` |boolean|True|The side that the subaccount took on the trade|
+ |is_taker
`it` |boolean|True|The role that the subaccount took on the trade|
+ |size
`s` |string|True|The number of assets being traded, expressed in base asset decimal units|
+ |price
`p` |string|True|The traded price, expressed in `9` decimals|
+ |mark_price
`mp` |string|True|The mark price of the instrument at point of trade, expressed in `9` decimals|
+ |index_price
`ip` |string|True|The index price of the instrument at point of trade, expressed in `9` decimals|
+ |interest_rate
`ir` |string|True|The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point)|
+ |forward_price
`fp` |string|True|[Options] The forward price of the option at point of trade, expressed in `9` decimals|
+ |realized_pnl
`rp` |string|True|The realized PnL of the trade, expressed in quote asset decimal units (0 if increasing position size)|
+ |fee
`f` |string|True|The fees paid on the trade, expressed in quote asset decimal unit (negative if maker rebate applied)|
+ |fee_rate
`fr` |string|True|The fee rate paid on the trade|
+ |trade_id
`ti` |string|True|A trade identifier, globally unique, and monotonically increasing (not by `1`).
All trades sharing a single taker execution share the same first component (before `-`), and `event_time`.
`trade_id` is guaranteed to be consistent across MarketData `Trade` and Trading `Fill`.|
+ |order_id
`oi` |string|True|An order identifier|
+ |venue
`v` |Venue|True|The venue where the trade occurred|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
+ |signer
`s1` |string|True|The address (public key) of the wallet signing the payload|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ |is_rpi
`ir1` |boolean|True|If the trade is a RPI trade|
+ ??? info "[Venue](/../../schemas/venue)"
+ The list of Trading Venues that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`ORDERBOOK` = 1|the trade is cleared on the orderbook venue|
+ |`RFQ` = 2|the trade is cleared on the RFQ venue|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0||
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
diff --git a/docs/grvt/schemas/ws_fill_feed_selector_v1.md b/docs/grvt/schemas/ws_fill_feed_selector_v1.md
new file mode 100644
index 0000000..1747ce4
--- /dev/null
+++ b/docs/grvt/schemas/ws_fill_feed_selector_v1.md
@@ -0,0 +1,7 @@
+!!! info "[WSFillFeedSelectorV1](/../../schemas/ws_fill_feed_selector_v1)"
+ Subscribes to a feed of private trade updates. This happens when a trade is executed.
To subscribe to all private trades, specify an empty `instrument` (eg. `2345123`).
Otherwise, specify the `instrument` to only receive private trades for that instrument (eg. `2345123-BTC_USDT_Perp`).
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The sub account ID to request for|
+ |instrument
`i` |string|False
`'all'`|The instrument filter to apply.|
diff --git a/docs/grvt/schemas/ws_list_streams_params.md b/docs/grvt/schemas/ws_list_streams_params.md
new file mode 100644
index 0000000..b103006
--- /dev/null
+++ b/docs/grvt/schemas/ws_list_streams_params.md
@@ -0,0 +1,5 @@
+!!! info "[WSListStreamsParams](/../../schemas/ws_list_streams_params)"
+ List down all the streams this connection has connected to.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
diff --git a/docs/grvt/schemas/ws_list_streams_result.md b/docs/grvt/schemas/ws_list_streams_result.md
new file mode 100644
index 0000000..a02e7cb
--- /dev/null
+++ b/docs/grvt/schemas/ws_list_streams_result.md
@@ -0,0 +1,11 @@
+!!! info "[WSListStreamsResult](/../../schemas/ws_list_streams_result)"
+ Returns a list of all rooms the client has subscribed to.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream_reference
`sr` |[StreamReference]|True|The list of stream references the connection is connected to|
+ ??? info "[StreamReference](/../../schemas/stream_reference)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|The channel to subscribe to (eg: ticker.s / ticker.d)|
+ |selectors
`s1` |[string]|True|The list of selectors for the stream|
diff --git a/docs/grvt/schemas/ws_mini_ticker_feed_data_v1.md b/docs/grvt/schemas/ws_mini_ticker_feed_data_v1.md
new file mode 100644
index 0000000..5aae76f
--- /dev/null
+++ b/docs/grvt/schemas/ws_mini_ticker_feed_data_v1.md
@@ -0,0 +1,21 @@
+!!! info "[WSMiniTickerFeedDataV1](/../../schemas/ws_mini_ticker_feed_data_v1)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|Stream name|
+ |selector
`s1` |string|True|Primary selector|
+ |sequence_number
`sn` |string|True|A sequence number used to determine message order within a stream.
- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.
- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.
- A single cluster payload can be multiplexed into multiple stream payloads.
- To distinguish each stream payload, a `dedupCounter` is included.
- The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`.|
+ |feed
`f` |MiniTicker|True|A mini ticker matching the request filter|
+ ??? info "[MiniTicker](/../../schemas/mini_ticker)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|False
`None`|Time at which the event was emitted in unix nanoseconds|
+ |instrument
`i` |string|False
`None`|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |mark_price
`mp` |string|False
`None`|The mark price of the instrument, expressed in `9` decimals|
+ |index_price
`ip` |string|False
`None`|The index price of the instrument, expressed in `9` decimals|
+ |last_price
`lp` |string|False
`None`|The last traded price of the instrument (also close price), expressed in `9` decimals|
+ |last_size
`ls` |string|False
`None`|The number of assets traded in the last trade, expressed in base asset decimal units|
+ |mid_price
`mp1` |string|False
`None`|The mid price of the instrument, expressed in `9` decimals|
+ |best_bid_price
`bb` |string|False
`None`|The best bid price of the instrument, expressed in `9` decimals|
+ |best_bid_size
`bb1` |string|False
`None`|The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units|
+ |best_ask_price
`ba` |string|False
`None`|The best ask price of the instrument, expressed in `9` decimals|
+ |best_ask_size
`ba1` |string|False
`None`|The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units|
diff --git a/docs/grvt/schemas/ws_mini_ticker_feed_selector_v1.md b/docs/grvt/schemas/ws_mini_ticker_feed_selector_v1.md
new file mode 100644
index 0000000..bac191b
--- /dev/null
+++ b/docs/grvt/schemas/ws_mini_ticker_feed_selector_v1.md
@@ -0,0 +1,7 @@
+!!! info "[WSMiniTickerFeedSelectorV1](/../../schemas/ws_mini_ticker_feed_selector_v1)"
+ Subscribes to a mini ticker feed for a single instrument. The `mini.s` channel offers simpler integration. To experience higher publishing rates, please use the `mini.d` channel.
Unlike the `mini.d` channel which publishes an initial snapshot, then only streams deltas after, the `mini.s` channel publishes full snapshots at each feed.
The Delta feed will work as follows:- On subscription, the server will send a full snapshot of the mini ticker.
- After the snapshot, the server will only send deltas of the mini ticker.
- The server will send a delta if any of the fields in the mini ticker have changed.
Field Semantics:- [DeltaOnly] If a field is not updated, {}
- If a field is updated, {field: '123'}
- If a field is set to zero, {field: '0'}
- If a field is set to null, {field: ''}
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |rate
`r` |integer|True|The minimal rate at which we publish feeds (in milliseconds)
Delta (0 - `raw`, 50, 100, 200, 500, 1000, 5000)
Snapshot (200, 500, 1000, 5000)|
diff --git a/docs/grvt/schemas/ws_order_feed_data_v1.md b/docs/grvt/schemas/ws_order_feed_data_v1.md
new file mode 100644
index 0000000..f8fc87e
--- /dev/null
+++ b/docs/grvt/schemas/ws_order_feed_data_v1.md
@@ -0,0 +1,161 @@
+!!! info "[WSOrderFeedDataV1](/../../schemas/ws_order_feed_data_v1)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|Stream name|
+ |selector
`s1` |string|True|Primary selector|
+ |sequence_number
`sn` |string|True|A sequence number used to determine message order within a stream.
- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.
- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.
- A single cluster payload can be multiplexed into multiple stream payloads.
- To distinguish each stream payload, a `dedupCounter` is included.
- The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`.|
+ |feed
`f` |Order|True|The order object being created or updated|
+ ??? info "[Order](/../../schemas/order)"
+ Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.
GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.
This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.
Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.
All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.
This minimizes the amount of trust users have to offer to GRVT
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |order_id
`oi` |string|False
`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
+ |sub_account_id
`sa` |string|True|The subaccount initiating the order|
+ |is_market
`im` |boolean|False
`false`|If the order is a market order
Market Orders do not have a limit price, and are always executed according to the maker order price.
Market Orders must always be taker orders|
+ |time_in_force
`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:
- PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg
- FULL EXECUTION = AON / FOK - only allows full size execution on all legs
- TAKER ONLY = IOC / FOK - only allows taker orders
- MAKER OR TAKER = GTT / AON - allows maker or taker orders
Exchange only supports (GTT, IOC, FOK)
RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
+ |post_only
`po` |boolean|False
`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.
If False, Order can be either a maker or taker order. In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.
| | Must Fill All | Can Fill Partial |
| - | - | - |
| Must Be Taker | FOK + False | IOC + False |
| Can Be Either | AON + False | GTC + False |
| Must Be Maker | AON + True | GTC + True |
|
+ |reduce_only
`ro` |boolean|False
`false`|If True, Order must reduce the position size, or be cancelled|
+ |legs
`l` |[OrderLeg]|True|The legs present in this order
The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
+ |signature
`s` |Signature|True|The signature approving this order|
+ |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
+ |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client|
+ ??? info "[TimeInForce](/../../schemas/time_in_force)"
+ | | Must Fill All | Can Fill Partial |
+ | - | - | - |
+ | Must Fill Immediately | FOK | IOC |
+ | Can Fill Till Time | AON | GTC |
+
+
+ |Value| Description |
+ |-|-|
+ |`GOOD_TILL_TIME` = 1|GTT - Remains open until it is cancelled, or expired|
+ |`ALL_OR_NONE` = 2|AON - Either fill the whole order or none of it (Block Trades Only)|
+ |`IMMEDIATE_OR_CANCEL` = 3|IOC - Fill the order as much as possible, when hitting the orderbook. Then cancel it|
+ |`FILL_OR_KILL` = 4|FOK - Both AoN and IoC. Either fill the full order when hitting the orderbook, or cancel it|
+ |`RETAIL_PRICE_IMPROVEMENT` = 5|RPI - A GTT + PostOnly maker order, that can only be taken by non-algorithmic UI users.|
+ ??? info "[OrderLeg](/../../schemas/order_leg)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The instrument to trade in this leg|
+ |size
`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
+ |limit_price
`lp` |string|False
`0`|The limit price of the order leg, expressed in `9` decimals.
This is the number of quote currency units to pay/receive for this leg.
This should be `null/0` if the order is a market order|
+ |is_buying_asset
`ib` |boolean|True|Specifies if the order leg is a buy or sell|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
+ ??? info "[OrderMetadata](/../../schemas/order_metadata)"
+ Metadata fields are used to support Backend only operations. These operations are not trustless by nature.
Hence, fields in here are never signed, and is never transmitted to the smart contract.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
+ |create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|False
``|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ |close_position
`cp` |boolean|True|If True, the order will close the position when the trigger price is reached|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ |`MID` = 3|MID - Order is activated when the mid price reaches the trigger price|
+ |`MARK` = 4|MARK - Order is activated when the mark price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0||
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
+ ??? info "[OrderState](/../../schemas/order_state)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |status
`s` |OrderStatus|True|The status of the order|
+ |reject_reason
`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
+ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
+ |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
+ |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
+ |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs|
+ ??? info "[OrderStatus](/../../schemas/order_status)"
+ |Value| Description |
+ |-|-|
+ |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.|
+ |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.|
+ |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.|
+ |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.|
+ |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.|
+ ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
+ |`REDUCE_ONLY_LIMIT` = 31|the remaining order size was cancelled because it exceeded current position size|
+ |`CLIENT_REPLACE` = 32|the order was replaced by a client replace request|
+ |`DERISK_MUST_BE_IOC` = 33|the derisk order must be an IOC order|
+ |`DERISK_MUST_BE_REDUCE_ONLY` = 34|the derisk order must be a reduce-only order|
+ |`DERISK_NOT_SUPPORTED` = 35|derisk is not supported|
+ |`INVALID_ORDER_TYPE` = 36|the order type is invalid|
+ |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined|
diff --git a/docs/grvt/schemas/ws_order_feed_selector_v1.md b/docs/grvt/schemas/ws_order_feed_selector_v1.md
new file mode 100644
index 0000000..a011280
--- /dev/null
+++ b/docs/grvt/schemas/ws_order_feed_selector_v1.md
@@ -0,0 +1,7 @@
+!!! info "[WSOrderFeedSelectorV1](/../../schemas/ws_order_feed_selector_v1)"
+ Subscribes to a feed of order updates pertaining to orders made by your account.
Each Order can be uniquely identified by its `order_id` or `client_order_id`.
To subscribe to all orders, specify an empty `instrument` (eg. `2345123`).
Otherwise, specify the `instrument` to only receive orders for that instrument (eg. `2345123-BTC_USDT_Perp`).
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The subaccount ID to filter by|
+ |instrument
`i` |string|False
`'all'`|The instrument filter to apply.|
diff --git a/docs/grvt/schemas/ws_order_group_feed_data_v1.md b/docs/grvt/schemas/ws_order_group_feed_data_v1.md
new file mode 100644
index 0000000..469e03f
--- /dev/null
+++ b/docs/grvt/schemas/ws_order_group_feed_data_v1.md
@@ -0,0 +1,15 @@
+!!! info "[WSOrderGroupFeedDataV1](/../../schemas/ws_order_group_feed_data_v1)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|Stream name|
+ |selector
`s1` |string|True|Primary selector|
+ |sequence_number
`sn` |string|True|A sequence number used to determine message order within a stream.
- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.
- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.
- A single cluster payload can be multiplexed into multiple stream payloads.
- To distinguish each stream payload, a `dedupCounter` is included.
- The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`.|
+ |feed
`f` |ClientOrderIDsByGroup|True|The order object being created or updated|
+ ??? info "[ClientOrderIDsByGroup](/../../schemas/client_order_i_ds_by_group)"
+ Grouping for the client order id and their associated groups.
This is used to define TP/SL pairs or other order groupings after loading the list of Open Orders.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |group_id
`gi` |string|True|The group this order belongs to. It can be used to define TP/SL pairs or other order groupings|
+ |client_order_id
`co` |[string]|True|List of client order IDs in the group|
+ |sub_account_id
`sa` |string|True|The sub account ID that these orders belong to|
diff --git a/docs/grvt/schemas/ws_order_group_feed_selector_v1.md b/docs/grvt/schemas/ws_order_group_feed_selector_v1.md
new file mode 100644
index 0000000..fd880b2
--- /dev/null
+++ b/docs/grvt/schemas/ws_order_group_feed_selector_v1.md
@@ -0,0 +1,6 @@
+!!! info "[WSOrderGroupFeedSelectorV1](/../../schemas/ws_order_group_feed_selector_v1)"
+ Subscribes to a feed of order group to get updated when a new group is created for the subAccount specified.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The subaccount ID to filter by|
diff --git a/docs/grvt/schemas/ws_order_state_feed_data_v1.md b/docs/grvt/schemas/ws_order_state_feed_data_v1.md
new file mode 100644
index 0000000..10c6dba
--- /dev/null
+++ b/docs/grvt/schemas/ws_order_state_feed_data_v1.md
@@ -0,0 +1,71 @@
+!!! info "[WSOrderStateFeedDataV1](/../../schemas/ws_order_state_feed_data_v1)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|Stream name|
+ |selector
`s1` |string|True|Primary selector|
+ |sequence_number
`sn` |string|True|A sequence number used to determine message order within a stream.
- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.
- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.
- A single cluster payload can be multiplexed into multiple stream payloads.
- To distinguish each stream payload, a `dedupCounter` is included.
- The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`.|
+ |feed
`f` |OrderStateFeed|True|The Order State Feed|
+ ??? info "[OrderStateFeed](/../../schemas/order_state_feed)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |order_id
`oi` |string|True|A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client|
+ |order_state
`os` |OrderState|True|The order state object being created or updated|
+ ??? info "[OrderState](/../../schemas/order_state)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |status
`s` |OrderStatus|True|The status of the order|
+ |reject_reason
`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
+ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
+ |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
+ |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
+ |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs|
+ ??? info "[OrderStatus](/../../schemas/order_status)"
+ |Value| Description |
+ |-|-|
+ |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.|
+ |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.|
+ |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.|
+ |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.|
+ |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.|
+ ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
+ |`REDUCE_ONLY_LIMIT` = 31|the remaining order size was cancelled because it exceeded current position size|
+ |`CLIENT_REPLACE` = 32|the order was replaced by a client replace request|
+ |`DERISK_MUST_BE_IOC` = 33|the derisk order must be an IOC order|
+ |`DERISK_MUST_BE_REDUCE_ONLY` = 34|the derisk order must be a reduce-only order|
+ |`DERISK_NOT_SUPPORTED` = 35|derisk is not supported|
+ |`INVALID_ORDER_TYPE` = 36|the order type is invalid|
+ |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined|
diff --git a/docs/grvt/schemas/ws_order_state_feed_selector_v1.md b/docs/grvt/schemas/ws_order_state_feed_selector_v1.md
new file mode 100644
index 0000000..28813c9
--- /dev/null
+++ b/docs/grvt/schemas/ws_order_state_feed_selector_v1.md
@@ -0,0 +1,7 @@
+!!! info "[WSOrderStateFeedSelectorV1](/../../schemas/ws_order_state_feed_selector_v1)"
+ Subscribes to a feed of order updates pertaining to orders made by your account.
Unlike the Order Stream, this only streams state updates, drastically improving throughput, and latency.
Each Order can be uniquely identified by its `order_id` or `client_order_id`.
To subscribe to all orders, specify an empty `instrument` (eg. `2345123`).
Otherwise, specify the `instrument` to only receive orders for that instrument (eg. `2345123-BTC_USDT_Perp`).
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The subaccount ID to filter by|
+ |instrument
`i` |string|False
`'all'`|The instrument filter to apply.|
diff --git a/docs/grvt/schemas/ws_orderbook_levels_feed_data_v1.md b/docs/grvt/schemas/ws_orderbook_levels_feed_data_v1.md
new file mode 100644
index 0000000..e37a0ed
--- /dev/null
+++ b/docs/grvt/schemas/ws_orderbook_levels_feed_data_v1.md
@@ -0,0 +1,26 @@
+!!! info "[WSOrderbookLevelsFeedDataV1](/../../schemas/ws_orderbook_levels_feed_data_v1)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|Stream name|
+ |selector
`s1` |string|True|Primary selector|
+ |sequence_number
`sn` |string|True|A sequence number used to determine message order within a stream.
- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.
- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.
- A single cluster payload can be multiplexed into multiple stream payloads.
- To distinguish each stream payload, a `dedupCounter` is included.
- The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`.|
+ |feed
`f` |OrderbookLevels|True|An orderbook levels object matching the request filter|
+ ??? info "[OrderbookLevels](/../../schemas/orderbook_levels)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |bids
`b` |[OrderbookLevel]|True|The list of best bids up till query depth|
+ |asks
`a` |[OrderbookLevel]|True|The list of best asks up till query depth|
+ ??? info "[OrderbookLevel](/../../schemas/orderbook_level)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |price
`p` |string|True|The price of the level, expressed in `9` decimals|
+ |size
`s` |string|True|The number of assets offered, expressed in base asset decimal units|
+ |num_orders
`no` |integer|True|The number of open orders at this level|
+ ??? info "[OrderbookLevel](/../../schemas/orderbook_level)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |price
`p` |string|True|The price of the level, expressed in `9` decimals|
+ |size
`s` |string|True|The number of assets offered, expressed in base asset decimal units|
+ |num_orders
`no` |integer|True|The number of open orders at this level|
diff --git a/docs/grvt/schemas/ws_orderbook_levels_feed_selector_v1.md b/docs/grvt/schemas/ws_orderbook_levels_feed_selector_v1.md
new file mode 100644
index 0000000..f091c62
--- /dev/null
+++ b/docs/grvt/schemas/ws_orderbook_levels_feed_selector_v1.md
@@ -0,0 +1,8 @@
+!!! info "[WSOrderbookLevelsFeedSelectorV1](/../../schemas/ws_orderbook_levels_feed_selector_v1)"
+ Subscribes to aggregated orderbook updates for a single instrument. The `book.s` channel offers simpler integration. To experience higher publishing rates, please use the `book.d` channel.
Unlike the `book.d` channel which publishes an initial snapshot, then only streams deltas after, the `book.s` channel publishes full snapshots at each feed.
The Delta feed will work as follows:- On subscription, the server will send a full snapshot of all levels of the Orderbook.
- After the snapshot, the server will only send levels that have changed in value.
Subscription Pattern:- Delta - `instrument@rate`
- Snapshot - `instrument@rate-depth`
Field Semantics:- [DeltaOnly] If a level is not updated, level not published
- If a level is updated, {size: '123'}
- If a level is set to zero, {size: '0'}
- Incoming levels will be published as soon as price moves
- Outgoing levels will be published with `size = 0`
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |rate
`r` |integer|True|The minimal rate at which we publish feeds (in milliseconds)
Delta (50, 100, 500, 1000)
Snapshot (500, 1000)|
+ |depth
`d` |integer|False
`'0'`|Depth of the order book to be retrieved
Delta(0 - `unlimited`)
Snapshot(10, 50, 100, 500)|
diff --git a/docs/grvt/schemas/ws_positions_feed_data_v1.md b/docs/grvt/schemas/ws_positions_feed_data_v1.md
new file mode 100644
index 0000000..44c4fc7
--- /dev/null
+++ b/docs/grvt/schemas/ws_positions_feed_data_v1.md
@@ -0,0 +1,25 @@
+!!! info "[WSPositionsFeedDataV1](/../../schemas/ws_positions_feed_data_v1)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|Stream name|
+ |selector
`s1` |string|True|Primary selector|
+ |sequence_number
`sn` |string|True|A sequence number used to determine message order within a stream.
- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.
- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.
- A single cluster payload can be multiplexed into multiple stream payloads.
- To distinguish each stream payload, a `dedupCounter` is included.
- The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`.|
+ |feed
`f` |Positions|True|A Position being created or updated matching the request filter|
+ ??? info "[Positions](/../../schemas/positions)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |sub_account_id
`sa` |string|True|The sub account ID that participated in the trade|
+ |instrument
`i` |string|True|The instrument being represented|
+ |size
`s` |string|True|The size of the position, expressed in base asset decimal units. Negative for short positions|
+ |notional
`n` |string|True|The notional value of the position, negative for short assets, expressed in quote asset decimal units|
+ |entry_price
`ep` |string|True|The entry price of the position, expressed in `9` decimals
Whenever increasing the size of a position, the entry price is updated to the new average entry price
`new_entry_price = (old_entry_price * old_size + trade_price * trade_size) / (old_size + trade_size)`|
+ |exit_price
`ep1` |string|True|The exit price of the position, expressed in `9` decimals
Whenever decreasing the size of a position, the exit price is updated to the new average exit price
`new_exit_price = (old_exit_price * old_exit_trade_size + trade_price * trade_size) / (old_exit_trade_size + trade_size)`|
+ |mark_price
`mp` |string|True|The mark price of the position, expressed in `9` decimals|
+ |unrealized_pnl
`up` |string|True|The unrealized PnL of the position, expressed in quote asset decimal units
`unrealized_pnl = (mark_price - entry_price) * size`|
+ |realized_pnl
`rp` |string|True|The realized PnL of the position, expressed in quote asset decimal units
`realized_pnl = (exit_price - entry_price) * exit_trade_size`|
+ |total_pnl
`tp` |string|True|The total PnL of the position, expressed in quote asset decimal units
`total_pnl = realized_pnl + unrealized_pnl`|
+ |roi
`r` |string|True|The ROI of the position, expressed as a percentage
`roi = (total_pnl / (entry_price * abs(size))) * 100^`|
+ |quote_index_price
`qi` |string|True|The index price of the quote currency. (reported in `USD`)|
+ |est_liquidation_price
`el` |string|True|The estimated liquidation price|
+ |leverage
`l` |string|True|The current leverage value for this position|
diff --git a/docs/grvt/schemas/ws_positions_feed_selector_v1.md b/docs/grvt/schemas/ws_positions_feed_selector_v1.md
new file mode 100644
index 0000000..3a4838f
--- /dev/null
+++ b/docs/grvt/schemas/ws_positions_feed_selector_v1.md
@@ -0,0 +1,7 @@
+!!! info "[WSPositionsFeedSelectorV1](/../../schemas/ws_positions_feed_selector_v1)"
+ Subscribes to a feed of position updates.
Updates get published when a trade is executed, and when leverage configurations are changed for instruments with ongoing positions.
To subscribe to all positions, specify an empty `instrument` (eg. `2345123`).
Otherwise, specify the `instrument` to only receive positions for that instrument (eg. `2345123-BTC_USDT_Perp`).
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The subaccount ID to filter by|
+ |instrument
`i` |string|False
`'all'`|The instrument filter to apply.|
diff --git a/docs/grvt/schemas/ws_request_v1.md b/docs/grvt/schemas/ws_request_v1.md
new file mode 100644
index 0000000..3751f65
--- /dev/null
+++ b/docs/grvt/schemas/ws_request_v1.md
@@ -0,0 +1,10 @@
+!!! info "[WSRequestV1](/../../schemas/ws_request_v1)"
+ All V1 Websocket Requests are housed in this wrapper. You may specify a stream, and a list of feeds to subscribe to.
If a `request_id` is supplied in this JSON RPC request, it will be propagated back to any relevant JSON RPC responses (including error).
When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |request_id
`ri` |number|False
`0`|Optional Field which is used to match the response by the client.
If not passed, this field will not be returned|
+ |stream
`s` |string|True|The channel to subscribe to (eg: ticker.s / ticker.d)|
+ |feed
`f` |[string]|True|The list of feeds to subscribe to|
+ |method
`m` |string|True|The method to use for the request (eg: subscribe / unsubscribe)|
+ |is_full
`if` |boolean|False
`false`|Whether the request is for full data or lite data|
diff --git a/docs/grvt/schemas/ws_response_v1.md b/docs/grvt/schemas/ws_response_v1.md
new file mode 100644
index 0000000..8100c3e
--- /dev/null
+++ b/docs/grvt/schemas/ws_response_v1.md
@@ -0,0 +1,11 @@
+!!! info "[WSResponseV1](/../../schemas/ws_response_v1)"
+ All V1 Websocket Responses are housed in this wrapper. It returns a confirmation of the JSON RPC subscribe request.
If a `request_id` is supplied in the JSON RPC request, it will be propagated back in this JSON RPC response.
To ensure you always know if you have missed any payloads, GRVT servers apply the following heuristics to sequence numbers:- All snapshot payloads will have a sequence number of `0`. All delta payloads will have a sequence number of `1+`. So its easy to distinguish between snapshots, and deltas
- Num snapshots returned in Response (per stream): You can ensure that you received the right number of snapshots
- First sequence number returned in Response (per stream): You can ensure that you received the first stream, without gaps from snapshots
- Sequence numbers should always monotonically increase by `1`. If it decreases, or increases by more than `1`. Please reconnect
- Duplicate sequence numbers are possible due to network retries. If you receive a duplicate, please ignore it, or idempotently re-update it.
When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |request_id
`ri` |number|False
`0`|Optional Field which is used to match the response by the client.
If not passed, this field will not be returned|
+ |stream
`s` |string|True|The channel to subscribe to (eg: ticker.s / ticker.d)|
+ |subs
`s1` |[string]|True|The list of feeds subscribed to|
+ |unsubs
`u` |[string]|True|The list of feeds unsubscribed from|
+ |num_snapshots
`ns` |[number]|True|The number of snapshot payloads to expect for each subscribed feed. Returned in same order as `subs`|
+ |first_sequence_number
`fs` |[string]|True|The first sequence number to expect for each subscribed feed. Returned in same order as `subs`|
diff --git a/docs/grvt/schemas/ws_subscribe_params.md b/docs/grvt/schemas/ws_subscribe_params.md
new file mode 100644
index 0000000..896bfaa
--- /dev/null
+++ b/docs/grvt/schemas/ws_subscribe_params.md
@@ -0,0 +1,7 @@
+!!! info "[WSSubscribeParams](/../../schemas/ws_subscribe_params)"
+ All V1 Websocket Subscription Requests are housed in this wrapper. You may specify a stream and a list of feeds to subscribe to.
When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details.
Sequence numbers can be either gateway-specific or global:
- **Gateway Unique Sequence Number**: Increments by one per stream, resets to 0 on gateway restart.
- **Global Unique Sequence Number**: A cluster-wide unique number assigned to each cluster payload, does not reset on gateway restarts, and can be used to track and identify message order across streams using `sequence_number` and `prev_sequence_number` in the feed response.
Set `useGlobalSequenceNumber = true` if you need a persistent, unique identifier across all streams or ordering across multiple feeds.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|The channel to subscribe to (eg: ticker.s / ticker.d)|
+ |selectors
`s1` |[string]|True|The list of feeds to subscribe to|
diff --git a/docs/grvt/schemas/ws_subscribe_request_v1_legacy.md b/docs/grvt/schemas/ws_subscribe_request_v1_legacy.md
new file mode 100644
index 0000000..2e5924d
--- /dev/null
+++ b/docs/grvt/schemas/ws_subscribe_request_v1_legacy.md
@@ -0,0 +1,10 @@
+!!! info "[WSSubscribeRequestV1Legacy](/../../schemas/ws_subscribe_request_v1_legacy)"
+ All V1 Websocket Requests are housed in this wrapper. You may specify a stream, and a list of feeds to subscribe to.
If a `request_id` is supplied in this JSON RPC request, it will be propagated back to any relevant JSON RPC responses (including error).
When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |request_id
`ri` |integer|False
`0`|Optional Field which is used to match the response by the client.
If not passed, this field will not be returned|
+ |stream
`s` |string|True|The channel to subscribe to (eg: ticker.s / ticker.d)|
+ |feed
`f` |[string]|True|The list of feeds to subscribe to|
+ |method
`m` |string|True|The method to use for the request (eg: subscribe / unsubscribe)|
+ |is_full
`if` |boolean|False
`false`|Whether the request is for full data or lite data|
diff --git a/docs/grvt/schemas/ws_subscribe_response_v1_legacy.md b/docs/grvt/schemas/ws_subscribe_response_v1_legacy.md
new file mode 100644
index 0000000..0ddb8ed
--- /dev/null
+++ b/docs/grvt/schemas/ws_subscribe_response_v1_legacy.md
@@ -0,0 +1,11 @@
+!!! info "[WSSubscribeResponseV1Legacy](/../../schemas/ws_subscribe_response_v1_legacy)"
+ All V1 Websocket Responses are housed in this wrapper. It returns a confirmation of the JSON RPC subscribe request.
If a `request_id` is supplied in the JSON RPC request, it will be propagated back in this JSON RPC response.
To ensure you always know if you have missed any payloads, GRVT servers apply the following heuristics to sequence numbers:- All snapshot payloads will have a sequence number of `0`. All delta payloads will have a sequence number of `1+`. So its easy to distinguish between snapshots, and deltas
- Num snapshots returned in Response (per stream): You can ensure that you received the right number of snapshots
- First sequence number returned in Response (per stream): You can ensure that you received the first stream, without gaps from snapshots
- Sequence numbers should always monotonically increase by `1`. If it decreases, or increases by more than `1`. Please reconnect
- Duplicate sequence numbers are possible due to network retries. If you receive a duplicate, please ignore it, or idempotently re-update it.
When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |request_id
`ri` |integer|False
`0`|Optional Field which is used to match the response by the client.
If not passed, this field will not be returned|
+ |stream
`s` |string|True|The channel to subscribe to (eg: ticker.s / ticker.d)|
+ |subs
`s1` |[string]|True|The list of feeds subscribed to|
+ |unsubs
`u` |[string]|True|The list of feeds unsubscribed from|
+ |num_snapshots
`ns` |[integer]|True|The number of snapshot payloads to expect for each subscribed feed. Returned in same order as `subs`|
+ |first_sequence_number
`fs` |[string]|True|The first sequence number to expect for each subscribed feed. Returned in same order as `subs`|
diff --git a/docs/grvt/schemas/ws_subscribe_result.md b/docs/grvt/schemas/ws_subscribe_result.md
new file mode 100644
index 0000000..a60e253
--- /dev/null
+++ b/docs/grvt/schemas/ws_subscribe_result.md
@@ -0,0 +1,10 @@
+!!! info "[WSSubscribeResult](/../../schemas/ws_subscribe_result)"
+ To ensure you always know if you have missed any payloads, GRVT servers apply the following heuristics to sequence numbers:- All snapshot payloads will have a sequence number of `0`. All delta payloads will have a sequence number of `1+`. So its easy to distinguish between snapshots, and deltas
- Num snapshots returned in Response (per stream): You can ensure that you received the right number of snapshots
- First sequence number returned in Response (per stream): You can ensure that you received the first stream, without gaps from snapshots
- Sequence numbers should always monotonically increase by `1`. If it decreases, or increases by more than `1`. Please reconnect
- Duplicate sequence numbers are possible due to network retries. If you receive a duplicate, please ignore it, or idempotently re-update it.
When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|The channel to subscribe to (eg: ticker.s / ticker.d)|
+ |subs
`s1` |[string]|True|The list of feeds subscribed to|
+ |unsubs
`u` |[string]|True|The list of feeds unsubscribed from|
+ |num_snapshots
`ns` |[integer]|True|The number of snapshot payloads to expect for each subscribed feed. Returned in same order as `subs`|
+ |first_sequence_number
`fs` |[string]|True|The first sequence number to expect for each subscribed feed. Returned in same order as `subs`|
diff --git a/docs/grvt/schemas/ws_ticker_feed_data_v1.md b/docs/grvt/schemas/ws_ticker_feed_data_v1.md
new file mode 100644
index 0000000..e9dacdc
--- /dev/null
+++ b/docs/grvt/schemas/ws_ticker_feed_data_v1.md
@@ -0,0 +1,36 @@
+!!! info "[WSTickerFeedDataV1](/../../schemas/ws_ticker_feed_data_v1)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|Stream name|
+ |selector
`s1` |string|True|Primary selector|
+ |sequence_number
`sn` |string|True|A sequence number used to determine message order within a stream.
- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.
- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.
- A single cluster payload can be multiplexed into multiple stream payloads.
- To distinguish each stream payload, a `dedupCounter` is included.
- The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`.|
+ |feed
`f` |Ticker|True|A ticker matching the request filter|
+ ??? info "[Ticker](/../../schemas/ticker)"
+ Derived data such as the below, will not be included by default:
- 24 hour volume (`buyVolume + sellVolume`)
- 24 hour taker buy/sell ratio (`buyVolume / sellVolume`)
- 24 hour average trade price (`volumeQ / volumeU`)
- 24 hour average trade volume (`volume / trades`)
- 24 hour percentage change (`24hStatChange / 24hStat`)
- 48 hour statistics (`2 * 24hStat - 24hStatChange`)
To query for an extended ticker payload, leverage the `greeks` and the `derived` flags.
Ticker extensions are currently under design to offer you more convenience.
These flags are only supported on the `Ticker Snapshot` WS endpoint, and on the `Ticker` API endpoint.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|False
`None`|Time at which the event was emitted in unix nanoseconds|
+ |instrument
`i` |string|False
`None`|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |mark_price
`mp` |string|False
`None`|The mark price of the instrument, expressed in `9` decimals|
+ |index_price
`ip` |string|False
`None`|The index price of the instrument, expressed in `9` decimals|
+ |last_price
`lp` |string|False
`None`|The last traded price of the instrument (also close price), expressed in `9` decimals|
+ |last_size
`ls` |string|False
`None`|The number of assets traded in the last trade, expressed in base asset decimal units|
+ |mid_price
`mp1` |string|False
`None`|The mid price of the instrument, expressed in `9` decimals|
+ |best_bid_price
`bb` |string|False
`None`|The best bid price of the instrument, expressed in `9` decimals|
+ |best_bid_size
`bb1` |string|False
`None`|The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units|
+ |best_ask_price
`ba` |string|False
`None`|The best ask price of the instrument, expressed in `9` decimals|
+ |best_ask_size
`ba1` |string|False
`None`|The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units|
+ |funding_rate_8h_curr
`fr` |string|False
`None`|The current funding rate of the instrument, expressed in percentage points|
+ |funding_rate_8h_avg
`fr1` |string|False
`None`|The average funding rate of the instrument (over last 8h), expressed in percentage points|
+ |interest_rate
`ir` |string|False
`None`|The interest rate of the underlying, expressed in centibeeps (1/100th of a basis point)|
+ |forward_price
`fp` |string|False
`None`|[Options] The forward price of the option, expressed in `9` decimals|
+ |buy_volume_24h_b
`bv` |string|False
`None`|The 24 hour taker buy volume of the instrument, expressed in base asset decimal units|
+ |sell_volume_24h_b
`sv` |string|False
`None`|The 24 hour taker sell volume of the instrument, expressed in base asset decimal units|
+ |buy_volume_24h_q
`bv1` |string|False
`None`|The 24 hour taker buy volume of the instrument, expressed in quote asset decimal units|
+ |sell_volume_24h_q
`sv1` |string|False
`None`|The 24 hour taker sell volume of the instrument, expressed in quote asset decimal units|
+ |high_price
`hp` |string|False
`None`|The 24 hour highest traded price of the instrument, expressed in `9` decimals|
+ |low_price
`lp1` |string|False
`None`|The 24 hour lowest traded price of the instrument, expressed in `9` decimals|
+ |open_price
`op` |string|False
`None`|The 24 hour first traded price of the instrument, expressed in `9` decimals|
+ |open_interest
`oi` |string|False
`None`|The open interest in the instrument, expressed in base asset decimal units|
+ |long_short_ratio
`ls1` |string|False
`None`|The ratio of accounts that are net long vs net short on this instrument|
diff --git a/docs/grvt/schemas/ws_ticker_feed_selector_v1.md b/docs/grvt/schemas/ws_ticker_feed_selector_v1.md
new file mode 100644
index 0000000..0f4d5af
--- /dev/null
+++ b/docs/grvt/schemas/ws_ticker_feed_selector_v1.md
@@ -0,0 +1,7 @@
+!!! info "[WSTickerFeedSelectorV1](/../../schemas/ws_ticker_feed_selector_v1)"
+ Subscribes to a ticker feed for a single instrument. The `ticker.s` channel offers simpler integration. To experience higher publishing rates, please use the `ticker.d` channel.
Unlike the `ticker.d` channel which publishes an initial snapshot, then only streams deltas after, the `ticker.s` channel publishes full snapshots at each feed.
The Delta feed will work as follows:- On subscription, the server will send a full snapshot of the ticker.
- After the snapshot, the server will only send deltas of the ticker.
- The server will send a delta if any of the fields in the ticker have changed.
Field Semantics:- [DeltaOnly] If a field is not updated, {}
- If a field is updated, {field: '123'}
- If a field is set to zero, {field: '0'}
- If a field is set to null, {field: ''}
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |rate
`r` |integer|True|The minimal rate at which we publish feeds (in milliseconds)
Delta (100, 200, 500, 1000, 5000)
Snapshot (500, 1000, 5000)|
diff --git a/docs/grvt/schemas/ws_trade_feed_data_v1.md b/docs/grvt/schemas/ws_trade_feed_data_v1.md
new file mode 100644
index 0000000..cb587b4
--- /dev/null
+++ b/docs/grvt/schemas/ws_trade_feed_data_v1.md
@@ -0,0 +1,31 @@
+!!! info "[WSTradeFeedDataV1](/../../schemas/ws_trade_feed_data_v1)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|Stream name|
+ |selector
`s1` |string|True|Primary selector|
+ |sequence_number
`sn` |string|True|A sequence number used to determine message order within a stream.
- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.
- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.
- A single cluster payload can be multiplexed into multiple stream payloads.
- To distinguish each stream payload, a `dedupCounter` is included.
- The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`.|
+ |feed
`f` |Trade|True|A public trade matching the request filter|
+ ??? info "[Trade](/../../schemas/trade)"
+ All private RFQs and Private AXEs will be filtered out from the responses
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |is_taker_buyer
`it` |boolean|True|If taker was the buyer on the trade|
+ |size
`s` |string|True|The number of assets being traded, expressed in base asset decimal units|
+ |price
`p` |string|True|The traded price, expressed in `9` decimals|
+ |mark_price
`mp` |string|True|The mark price of the instrument at point of trade, expressed in `9` decimals|
+ |index_price
`ip` |string|True|The index price of the instrument at point of trade, expressed in `9` decimals|
+ |interest_rate
`ir` |string|True|The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point)|
+ |forward_price
`fp` |string|True|[Options] The forward price of the option at point of trade, expressed in `9` decimals|
+ |trade_id
`ti` |string|True|A trade identifier, globally unique, and monotonically increasing (not by `1`).
All trades sharing a single taker execution share the same first component (before `-`), and `event_time`.
`trade_id` is guaranteed to be consistent across MarketData `Trade` and Trading `Fill`.|
+ |venue
`v` |Venue|True|The venue where the trade occurred|
+ |is_rpi
`ir1` |boolean|True|If the trade is a RPI trade|
+ ??? info "[Venue](/../../schemas/venue)"
+ The list of Trading Venues that are supported on the GRVT exchange
+
+ |Value| Description |
+ |-|-|
+ |`ORDERBOOK` = 1|the trade is cleared on the orderbook venue|
+ |`RFQ` = 2|the trade is cleared on the RFQ venue|
diff --git a/docs/grvt/schemas/ws_trade_feed_selector_v1.md b/docs/grvt/schemas/ws_trade_feed_selector_v1.md
new file mode 100644
index 0000000..bc3e2fd
--- /dev/null
+++ b/docs/grvt/schemas/ws_trade_feed_selector_v1.md
@@ -0,0 +1,7 @@
+!!! info "[WSTradeFeedSelectorV1](/../../schemas/ws_trade_feed_selector_v1)"
+ Subscribes to a stream of Public Trades for an instrument.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |instrument
`i` |string|True|The readable instrument name:- Perpetual: `ETH_USDT_Perp`
- Future: `BTC_USDT_Fut_20Oct23`
- Call: `ETH_USDT_Call_20Oct23_2800`
- Put: `ETH_USDT_Put_20Oct23_2800`
|
+ |limit
`l` |integer|True|The limit to query for. Valid values are (50, 200, 500, 1000). Default is 50|
diff --git a/docs/grvt/schemas/ws_transfer_feed_data_v1.md b/docs/grvt/schemas/ws_transfer_feed_data_v1.md
new file mode 100644
index 0000000..9eca61c
--- /dev/null
+++ b/docs/grvt/schemas/ws_transfer_feed_data_v1.md
@@ -0,0 +1,41 @@
+!!! info "[WSTransferFeedDataV1](/../../schemas/ws_transfer_feed_data_v1)"
+ Subscribes to a feed of transfer updates.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|The websocket channel to which the response is sent|
+ |selector
`s1` |string|True|Primary selector|
+ |sequence_number
`sn` |string|True|A sequence number used to determine message order within a stream.
- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.
- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.
- A single cluster payload can be multiplexed into multiple stream payloads.
- To distinguish each stream payload, a `dedupCounter` is included.
- The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`.|
+ |feed
`f` |TransferHistory|True|The transfer history matching the requested filters|
+ ??? info "[TransferHistory](/../../schemas/transfer_history)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |tx_id
`ti` |string|True|The transaction ID of the transfer|
+ |from_account_id
`fa` |string|True|The account to transfer from|
+ |from_sub_account_id
`fs` |string|True|The subaccount to transfer from (0 if transferring from main account)|
+ |to_account_id
`ta` |string|True|The account to deposit into|
+ |to_sub_account_id
`ts` |string|True|The subaccount to transfer to (0 if transferring to main account)|
+ |currency
`c` |string|True|The token currency to transfer|
+ |num_tokens
`nt` |string|True|The number of tokens to transfer|
+ |signature
`s` |Signature|True|The signature of the transfer|
+ |event_time
`et` |string|True|The timestamp of the transfer in unix nanoseconds|
+ |transfer_type
`tt` |TransferType|True|The type of transfer|
+ |transfer_metadata
`tm` |string|True|The metadata of the transfer|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
+ ??? info "[TransferType](/../../schemas/transfer_type)"
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Default transfer that has nothing to do with bridging|
+ |`STANDARD` = 1|Standard transfer that has nothing to do with bridging|
+ |`FAST_ARB_DEPOSIT` = 2|Fast Arb Deposit Metadata type|
+ |`FAST_ARB_WITHDRAWAL` = 3|Fast Arb Withdrawal Metadata type|
+ |`NON_NATIVE_BRIDGE_DEPOSIT` = 4|Transfer type for non native bridging deposit|
+ |`NON_NATIVE_BRIDGE_WITHDRAWAL` = 5|Transfer type for non native bridging withdrawal|
diff --git a/docs/grvt/schemas/ws_transfer_feed_selector_v1.md b/docs/grvt/schemas/ws_transfer_feed_selector_v1.md
new file mode 100644
index 0000000..5900b5e
--- /dev/null
+++ b/docs/grvt/schemas/ws_transfer_feed_selector_v1.md
@@ -0,0 +1,7 @@
+!!! info "[WSTransferFeedSelectorV1](/../../schemas/ws_transfer_feed_selector_v1)"
+ Subscribes to a feed of transfers. This will execute when there is any transfer to or from the selected account.
To subscribe to a main account, specify the account ID (eg. `0x9fe3758b67ce7a2875ee4b452f01a5282d84ed8a`).
To subscribe to a sub account, specify the main account and the sub account dash separated (eg. `0x9fe3758b67ce7a2875ee4b452f01a5282d84ed8a-1920109784202388`).
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |main_account_id
`ma` |string|True|The main account ID to request for|
+ |sub_account_id
`sa` |string|False
`'0'`|The sub account ID to request for|
diff --git a/docs/grvt/schemas/ws_unsubscribe_all_params.md b/docs/grvt/schemas/ws_unsubscribe_all_params.md
new file mode 100644
index 0000000..1e1636d
--- /dev/null
+++ b/docs/grvt/schemas/ws_unsubscribe_all_params.md
@@ -0,0 +1,5 @@
+!!! info "[WSUnsubscribeAllParams](/../../schemas/ws_unsubscribe_all_params)"
+ All V1 Websocket Unsubscription Request to unsubscribe from all active websocket streams.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
diff --git a/docs/grvt/schemas/ws_unsubscribe_all_result.md b/docs/grvt/schemas/ws_unsubscribe_all_result.md
new file mode 100644
index 0000000..aae2c8e
--- /dev/null
+++ b/docs/grvt/schemas/ws_unsubscribe_all_result.md
@@ -0,0 +1,11 @@
+!!! info "[WSUnsubscribeAllResult](/../../schemas/ws_unsubscribe_all_result)"
+ Returns a list of all rooms the client has unsubscribed from.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream_reference
`sr` |[StreamReference]|True|The list of stream references unsubscribed from|
+ ??? info "[StreamReference](/../../schemas/stream_reference)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|The channel to subscribe to (eg: ticker.s / ticker.d)|
+ |selectors
`s1` |[string]|True|The list of selectors for the stream|
diff --git a/docs/grvt/schemas/ws_unsubscribe_params.md b/docs/grvt/schemas/ws_unsubscribe_params.md
new file mode 100644
index 0000000..5914171
--- /dev/null
+++ b/docs/grvt/schemas/ws_unsubscribe_params.md
@@ -0,0 +1,7 @@
+!!! info "[WSUnsubscribeParams](/../../schemas/ws_unsubscribe_params)"
+ All V1 Websocket Unsubscription Requests are housed in this wrapper. You may specify a stream, a list of feeds and whether those feeds use global sequence numbers to unsubscribe from.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|The channel to unsubscribe from (eg: ticker.s / ticker.d)|
+ |selectors
`s1` |[string]|True|The list of feeds to unsubscribe from|
diff --git a/docs/grvt/schemas/ws_unsubscribe_result.md b/docs/grvt/schemas/ws_unsubscribe_result.md
new file mode 100644
index 0000000..09bd37b
--- /dev/null
+++ b/docs/grvt/schemas/ws_unsubscribe_result.md
@@ -0,0 +1,7 @@
+!!! info "[WSUnsubscribeResult](/../../schemas/ws_unsubscribe_result)"
+ Returns a confirmation of all unsubscribes
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|The channel to subscribe to (eg: ticker.s / ticker.d)|
+ |unsubs
`u` |[string]|True|The list of feeds unsubscribed from|
diff --git a/docs/grvt/schemas/ws_withdrawal_feed_data_v1.md b/docs/grvt/schemas/ws_withdrawal_feed_data_v1.md
new file mode 100644
index 0000000..fe45dfe
--- /dev/null
+++ b/docs/grvt/schemas/ws_withdrawal_feed_data_v1.md
@@ -0,0 +1,26 @@
+!!! info "[WSWithdrawalFeedDataV1](/../../schemas/ws_withdrawal_feed_data_v1)"
+ Subscribes to a feed of withdrawal updates.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|The websocket channel to which the response is sent|
+ |selector
`s1` |string|True|Primary selector|
+ |sequence_number
`sn` |string|True|A sequence number used to determine message order within a stream.
- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.
- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.
- A single cluster payload can be multiplexed into multiple stream payloads.
- To distinguish each stream payload, a `dedupCounter` is included.
- The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`.|
+ |feed
`f` |Withdrawal|True|The Withdrawal object|
+ ??? info "[Withdrawal](/../../schemas/withdrawal)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |from_account_id
`fa` |string|True|The subaccount to withdraw from|
+ |to_eth_address
`te` |string|True|The ethereum address to withdraw to|
+ |currency
`c` |string|True|The token currency to withdraw|
+ |num_tokens
`nt` |string|True|The number of tokens to withdraw|
+ |signature
`s` |Signature|True|The signature of the withdrawal|
+ ??? info "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
diff --git a/docs/grvt/schemas/ws_withdrawal_feed_selector_v1.md b/docs/grvt/schemas/ws_withdrawal_feed_selector_v1.md
new file mode 100644
index 0000000..86e6511
--- /dev/null
+++ b/docs/grvt/schemas/ws_withdrawal_feed_selector_v1.md
@@ -0,0 +1,6 @@
+!!! info "[WSWithdrawalFeedSelectorV1](/../../schemas/ws_withdrawal_feed_selector_v1)"
+ Subscribes to a feed of withdrawals. This will execute when there is any withdrawal from the selected account.
To subscribe to a main account, specify the account ID (eg. `0x9fe3758b67ce7a2875ee4b452f01a5282d84ed8a`).
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |main_account_id
`ma` |string|True|The main account ID to request for|
diff --git a/docs/grvt/sdk-readme.md b/docs/grvt/sdk-readme.md
new file mode 100644
index 0000000..f59556b
--- /dev/null
+++ b/docs/grvt/sdk-readme.md
@@ -0,0 +1,231 @@
+# GRVT TypeScript SDK
+
+This SDK provides a TypeScript interface to interact with the GRVT API. It supports both REST API and WebSocket connections.
+
+## Installation
+
+```bash
+npm install @grvt/sdk
+```
+
+## Usage
+
+### REST API Client
+
+```typescript
+import {
+ ECurrency,
+ ETransferType,
+ ITransferMetadata,
+ ETransferProvider,
+ ETransferDirection,
+ EGrvtEnvironment,
+ EChain,
+ ISigningOption
+} from '@grvt/sdk';
+
+// Initialize the client
+const client = new GrvtClient({
+ apiKey: 'your-api-key',
+ apiSecret: 'your-api-secret',
+ env: EGrvtEnvironment.DEV,
+});
+
+// Get funding account summary
+const accountSummary = await client.getFundingAccountSummary();
+
+// Get sub account summary
+const subAccountSummary = await client.getSubAccountSummary({
+ sub_account_id: 'your-sub-account-id',
+});
+
+// Transfer examples
+// Note: the signature field is optional. If not provided, the SDK will automatically compute it using the apiSecret and provided signing options
+
+// Standard transfer
+const transfer1 = await client.transfer({
+ from_account_id: 'from-account-id',
+ from_sub_account_id: 'from-sub-account-id',
+ to_account_id: 'to-account-id',
+ to_sub_account_id: 'to-sub-account-id',
+ currency: ECurrency.USDT,
+ num_tokens: '100',
+ transfer_type: ETransferType.STANDARD,
+});
+
+
+// Metadata for transfer, you can pass it as the second argument for the transfer API
+const metadata: ITransferMetadata = {
+ provider: ETransferProvider.RHINO;
+ direction: ETransferDirection.DEPOSIT; // Use ETransferDirection.WITHDRAWAL for withdraw flow
+ chainid: Echain.TRON,
+ endpoint,
+ provider_tx_id: tx_hash,
+ provider_ref_id: commit_id,
+};
+
+// Signing options for generating the signature as the third argument for the transfer API
+// Note: nonce must be non-negative and expiration must be within 30 days
+const signingOptions: ISigningOption = {
+ nonce: 12345,
+ expiration: '1746093221289693252'
+};
+
+const transfer2 = await client.transfer(
+ {
+ from_account_id: 'from-account-id',
+ to_account_id: 'to-account-id',
+ currency: ECurrency.USDT,
+ num_tokens: '100',
+ transfer_type: ETransferType.NON_NATIVE_BRIDGE_DEPOSIT, // Use NON_NATIVE_BRIDGE_WITHDRAW for withdraw flow
+ },
+ metadata,
+ signingOptions
+);
+
+// Request deposit approval
+// This API is used to get signature for a deposit before executing it
+const depositApproval = await client.requestDepositApproval({
+ l1Sender: 'your-l1-address', // L1 address of the sending wallet
+ l2Receiver: 'your-l2-address', // Your L2 address to receive the funds
+ l1Token: 'token-contract-address', // L1 token contract address
+ amount: '100' // Amount to deposit
+});
+
+
+// Withdraw funds from your account
+// Note: the signature field is optional. If not provided, the SDK will automatically compute it using the apiSecret and provided signing options
+const withdrawResult = await client.withdraw({
+ from_account_id: 'your-account-id',
+ to_eth_address: 'destination-eth-address',
+ currency: ECurrency.USDT,
+ num_tokens: '100'
+});
+
+// Query transfer history
+const transferHistory = await client.getTransferHistory({
+ start_time: '1745600642000785050' // timestamp in nanosecond, use this to filter transfers with event time >= start_time
+ end_time: '17588917787741000000' // timestamp in nanoseconds, use this to filter transfers with event time <= end_time
+});
+// You can filter more & do pagination with this query if needed, please take a look at the request interface to get more details
+
+// Query deposit history
+const depositHistory = await client.getDepositHistory({
+ start_time: '1745600642000785050' // timestamp in nanosecond, use this to filter deposits with event time >= start_time
+ end_time: '17588917787741000000' // timestamp in nanoseconds, use this to filter deposits with event time <= end_time
+});
+// You can filter more & do pagination with this query if needed, please take a look at the request interface to get more details
+
+
+// Get current server time, in milliseconds since epoch
+const currentTime = await client.getCurrentTime()
+// Example result: 1747397398409
+
+// Convert Rhino chain to Gravity Echain
+// Result will depend on the environment, specifically
+// - DEV, STAGING - Rhino DEV
+// - TESTNET - Rhino STG
+// - PRODUCTIOn - Rhino PROD
+// This will return null if the chain ID is not found or not supported
+import { SupportedChains } from "@rhino.fi/sdk"
+
+const chainID = await client.getGravityChainIDFromRhinoChain(SupportedChains.BNB_SMART_CHAIN)
+// Result:
+// - On DEV/STAGING/TESTNET: 97
+// - On PRODUCTION: 56
+
+```
+
+### WebSocket Client
+
+The WebSocket client supports real-time data streaming and follows the same authentication mehanism as the REST API client.
+
+```typescript
+import { GrvtWsClient, EGrvtEnvironment } from '@grvt/sdk';
+
+// Initialize the WebSocket client
+const client = new GrvtWsClient({
+ apiKey: 'your-api-key',
+ env: EGrvtEnvironment.DEV,
+});
+
+// Connect to WebSocket
+await client.connect();
+
+// Subscribe to transfer history
+client.subscribeTransferHistory(
+ 'main-account-id',
+ (data) => {
+ console.log('Received transfer:', data);
+ },
+ 'sub-account-id' // optional
+);
+
+// Disconnect when done
+client.disconnect();
+```
+
+#### WebSocket Features
+
+1. **Authentication**:
+
+ - Uses the same cookie-based authentication as the REST API
+ - Automatically refreshes cookies when needed
+
+2. **Connection Management**:
+
+ - Automatic reconnection with exponential backoff
+ - Connection monitoring with 5-second timeout
+ - Reconnects if no messages are received within the timeout period
+
+3. **Subscription Handling**:
+
+ - Unique subscription IDs for each subscription
+ - Subscriptions are not automatically restored after reconnection
+ - Users need to manually resubscribe after reconnection
+
+4. **Error Handling**:
+ - Automatic error logging
+ - Graceful disconnection handling
+ - Reconnection attempts with configurable maximum retries
+
+## Development
+
+### Building
+
+```bash
+npm run build
+```
+
+### Formatting
+
+```bash
+npm run format
+```
+
+### Testing
+
+```bash
+# Run all tests
+npm test
+
+# Run SDK tests
+npm run test:sdk
+
+# Run WebSocket tests
+npm run test:ws
+```
+
+### Linting and Formating
+
+```bash
+npm run lint
+```
+
+```bash
+npm run format
+```
+
+## License
+
+This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
\ No newline at end of file
diff --git a/docs/grvt/trading_api.md b/docs/grvt/trading_api.md
new file mode 100644
index 0000000..445feee
--- /dev/null
+++ b/docs/grvt/trading_api.md
@@ -0,0 +1,12674 @@
+# Trading APIs
+All requests should be made using the `POST` HTTP method.
+
+## Order
+### Create Order
+```
+FULL ENDPOINT: full/v1/create_order
+LITE ENDPOINT: lite/v1/create_order
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_create_order_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "order": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "TAKE_PROFIT",
+ "tpsl": {
+ "trigger_by": "LAST",
+ "trigger_price": "65038.10",
+ "close_position": false
+ }
+ },
+ "broker": "BROKER_CODE"
+ }
+ }
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "o": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "TAKE_PROFIT",
+ "t": {
+ "tb": "LAST",
+ "tp": "65038.10",
+ "cp": false
+ }
+ },
+ "b": "BROKER_CODE"
+ }
+ }
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_create_order_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": {
+ "order_id": "0x1234567890abcdef",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "TAKE_PROFIT",
+ "tpsl": {
+ "trigger_by": "LAST",
+ "trigger_price": "65038.10",
+ "close_position": false
+ }
+ },
+ "broker": "BROKER_CODE"
+ },
+ "state": {
+ "status": "PENDING",
+ "reject_reason": "CLIENT_CANCEL",
+ "book_size": ["10.5"],
+ "traded_size": ["1.5"],
+ "update_time": "1697788800000000000",
+ "avg_fill_price": ["60000.4"]
+ }
+ }
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": {
+ "oi": "0x1234567890abcdef",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "TAKE_PROFIT",
+ "t": {
+ "tb": "LAST",
+ "tp": "65038.10",
+ "cp": false
+ }
+ },
+ "b": "BROKER_CODE"
+ },
+ "s1": {
+ "s": "PENDING",
+ "rr": "CLIENT_CANCEL",
+ "bs": ["10.5"],
+ "ts": ["1.5"],
+ "ut": "1697788800000000000",
+ "af": ["60000.4"]
+ }
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1004|404|Data Not Found|
+ |1005|500|Unknown Error|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+ |1400|403|Signer does not have trade permission|
+ |1009|503|We are temporarily deactivating this API endpoint, please try again later|
+ |2000|403|Signature is from an unauthorized signer|
+ |2001|403|Signature has expired|
+ |2002|403|Signature does not match payload|
+ |2003|403|Order sub account does not match logged in user|
+ |2004|403|Signature is from an expired session key|
+ |2006|403|Signature R/S must have exactly 64 characters long without 0x prefix|
+ |2005|403|Signature V must be 27/28|
+ |2007|403|Signature S must be in the lower half of the curve|
+ |2010|400|Order ID should be empty when creating an order|
+ |2011|400|Client Order ID should be supplied when creating an order|
+ |2012|400|Client Order ID overlaps with existing active order|
+ |2030|400|Orderbook Orders must have a TimeInForce of GTT/IOC/FOK|
+ |2031|400|RFQ Orders must have a TimeInForce of GTT/AON/IOC/FOK|
+ |2032|400|Post Only can only be set to true for GTT/AON orders|
+ |2020|400|Market Order must always be supplied without a limit price|
+ |2021|400|Limit Order must always be supplied with a limit price|
+ |2040|400|Order must contain at least one leg|
+ |2041|400|Order Legs must be sorted by Derivative.Instrument/Underlying/BaseCurrency/Expiration/StrikePrice|
+ |2042|400|Orderbook Orders must contain only one leg|
+ |2050|400|Order state must be empty upon creation|
+ |2051|400|Order execution metadata must be empty upon creation|
+ |2060|400|Order Legs contain one or more inactive derivative|
+ |2061|400|Unsupported Instrument Requested|
+ |2062|400|Order size smaller than min size|
+ |2063|400|Order size smaller than min block size in block trade venue|
+ |2064|400|Invalid limit price tick|
+ |2065|400|Order size too granular|
+ |2070|400|Liquidation Order is not supported|
+ |2080|400|Insufficient margin to create order|
+ |2081|400|Order Fill would result in exceeding maximum position size|
+ |2082|400|Pre-order check failed|
+ |2083|400|Order Fill would result in exceeding maximum position size under current configurable leverage tier|
+ |2090|429|Max open orders exceeded|
+ |2110|400|Invalid trigger by|
+ |2111|400|Unsupported trigger by|
+ |2112|400|Invalid trigger order|
+ |2113|400|Trigger price must be non-zero|
+ |2114|400|Invalid position linked TPSL orders, position linked TPSL must be a reduce-only order|
+ |2115|400|Invalid position linked TPSL orders, position linked TPSL must not have smaller size than the position|
+ |2116|400|Position linked TPSL order for this asset already exists|
+ |3004|500|Instrument does not have a valid maintenance margin configuration|
+ |3005|500|Instrument's underlying currency does not have a valid balance decimal configuration|
+ |3006|500|Instrument's quote currency does not have a valid balance decimal configuration|
+ |2400|400|Reduce only order with no position|
+ |2401|400|Reduce only order must not increase position size|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/create_order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "order": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "TAKE_PROFIT",
+ "tpsl": {
+ "trigger_by": "LAST",
+ "trigger_price": "65038.10",
+ "close_position": false
+ }
+ },
+ "broker": "BROKER_CODE"
+ }
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/create_order",
+ "params": {
+ "order": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "TAKE_PROFIT",
+ "tpsl": {
+ "trigger_by": "LAST",
+ "trigger_price": "65038.10",
+ "close_position": false
+ }
+ },
+ "broker": "BROKER_CODE"
+ }
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/create_order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "o": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "TAKE_PROFIT",
+ "t": {
+ "tb": "LAST",
+ "tp": "65038.10",
+ "cp": false
+ }
+ },
+ "b": "BROKER_CODE"
+ }
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/create_order",
+ "p": {
+ "o": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "TAKE_PROFIT",
+ "t": {
+ "tb": "LAST",
+ "tp": "65038.10",
+ "cp": false
+ }
+ },
+ "b": "BROKER_CODE"
+ }
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/create_order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "order": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "TAKE_PROFIT",
+ "tpsl": {
+ "trigger_by": "LAST",
+ "trigger_price": "65038.10",
+ "close_position": false
+ }
+ },
+ "broker": "BROKER_CODE"
+ }
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/create_order",
+ "params": {
+ "order": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "TAKE_PROFIT",
+ "tpsl": {
+ "trigger_by": "LAST",
+ "trigger_price": "65038.10",
+ "close_position": false
+ }
+ },
+ "broker": "BROKER_CODE"
+ }
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/create_order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "o": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "TAKE_PROFIT",
+ "t": {
+ "tb": "LAST",
+ "tp": "65038.10",
+ "cp": false
+ }
+ },
+ "b": "BROKER_CODE"
+ }
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/create_order",
+ "p": {
+ "o": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "TAKE_PROFIT",
+ "t": {
+ "tb": "LAST",
+ "tp": "65038.10",
+ "cp": false
+ }
+ },
+ "b": "BROKER_CODE"
+ }
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/create_order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "order": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "TAKE_PROFIT",
+ "tpsl": {
+ "trigger_by": "LAST",
+ "trigger_price": "65038.10",
+ "close_position": false
+ }
+ },
+ "broker": "BROKER_CODE"
+ }
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/create_order",
+ "params": {
+ "order": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "TAKE_PROFIT",
+ "tpsl": {
+ "trigger_by": "LAST",
+ "trigger_price": "65038.10",
+ "close_position": false
+ }
+ },
+ "broker": "BROKER_CODE"
+ }
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/create_order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "o": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "TAKE_PROFIT",
+ "t": {
+ "tb": "LAST",
+ "tp": "65038.10",
+ "cp": false
+ }
+ },
+ "b": "BROKER_CODE"
+ }
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/create_order",
+ "p": {
+ "o": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "TAKE_PROFIT",
+ "t": {
+ "tb": "LAST",
+ "tp": "65038.10",
+ "cp": false
+ }
+ },
+ "b": "BROKER_CODE"
+ }
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/create_order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "order": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "TAKE_PROFIT",
+ "tpsl": {
+ "trigger_by": "LAST",
+ "trigger_price": "65038.10",
+ "close_position": false
+ }
+ },
+ "broker": "BROKER_CODE"
+ }
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/create_order",
+ "params": {
+ "order": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "TAKE_PROFIT",
+ "tpsl": {
+ "trigger_by": "LAST",
+ "trigger_price": "65038.10",
+ "close_position": false
+ }
+ },
+ "broker": "BROKER_CODE"
+ }
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/create_order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "o": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "TAKE_PROFIT",
+ "t": {
+ "tb": "LAST",
+ "tp": "65038.10",
+ "cp": false
+ }
+ },
+ "b": "BROKER_CODE"
+ }
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/create_order",
+ "p": {
+ "o": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "TAKE_PROFIT",
+ "t": {
+ "tb": "LAST",
+ "tp": "65038.10",
+ "cp": false
+ }
+ },
+ "b": "BROKER_CODE"
+ }
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Cancel Order
+```
+FULL ENDPOINT: full/v1/cancel_order
+LITE ENDPOINT: lite/v1/cancel_order
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_cancel_order_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "order_id": "0x1028403",
+ "client_order_id": "23042",
+ "time_to_live_ms": "500"
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "oi": "0x1028403",
+ "co": "23042",
+ "tt": "500"
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/ack_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": {
+ "ack": "true"
+ }
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": {
+ "a": "true"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+ |2300|400|Order cancel time-to-live settings currently disabled.|
+ |2301|400|Order cancel time-to-live exceeds maximum allowed value.|
+ |3021|400|Either order ID or client order ID must be supplied|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/cancel_order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "order_id": "0x1028403",
+ "client_order_id": "23042",
+ "time_to_live_ms": "500"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/cancel_order",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "order_id": "0x1028403",
+ "client_order_id": "23042",
+ "time_to_live_ms": "500"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/cancel_order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "oi": "0x1028403",
+ "co": "23042",
+ "tt": "500"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/cancel_order",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "oi": "0x1028403",
+ "co": "23042",
+ "tt": "500"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/cancel_order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "order_id": "0x1028403",
+ "client_order_id": "23042",
+ "time_to_live_ms": "500"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/cancel_order",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "order_id": "0x1028403",
+ "client_order_id": "23042",
+ "time_to_live_ms": "500"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/cancel_order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "oi": "0x1028403",
+ "co": "23042",
+ "tt": "500"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/cancel_order",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "oi": "0x1028403",
+ "co": "23042",
+ "tt": "500"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/cancel_order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "order_id": "0x1028403",
+ "client_order_id": "23042",
+ "time_to_live_ms": "500"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/cancel_order",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "order_id": "0x1028403",
+ "client_order_id": "23042",
+ "time_to_live_ms": "500"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/cancel_order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "oi": "0x1028403",
+ "co": "23042",
+ "tt": "500"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/cancel_order",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "oi": "0x1028403",
+ "co": "23042",
+ "tt": "500"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/cancel_order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "order_id": "0x1028403",
+ "client_order_id": "23042",
+ "time_to_live_ms": "500"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/cancel_order",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "order_id": "0x1028403",
+ "client_order_id": "23042",
+ "time_to_live_ms": "500"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/cancel_order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "oi": "0x1028403",
+ "co": "23042",
+ "tt": "500"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/cancel_order",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "oi": "0x1028403",
+ "co": "23042",
+ "tt": "500"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Cancel All Orders
+```
+FULL ENDPOINT: full/v1/cancel_all_orders
+LITE ENDPOINT: lite/v1/cancel_all_orders
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_cancel_all_orders_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/ack_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": {
+ "ack": "true"
+ }
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": {
+ "a": "true"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/cancel_all_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/cancel_all_orders",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/cancel_all_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/cancel_all_orders",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/cancel_all_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/cancel_all_orders",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/cancel_all_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/cancel_all_orders",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/cancel_all_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/cancel_all_orders",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/cancel_all_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/cancel_all_orders",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/cancel_all_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/cancel_all_orders",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/cancel_all_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/cancel_all_orders",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Get Order
+```
+FULL ENDPOINT: full/v1/order
+LITE ENDPOINT: lite/v1/order
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_get_order_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "order_id": "0x1028403",
+ "client_order_id": "23042"
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "oi": "0x1028403",
+ "co": "23042"
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_get_order_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": {
+ "order_id": "0x1234567890abcdef",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "TAKE_PROFIT",
+ "tpsl": {
+ "trigger_by": "LAST",
+ "trigger_price": "65038.10",
+ "close_position": false
+ }
+ },
+ "broker": "BROKER_CODE"
+ },
+ "state": {
+ "status": "PENDING",
+ "reject_reason": "CLIENT_CANCEL",
+ "book_size": ["10.5"],
+ "traded_size": ["1.5"],
+ "update_time": "1697788800000000000",
+ "avg_fill_price": ["60000.4"]
+ }
+ }
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": {
+ "oi": "0x1234567890abcdef",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "TAKE_PROFIT",
+ "t": {
+ "tb": "LAST",
+ "tp": "65038.10",
+ "cp": false
+ }
+ },
+ "b": "BROKER_CODE"
+ },
+ "s1": {
+ "s": "PENDING",
+ "rr": "CLIENT_CANCEL",
+ "bs": ["10.5"],
+ "ts": ["1.5"],
+ "ut": "1697788800000000000",
+ "af": ["60000.4"]
+ }
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+ |1004|404|Data Not Found|
+ |3021|400|Either order ID or client order ID must be supplied|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "order_id": "0x1028403",
+ "client_order_id": "23042"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/order",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "order_id": "0x1028403",
+ "client_order_id": "23042"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "oi": "0x1028403",
+ "co": "23042"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/order",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "oi": "0x1028403",
+ "co": "23042"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "order_id": "0x1028403",
+ "client_order_id": "23042"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/order",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "order_id": "0x1028403",
+ "client_order_id": "23042"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "oi": "0x1028403",
+ "co": "23042"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/order",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "oi": "0x1028403",
+ "co": "23042"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "order_id": "0x1028403",
+ "client_order_id": "23042"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/order",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "order_id": "0x1028403",
+ "client_order_id": "23042"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "oi": "0x1028403",
+ "co": "23042"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/order",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "oi": "0x1028403",
+ "co": "23042"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "order_id": "0x1028403",
+ "client_order_id": "23042"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/order",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "order_id": "0x1028403",
+ "client_order_id": "23042"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/order' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "oi": "0x1028403",
+ "co": "23042"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/order",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "oi": "0x1028403",
+ "co": "23042"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Open Orders
+```
+FULL ENDPOINT: full/v1/open_orders
+LITE ENDPOINT: lite/v1/open_orders
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_open_orders_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_open_orders_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": [{
+ "order_id": "0x1234567890abcdef",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "TAKE_PROFIT",
+ "tpsl": {
+ "trigger_by": "LAST",
+ "trigger_price": "65038.10",
+ "close_position": false
+ }
+ },
+ "broker": "BROKER_CODE"
+ },
+ "state": {
+ "status": "PENDING",
+ "reject_reason": "CLIENT_CANCEL",
+ "book_size": ["10.5"],
+ "traded_size": ["1.5"],
+ "update_time": "1697788800000000000",
+ "avg_fill_price": ["60000.4"]
+ }
+ }]
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "oi": "0x1234567890abcdef",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "TAKE_PROFIT",
+ "t": {
+ "tb": "LAST",
+ "tp": "65038.10",
+ "cp": false
+ }
+ },
+ "b": "BROKER_CODE"
+ },
+ "s1": {
+ "s": "PENDING",
+ "rr": "CLIENT_CANCEL",
+ "bs": ["10.5"],
+ "ts": ["1.5"],
+ "ut": "1697788800000000000",
+ "af": ["60000.4"]
+ }
+ }]
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+ |1003|400|Request could not be processed due to malformed syntax|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/open_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/open_orders",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/open_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/open_orders",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/open_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/open_orders",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/open_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/open_orders",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/open_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/open_orders",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/open_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/open_orders",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/open_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/open_orders",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/open_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/open_orders",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Order History
+```
+FULL ENDPOINT: full/v1/order_history
+LITE ENDPOINT: lite/v1/order_history
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_order_history_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_order_history_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": [{
+ "order_id": "0x1234567890abcdef",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "TAKE_PROFIT",
+ "tpsl": {
+ "trigger_by": "LAST",
+ "trigger_price": "65038.10",
+ "close_position": false
+ }
+ },
+ "broker": "BROKER_CODE"
+ },
+ "state": {
+ "status": "PENDING",
+ "reject_reason": "CLIENT_CANCEL",
+ "book_size": ["10.5"],
+ "traded_size": ["1.5"],
+ "update_time": "1697788800000000000",
+ "avg_fill_price": ["60000.4"]
+ }
+ }],
+ "next": "Qw0918="
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "oi": "0x1234567890abcdef",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "TAKE_PROFIT",
+ "t": {
+ "tb": "LAST",
+ "tp": "65038.10",
+ "cp": false
+ }
+ },
+ "b": "BROKER_CODE"
+ },
+ "s1": {
+ "s": "PENDING",
+ "rr": "CLIENT_CANCEL",
+ "bs": ["10.5"],
+ "ts": ["1.5"],
+ "ut": "1697788800000000000",
+ "af": ["60000.4"]
+ }
+ }],
+ "n": "Qw0918="
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/order_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/order_history",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/order_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/order_history",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/order_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/order_history",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/order_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/order_history",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/order_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/order_history",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/order_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/order_history",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/order_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/order_history",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/order_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/order_history",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Cancel On Disconnect
+```
+FULL ENDPOINT: full/v1/cancel_on_disconnect
+LITE ENDPOINT: lite/v1/cancel_on_disconnect
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_cancel_on_disconnect_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "countdown_time": 300
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ct": 300
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/ack_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": {
+ "ack": "true"
+ }
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": {
+ "a": "true"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+ |6000|400|Countdown time is bigger than 300s supported|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/cancel_on_disconnect' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "countdown_time": 300
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/cancel_on_disconnect",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "countdown_time": 300
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/cancel_on_disconnect' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ct": 300
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/cancel_on_disconnect",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ct": 300
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/cancel_on_disconnect' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "countdown_time": 300
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/cancel_on_disconnect",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "countdown_time": 300
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/cancel_on_disconnect' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ct": 300
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/cancel_on_disconnect",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ct": 300
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/cancel_on_disconnect' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "countdown_time": 300
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/cancel_on_disconnect",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "countdown_time": 300
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/cancel_on_disconnect' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ct": 300
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/cancel_on_disconnect",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ct": 300
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/cancel_on_disconnect' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "countdown_time": 300
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/cancel_on_disconnect",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "countdown_time": 300
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/cancel_on_disconnect' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ct": 300
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/cancel_on_disconnect",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ct": 300
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+## Execution
+### Fill History
+```
+FULL ENDPOINT: full/v1/fill_history
+LITE ENDPOINT: lite/v1/fill_history
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_fill_history_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_fill_history_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": [{
+ "event_time": "1697788800000000000",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "is_buyer": true,
+ "is_taker": true,
+ "size": "0.30",
+ "price": "65038.01",
+ "mark_price": "65038.01",
+ "index_price": "65038.01",
+ "interest_rate": 0.0003,
+ "forward_price": "65038.01",
+ "realized_pnl": "2400.50",
+ "fee": "9.75",
+ "fee_rate": 0.0003,
+ "trade_id": "209358-2",
+ "order_id": "0x10000101000203040506",
+ "venue": "ORDERBOOK",
+ "client_order_id": "23042",
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "broker": "UNSPECIFIED",
+ "is_rpi": false
+ }],
+ "next": "Qw0918="
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "et": "1697788800000000000",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "ib": true,
+ "it": true,
+ "s": "0.30",
+ "p": "65038.01",
+ "mp": "65038.01",
+ "ip": "65038.01",
+ "ir": 0.0003,
+ "fp": "65038.01",
+ "rp": "2400.50",
+ "f": "9.75",
+ "fr": 0.0003,
+ "ti": "209358-2",
+ "oi": "0x10000101000203040506",
+ "v": "ORDERBOOK",
+ "co": "23042",
+ "s1": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "b": "UNSPECIFIED",
+ "ir1": false
+ }],
+ "n": "Qw0918="
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/fill_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/fill_history",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/fill_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/fill_history",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/fill_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/fill_history",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/fill_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/fill_history",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/fill_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/fill_history",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/fill_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/fill_history",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/fill_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/fill_history",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/fill_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/fill_history",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Positions
+```
+FULL ENDPOINT: full/v1/positions
+LITE ENDPOINT: lite/v1/positions
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_positions_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_positions_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": [{
+ "event_time": "1697788800000000000",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "size": "2635000.50",
+ "notional": "2635000.50",
+ "entry_price": "65038.01",
+ "exit_price": "65038.01",
+ "mark_price": "65038.01",
+ "unrealized_pnl": "135000.50",
+ "realized_pnl": "-35000.30",
+ "total_pnl": "100000.20",
+ "roi": "10.20",
+ "quote_index_price": "1.0000102",
+ "est_liquidation_price": 60000.25,
+ "leverage": "10"
+ }]
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "et": "1697788800000000000",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "s": "2635000.50",
+ "n": "2635000.50",
+ "ep": "65038.01",
+ "ep1": "65038.01",
+ "mp": "65038.01",
+ "up": "135000.50",
+ "rp": "-35000.30",
+ "tp": "100000.20",
+ "r": "10.20",
+ "qi": "1.0000102",
+ "el": 60000.25,
+ "l": "10"
+ }]
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/positions' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/positions",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/positions' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/positions",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/positions' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/positions",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/positions' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/positions",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/positions' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/positions",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/positions' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/positions",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/positions' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/positions",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/positions' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/positions",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Funding Payment History
+```
+FULL ENDPOINT: full/v1/funding_payment_history
+LITE ENDPOINT: lite/v1/funding_payment_history
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_funding_payment_history_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_funding_payment_history_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": [{
+ "event_time": "1697788800000000000",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "currency": "USDT",
+ "amount": "9.75",
+ "tx_id": "209358"
+ }],
+ "next": "Qw0918="
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "et": "1697788800000000000",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "c": "USDT",
+ "a": "9.75",
+ "ti": "209358"
+ }],
+ "n": "Qw0918="
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/funding_payment_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/funding_payment_history",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/funding_payment_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/funding_payment_history",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/funding_payment_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/funding_payment_history",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/funding_payment_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/funding_payment_history",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/funding_payment_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/funding_payment_history",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/funding_payment_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/funding_payment_history",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/funding_payment_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/funding_payment_history",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/funding_payment_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/funding_payment_history",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+## Transfer
+### Deposit History
+```
+FULL ENDPOINT: full/v1/deposit_history
+LITE ENDPOINT: lite/v1/deposit_history
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_deposit_history_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "main_account_id": null
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ma": null
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_deposit_history_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": [{
+ "l_1_hash": "0x10000101000203040506",
+ "l_2_hash": "0x10000101000203040506",
+ "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "initiated_time": "1697788800000000000",
+ "confirmed_time": "1697788800000000000",
+ "from_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"
+ }],
+ "next": "Qw0918="
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "l1": "0x10000101000203040506",
+ "l2": "0x10000101000203040506",
+ "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "c": "USDT",
+ "nt": "1500.0",
+ "it": "1697788800000000000",
+ "ct": "1697788800000000000",
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"
+ }],
+ "n": "Qw0918="
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/deposit_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "main_account_id": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/deposit_history",
+ "params": {
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "main_account_id": null
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/deposit_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ma": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/deposit_history",
+ "p": {
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ma": null
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/deposit_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "main_account_id": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/deposit_history",
+ "params": {
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "main_account_id": null
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/deposit_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ma": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/deposit_history",
+ "p": {
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ma": null
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/deposit_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "main_account_id": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/deposit_history",
+ "params": {
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "main_account_id": null
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/deposit_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ma": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/deposit_history",
+ "p": {
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ma": null
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/deposit_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "main_account_id": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/deposit_history",
+ "params": {
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "main_account_id": null
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/deposit_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ma": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/deposit_history",
+ "p": {
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ma": null
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Transfer
+```
+FULL ENDPOINT: full/v1/transfer
+LITE ENDPOINT: lite/v1/transfer
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_transfer_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "transfer_type": "UNSPECIFIED",
+ "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"}
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "fs": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "ts": "'$GRVT_SUB_ACCOUNT_ID'",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "tt": "UNSPECIFIED",
+ "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"}
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_transfer_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": {
+ "ack": "true",
+ "tx_id": "1028403"
+ }
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": {
+ "a": "true",
+ "ti": "1028403"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+ |5000|400|Transfer Metadata does not match the expected structure.|
+ |5001|400|Transfer Provider does not match the expected provider.|
+ |4002|400|Transfer failed with an unrefined failure reason, please report to GRVT|
+ |5002|400|Direction of the transfer does not match the expected direction.|
+ |5003|400|Endpoint account ID is invalid.|
+ |5004|400|Funding account does not exist in our system.|
+ |5005|400|Invalid ChainID for the transfer request.|
+ |7100|500|Unknown transaction type|
+ |7101|400|Transfer account not found|
+ |7102|400|Transfer sub-account not found|
+ |7103|500|Charged trading fee below the config minimum|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/transfer' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "transfer_type": "UNSPECIFIED",
+ "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"}
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/transfer",
+ "params": {
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "transfer_type": "UNSPECIFIED",
+ "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"}
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/transfer' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "fs": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "ts": "'$GRVT_SUB_ACCOUNT_ID'",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "tt": "UNSPECIFIED",
+ "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"}
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/transfer",
+ "p": {
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "fs": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "ts": "'$GRVT_SUB_ACCOUNT_ID'",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "tt": "UNSPECIFIED",
+ "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"}
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/transfer' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "transfer_type": "UNSPECIFIED",
+ "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"}
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/transfer",
+ "params": {
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "transfer_type": "UNSPECIFIED",
+ "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"}
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/transfer' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "fs": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "ts": "'$GRVT_SUB_ACCOUNT_ID'",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "tt": "UNSPECIFIED",
+ "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"}
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/transfer",
+ "p": {
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "fs": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "ts": "'$GRVT_SUB_ACCOUNT_ID'",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "tt": "UNSPECIFIED",
+ "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"}
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/transfer' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "transfer_type": "UNSPECIFIED",
+ "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"}
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/transfer",
+ "params": {
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "transfer_type": "UNSPECIFIED",
+ "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"}
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/transfer' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "fs": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "ts": "'$GRVT_SUB_ACCOUNT_ID'",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "tt": "UNSPECIFIED",
+ "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"}
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/transfer",
+ "p": {
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "fs": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "ts": "'$GRVT_SUB_ACCOUNT_ID'",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "tt": "UNSPECIFIED",
+ "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"}
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/transfer' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "transfer_type": "UNSPECIFIED",
+ "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"}
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/transfer",
+ "params": {
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "transfer_type": "UNSPECIFIED",
+ "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"}
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/transfer' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "fs": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "ts": "'$GRVT_SUB_ACCOUNT_ID'",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "tt": "UNSPECIFIED",
+ "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"}
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/transfer",
+ "p": {
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "fs": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "ts": "'$GRVT_SUB_ACCOUNT_ID'",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "tt": "UNSPECIFIED",
+ "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"}
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Transfer History
+```
+FULL ENDPOINT: full/v1/transfer_history
+LITE ENDPOINT: lite/v1/transfer_history
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_transfer_history_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "tx_id": "1028403",
+ "main_account_id": null
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ti": "1028403",
+ "ma": null
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_transfer_history_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": [{
+ "tx_id": "1028403",
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "event_time": "1697788800000000000",
+ "transfer_type": "UNSPECIFIED",
+ "transfer_metadata": null
+ }],
+ "next": "Qw0918="
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "ti": "1028403",
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "fs": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "ts": "'$GRVT_SUB_ACCOUNT_ID'",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "et": "1697788800000000000",
+ "tt": "UNSPECIFIED",
+ "tm": null
+ }],
+ "n": "Qw0918="
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/transfer_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "tx_id": "1028403",
+ "main_account_id": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/transfer_history",
+ "params": {
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "tx_id": "1028403",
+ "main_account_id": null
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/transfer_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ti": "1028403",
+ "ma": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/transfer_history",
+ "p": {
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ti": "1028403",
+ "ma": null
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/transfer_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "tx_id": "1028403",
+ "main_account_id": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/transfer_history",
+ "params": {
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "tx_id": "1028403",
+ "main_account_id": null
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/transfer_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ti": "1028403",
+ "ma": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/transfer_history",
+ "p": {
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ti": "1028403",
+ "ma": null
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/transfer_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "tx_id": "1028403",
+ "main_account_id": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/transfer_history",
+ "params": {
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "tx_id": "1028403",
+ "main_account_id": null
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/transfer_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ti": "1028403",
+ "ma": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/transfer_history",
+ "p": {
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ti": "1028403",
+ "ma": null
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/transfer_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "tx_id": "1028403",
+ "main_account_id": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/transfer_history",
+ "params": {
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "tx_id": "1028403",
+ "main_account_id": null
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/transfer_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ti": "1028403",
+ "ma": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/transfer_history",
+ "p": {
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ti": "1028403",
+ "ma": null
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Withdrawal
+```
+FULL ENDPOINT: full/v1/withdrawal
+LITE ENDPOINT: lite/v1/withdrawal
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_withdrawal_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/ack_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": {
+ "ack": "true"
+ }
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": {
+ "a": "true"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+ |4010|400|This wallet is not supported. Please try another wallet.|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/withdrawal' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/withdrawal",
+ "params": {
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/withdrawal' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/withdrawal",
+ "p": {
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/withdrawal' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/withdrawal",
+ "params": {
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/withdrawal' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/withdrawal",
+ "p": {
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/withdrawal' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/withdrawal",
+ "params": {
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/withdrawal' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/withdrawal",
+ "p": {
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/withdrawal' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/withdrawal",
+ "params": {
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/withdrawal' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/withdrawal",
+ "p": {
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Withdrawal History
+```
+FULL ENDPOINT: full/v1/withdrawal_history
+LITE ENDPOINT: lite/v1/withdrawal_history
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_withdrawal_history_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "main_account_id": null
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ma": null
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_withdrawal_history_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": [{
+ "tx_id": "1028403",
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "event_time": "1697788800000000000"
+ }],
+ "next": "Qw0918="
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "ti": "1028403",
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "et": "1697788800000000000"
+ }],
+ "n": "Qw0918="
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/withdrawal_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "main_account_id": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/withdrawal_history",
+ "params": {
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "main_account_id": null
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/withdrawal_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ma": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/withdrawal_history",
+ "p": {
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ma": null
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/withdrawal_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "main_account_id": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/withdrawal_history",
+ "params": {
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "main_account_id": null
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/withdrawal_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ma": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/withdrawal_history",
+ "p": {
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ma": null
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/withdrawal_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "main_account_id": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/withdrawal_history",
+ "params": {
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "main_account_id": null
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/withdrawal_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ma": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/withdrawal_history",
+ "p": {
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ma": null
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/withdrawal_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "main_account_id": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/withdrawal_history",
+ "params": {
+ "currency": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": "",
+ "main_account_id": null
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/withdrawal_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ma": null
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/withdrawal_history",
+ "p": {
+ "c": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c1": "",
+ "ma": null
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+## Account
+### Sub Account Summary
+```
+FULL ENDPOINT: full/v1/account_summary
+LITE ENDPOINT: lite/v1/account_summary
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_sub_account_summary_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_sub_account_summary_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": {
+ "event_time": "1697788800000000000",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "margin_type": "SIMPLE_CROSS_MARGIN",
+ "settle_currency": "USDT",
+ "unrealized_pnl": "123456.78",
+ "total_equity": "123456.78",
+ "initial_margin": "123456.78",
+ "maintenance_margin": "123456.78",
+ "available_balance": "123456.78",
+ "spot_balances": [{
+ "currency": "USDT",
+ "balance": "123456.78",
+ "index_price": "1.0000102"
+ }],
+ "positions": [{
+ "event_time": "1697788800000000000",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "size": "2635000.50",
+ "notional": "2635000.50",
+ "entry_price": "65038.01",
+ "exit_price": "65038.01",
+ "mark_price": "65038.01",
+ "unrealized_pnl": "135000.50",
+ "realized_pnl": "-35000.30",
+ "total_pnl": "100000.20",
+ "roi": "10.20",
+ "quote_index_price": "1.0000102",
+ "est_liquidation_price": 60000.25,
+ "leverage": "10"
+ }],
+ "settle_index_price": "1.0000102",
+ "is_vault": null,
+ "vault_im_additions": "123456.78",
+ "derisk_margin": "185185.77",
+ "derisk_to_maintenance_margin_ratio": "1.5"
+ }
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": {
+ "et": "1697788800000000000",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "mt": "SIMPLE_CROSS_MARGIN",
+ "sc": "USDT",
+ "up": "123456.78",
+ "te": "123456.78",
+ "im": "123456.78",
+ "mm": "123456.78",
+ "ab": "123456.78",
+ "sb": [{
+ "c": "USDT",
+ "b": "123456.78",
+ "ip": "1.0000102"
+ }],
+ "p": [{
+ "et": "1697788800000000000",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "s": "2635000.50",
+ "n": "2635000.50",
+ "ep": "65038.01",
+ "ep1": "65038.01",
+ "mp": "65038.01",
+ "up": "135000.50",
+ "rp": "-35000.30",
+ "tp": "100000.20",
+ "r": "10.20",
+ "qi": "1.0000102",
+ "el": 60000.25,
+ "l": "10"
+ }],
+ "si": "1.0000102",
+ "iv": null,
+ "vi": "123456.78",
+ "dm": "185185.77",
+ "dt": "1.5"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/account_summary",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/account_summary",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/account_summary",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/account_summary",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/account_summary",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/account_summary",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/account_summary",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/account_summary",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Sub Account History
+```
+FULL ENDPOINT: full/v1/account_history
+LITE ENDPOINT: lite/v1/account_history
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_sub_account_history_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_sub_account_history_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": [{
+ "event_time": "1697788800000000000",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "margin_type": "SIMPLE_CROSS_MARGIN",
+ "settle_currency": "USDT",
+ "unrealized_pnl": "123456.78",
+ "total_equity": "123456.78",
+ "initial_margin": "123456.78",
+ "maintenance_margin": "123456.78",
+ "available_balance": "123456.78",
+ "spot_balances": [{
+ "currency": "USDT",
+ "balance": "123456.78",
+ "index_price": "1.0000102"
+ }],
+ "positions": [{
+ "event_time": "1697788800000000000",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "size": "2635000.50",
+ "notional": "2635000.50",
+ "entry_price": "65038.01",
+ "exit_price": "65038.01",
+ "mark_price": "65038.01",
+ "unrealized_pnl": "135000.50",
+ "realized_pnl": "-35000.30",
+ "total_pnl": "100000.20",
+ "roi": "10.20",
+ "quote_index_price": "1.0000102",
+ "est_liquidation_price": 60000.25,
+ "leverage": "10"
+ }],
+ "settle_index_price": "1.0000102",
+ "is_vault": null,
+ "vault_im_additions": "123456.78",
+ "derisk_margin": "185185.77",
+ "derisk_to_maintenance_margin_ratio": "1.5"
+ }],
+ "next": "Qw0918="
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "et": "1697788800000000000",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "mt": "SIMPLE_CROSS_MARGIN",
+ "sc": "USDT",
+ "up": "123456.78",
+ "te": "123456.78",
+ "im": "123456.78",
+ "mm": "123456.78",
+ "ab": "123456.78",
+ "sb": [{
+ "c": "USDT",
+ "b": "123456.78",
+ "ip": "1.0000102"
+ }],
+ "p": [{
+ "et": "1697788800000000000",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "s": "2635000.50",
+ "n": "2635000.50",
+ "ep": "65038.01",
+ "ep1": "65038.01",
+ "mp": "65038.01",
+ "up": "135000.50",
+ "rp": "-35000.30",
+ "tp": "100000.20",
+ "r": "10.20",
+ "qi": "1.0000102",
+ "el": 60000.25,
+ "l": "10"
+ }],
+ "si": "1.0000102",
+ "iv": null,
+ "vi": "123456.78",
+ "dm": "185185.77",
+ "dt": "1.5"
+ }],
+ "n": "Qw0918="
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/account_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/account_history",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/account_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/account_history",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/account_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/account_history",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/account_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/account_history",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/account_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/account_history",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/account_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/account_history",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/account_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/account_history",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/account_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/account_history",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Aggregated Account Summary
+```
+FULL ENDPOINT: full/v1/aggregated_account_summary
+LITE ENDPOINT: lite/v1/aggregated_account_summary
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/empty_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_aggregated_account_summary_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": {
+ "main_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "total_equity": "3945034.23",
+ "spot_balances": [{
+ "currency": "USDT",
+ "balance": "123456.78",
+ "index_price": "1.0000102"
+ }],
+ "vault_investments": [{
+ "vault_id": 123456789,
+ "num_lp_tokens": 1000000,
+ "share_price": 1000000
+ }]
+ }
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": {
+ "ma": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "te": "3945034.23",
+ "sb": [{
+ "c": "USDT",
+ "b": "123456.78",
+ "ip": "1.0000102"
+ }],
+ "vi": [{
+ "vi": 123456789,
+ "nl": 1000000,
+ "sp": 1000000
+ }]
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1001,
+ "message":"You are not authorized to access this functionality",
+ "status":403
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1001,
+ "m":"You are not authorized to access this functionality",
+ "s":403
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/aggregated_account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/aggregated_account_summary",
+ "params": {
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/aggregated_account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/aggregated_account_summary",
+ "p": {
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/aggregated_account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/aggregated_account_summary",
+ "params": {
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/aggregated_account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/aggregated_account_summary",
+ "p": {
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/aggregated_account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/aggregated_account_summary",
+ "params": {
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/aggregated_account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/aggregated_account_summary",
+ "p": {
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/aggregated_account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/aggregated_account_summary",
+ "params": {
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/aggregated_account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/aggregated_account_summary",
+ "p": {
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Funding Account Summary
+```
+FULL ENDPOINT: full/v1/funding_account_summary
+LITE ENDPOINT: lite/v1/funding_account_summary
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/empty_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_funding_account_summary_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": {
+ "main_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "total_equity": "3945034.23",
+ "spot_balances": [{
+ "currency": "USDT",
+ "balance": "123456.78",
+ "index_price": "1.0000102"
+ }],
+ "vault_investments": [{
+ "vault_id": 123456789,
+ "num_lp_tokens": 1000000,
+ "share_price": 1000000
+ }]
+ },
+ "tier": {
+ "tier": null,
+ "futures_taker_fee": null,
+ "futures_maker_fee": null,
+ "options_taker_fee": null,
+ "options_maker_fee": null
+ }
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": {
+ "ma": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "te": "3945034.23",
+ "sb": [{
+ "c": "USDT",
+ "b": "123456.78",
+ "ip": "1.0000102"
+ }],
+ "vi": [{
+ "vi": 123456789,
+ "nl": 1000000,
+ "sp": 1000000
+ }]
+ },
+ "t": {
+ "t": null,
+ "ft": null,
+ "fm": null,
+ "ot": null,
+ "om": null
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1001,
+ "message":"You are not authorized to access this functionality",
+ "status":403
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1001,
+ "m":"You are not authorized to access this functionality",
+ "s":403
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/funding_account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/funding_account_summary",
+ "params": {
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/funding_account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/funding_account_summary",
+ "p": {
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/funding_account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/funding_account_summary",
+ "params": {
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/funding_account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/funding_account_summary",
+ "p": {
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/funding_account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/funding_account_summary",
+ "params": {
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/funding_account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/funding_account_summary",
+ "p": {
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/funding_account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/funding_account_summary",
+ "params": {
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/funding_account_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/funding_account_summary",
+ "p": {
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+## DeriskMMRatio
+### Set Derisk M M Ratio
+```
+FULL ENDPOINT: full/v1/set_derisk_mm_ratio
+LITE ENDPOINT: lite/v1/set_derisk_mm_ratio
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_set_derisk_to_maintenance_margin_ratio_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ratio": "1.5",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "r": "1.5",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_set_derisk_to_maintenance_margin_ratio_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "success": "true"
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "s": "true"
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1004|404|Data Not Found|
+ |6100|400|Derisk MM Ratio is out of range|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/set_derisk_mm_ratio' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ratio": "1.5",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/set_derisk_mm_ratio",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ratio": "1.5",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/set_derisk_mm_ratio' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "r": "1.5",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/set_derisk_mm_ratio",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "r": "1.5",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/set_derisk_mm_ratio' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ratio": "1.5",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/set_derisk_mm_ratio",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ratio": "1.5",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/set_derisk_mm_ratio' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "r": "1.5",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/set_derisk_mm_ratio",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "r": "1.5",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/set_derisk_mm_ratio' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ratio": "1.5",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/set_derisk_mm_ratio",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ratio": "1.5",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/set_derisk_mm_ratio' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "r": "1.5",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/set_derisk_mm_ratio",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "r": "1.5",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/set_derisk_mm_ratio' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ratio": "1.5",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/set_derisk_mm_ratio",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ratio": "1.5",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/set_derisk_mm_ratio' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "r": "1.5",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/set_derisk_mm_ratio",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "r": "1.5",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+## InitialLeverage
+### Get All Initial Leverage
+```
+FULL ENDPOINT: full/v1/get_all_initial_leverage
+LITE ENDPOINT: lite/v1/get_all_initial_leverage
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_get_all_initial_leverage_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_get_all_initial_leverage_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "results": [{
+ "instrument": "BTC_USDT_Perp",
+ "leverage": "10",
+ "min_leverage": "10",
+ "max_leverage": "50"
+ }]
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "i": "BTC_USDT_Perp",
+ "l": "10",
+ "ml": "10",
+ "ml1": "50"
+ }]
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1004|404|Data Not Found|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/get_all_initial_leverage' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/get_all_initial_leverage",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/get_all_initial_leverage' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/get_all_initial_leverage",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/get_all_initial_leverage' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/get_all_initial_leverage",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/get_all_initial_leverage' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/get_all_initial_leverage",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/get_all_initial_leverage' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/get_all_initial_leverage",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/get_all_initial_leverage' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/get_all_initial_leverage",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/get_all_initial_leverage' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/get_all_initial_leverage",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/get_all_initial_leverage' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/get_all_initial_leverage",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Set Initial Leverage
+```
+FULL ENDPOINT: full/v1/set_initial_leverage
+LITE ENDPOINT: lite/v1/set_initial_leverage
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_set_initial_leverage_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "leverage": "10"
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "l": "10"
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_set_initial_leverage_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "success": "true"
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "s": "true"
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1004|404|Data Not Found|
+ |2100|400|Invalid initial leverage|
+ |2101|400|Vaults cannot configure leverage|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/set_initial_leverage' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "leverage": "10"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/set_initial_leverage",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "leverage": "10"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/set_initial_leverage' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "l": "10"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/set_initial_leverage",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "l": "10"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/set_initial_leverage' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "leverage": "10"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/set_initial_leverage",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "leverage": "10"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/set_initial_leverage' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "l": "10"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/set_initial_leverage",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "l": "10"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/set_initial_leverage' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "leverage": "10"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/set_initial_leverage",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "leverage": "10"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/set_initial_leverage' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "l": "10"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/set_initial_leverage",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "l": "10"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/set_initial_leverage' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "leverage": "10"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/set_initial_leverage",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "leverage": "10"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/set_initial_leverage' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "l": "10"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/set_initial_leverage",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "l": "10"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+## Vault
+### Vault Burn Tokens
+```
+FULL ENDPOINT: full/v1/vault_burn_tokens
+LITE ENDPOINT: lite/v1/vault_burn_tokens
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_vault_burn_tokens_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/ack_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": {
+ "ack": "true"
+ }
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": {
+ "a": "true"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+ |1009|503|We are temporarily deactivating this API endpoint, please try again later|
+ |2000|403|Signature is from an unauthorized signer|
+ |2001|403|Signature has expired|
+ |2002|403|Signature does not match payload|
+ |2004|403|Signature is from an expired session key|
+ |2006|403|Signature R/S must have exactly 64 characters long without 0x prefix|
+ |2005|403|Signature V must be 27/28|
+ |2007|403|Signature S must be in the lower half of the curve|
+ |2008|403|Signature exceeds maximum allowed duration.|
+ |7000|400|Vault ID provided is invalid and does not belong to any vault|
+ |7005|400|You are attempting to burn more vault tokens than you own.|
+ |7006|400|You are attempting to burn vault tokens whilst having an active redemption request.|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_burn_tokens' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_burn_tokens",
+ "params": {
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_burn_tokens' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_burn_tokens",
+ "p": {
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_burn_tokens' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_burn_tokens",
+ "params": {
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_burn_tokens' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_burn_tokens",
+ "p": {
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/vault_burn_tokens' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_burn_tokens",
+ "params": {
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_burn_tokens' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_burn_tokens",
+ "p": {
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/vault_burn_tokens' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_burn_tokens",
+ "params": {
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/vault_burn_tokens' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_burn_tokens",
+ "p": {
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Vault Invest
+```
+FULL ENDPOINT: full/v1/vault_invest
+LITE ENDPOINT: lite/v1/vault_invest
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_vault_invest_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/ack_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": {
+ "ack": "true"
+ }
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": {
+ "a": "true"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+ |1009|503|We are temporarily deactivating this API endpoint, please try again later|
+ |2000|403|Signature is from an unauthorized signer|
+ |2001|403|Signature has expired|
+ |2002|403|Signature does not match payload|
+ |2004|403|Signature is from an expired session key|
+ |2006|403|Signature R/S must have exactly 64 characters long without 0x prefix|
+ |2005|403|Signature V must be 27/28|
+ |2007|403|Signature S must be in the lower half of the curve|
+ |2008|403|Signature exceeds maximum allowed duration.|
+ |4000|400|Insufficient balance to complete transfer|
+ |7000|400|Vault ID provided is invalid and does not belong to any vault|
+ |7003|400|This vault has been delisted/closed.|
+ |7004|400|This investment would cause the vault to exceed its valuation cap.|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_invest' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_invest",
+ "params": {
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_invest' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_invest",
+ "p": {
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_invest' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_invest",
+ "params": {
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_invest' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_invest",
+ "p": {
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/vault_invest' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_invest",
+ "params": {
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_invest' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_invest",
+ "p": {
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/vault_invest' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_invest",
+ "params": {
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/vault_invest' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_invest",
+ "p": {
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Vault Investor Summary
+```
+FULL ENDPOINT: full/v1/vault_investor_summary
+LITE ENDPOINT: lite/v1/vault_investor_summary
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_vault_investor_summary_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "vault_id": "3477045127917224"
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "vi": "3477045127917224"
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_vault_investor_summary_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "vault_investor_summary": [{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "num_lp_tokens": 1000000,
+ "avg_entry_price": 1000000,
+ "current_price": 1000000,
+ "total_equity": 1000000,
+ "all_time_realized_pnl": 1000000,
+ "pending_redemption": {
+ "num_lp_tokens": 1000000,
+ "request_valuation": 1000000,
+ "request_time": "1697788800000000000",
+ "max_redemption_period_timestamp": 1727788800000000000
+ },
+ "can_burn": null
+ }]
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "vi": [{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "nl": 1000000,
+ "ae": 1000000,
+ "cp": 1000000,
+ "te": 1000000,
+ "at": 1000000,
+ "pr": {
+ "nl": 1000000,
+ "rv": 1000000,
+ "rt": "1697788800000000000",
+ "mr": 1727788800000000000
+ },
+ "cb": null
+ }]
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+ |7000|400|Vault ID provided is invalid and does not belong to any vault|
+ |7007|400|The investor is not an LP for this vault.|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_investor_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_investor_summary",
+ "params": {
+ "vault_id": "3477045127917224"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_investor_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_investor_summary",
+ "p": {
+ "vi": "3477045127917224"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_investor_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_investor_summary",
+ "params": {
+ "vault_id": "3477045127917224"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_investor_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_investor_summary",
+ "p": {
+ "vi": "3477045127917224"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/vault_investor_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_investor_summary",
+ "params": {
+ "vault_id": "3477045127917224"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_investor_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_investor_summary",
+ "p": {
+ "vi": "3477045127917224"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/vault_investor_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_investor_summary",
+ "params": {
+ "vault_id": "3477045127917224"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/vault_investor_summary' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_investor_summary",
+ "p": {
+ "vi": "3477045127917224"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Vault Redeem
+```
+FULL ENDPOINT: full/v1/vault_redeem
+LITE ENDPOINT: lite/v1/vault_redeem
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_vault_redeem_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/ack_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": {
+ "ack": "true"
+ }
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": {
+ "a": "true"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+ |7000|400|Vault ID provided is invalid and does not belong to any vault|
+ |7001|400|Vault does not have sufficient LP token balance|
+ |7002|400|User has an ongoing redemption|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_redeem' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_redeem",
+ "params": {
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_redeem' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_redeem",
+ "p": {
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_redeem' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_redeem",
+ "params": {
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_redeem' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_redeem",
+ "p": {
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/vault_redeem' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_redeem",
+ "params": {
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_redeem' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_redeem",
+ "p": {
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/vault_redeem' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_redeem",
+ "params": {
+ "vault_id": "3477045127917224",
+ "currency": "USDT",
+ "num_tokens": 1000000,
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/vault_redeem' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_redeem",
+ "p": {
+ "vi": "3477045127917224",
+ "c": "USDT",
+ "nt": 1000000,
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Vault Redeem Cancel
+```
+FULL ENDPOINT: full/v1/vault_redeem_cancel
+LITE ENDPOINT: lite/v1/vault_redeem_cancel
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_vault_redeem_cancel_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "vault_id": "3477045127917224"
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "vi": "3477045127917224"
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/ack_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": {
+ "ack": "true"
+ }
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": {
+ "a": "true"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+ |7000|400|Vault ID provided is invalid and does not belong to any vault|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_redeem_cancel' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_redeem_cancel",
+ "params": {
+ "vault_id": "3477045127917224"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_redeem_cancel' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_redeem_cancel",
+ "p": {
+ "vi": "3477045127917224"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_redeem_cancel' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_redeem_cancel",
+ "params": {
+ "vault_id": "3477045127917224"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_redeem_cancel' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_redeem_cancel",
+ "p": {
+ "vi": "3477045127917224"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/vault_redeem_cancel' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_redeem_cancel",
+ "params": {
+ "vault_id": "3477045127917224"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_redeem_cancel' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_redeem_cancel",
+ "p": {
+ "vi": "3477045127917224"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/vault_redeem_cancel' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_redeem_cancel",
+ "params": {
+ "vault_id": "3477045127917224"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/vault_redeem_cancel' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_redeem_cancel",
+ "p": {
+ "vi": "3477045127917224"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Vault Redemption Queue
+```
+FULL ENDPOINT: full/v1/vault_view_redemption_queue
+LITE ENDPOINT: lite/v1/vault_view_redemption_queue
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_vault_view_redemption_queue_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "vault_id": "3477045127917224"
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "vi": "3477045127917224"
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_vault_view_redemption_queue_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "redemption_queue": [{
+ "request_time": "1697788800000000000",
+ "num_lp_tokens": "1000000",
+ "max_redemption_period_timestamp": "1727788800000000000",
+ "age_category": "NORMAL",
+ "is_manager": true,
+ "eligible_for_auto_redemption_timestamp": "1727788800000000000"
+ }],
+ "pending_redemption_token_count": "1000000",
+ "urgent_redemption_token_count": "0",
+ "auto_redeemable_balance": "0",
+ "share_price": "1.25",
+ "pre_min": {
+ "requests": [{
+ "request_time": "1697788800000000000",
+ "num_lp_tokens": "1000000",
+ "max_redemption_period_timestamp": "1727788800000000000",
+ "age_category": "NORMAL",
+ "is_manager": true,
+ "eligible_for_auto_redemption_timestamp": "1727788800000000000"
+ }],
+ "token_count": "1000000"
+ }
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "rq": [{
+ "rt": "1697788800000000000",
+ "nl": "1000000",
+ "mr": "1727788800000000000",
+ "ac": "NORMAL",
+ "im": true,
+ "ef": "1727788800000000000"
+ }],
+ "pr": "1000000",
+ "ur": "0",
+ "ar": "0",
+ "sp": "1.25",
+ "pm": {
+ "r": [{
+ "rt": "1697788800000000000",
+ "nl": "1000000",
+ "mr": "1727788800000000000",
+ "ac": "NORMAL",
+ "im": true,
+ "ef": "1727788800000000000"
+ }],
+ "tc": "1000000"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+ |7000|400|Vault ID provided is invalid and does not belong to any vault|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_view_redemption_queue' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_view_redemption_queue",
+ "params": {
+ "vault_id": "3477045127917224"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_view_redemption_queue' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_view_redemption_queue",
+ "p": {
+ "vi": "3477045127917224"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_view_redemption_queue' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_view_redemption_queue",
+ "params": {
+ "vault_id": "3477045127917224"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_view_redemption_queue' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_view_redemption_queue",
+ "p": {
+ "vi": "3477045127917224"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/vault_view_redemption_queue' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_view_redemption_queue",
+ "params": {
+ "vault_id": "3477045127917224"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_view_redemption_queue' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_view_redemption_queue",
+ "p": {
+ "vi": "3477045127917224"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/vault_view_redemption_queue' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_view_redemption_queue",
+ "params": {
+ "vault_id": "3477045127917224"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/vault_view_redemption_queue' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "3477045127917224"
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_view_redemption_queue",
+ "p": {
+ "vi": "3477045127917224"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Vault Manager Investment History
+```
+FULL ENDPOINT: full/v1/vault_manager_investor_history
+LITE ENDPOINT: lite/v1/vault_manager_investor_history
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_query_vault_manager_investor_history_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "vault_id": "2312134",
+ "only_own_investments": true
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "vi": "2312134",
+ "oo": true
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_query_vault_manager_investor_history_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": [{
+ "event_time": "1697788800000000000",
+ "off_chain_account_id": "ACC:123456",
+ "vault_id": "2312134",
+ "type": "VAULT_INVEST",
+ "price": "1000000",
+ "size": "1000000",
+ "realized_pnl": "1000000",
+ "performance_fee": "1000000"
+ }]
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "et": "1697788800000000000",
+ "oc": "ACC:123456",
+ "vi": "2312134",
+ "t": "VAULT_INVEST",
+ "p": "1000000",
+ "s": "1000000",
+ "rp": "1000000",
+ "pf": "1000000"
+ }]
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1003|400|Request could not be processed due to malformed syntax|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+
+
+ !!! failure
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "ri":1,
+ "c":1000,
+ "m":"You need to authenticate prior to using this functionality",
+ "s":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_manager_investor_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "2312134",
+ "only_own_investments": true
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_manager_investor_history",
+ "params": {
+ "vault_id": "2312134",
+ "only_own_investments": true
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_manager_investor_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "2312134",
+ "oo": true
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_manager_investor_history",
+ "p": {
+ "vi": "2312134",
+ "oo": true
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_manager_investor_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "2312134",
+ "only_own_investments": true
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_manager_investor_history",
+ "params": {
+ "vault_id": "2312134",
+ "only_own_investments": true
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_manager_investor_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "2312134",
+ "oo": true
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_manager_investor_history",
+ "p": {
+ "vi": "2312134",
+ "oo": true
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/vault_manager_investor_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "2312134",
+ "only_own_investments": true
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_manager_investor_history",
+ "params": {
+ "vault_id": "2312134",
+ "only_own_investments": true
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_manager_investor_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "2312134",
+ "oo": true
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_manager_investor_history",
+ "p": {
+ "vi": "2312134",
+ "oo": true
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/vault_manager_investor_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vault_id": "2312134",
+ "only_own_investments": true
+ }
+ '
+ ```
+ !!! example "JSONRPC Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "v1/vault_manager_investor_history",
+ "params": {
+ "vault_id": "2312134",
+ "only_own_investments": true
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/vault_manager_investor_history' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "vi": "2312134",
+ "oo": true
+ }
+ '
+ ```
+ !!! example "JSONRPC Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "v1/vault_manager_investor_history",
+ "p": {
+ "vi": "2312134",
+ "oo": true
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
diff --git a/docs/grvt/trading_streams.md b/docs/grvt/trading_streams.md
new file mode 100644
index 0000000..ea50eea
--- /dev/null
+++ b/docs/grvt/trading_streams.md
@@ -0,0 +1,4952 @@
+# Trading Websocket Streams
+
+## Order
+### Order
+```
+STREAM: v1.order
+```
+
+=== "Feed Selector"
+
+ -8<- "docs/schemas/ws_order_feed_selector_v1.md"
+ ??? info "JSONRPC Wrappers"
+ -8<- "docs/schemas/jsonrpc_request.md"
+ -8<- "docs/schemas/jsonrpc_response.md"
+ -8<- "docs/schemas/ws_subscribe_params.md"
+ -8<- "docs/schemas/ws_subscribe_result.md"
+ -8<- "docs/schemas/ws_unsubscribe_params.md"
+ -8<- "docs/schemas/ws_unsubscribe_result.md"
+ -8<- "docs/schemas/ws_subscribe_request_v1_legacy.md"
+ -8<- "docs/schemas/ws_subscribe_response_v1_legacy.md"
+
+
+ ???+ question "Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.order",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.order",
+ "subs": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "unsubs": [],
+ "num_snapshots": [10],
+ "first_sequence_number": [872634876]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Unsubscribe"
+ **Full Unsubscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.order",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Unsubscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.order",
+ "unsubs": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Legacy Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.order",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.order",
+ "subs":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "unsubs":[],
+ "num_snapshots":[1],
+ "first_sequence_number":[2813]
+ }
+ ```
+
+=== "Feed Data"
+
+ -8<- "docs/schemas/ws_order_feed_data_v1.md"
+
+
+ !!! success
+ **Full Feed Response**
+ ``` { .json .copy }
+ {
+ "stream": "v1.order",
+ "selector": "BTC_USDT_Perp",
+ "sequence_number": "872634876",
+ "feed": {
+ "order_id": "0x1234567890abcdef",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "TAKE_PROFIT",
+ "tpsl": {
+ "trigger_by": "LAST",
+ "trigger_price": "65038.10",
+ "close_position": false
+ }
+ },
+ "broker": "BROKER_CODE"
+ },
+ "state": {
+ "status": "PENDING",
+ "reject_reason": "CLIENT_CANCEL",
+ "book_size": ["10.5"],
+ "traded_size": ["1.5"],
+ "update_time": "1697788800000000000",
+ "avg_fill_price": ["60000.4"]
+ }
+ }
+ }
+ ```
+ **Lite Feed Response**
+ ``` { .json .copy }
+ {
+ "s": "v1.order",
+ "s1": "BTC_USDT_Perp",
+ "sn": "872634876",
+ "f": {
+ "oi": "0x1234567890abcdef",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "TAKE_PROFIT",
+ "t": {
+ "tb": "LAST",
+ "tp": "65038.10",
+ "cp": false
+ }
+ },
+ "b": "BROKER_CODE"
+ },
+ "s1": {
+ "s": "PENDING",
+ "rr": "CLIENT_CANCEL",
+ "bs": ["10.5"],
+ "ts": ["1.5"],
+ "ut": "1697788800000000000",
+ "af": ["60000.4"]
+ }
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1008|401|Your IP has not been whitelisted for access|
+ |1101|400|Feed Format must be in the format of @|
+ |1102|400|Wrong number of primary selectors|
+ |1103|400|Wrong number of secondary selectors|
+ |3000|400|Instrument is invalid|
+ |3020|400|Sub account ID must be an uint64 integer|
+ -8<- "docs/schemas/jsonrpc_response.md"
+
+
+ !!! failure "Error"
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "error": {
+ "code": 1000,
+ "message": "You need to authenticate prior to using this functionality"
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "j": "2.0",
+ "e": {
+ "c": 1000,
+ "m": "You need to authenticate prior to using this functionality"
+ },
+ "i": 123,
+ "m": "subscribe"
+ }
+ ```
+ **Legacy Error Response**
+ ``` { .json .copy }
+ {
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.order",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.order",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.order",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.order",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.order",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.order",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.order",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.order",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.order",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.order",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.order",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.order",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.order",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.order",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.order",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.order",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.order",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.order",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.order",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.order",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.order",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.order",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.order",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.order",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+
+### Order State
+```
+STREAM: v1.state
+```
+
+=== "Feed Selector"
+
+ -8<- "docs/schemas/ws_order_state_feed_selector_v1.md"
+ ??? info "JSONRPC Wrappers"
+ -8<- "docs/schemas/jsonrpc_request.md"
+ -8<- "docs/schemas/jsonrpc_response.md"
+ -8<- "docs/schemas/ws_subscribe_params.md"
+ -8<- "docs/schemas/ws_subscribe_result.md"
+ -8<- "docs/schemas/ws_unsubscribe_params.md"
+ -8<- "docs/schemas/ws_unsubscribe_result.md"
+ -8<- "docs/schemas/ws_subscribe_request_v1_legacy.md"
+ -8<- "docs/schemas/ws_subscribe_response_v1_legacy.md"
+
+
+ ???+ question "Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.state",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.state",
+ "subs": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "unsubs": [],
+ "num_snapshots": [10],
+ "first_sequence_number": [872634876]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Unsubscribe"
+ **Full Unsubscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.state",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Unsubscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.state",
+ "unsubs": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Legacy Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.state",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.state",
+ "subs":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "unsubs":[],
+ "num_snapshots":[1],
+ "first_sequence_number":[2813]
+ }
+ ```
+
+=== "Feed Data"
+
+ -8<- "docs/schemas/ws_order_state_feed_data_v1.md"
+
+
+ !!! success
+ **Full Feed Response**
+ ``` { .json .copy }
+ {
+ "stream": "v1.state",
+ "selector": "BTC_USDT_Perp",
+ "sequence_number": "872634876",
+ "feed": {
+ "order_id": "10000101000203040506",
+ "client_order_id": "23042",
+ "order_state": {
+ "status": "PENDING",
+ "reject_reason": "CLIENT_CANCEL",
+ "book_size": ["10.5"],
+ "traded_size": ["1.5"],
+ "update_time": "1697788800000000000",
+ "avg_fill_price": ["60000.4"]
+ }
+ }
+ }
+ ```
+ **Lite Feed Response**
+ ``` { .json .copy }
+ {
+ "s": "v1.state",
+ "s1": "BTC_USDT_Perp",
+ "sn": "872634876",
+ "f": {
+ "oi": "10000101000203040506",
+ "co": "23042",
+ "os": {
+ "s": "PENDING",
+ "rr": "CLIENT_CANCEL",
+ "bs": ["10.5"],
+ "ts": ["1.5"],
+ "ut": "1697788800000000000",
+ "af": ["60000.4"]
+ }
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1008|401|Your IP has not been whitelisted for access|
+ |1101|400|Feed Format must be in the format of @|
+ |1102|400|Wrong number of primary selectors|
+ |1103|400|Wrong number of secondary selectors|
+ |3000|400|Instrument is invalid|
+ |3020|400|Sub account ID must be an uint64 integer|
+ -8<- "docs/schemas/jsonrpc_response.md"
+
+
+ !!! failure "Error"
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "error": {
+ "code": 1000,
+ "message": "You need to authenticate prior to using this functionality"
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "j": "2.0",
+ "e": {
+ "c": 1000,
+ "m": "You need to authenticate prior to using this functionality"
+ },
+ "i": 123,
+ "m": "subscribe"
+ }
+ ```
+ **Legacy Error Response**
+ ``` { .json .copy }
+ {
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.state",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.state",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.state",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.state",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.state",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.state",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.state",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.state",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.state",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.state",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.state",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.state",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.state",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.state",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.state",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.state",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.state",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.state",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.state",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.state",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.state",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.state",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.state",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.state",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+
+### Cancel Status
+```
+STREAM: v1.cancel
+```
+
+=== "Feed Selector"
+
+ -8<- "docs/schemas/ws_cancel_feed_selector_v1.md"
+ ??? info "JSONRPC Wrappers"
+ -8<- "docs/schemas/jsonrpc_request.md"
+ -8<- "docs/schemas/jsonrpc_response.md"
+ -8<- "docs/schemas/ws_subscribe_params.md"
+ -8<- "docs/schemas/ws_subscribe_result.md"
+ -8<- "docs/schemas/ws_unsubscribe_params.md"
+ -8<- "docs/schemas/ws_unsubscribe_result.md"
+ -8<- "docs/schemas/ws_subscribe_request_v1_legacy.md"
+ -8<- "docs/schemas/ws_subscribe_response_v1_legacy.md"
+
+
+ ???+ question "Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.cancel",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.cancel",
+ "subs": ["'$GRVT_SUB_ACCOUNT_ID'"],
+ "unsubs": [],
+ "num_snapshots": [10],
+ "first_sequence_number": [872634876]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Unsubscribe"
+ **Full Unsubscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.cancel",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Unsubscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.cancel",
+ "unsubs": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Legacy Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.cancel",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.cancel",
+ "subs":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "unsubs":[],
+ "num_snapshots":[1],
+ "first_sequence_number":[2813]
+ }
+ ```
+
+=== "Feed Data"
+
+ -8<- "docs/schemas/ws_cancel_feed_data_v1.md"
+
+
+ !!! success
+ **Full Feed Response**
+ ``` { .json .copy }
+ {
+ "stream": "v1.cancel",
+ "selector": "'$GRVT_SUB_ACCOUNT_ID'",
+ "sequence_number": "872634876",
+ "feed": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "client_order_id": "23042",
+ "order_id": "10000101000203040506",
+ "reason": "UNSPECIFIED",
+ "update_time": "1697788800000000000",
+ "cancel_status": "EXPIRED"
+ }
+ }
+ ```
+ **Lite Feed Response**
+ ``` { .json .copy }
+ {
+ "s": "v1.cancel",
+ "s1": "'$GRVT_SUB_ACCOUNT_ID'",
+ "sn": "872634876",
+ "f": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "co": "23042",
+ "oi": "10000101000203040506",
+ "r": "UNSPECIFIED",
+ "ut": "1697788800000000000",
+ "cs": "EXPIRED"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1008|401|Your IP has not been whitelisted for access|
+ |1101|400|Feed Format must be in the format of @|
+ |1102|400|Wrong number of primary selectors|
+ |1103|400|Wrong number of secondary selectors|
+ |3000|400|Instrument is invalid|
+ |3020|400|Sub account ID must be an uint64 integer|
+ -8<- "docs/schemas/jsonrpc_response.md"
+
+
+ !!! failure "Error"
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "error": {
+ "code": 1000,
+ "message": "You need to authenticate prior to using this functionality"
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "j": "2.0",
+ "e": {
+ "c": 1000,
+ "m": "You need to authenticate prior to using this functionality"
+ },
+ "i": 123,
+ "m": "subscribe"
+ }
+ ```
+ **Legacy Error Response**
+ ``` { .json .copy }
+ {
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.cancel",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.cancel",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.cancel",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.cancel",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.cancel",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.cancel",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.cancel",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.cancel",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.cancel",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.cancel",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.cancel",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.cancel",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.cancel",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.cancel",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.cancel",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.cancel",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.cancel",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.cancel",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.cancel",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.cancel",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.cancel",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.cancel",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.cancel",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.cancel",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+
+## Execution
+### Fill
+```
+STREAM: v1.fill
+```
+
+=== "Feed Selector"
+
+ -8<- "docs/schemas/ws_fill_feed_selector_v1.md"
+ ??? info "JSONRPC Wrappers"
+ -8<- "docs/schemas/jsonrpc_request.md"
+ -8<- "docs/schemas/jsonrpc_response.md"
+ -8<- "docs/schemas/ws_subscribe_params.md"
+ -8<- "docs/schemas/ws_subscribe_result.md"
+ -8<- "docs/schemas/ws_unsubscribe_params.md"
+ -8<- "docs/schemas/ws_unsubscribe_result.md"
+ -8<- "docs/schemas/ws_subscribe_request_v1_legacy.md"
+ -8<- "docs/schemas/ws_subscribe_response_v1_legacy.md"
+
+
+ ???+ question "Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.fill",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.fill",
+ "subs": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "unsubs": [],
+ "num_snapshots": [10],
+ "first_sequence_number": [872634876]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Unsubscribe"
+ **Full Unsubscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.fill",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Unsubscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.fill",
+ "unsubs": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Legacy Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.fill",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.fill",
+ "subs":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "unsubs":[],
+ "num_snapshots":[1],
+ "first_sequence_number":[2813]
+ }
+ ```
+
+=== "Feed Data"
+
+ -8<- "docs/schemas/ws_fill_feed_data_v1.md"
+
+
+ !!! success
+ **Full Feed Response**
+ ``` { .json .copy }
+ {
+ "stream": "v1.fill",
+ "selector": "BTC_USDT_Perp",
+ "sequence_number": "872634876",
+ "feed": {
+ "event_time": "1697788800000000000",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "is_buyer": true,
+ "is_taker": true,
+ "size": "0.30",
+ "price": "65038.01",
+ "mark_price": "65038.01",
+ "index_price": "65038.01",
+ "interest_rate": 0.0003,
+ "forward_price": "65038.01",
+ "realized_pnl": "2400.50",
+ "fee": "9.75",
+ "fee_rate": 0.0003,
+ "trade_id": "209358-2",
+ "order_id": "0x10000101000203040506",
+ "venue": "ORDERBOOK",
+ "client_order_id": "23042",
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "broker": "UNSPECIFIED",
+ "is_rpi": false
+ }
+ }
+ ```
+ **Lite Feed Response**
+ ``` { .json .copy }
+ {
+ "s": "v1.fill",
+ "s1": "BTC_USDT_Perp",
+ "sn": "872634876",
+ "f": {
+ "et": "1697788800000000000",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "ib": true,
+ "it": true,
+ "s": "0.30",
+ "p": "65038.01",
+ "mp": "65038.01",
+ "ip": "65038.01",
+ "ir": 0.0003,
+ "fp": "65038.01",
+ "rp": "2400.50",
+ "f": "9.75",
+ "fr": 0.0003,
+ "ti": "209358-2",
+ "oi": "0x10000101000203040506",
+ "v": "ORDERBOOK",
+ "co": "23042",
+ "s1": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "b": "UNSPECIFIED",
+ "ir1": false
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1008|401|Your IP has not been whitelisted for access|
+ |1101|400|Feed Format must be in the format of @|
+ |1102|400|Wrong number of primary selectors|
+ |1103|400|Wrong number of secondary selectors|
+ |3000|400|Instrument is invalid|
+ |3020|400|Sub account ID must be an uint64 integer|
+ -8<- "docs/schemas/jsonrpc_response.md"
+
+
+ !!! failure "Error"
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "error": {
+ "code": 1000,
+ "message": "You need to authenticate prior to using this functionality"
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "j": "2.0",
+ "e": {
+ "c": 1000,
+ "m": "You need to authenticate prior to using this functionality"
+ },
+ "i": 123,
+ "m": "subscribe"
+ }
+ ```
+ **Legacy Error Response**
+ ``` { .json .copy }
+ {
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.fill",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.fill",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.fill",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.fill",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.fill",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.fill",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.fill",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.fill",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.fill",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.fill",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.fill",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.fill",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.fill",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.fill",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.fill",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.fill",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.fill",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.fill",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.fill",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.fill",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.fill",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.fill",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.fill",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.fill",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+
+### Positions
+```
+STREAM: v1.position
+```
+
+=== "Feed Selector"
+
+ -8<- "docs/schemas/ws_positions_feed_selector_v1.md"
+ ??? info "JSONRPC Wrappers"
+ -8<- "docs/schemas/jsonrpc_request.md"
+ -8<- "docs/schemas/jsonrpc_response.md"
+ -8<- "docs/schemas/ws_subscribe_params.md"
+ -8<- "docs/schemas/ws_subscribe_result.md"
+ -8<- "docs/schemas/ws_unsubscribe_params.md"
+ -8<- "docs/schemas/ws_unsubscribe_result.md"
+ -8<- "docs/schemas/ws_subscribe_request_v1_legacy.md"
+ -8<- "docs/schemas/ws_subscribe_response_v1_legacy.md"
+
+
+ ???+ question "Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.position",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.position",
+ "subs": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "unsubs": [],
+ "num_snapshots": [10],
+ "first_sequence_number": [872634876]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Unsubscribe"
+ **Full Unsubscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.position",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Unsubscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.position",
+ "unsubs": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Legacy Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.position",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.position",
+ "subs":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "unsubs":[],
+ "num_snapshots":[1],
+ "first_sequence_number":[2813]
+ }
+ ```
+
+=== "Feed Data"
+
+ -8<- "docs/schemas/ws_positions_feed_data_v1.md"
+
+
+ !!! success
+ **Full Feed Response**
+ ``` { .json .copy }
+ {
+ "stream": "v1.position",
+ "selector": "BTC_USDT_Perp",
+ "sequence_number": "872634876",
+ "feed": {
+ "event_time": "1697788800000000000",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "size": "2635000.50",
+ "notional": "2635000.50",
+ "entry_price": "65038.01",
+ "exit_price": "65038.01",
+ "mark_price": "65038.01",
+ "unrealized_pnl": "135000.50",
+ "realized_pnl": "-35000.30",
+ "total_pnl": "100000.20",
+ "roi": "10.20",
+ "quote_index_price": "1.0000102",
+ "est_liquidation_price": 60000.25,
+ "leverage": "10"
+ }
+ }
+ ```
+ **Lite Feed Response**
+ ``` { .json .copy }
+ {
+ "s": "v1.position",
+ "s1": "BTC_USDT_Perp",
+ "sn": "872634876",
+ "f": {
+ "et": "1697788800000000000",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "i": "BTC_USDT_Perp",
+ "s": "2635000.50",
+ "n": "2635000.50",
+ "ep": "65038.01",
+ "ep1": "65038.01",
+ "mp": "65038.01",
+ "up": "135000.50",
+ "rp": "-35000.30",
+ "tp": "100000.20",
+ "r": "10.20",
+ "qi": "1.0000102",
+ "el": 60000.25,
+ "l": "10"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1000|401|You need to authenticate prior to using this functionality|
+ |1001|403|You are not authorized to access this functionality|
+ |1002|500|Internal Server Error|
+ |1008|401|Your IP has not been whitelisted for access|
+ |1101|400|Feed Format must be in the format of @|
+ |1102|400|Wrong number of primary selectors|
+ |1103|400|Wrong number of secondary selectors|
+ |3000|400|Instrument is invalid|
+ |3020|400|Sub account ID must be an uint64 integer|
+ -8<- "docs/schemas/jsonrpc_response.md"
+
+
+ !!! failure "Error"
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "error": {
+ "code": 1000,
+ "message": "You need to authenticate prior to using this functionality"
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "j": "2.0",
+ "e": {
+ "c": 1000,
+ "m": "You need to authenticate prior to using this functionality"
+ },
+ "i": 123,
+ "m": "subscribe"
+ }
+ ```
+ **Legacy Error Response**
+ ``` { .json .copy }
+ {
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.position",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.position",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.position",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.position",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.position",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.position",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.position",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.position",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.position",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.position",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.position",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.position",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.position",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.position",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.position",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.position",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.position",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.position",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.position",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.position",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.position",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.position",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.position",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.position",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+
+## Transfer
+### Deposit
+```
+STREAM: v1.deposit
+```
+
+=== "Feed Selector"
+
+ -8<- "docs/schemas/ws_deposit_feed_selector_v1.md"
+ ??? info "JSONRPC Wrappers"
+ -8<- "docs/schemas/jsonrpc_request.md"
+ -8<- "docs/schemas/jsonrpc_response.md"
+ -8<- "docs/schemas/ws_subscribe_params.md"
+ -8<- "docs/schemas/ws_subscribe_result.md"
+ -8<- "docs/schemas/ws_unsubscribe_params.md"
+ -8<- "docs/schemas/ws_unsubscribe_result.md"
+ -8<- "docs/schemas/ws_subscribe_request_v1_legacy.md"
+ -8<- "docs/schemas/ws_subscribe_response_v1_legacy.md"
+
+
+ ???+ question "Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.deposit",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.deposit",
+ "subs": ["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "unsubs": [],
+ "num_snapshots": [10],
+ "first_sequence_number": [872634876]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Unsubscribe"
+ **Full Unsubscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.deposit",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Unsubscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.deposit",
+ "unsubs": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Legacy Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.deposit",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.deposit",
+ "subs":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "unsubs":[],
+ "num_snapshots":[1],
+ "first_sequence_number":[2813]
+ }
+ ```
+
+=== "Feed Data"
+
+ -8<- "docs/schemas/ws_deposit_feed_data_v1.md"
+
+
+ !!! success
+ **Full Feed Response**
+ ``` { .json .copy }
+ {
+ "stream": "v1.deposit",
+ "selector": "BTC_USDT_Perp",
+ "sequence_number": "872634876",
+ "feed": {
+ "tx_hash": "0x1234567890123456789012345678901234567890123456789012345678901234",
+ "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "currency": "USDT",
+ "num_tokens": "10.50"
+ }
+ }
+ ```
+ **Lite Feed Response**
+ ``` { .json .copy }
+ {
+ "s": "v1.deposit",
+ "s1": "BTC_USDT_Perp",
+ "sn": "872634876",
+ "f": {
+ "th": "0x1234567890123456789012345678901234567890123456789012345678901234",
+ "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "c": "USDT",
+ "nt": "10.50"
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1001|403|You are not authorized to access this functionality|
+ |1008|401|Your IP has not been whitelisted for access|
+ |1101|400|Feed Format must be in the format of @|
+ |1102|400|Wrong number of primary selectors|
+ |1103|400|Wrong number of secondary selectors|
+ -8<- "docs/schemas/jsonrpc_response.md"
+
+
+ !!! failure "Error"
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "error": {
+ "code": 1001,
+ "message": "You are not authorized to access this functionality"
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "j": "2.0",
+ "e": {
+ "c": 1001,
+ "m": "You are not authorized to access this functionality"
+ },
+ "i": 123,
+ "m": "subscribe"
+ }
+ ```
+ **Legacy Error Response**
+ ``` { .json .copy }
+ {
+ "code":1001,
+ "message":"You are not authorized to access this functionality",
+ "status":403
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.deposit",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.deposit",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.deposit",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.deposit",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.deposit",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.deposit",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.deposit",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.deposit",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.deposit",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.deposit",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.deposit",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.deposit",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.deposit",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.deposit",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.deposit",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.deposit",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.deposit",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.deposit",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.deposit",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.deposit",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.deposit",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.deposit",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.deposit",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.deposit",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+
+### Transfer
+```
+STREAM: v1.transfer
+```
+
+=== "Feed Selector"
+
+ -8<- "docs/schemas/ws_transfer_feed_selector_v1.md"
+ ??? info "JSONRPC Wrappers"
+ -8<- "docs/schemas/jsonrpc_request.md"
+ -8<- "docs/schemas/jsonrpc_response.md"
+ -8<- "docs/schemas/ws_subscribe_params.md"
+ -8<- "docs/schemas/ws_subscribe_result.md"
+ -8<- "docs/schemas/ws_unsubscribe_params.md"
+ -8<- "docs/schemas/ws_unsubscribe_result.md"
+ -8<- "docs/schemas/ws_subscribe_request_v1_legacy.md"
+ -8<- "docs/schemas/ws_subscribe_response_v1_legacy.md"
+
+
+ ???+ question "Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.transfer",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.transfer",
+ "subs": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"],
+ "unsubs": [],
+ "num_snapshots": [10],
+ "first_sequence_number": [872634876]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Unsubscribe"
+ **Full Unsubscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.transfer",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Unsubscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.transfer",
+ "unsubs": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Legacy Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.transfer",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.transfer",
+ "subs":["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"],
+ "unsubs":[],
+ "num_snapshots":[1],
+ "first_sequence_number":[2813]
+ }
+ ```
+
+=== "Feed Data"
+
+ -8<- "docs/schemas/ws_transfer_feed_data_v1.md"
+
+
+ !!! success
+ **Full Feed Response**
+ ``` { .json .copy }
+ {
+ "stream": "v1.transfer",
+ "selector": "BTC_USDT_Perp",
+ "sequence_number": "872634876",
+ "feed": {
+ "tx_id": "1028403",
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "currency": "USDT",
+ "num_tokens": "1500.0",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "event_time": "1697788800000000000",
+ "transfer_type": "UNSPECIFIED",
+ "transfer_metadata": null
+ }
+ }
+ ```
+ **Lite Feed Response**
+ ``` { .json .copy }
+ {
+ "s": "v1.transfer",
+ "s1": "BTC_USDT_Perp",
+ "sn": "872634876",
+ "f": {
+ "ti": "1028403",
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "fs": "'$GRVT_SUB_ACCOUNT_ID'",
+ "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "ts": "'$GRVT_SUB_ACCOUNT_ID'",
+ "c": "USDT",
+ "nt": "1500.0",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "et": "1697788800000000000",
+ "tt": "UNSPECIFIED",
+ "tm": null
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1001|403|You are not authorized to access this functionality|
+ |1008|401|Your IP has not been whitelisted for access|
+ |1101|400|Feed Format must be in the format of @|
+ |1102|400|Wrong number of primary selectors|
+ |1103|400|Wrong number of secondary selectors|
+ |3020|400|Sub account ID must be an uint64 integer|
+ -8<- "docs/schemas/jsonrpc_response.md"
+
+
+ !!! failure "Error"
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "error": {
+ "code": 1001,
+ "message": "You are not authorized to access this functionality"
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "j": "2.0",
+ "e": {
+ "c": 1001,
+ "m": "You are not authorized to access this functionality"
+ },
+ "i": 123,
+ "m": "subscribe"
+ }
+ ```
+ **Legacy Error Response**
+ ``` { .json .copy }
+ {
+ "code":1001,
+ "message":"You are not authorized to access this functionality",
+ "status":403
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.transfer",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.transfer",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.transfer",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.transfer",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.transfer",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.transfer",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.transfer",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.transfer",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.transfer",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.transfer",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.transfer",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.transfer",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.transfer",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.transfer",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.transfer",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.transfer",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.transfer",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.transfer",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.transfer",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.transfer",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.transfer",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.transfer",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.transfer",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.transfer",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+
+### Withdrawal
+```
+STREAM: v1.withdrawal
+```
+
+=== "Feed Selector"
+
+ -8<- "docs/schemas/ws_withdrawal_feed_selector_v1.md"
+ ??? info "JSONRPC Wrappers"
+ -8<- "docs/schemas/jsonrpc_request.md"
+ -8<- "docs/schemas/jsonrpc_response.md"
+ -8<- "docs/schemas/ws_subscribe_params.md"
+ -8<- "docs/schemas/ws_subscribe_result.md"
+ -8<- "docs/schemas/ws_unsubscribe_params.md"
+ -8<- "docs/schemas/ws_unsubscribe_result.md"
+ -8<- "docs/schemas/ws_subscribe_request_v1_legacy.md"
+ -8<- "docs/schemas/ws_subscribe_response_v1_legacy.md"
+
+
+ ???+ question "Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.withdrawal",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.withdrawal",
+ "subs": ["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "unsubs": [],
+ "num_snapshots": [10],
+ "first_sequence_number": [872634876]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Unsubscribe"
+ **Full Unsubscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.withdrawal",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Unsubscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.withdrawal",
+ "unsubs": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Legacy Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.withdrawal",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.withdrawal",
+ "subs":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "unsubs":[],
+ "num_snapshots":[1],
+ "first_sequence_number":[2813]
+ }
+ ```
+
+=== "Feed Data"
+
+ -8<- "docs/schemas/ws_withdrawal_feed_data_v1.md"
+
+
+ !!! success
+ **Full Feed Response**
+ ``` { .json .copy }
+ {
+ "stream": "v1.withdrawal",
+ "selector": "BTC_USDT_Perp",
+ "sequence_number": "872634876",
+ "feed": {
+ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "currency": "USDT",
+ "num_tokens": "10.50",
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ }
+ }
+ }
+ ```
+ **Lite Feed Response**
+ ``` { .json .copy }
+ {
+ "s": "v1.withdrawal",
+ "s1": "BTC_USDT_Perp",
+ "sn": "872634876",
+ "f": {
+ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "c": "USDT",
+ "nt": "10.50",
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ }
+ }
+ }
+ ```
+
+=== "Errors"
+
+ !!! info "Error Codes"
+ |Code|HttpStatus| Description |
+ |-|-|-|
+ |1001|403|You are not authorized to access this functionality|
+ |1008|401|Your IP has not been whitelisted for access|
+ |1101|400|Feed Format must be in the format of @|
+ |1102|400|Wrong number of primary selectors|
+ |1103|400|Wrong number of secondary selectors|
+ -8<- "docs/schemas/jsonrpc_response.md"
+
+
+ !!! failure "Error"
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "error": {
+ "code": 1001,
+ "message": "You are not authorized to access this functionality"
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "j": "2.0",
+ "e": {
+ "c": 1001,
+ "m": "You are not authorized to access this functionality"
+ },
+ "i": 123,
+ "m": "subscribe"
+ }
+ ```
+ **Legacy Error Response**
+ ``` { .json .copy }
+ {
+ "code":1001,
+ "message":"You are not authorized to access this functionality",
+ "status":403
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.withdrawal",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.withdrawal",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.withdrawal",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.withdrawal",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.withdrawal",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.withdrawal",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.withdrawal",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.withdrawal",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.withdrawal",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.withdrawal",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.withdrawal",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.withdrawal",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.withdrawal",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.withdrawal",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.withdrawal",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.withdrawal",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.withdrawal",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.withdrawal",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.withdrawal",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/full" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.withdrawal",
+ "selectors": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.withdrawal",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "subscribe",
+ "p": {
+ "s": "v1.withdrawal",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws/lite" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "j": "2.0",
+ "m": "unsubscribe",
+ "p": {
+ "s": "v1.withdrawal",
+ "s1": ["'$GRVT_MAIN_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.withdrawal",
+ "feed":["'$GRVT_MAIN_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+
diff --git a/package.json b/package.json
index bf7fcf1..e715c1f 100644
--- a/package.json
+++ b/package.json
@@ -17,6 +17,8 @@
"typescript": "^5"
},
"dependencies": {
+ "@grvt/sdk": "^0.0.1-beta.17",
+ "axios": "^1.12.2",
"ccxt": "^4.5.5",
"dotenv": "^17.2.2",
"ink": "^6.3.1",
diff --git a/src/exchanges/grvt/README.md b/src/exchanges/grvt/README.md
new file mode 100644
index 0000000..5de7db0
--- /dev/null
+++ b/src/exchanges/grvt/README.md
@@ -0,0 +1,2 @@
+Placeholder until adapter implementation
+
diff --git a/src/exchanges/grvt/client.ts b/src/exchanges/grvt/client.ts
new file mode 100644
index 0000000..f9514cb
--- /dev/null
+++ b/src/exchanges/grvt/client.ts
@@ -0,0 +1,28 @@
+import { GrvtClient, GrvtWsClient, EGrvtEnvironment } from "@grvt/sdk";
+
+export interface GrvtCredentials {
+ apiKey: string;
+ apiSecret: string;
+ env: EGrvtEnvironment;
+ subAccountId: string;
+ instrument: string;
+}
+
+export class GrvtGateway {
+ private readonly grvtClient: GrvtClient;
+ private readonly wsClient: GrvtWsClient;
+
+ constructor(private readonly credentials: GrvtCredentials) {
+ this.grvtClient = new GrvtClient({
+ apiKey: credentials.apiKey,
+ apiSecret: credentials.apiSecret,
+ env: credentials.env,
+ });
+ this.wsClient = new GrvtWsClient({ apiKey: credentials.apiKey, env: credentials.env });
+ }
+
+ async initialize(): Promise {
+ await this.wsClient.connect();
+ }
+}
+
diff --git a/src/exchanges/grvt/gateway.ts b/src/exchanges/grvt/gateway.ts
new file mode 100644
index 0000000..eb2806b
--- /dev/null
+++ b/src/exchanges/grvt/gateway.ts
@@ -0,0 +1,269 @@
+import { GrvtClient, GrvtWsClient, EGrvtEnvironment } from "@grvt/sdk";
+import { TDG } from "@grvt/client";
+
+import type {
+ GrvtAccountSnapshot,
+ GrvtOrder,
+ GrvtOrderUpdateFeed,
+ GrvtPosition,
+ GrvtPositionUpdateFeed,
+} from "../types";
+
+export interface GrvtGatewayOptions {
+ apiKey: string;
+ apiSecret: string;
+ subAccountId: string;
+ instrument: string;
+ env?: EGrvtEnvironment;
+}
+
+export class GrvtGateway {
+ private readonly client: GrvtClient;
+ private readonly ws: GrvtWsClient;
+ private readonly tdg: TDG;
+
+ private accountSnapshot: GrvtAccountSnapshot | null = null;
+ private openOrders: GrvtOrder[] = [];
+ private positions: GrvtPosition[] = [];
+ private readonly instrument: string;
+ private snapshotListeners = new Set<(snapshot: GrvtAccountSnapshot) => void>();
+ private ordersListeners = new Set<(orders: GrvtOrder[]) => void>();
+ private positionsListeners = new Set<(positions: GrvtPosition[]) => void>();
+
+ constructor(private readonly options: GrvtGatewayOptions) {
+ const environment = options.env ?? (process.env.GRVT_ENV as EGrvtEnvironment) ?? EGrvtEnvironment.TESTNET;
+ this.client = new GrvtClient({
+ apiKey: options.apiKey,
+ apiSecret: options.apiSecret,
+ env: environment,
+ });
+ this.ws = new GrvtWsClient({ apiKey: options.apiKey, env: environment });
+ this.tdg = new TDG({ host: `https://trades.${this.client["domain"]}/lite/v1` });
+ this.tdg = new TDG({ host: `https://trades.${this.client["domain"]}` });
+ this.instrument = options.instrument;
+ }
+
+ async initialize(): Promise {
+ await this.refreshAccountSnapshot();
+ await this.refreshOpenOrders();
+ await this.refreshPositions();
+ await this.ws.connect();
+ this.subscribeStreams();
+ }
+
+ onAccount(listener: (snapshot: GrvtAccountSnapshot) => void): () => void {
+ this.snapshotListeners.add(listener);
+ if (this.accountSnapshot) listener(this.accountSnapshot);
+ return () => {
+ this.snapshotListeners.delete(listener);
+ };
+ }
+
+ onOrders(listener: (orders: GrvtOrder[]) => void): () => void {
+ this.ordersListeners.add(listener);
+ if (this.openOrders.length) listener([...this.openOrders]);
+ return () => {
+ this.ordersListeners.delete(listener);
+ };
+ }
+
+ onPositions(listener: (positions: GrvtPosition[]) => void): () => void {
+ this.positionsListeners.add(listener);
+ if (this.positions.length) listener([...this.positions]);
+ return () => {
+ this.positionsListeners.delete(listener);
+ };
+ }
+
+ getAccountSnapshot(): GrvtAccountSnapshot | null {
+ return this.accountSnapshot ? { ...this.accountSnapshot } : null;
+ }
+
+ getOpenOrders(): GrvtOrder[] {
+ return [...this.openOrders];
+ }
+
+ getPositions(): GrvtPosition[] {
+ return [...this.positions];
+ }
+
+ private async refreshAccountSnapshot(): Promise {
+ const response = await this.client.getSubAccountSummary({ sub_account_id: this.options.subAccountId });
+ const snapshot = mapAccountSnapshot(response);
+ this.accountSnapshot = snapshot;
+ this.emitAccount(snapshot);
+ }
+
+ private async refreshOpenOrders(): Promise {
+ const response = await this.client.tdgClient.openOrders({ sub_account_id: this.options.subAccountId });
+ const orders = mapOpenOrders(response);
+ this.openOrders = orders;
+ this.emitOrders(orders);
+ }
+
+ private async refreshPositions(): Promise {
+ const response = await this.client.tdgClient.positions({ sub_account_id: this.options.subAccountId });
+ const positions = mapPositions(response);
+ this.positions = positions.filter((position) => position.instrument === this.instrument);
+ this.emitPositions(this.positions);
+ }
+
+ private subscribeStreams(): void {
+ const orderSubscription: IWSTdgOrderRequest = {
+ stream: `${EStream.ORDER}`,
+ params: {
+ sub_account_id: this.options.subAccountId,
+ instrument: this.instrument,
+ },
+ onData: (message) => this.handleOrderFeed(message),
+ };
+
+ const orderStateSubscription: IWSTdgOrderStateRequest = {
+ stream: `${EStream.STATE}`,
+ params: {
+ sub_account_id: this.options.subAccountId,
+ instrument: this.instrument,
+ },
+ onData: (message) => this.handleOrderStateFeed(message),
+ };
+
+ const positionSubscription: IWSTdgPositionRequest = {
+ stream: `${EStream.POSITION}`,
+ params: {
+ sub_account_id: this.options.subAccountId,
+ instrument: this.instrument,
+ },
+ onData: (message) => this.handlePositionFeed(message),
+ };
+
+ this.ws.subscribe(orderSubscription);
+ this.ws.subscribe(orderStateSubscription);
+ this.ws.subscribe(positionSubscription);
+ }
+
+ private handleOrderFeed(feed: GrvtOrder): void {
+ this.mergeOrder(feed);
+ }
+
+ private handleOrderStateFeed(feed: GrvtOrderUpdateFeed): void {
+ this.mergeOrderState(feed);
+ }
+
+ private handlePositionFeed(feed: GrvtPositionUpdateFeed): void {
+ this.mergePosition(feed);
+ }
+
+ private mergeOrder(order: GrvtOrder): void {
+ const existingIndex = this.openOrders.findIndex((item) => item.order_id === order.order_id);
+ if (existingIndex >= 0) {
+ this.openOrders[existingIndex] = { ...this.openOrders[existingIndex], ...order };
+ } else {
+ this.openOrders.push(order);
+ }
+ this.emitOrders([...this.openOrders]);
+ }
+
+ private mergeOrderState(update: GrvtOrderUpdateFeed): void {
+ const existing = this.openOrders.find((item) => item.order_id === update.order_id);
+ if (existing) {
+ existing.state = update.state;
+ this.emitOrders([...this.openOrders]);
+ }
+ }
+
+ private mergePosition(update: GrvtPositionUpdateFeed): void {
+ const idx = this.positions.findIndex((item) => item.instrument === update.instrument);
+ if (idx >= 0) {
+ this.positions[idx] = {
+ ...this.positions[idx],
+ ...update,
+ };
+ } else {
+ this.positions.push(update);
+ }
+ this.emitPositions([...this.positions]);
+ }
+
+ private emitAccount(snapshot: GrvtAccountSnapshot): void {
+ this.snapshotListeners.forEach((listener) => {
+ try {
+ listener({ ...snapshot });
+ } catch (error) {
+ console.error("[GrvtGateway] account listener failed", error);
+ }
+ });
+ }
+
+ private emitOrders(orders: GrvtOrder[]): void {
+ this.ordersListeners.forEach((listener) => {
+ try {
+ listener([...orders]);
+ } catch (error) {
+ console.error("[GrvtGateway] orders listener failed", error);
+ }
+ });
+ }
+
+ private emitPositions(positions: GrvtPosition[]): void {
+ this.positionsListeners.forEach((listener) => {
+ try {
+ listener([...positions]);
+ } catch (error) {
+ console.error("[GrvtGateway] positions listener failed", error);
+ }
+ });
+ }
+}
+
+function mapAccountSnapshot(response: IApiSubAccountSummaryResponse): GrvtAccountSnapshot {
+ const result = response.result;
+ if (!result) {
+ return {
+ total_unrealized_pnl: "0",
+ positions: [],
+ };
+ }
+ return {
+ total_unrealized_pnl: result.unrealized_pnl,
+ positions: (result.positions ?? []).map(mapPositionEntry),
+ settle_currency: result.settle_currency,
+ available_balance: result.available_balance,
+ };
+}
+
+function mapOpenOrders(response: IApiOpenOrdersResponse): GrvtOrder[] {
+ return (response.result ?? []).map((order) => ({
+ order_id: order.order_id ?? "",
+ client_order_id: order.metadata?.client_order_id,
+ sub_account_id: order.sub_account_id,
+ is_market: order.is_market,
+ time_in_force: order.time_in_force,
+ post_only: order.post_only,
+ reduce_only: order.reduce_only,
+ legs: order.legs?.map((leg) => ({
+ instrument: leg.instrument ?? "",
+ size: leg.size ?? "0",
+ limit_price: leg.limit_price ?? undefined,
+ is_buying_asset: leg.is_buying_asset,
+ })),
+ metadata: order.metadata,
+ state: order.state,
+ }));
+}
+
+function mapPositions(response: IApiPositionsResponse): GrvtPosition[] {
+ return (response.result ?? []).map(mapPositionEntry);
+}
+
+function mapPositionEntry(entry: any): GrvtPosition {
+ return {
+ instrument: entry.instrument ?? "",
+ size: entry.size ?? "0",
+ entry_price: entry.entry_price,
+ mark_price: entry.mark_price,
+ unrealized_pnl: entry.unrealized_pnl,
+ sub_account_id: entry.sub_account_id,
+ update_time: entry.event_time,
+ };
+}
+
diff --git a/src/exchanges/types.ts b/src/exchanges/types.ts
index bb676d7..cc66c70 100644
--- a/src/exchanges/types.ts
+++ b/src/exchanges/types.ts
@@ -44,6 +44,157 @@ export interface AsterAccountPosition {
markPrice?: string;
}
+export interface GrvtOrderLeg {
+ instrument: string;
+ size: string;
+ limit_price?: string;
+ is_buying_asset?: boolean;
+}
+
+export interface GrvtOrderMetadata {
+ client_order_id?: string;
+ create_time?: string;
+ broker?: string | null;
+}
+
+export interface GrvtOrderState {
+ status?: string;
+ reject_reason?: string | null;
+ book_size?: string[];
+ traded_size?: string[];
+ update_time?: string;
+ avg_fill_price?: string[];
+}
+
+export interface GrvtOrder {
+ order_id: string;
+ client_order_id?: string;
+ sub_account_id?: string;
+ is_market?: boolean;
+ time_in_force?: string;
+ post_only?: boolean;
+ reduce_only?: boolean;
+ legs?: GrvtOrderLeg[];
+ metadata?: GrvtOrderMetadata;
+ state?: GrvtOrderState;
+ instrument?: string;
+}
+
+export interface GrvtTrade {
+ price: string;
+ size: string;
+ taker_side: "BUY" | "SELL";
+ timestamp: string;
+}
+
+export interface GrvtTradeHistoryResponse {
+ result?: GrvtTrade[];
+}
+
+export interface GrvtWebsocketMessage {
+ stream: string;
+ selector: string;
+ sequence_number?: string;
+ feed: T;
+}
+
+export interface GrvtOrderUpdateFeed {
+ order_id: string;
+ client_order_id?: string;
+ sub_account_id?: string;
+ state?: GrvtOrderState;
+ traded_size?: string[];
+ update_time?: string;
+}
+
+export interface GrvtPositionUpdateFeed {
+ instrument: string;
+ size: string;
+ entry_price?: string;
+ mark_price?: string;
+ unrealized_pnl?: string;
+ sub_account_id?: string;
+ update_time?: string;
+}
+
+export interface GrvtDepthUpdateFeed {
+ instrument: string;
+ bids: GrvtDepthLevel[];
+ asks: GrvtDepthLevel[];
+ event_time?: string;
+}
+
+export interface GrvtTickerUpdateFeed {
+ instrument: string;
+ mark_price?: string;
+ last_trade_price?: string;
+ best_bid_price?: string;
+ best_ask_price?: string;
+ volume_24h?: string;
+}
+
+export interface GrvtOpenOrdersResponse {
+ result?: GrvtOrder[];
+}
+
+export interface GrvtPositionsResponse {
+ result?: GrvtPosition[];
+}
+
+export interface GrvtPosition {
+ instrument: string;
+ size: string;
+ entry_price?: string;
+ mark_price?: string;
+ unrealized_pnl?: string;
+}
+
+export interface GrvtAccountSnapshot {
+ total_unrealized_pnl?: string;
+ positions: GrvtPosition[];
+ settle_currency?: string;
+ available_balance?: string;
+}
+
+export interface GrvtBalancesResponse {
+ result?: {
+ total_unrealized_pnl?: string;
+ positions?: GrvtPosition[];
+ };
+}
+
+export interface GrvtDepthLevel {
+ price: string;
+ size: string;
+}
+
+export interface GrvtDepth {
+ instrument: string;
+ event_time?: string;
+ bids: GrvtDepthLevel[];
+ asks: GrvtDepthLevel[];
+}
+
+export interface GrvtTicker {
+ instrument: string;
+ mark_price?: string;
+ last_trade_price?: string;
+ best_bid_price?: string;
+ best_ask_price?: string;
+ volume_24h?: string;
+}
+
+export interface GrvtKline {
+ open_time: number;
+ close_time: number;
+ open: string;
+ high: string;
+ low: string;
+ close: string;
+ volume: string;
+ number_of_trades?: number;
+}
+
export interface AsterAccountAsset {
asset: string;
walletBalance: string;