blockworks-foundation / mango-ui-v3

Mango Markets V3 UI
https://trade.mango.markets
GNU Affero General Public License v3.0
84 stars 114 forks source link

Add execution arrows to tradingview chart #408

Closed rjpeterson closed 1 year ago

rjpeterson commented 1 year ago

Per this comment in Discord, I've added FTX style execution arrows to the tradingview chart. It currently draws an arrow for every trade in the current market in the accounts trade history. I have not tested it on an account with hundreds or thousands of trades. Hopefully someone with an account like that can try it out.

PR Requirements:

image

vercel[bot] commented 1 year ago

@rjpeterson is attempting to deploy a commit to the blockworks-foundation Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
mango-ui-v3 ✅ Ready (Inspect) Visit Preview Sep 14, 2022 at 8:07AM (UTC)
rjpeterson commented 1 year ago

@mschneider Toggle button and a limit for the number of arrows to render has been added. I'm still working out how to clear them when switching mango accounts

mschneider commented 1 year ago

build is failling image

mschneider commented 1 year ago

tried this, but it's still incredibly laggy 250ms for one repaint when trying to drag the chart. the limit might still be too conservative or there's something else going on

image

mschneider commented 1 year ago

managed to hit a crash

Value is null
Error: Value is null at s (https://mango-ui-v3-8q32zz0x5-blockworks-foundation.vercel.app/charting_library/bundles/library.1fbbf36d35f97ccfbd00.js:1:232) at e.exports._createTradingPrimitive (https://mango-ui-v3-8q32zz0x5-blockworks-foundation.vercel.app/charting_library/bundles/library.1fbbf36d35f97ccfbd00.js:295:1093) at e.exports.createExecutionShape (https://mango-ui-v3-8q32zz0x5-blockworks-foundation.vercel.app/charting_library/bundles/library.1fbbf36d35f97ccfbd00.js:295:1422) at https://mango-ui-v3-8q32zz0x5-blockworks-foundation.vercel.app/_next/static/chunks/26.c84096d7e5028ab9.js:1:3074
rjpeterson commented 1 year ago

Still working out some kinks.....

rjpeterson commented 1 year ago

@mschneider @ImpossiblePairs From my testing this seems to be working well for owned mango accounts. I'm having trouble getting it to work with unowned accounts as I can't get router.query to return a pubkey in those instances for some reason.

ImpossiblePairs commented 1 year ago

I've added a PR to your fork/branch for viewing of unowned accounts here:

https://github.com/rjpeterson/mango-ui-v3/pull/3

It's still needs some debugging (I've had a random crash or two where it loses the TV container somehow), but hopefully this is helps get you closer. Will keep on looking at it, but with any luck you'll figure it out whilst my eyes uncross.

rjpeterson commented 1 year ago

Storing the button state between sessions was causing some issues I wasn't able to solve, so for now it defaults to not showing execution arrows on startup

mschneider commented 1 year ago
  1. about the pubkey query, this should probably be another PR independent of this change (although it might help in reproduction)
  2. performance issues are gone
  3. the trade arrows do periodically disappear and re-appear now (maybe every 30s), if i refresh the trade history tab with the "spinner" button, they all re-appear

EDIT: arrows tend to disappear when the account gets filled

rjpeterson commented 1 year ago

I haven't been able to reproduce the periodic disappearing and reappearing of the execution arrows.

mschneider commented 1 year ago

i guess in that case it makes sense to work on the pubkey query support next, so you can easily inspect accounts that trade very actively