handle no open orders account
This commit is contained in:
parent
d495be6b32
commit
8b418dbe5f
|
@ -47,6 +47,7 @@ const useFills = () => {
|
||||||
|
|
||||||
const marketIndex = selectedMangoGroup.getMarketIndex(market)
|
const marketIndex = selectedMangoGroup.getMarketIndex(market)
|
||||||
const openOrdersAccount = marginAccount.openOrdersAccounts[marketIndex]
|
const openOrdersAccount = marginAccount.openOrdersAccounts[marketIndex]
|
||||||
|
if (!openOrdersAccount) return []
|
||||||
return fills
|
return fills
|
||||||
.filter((fill) => fill.openOrders.equals(openOrdersAccount.publicKey))
|
.filter((fill) => fill.openOrders.equals(openOrdersAccount.publicKey))
|
||||||
.map((fill) => ({ ...fill, marketName }))
|
.map((fill) => ({ ...fill, marketName }))
|
||||||
|
@ -97,12 +98,7 @@ export const useTradeHistory = () => {
|
||||||
}, 10000)
|
}, 10000)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (eventQueueFills && eventQueueFills.length > 0) {
|
||||||
eventQueueFills &&
|
|
||||||
tradeHistory &&
|
|
||||||
tradeHistory.length > 0 &&
|
|
||||||
eventQueueFills.length > 0
|
|
||||||
) {
|
|
||||||
const newFills = eventQueueFills.filter(
|
const newFills = eventQueueFills.filter(
|
||||||
(fill) =>
|
(fill) =>
|
||||||
!tradeHistory.find((t) => t.orderId === fill.orderId.toString())
|
!tradeHistory.find((t) => t.orderId === fill.orderId.toString())
|
||||||
|
|
Loading…
Reference in New Issue