@yuants/vendor-hyperliquid 0.3.16 → 0.3.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -14,19 +14,14 @@ const terminal = Terminal.fromNodeEnv();
14
14
  const accountRes = await client.getUserPerpetualsAccountSummary({
15
15
  user: client.public_key,
16
16
  });
17
- const profit = accountRes.assetPositions
18
- .map((pos) => +pos.position.unrealizedPnl)
19
- .reduce((a, b) => a + b, 0);
20
- const money = {
21
- currency: 'USDC',
22
- equity: +accountRes.crossMarginSummary.accountValue,
23
- profit: profit,
24
- free: +accountRes.withdrawable,
25
- used: +accountRes.crossMarginSummary.accountValue - +accountRes.withdrawable,
26
- balance: +accountRes.crossMarginSummary.accountValue - profit,
27
- };
17
+ const equity = +accountRes.crossMarginSummary.accountValue;
18
+ const free = +accountRes.withdrawable;
28
19
  return {
29
- money: money,
20
+ money: {
21
+ currency: 'USDC',
22
+ equity,
23
+ free,
24
+ },
30
25
  positions: accountRes.assetPositions.map((position) => ({
31
26
  position_id: `${position.position.coin}-USD`,
32
27
  datasource_id: 'HYPERLIQUID',
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA4B,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAC7G,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,iBAAiB,CAAC;AACzB,OAAO,SAAS,CAAC;AACjB,OAAO,WAAW,CAAC;AAEnB,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,CAAC,KAAK,IAAI,EAAE;IACV,oBAAoB;IACpB;QACE,MAAM,UAAU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C,OAAO;oBACxD,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC;oBACxC,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC;oBAC7C,cAAc,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO;oBAC1C,cAAc,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC;oBACnF,eAAe,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa;oBACjD,SAAS,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa;oBAC3C,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU;iBACtC,CAAC,CACH;aACF,CAAC;QACJ,CAAC,EACD,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAChC,CAAC;QAEF,gBAAgB,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,eAAe,MAAM,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;KAC1G;IAED,0BAA0B;IAE1B,qBAAqB;IAErB,iBAAiB;AACnB,CAAC,CAAC,EAAE,CAAC","sourcesContent":["import { addAccountMarket, IAccountMoney, IPosition, provideAccountInfoService } from '@yuants/data-account';\nimport { Terminal } from '@yuants/protocol';\nimport { encodePath } from '@yuants/utils';\nimport { client } from './api';\nimport './interest_rate';\nimport './order';\nimport './product';\n\nconst terminal = Terminal.fromNodeEnv();\n\n(async () => {\n // swap account info\n {\n const account_id = `Hyperliquid/${client.public_key}`;\n\n provideAccountInfoService(\n terminal,\n account_id,\n async () => {\n const accountRes = await client.getUserPerpetualsAccountSummary({\n user: client.public_key!,\n });\n\n const profit = accountRes.assetPositions\n .map((pos) => +pos.position.unrealizedPnl)\n .reduce((a, b) => a + b, 0);\n\n const money: IAccountMoney = {\n currency: 'USDC',\n equity: +accountRes.crossMarginSummary.accountValue,\n profit: profit,\n free: +accountRes.withdrawable,\n used: +accountRes.crossMarginSummary.accountValue - +accountRes.withdrawable,\n balance: +accountRes.crossMarginSummary.accountValue - profit,\n };\n\n return {\n money: money,\n positions: accountRes.assetPositions.map(\n (position): IPosition => ({\n position_id: `${position.position.coin}-USD`,\n datasource_id: 'HYPERLIQUID',\n product_id: encodePath('PERPETUAL', `${position.position.coin}-USD`),\n direction: +position.position.szi > 0 ? 'LONG' : 'SHORT',\n volume: Math.abs(+position.position.szi),\n free_volume: Math.abs(+position.position.szi),\n position_price: +position.position.entryPx,\n closable_price: Math.abs(+position.position.positionValue / +position.position.szi),\n floating_profit: +position.position.unrealizedPnl,\n valuation: +position.position.positionValue,\n margin: +position.position.marginUsed,\n }),\n ),\n };\n },\n { auto_refresh_interval: 1000 },\n );\n\n addAccountMarket(terminal, { account_id: `Hyperliquid/${client.public_key}`, market_id: 'Hyperliquid' });\n }\n\n // TODO: spot account info\n\n // TODO: funding rate\n\n // TODO: transfer\n})();\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAa,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAC9F,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,iBAAiB,CAAC;AACzB,OAAO,SAAS,CAAC;AACjB,OAAO,WAAW,CAAC;AAEnB,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,CAAC,KAAK,IAAI,EAAE;IACV,oBAAoB;IACpB;QACE,MAAM,UAAU,GAAG,eAAe,MAAM,CAAC,UAAU,EAAE,CAAC;QAEtD,yBA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C,QAAQ,CAAC,aAAa;oBAC3C,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU;iBACtC,CAAC,CACH;aACF,CAAC;QACJ,CAAC,EACD,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAChC,CAAC;QAEF,gBAAgB,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,eAAe,MAAM,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;KAC1G;IAED,0BAA0B;IAE1B,qBAAqB;IAErB,iBAAiB;AACnB,CAAC,CAAC,EAAE,CAAC","sourcesContent":["import { addAccountMarket, IPosition, provideAccountInfoService } from '@yuants/data-account';\nimport { Terminal } from '@yuants/protocol';\nimport { encodePath } from '@yuants/utils';\nimport { client } from './api';\nimport './interest_rate';\nimport './order';\nimport './product';\n\nconst terminal = Terminal.fromNodeEnv();\n\n(async () => {\n // swap account info\n {\n const account_id = `Hyperliquid/${client.public_key}`;\n\n provideAccountInfoService(\n terminal,\n account_id,\n async () => {\n const accountRes = await client.getUserPerpetualsAccountSummary({\n user: client.public_key!,\n });\n\n const equity = +accountRes.crossMarginSummary.accountValue;\n const free = +accountRes.withdrawable;\n\n return {\n money: {\n currency: 'USDC',\n equity,\n free,\n },\n positions: accountRes.assetPositions.map(\n (position): IPosition => ({\n position_id: `${position.position.coin}-USD`,\n datasource_id: 'HYPERLIQUID',\n product_id: encodePath('PERPETUAL', `${position.position.coin}-USD`),\n direction: +position.position.szi > 0 ? 'LONG' : 'SHORT',\n volume: Math.abs(+position.position.szi),\n free_volume: Math.abs(+position.position.szi),\n position_price: +position.position.entryPx,\n closable_price: Math.abs(+position.position.positionValue / +position.position.szi),\n floating_profit: +position.position.unrealizedPnl,\n valuation: +position.position.positionValue,\n margin: +position.position.marginUsed,\n }),\n ),\n };\n },\n { auto_refresh_interval: 1000 },\n );\n\n addAccountMarket(terminal, { account_id: `Hyperliquid/${client.public_key}`, market_id: 'Hyperliquid' });\n }\n\n // TODO: spot account info\n\n // TODO: funding rate\n\n // TODO: transfer\n})();\n"]}
package/lib/index.js CHANGED
@@ -16,19 +16,14 @@ const terminal = protocol_1.Terminal.fromNodeEnv();
16
16
  const accountRes = await api_1.client.getUserPerpetualsAccountSummary({
17
17
  user: api_1.client.public_key,
18
18
  });
19
- const profit = accountRes.assetPositions
20
- .map((pos) => +pos.position.unrealizedPnl)
21
- .reduce((a, b) => a + b, 0);
22
- const money = {
23
- currency: 'USDC',
24
- equity: +accountRes.crossMarginSummary.accountValue,
25
- profit: profit,
26
- free: +accountRes.withdrawable,
27
- used: +accountRes.crossMarginSummary.accountValue - +accountRes.withdrawable,
28
- balance: +accountRes.crossMarginSummary.accountValue - profit,
29
- };
19
+ const equity = +accountRes.crossMarginSummary.accountValue;
20
+ const free = +accountRes.withdrawable;
30
21
  return {
31
- money: money,
22
+ money: {
23
+ currency: 'USDC',
24
+ equity,
25
+ free,
26
+ },
32
27
  positions: accountRes.assetPositions.map((position) => ({
33
28
  position_id: `${position.position.coin}-USD`,
34
29
  datasource_id: 'HYPERLIQUID',
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,uDAA6G;AAC7G,+CAA4C;AAC5C,yCAA2C;AAC3C,+BAA+B;AAC/B,2BAAyB;AACzB,mBAAiB;AACjB,qBAAmB;AAEnB,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,CAAC,KAAK,IAAI,EAAE;IACV,oBAAoB;IACpB;QACE,MAAM,UAAU,GAAG,eAAe,YAAM,CAAC,UAAU,EAAE,CAAC;QAEtD,IAAA,wCAAyB,EACvB,QAAQ,EACR,UAAU,EACV,KAAK,IAAI,EAAE;YACT,MAAM,UAAU,GAAG,MAAM,YAAM,CAAC,+BAA+B,CAAC;gBAC9D,IAAI,EAAE,YAAM,CAAC,UAAW;aACzB,CAAC,CAAC;YAEH,MAAM,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,QAAQ,CAAC,OAAO;oBAC1C,cAAc,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC;oBACnF,eAAe,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa;oBACjD,SAAS,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa;oBAC3C,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU;iBACtC,CAAC,CACH;aACF,CAAC;QACJ,CAAC,EACD,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAChC,CAAC;QAEF,IAAA,+BAAgB,EAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,eAAe,YAAM,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;KAC1G;IAED,0BAA0B;IAE1B,qBAAqB;IAErB,iBAAiB;AACnB,CAAC,CAAC,EAAE,CAAC","sourcesContent":["import { addAccountMarket, IAccountMoney, IPosition, provideAccountInfoService } from '@yuants/data-account';\nimport { Terminal } from '@yuants/protocol';\nimport { encodePath } from '@yuants/utils';\nimport { client } from './api';\nimport './interest_rate';\nimport './order';\nimport './product';\n\nconst terminal = Terminal.fromNodeEnv();\n\n(async () => {\n // swap account info\n {\n const account_id = `Hyperliquid/${client.public_key}`;\n\n provideAccountInfoService(\n terminal,\n account_id,\n async () => {\n const accountRes = await client.getUserPerpetualsAccountSummary({\n user: client.public_key!,\n });\n\n const profit = accountRes.assetPositions\n .map((pos) => +pos.position.unrealizedPnl)\n .reduce((a, b) => a + b, 0);\n\n const money: IAccountMoney = {\n currency: 'USDC',\n equity: +accountRes.crossMarginSummary.accountValue,\n profit: profit,\n free: +accountRes.withdrawable,\n used: +accountRes.crossMarginSummary.accountValue - +accountRes.withdrawable,\n balance: +accountRes.crossMarginSummary.accountValue - profit,\n };\n\n return {\n money: money,\n positions: accountRes.assetPositions.map(\n (position): IPosition => ({\n position_id: `${position.position.coin}-USD`,\n datasource_id: 'HYPERLIQUID',\n product_id: encodePath('PERPETUAL', `${position.position.coin}-USD`),\n direction: +position.position.szi > 0 ? 'LONG' : 'SHORT',\n volume: Math.abs(+position.position.szi),\n free_volume: Math.abs(+position.position.szi),\n position_price: +position.position.entryPx,\n closable_price: Math.abs(+position.position.positionValue / +position.position.szi),\n floating_profit: +position.position.unrealizedPnl,\n valuation: +position.position.positionValue,\n margin: +position.position.marginUsed,\n }),\n ),\n };\n },\n { auto_refresh_interval: 1000 },\n );\n\n addAccountMarket(terminal, { account_id: `Hyperliquid/${client.public_key}`, market_id: 'Hyperliquid' });\n }\n\n // TODO: spot account info\n\n // TODO: funding rate\n\n // TODO: transfer\n})();\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,uDAA8F;AAC9F,+CAA4C;AAC5C,yCAA2C;AAC3C,+BAA+B;AAC/B,2BAAyB;AACzB,mBAAiB;AACjB,qBAAmB;AAEnB,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,CAAC,KAAK,IAAI,EAAE;IACV,oBAAoB;IACpB;QACE,MAAM,UAAU,GAAG,eAAe,YAAM,CAAC,UAAU,EAAE,CAAC;QAEtD,IAAA,wCAAyB,EACvB,QAAQ,EACR,UAAU,EACV,KAAK,IAAI,EAAE;YACT,MAAM,UAAU,GAAG,MAAM,YAAM,CAAC,+BAA+B,CAAC;gBAC9D,IAAI,EAAE,YAAM,CAAC,UAAW;aACzB,CAAC,CAAC;YAEH,MAAM,MAAM,GAAG,CAAC,UAAU,CAAC,kBAAkB,CAAC,YAAY,CAAC;YAC3D,MAAM,IAAI,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC;YAEtC,OAAO;gBACL,KAAK,EAAE;oBACL,QAAQ,EAAE,MAAM;oBAChB,MAAM;oBACN,IAAI;iBACL;gBACD,SAAS,EAAE,UAA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["import { addAccountMarket, IPosition, provideAccountInfoService } from '@yuants/data-account';\nimport { Terminal } from '@yuants/protocol';\nimport { encodePath } from '@yuants/utils';\nimport { client } from './api';\nimport './interest_rate';\nimport './order';\nimport './product';\n\nconst terminal = Terminal.fromNodeEnv();\n\n(async () => {\n // swap account info\n {\n const account_id = `Hyperliquid/${client.public_key}`;\n\n provideAccountInfoService(\n terminal,\n account_id,\n async () => {\n const accountRes = await client.getUserPerpetualsAccountSummary({\n user: client.public_key!,\n });\n\n const equity = +accountRes.crossMarginSummary.accountValue;\n const free = +accountRes.withdrawable;\n\n return {\n money: {\n currency: 'USDC',\n equity,\n free,\n },\n positions: accountRes.assetPositions.map(\n (position): IPosition => ({\n position_id: `${position.position.coin}-USD`,\n datasource_id: 'HYPERLIQUID',\n product_id: encodePath('PERPETUAL', `${position.position.coin}-USD`),\n direction: +position.position.szi > 0 ? 'LONG' : 'SHORT',\n volume: Math.abs(+position.position.szi),\n free_volume: Math.abs(+position.position.szi),\n position_price: +position.position.entryPx,\n closable_price: Math.abs(+position.position.positionValue / +position.position.szi),\n floating_profit: +position.position.unrealizedPnl,\n valuation: +position.position.positionValue,\n margin: +position.position.marginUsed,\n }),\n ),\n };\n },\n { auto_refresh_interval: 1000 },\n );\n\n addAccountMarket(terminal, { account_id: `Hyperliquid/${client.public_key}`, market_id: 'Hyperliquid' });\n }\n\n // TODO: spot account info\n\n // TODO: funding rate\n\n // TODO: transfer\n})();\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuants/vendor-hyperliquid",
3
- "version": "0.3.16",
3
+ "version": "0.3.18",
4
4
  "bin": "lib/cli.js",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -11,10 +11,10 @@
11
11
  "dependencies": {
12
12
  "@yuants/protocol": "0.45.0",
13
13
  "@yuants/transfer": "0.2.17",
14
- "@yuants/data-account": "0.4.6",
14
+ "@yuants/data-account": "0.5.0",
15
15
  "@yuants/utils": "0.8.0",
16
16
  "@yuants/sql": "0.9.8",
17
- "@yuants/data-product": "0.2.18",
17
+ "@yuants/data-product": "0.3.0",
18
18
  "@yuants/data-interest-rate": "0.1.26",
19
19
  "@yuants/data-order": "0.2.14",
20
20
  "@yuants/data-series": "0.3.29",
@@ -1,15 +1,15 @@
1
1
  {
2
- "apps/vendor-hyperliquid/CHANGELOG.json": "110ad6e8cbce0b2f642c1edb79ad7739b1596b91",
3
- "apps/vendor-hyperliquid/CHANGELOG.md": "4aaa49f1cce94784bc985c7d9c387185521c6f70",
2
+ "apps/vendor-hyperliquid/CHANGELOG.json": "1b4efcd8247dfe9eaa5027f435c1fdeaf018163e",
3
+ "apps/vendor-hyperliquid/CHANGELOG.md": "77fbed91a9c952d96f5327bd665ccf0be6be29f3",
4
4
  "apps/vendor-hyperliquid/api-extractor.json": "62f4fd324425b9a235f0c117975967aab09ced0c",
5
5
  "apps/vendor-hyperliquid/config/jest.config.json": "4bb17bde3ee911163a3edb36a6eb71491d80b1bd",
6
6
  "apps/vendor-hyperliquid/config/rig.json": "f6c7b5537dc77a3170ba9f008bae3b6c3ee11956",
7
7
  "apps/vendor-hyperliquid/config/typescript.json": "854907e8a821f2050f6533368db160c649c25348",
8
8
  "apps/vendor-hyperliquid/etc/vendor-hyperliquid.api.md": "66675bd88afa1fe945f0d4023984c1c9c3e60a34",
9
- "apps/vendor-hyperliquid/package.json": "0638d77c6403bd49be79704672f568d941d6ce18",
9
+ "apps/vendor-hyperliquid/package.json": "02d930a0040abe441b9e48da718d3383a8e503fe",
10
10
  "apps/vendor-hyperliquid/src/api.ts": "041aa6e0e322b7c6ea5c822119c695b05d32295a",
11
11
  "apps/vendor-hyperliquid/src/cli.ts": "9bf6b5559a6c6f33da20e74cc6c5d702c60ec891",
12
- "apps/vendor-hyperliquid/src/index.ts": "7657d0e32c93b8c81496119ec7a05e2882207e5a",
12
+ "apps/vendor-hyperliquid/src/index.ts": "3332583b64a96e0a1126b925a8f5a44a86454b90",
13
13
  "apps/vendor-hyperliquid/src/interest_rate.ts": "5b46f8a4904734d9801e3ddd1146813918e36835",
14
14
  "apps/vendor-hyperliquid/src/ohlc.ts": "b1272944f0ffe8dd77ef9e7e39429efb7d2e5006",
15
15
  "apps/vendor-hyperliquid/src/order.ts": "de633327cb9ca8c02295f14d2d8a8b8384fdc1b4",
@@ -19,10 +19,10 @@
19
19
  "apps/vendor-hyperliquid/.rush/temp/shrinkwrap-deps.json": "d8a15e8163d8abdb142a2024a5b5b13ab444f87b",
20
20
  "libraries/protocol/temp/package-deps.json": "ff231b7689ff7d151498b496f70944d4598fcf33",
21
21
  "libraries/transfer/temp/package-deps.json": "2a26e3db2d5ef3318172d1d29ca257bfa94d1b21",
22
- "libraries/data-account/temp/package-deps.json": "7baeec049b7f31fb4bafb63018c0c9736f1aa456",
22
+ "libraries/data-account/temp/package-deps.json": "2bb2640092ffc415b896930eb47edf7a46bdb0c8",
23
23
  "libraries/utils/temp/package-deps.json": "56def945d0e67a9d0ca13447d2333155be0138f2",
24
24
  "libraries/sql/temp/package-deps.json": "2da55e5e704b1c1558acab11b6df163744d1b24a",
25
- "libraries/data-product/temp/package-deps.json": "fceed1ec7ecb23e7e3f9c36bc0abd3f053a27c75",
25
+ "libraries/data-product/temp/package-deps.json": "7c61716062e33869b203755b1b7db894e713b46f",
26
26
  "libraries/data-interest-rate/temp/package-deps.json": "246f09881d5bce801a352861086d7e2b90eb5b6b",
27
27
  "libraries/data-order/temp/package-deps.json": "add9a90c23442334f0575f403ef48dc33ceb5fd4",
28
28
  "libraries/data-series/temp/package-deps.json": "dd0d2f8322b484f074ae09c050ceb53fbc1368f4",