Skip to content

Instantly share code, notes, and snippets.

@harsh-98
Last active May 30, 2023 19:54
Show Gist options
  • Save harsh-98/a252d3cf2df562726d82332fe7aaa692 to your computer and use it in GitHub Desktop.
Save harsh-98/a252d3cf2df562726d82332fe7aaa692 to your computer and use it in GitHub Desktop.
websocket for trading app

wss://gearbox-ws.fly.dev/ws

Send ->

{"type":"subscribe:Updates", "data":{ "borrower":"0x1B3dfF537b7d46A0d30B1D20b101c483586747AA"}}

Receive updates in form of:

{
  "address": "0xD3BeD41dc971225a759fFd6122Af3b40Da1e882C",
  "creditManager": "0xf7ba434952acaa2e12035a2c3643ca327914a470",
  "underlyingToken": "0x55a309598ABf543bF76FbB22859938ba2F29C2eA",
  "borrower": "0x1B3dfF537b7d46A0d30B1D20b101c483586747AA",
  "borrowedAmount": "4644539375066727961353",
  "balance": {
    "0x55a309598ABf543bF76FbB22859938ba2F29C2eA": {
      "isAllowed": true,
      "isEnabled": true,
      "BI": "3144539375066727961353"
    },
    "0x595DFFf822767c2E14CFB7D5e0b5a5e23eCfACdd": {
      "isAllowed": true,
      "isEnabled": true,
      "BI": "1751566605847480969"
    },
    "0xb2f394A64966a8892a43CcfBBD48D28bC58Aeb67": {
      "isAllowed": true,
      "isEnabled": true,
      "BI": "488713780716526789495"
    }
  },
  "id": "0xD3BeD41dc971225a759fFd6122Af3b40Da1e882C_7766396_66",
  "healthFactor": "12247",
  "totalValue": "6339297787663940879276",
  "debt": "4663810272472257665116",
  "pnlUnderlying": "1538808894683074960530",
  "oraclePrice": null,
  "borrowAPY_RAY": "1002775257046699072660579283",
  "collateral": {
    "0x595DFFf822767c2E14CFB7D5e0b5a5e23eCfACdd": "1000000000000000000"
  },
  "collateralUnderlying": "1538808894683074960530",
  "1DAgo": {
    "Id": "0xD3BeD41dc971225a759fFd6122Af3b40Da1e882C_7766396_66",
    "healthFactorOld": "12247",
    "totalValueOld": "6339297787663940879276",
    "debtOld": "4663734779165397751719",
    "borrowAPY_RAYOld": "4794930697263616428571428",
    "pnlUnderlyingOld": "136754113815468167027",
    "blockNum": 9088137
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment