Skip to content

Commit

Permalink
fix charting
Browse files Browse the repository at this point in the history
  • Loading branch information
abrzezinski94 committed Nov 14, 2024
1 parent 480b65a commit 759d574
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
34 changes: 27 additions & 7 deletions components/trade/TradingViewChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -718,15 +718,35 @@ const TradingViewChart = () => {
? mkt?.serumMarketExternal.toString()
: mkt?.publicKey.toString()) || 'Loading'

const baseTokenBank =
mkt instanceof Serum3Market
? mangoStore
.getState()
.group?.getFirstBankByTokenIndex(mkt.baseTokenIndex)
: mangoStore.getState().group?.getFirstBankByMint(WRAPPED_SOL_MINT)
const quoteTokenBank =
mkt instanceof Serum3Market
? mangoStore
.getState()
.group?.getFirstBankByTokenIndex(mkt.quoteTokenIndex)
: mangoStore
.getState()
.group?.getFirstBankByMint(new PublicKey(USDC_MINT))

console.log(baseTokenBank, mkt, '@@@@@')

const widgetOptions: ChartingLibraryWidgetOptions = {
// debug: true,
symbol: marketAddress,
datafeed: datafeed(
WRAPPED_SOL_MINT.toBase58(),
'SOL',
USDC_MINT,
'USDC',
),
datafeed:
baseTokenBank && quoteTokenBank
? datafeed(
baseTokenBank!.mint.toBase58(),
baseTokenBank!.name,
quoteTokenBank!.mint.toBase58(),
quoteTokenBank!.name,
)
: datafeed('', '', '', ''),
interval:
defaultProps.interval as ChartingLibraryWidgetOptions['interval'],
container:
Expand Down Expand Up @@ -804,7 +824,7 @@ const TradingViewChart = () => {
})
})
}
}, [theme, themeData, defaultProps, isMobile, userId])
}, [theme, themeData, defaultProps, isMobile, userId, selectedMarketName])

// set a limit price from right click context menu
useEffect(() => {
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9925,11 +9925,6 @@ kleur@^3.0.3:
resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e"
integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==

[email protected]:
version "8.6.3"
resolved "https://registry.yarnpkg.com/klinecharts/-/klinecharts-8.6.3.tgz#9ff2c40e31d86ca0600abc5fb8bf546c61daf130"
integrity sha512-hGDtWiMNywEDneZFmt+vZ6tOYutCDWV5FPBcXcn7L8kGwe73Q5yJayk8UzP9pIQSBWyxswWIySKh/BVFA6GhuQ==

language-subtag-registry@^0.3.20:
version "0.3.23"
resolved "https://registry.yarnpkg.com/language-subtag-registry/-/language-subtag-registry-0.3.23.tgz#23529e04d9e3b74679d70142df3fd2eb6ec572e7"
Expand Down

0 comments on commit 759d574

Please sign in to comment.