-
Notifications
You must be signed in to change notification settings - Fork 105
add twap active orders table to the fe #1861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,6 +76,10 @@ function calculateSubaccountOrder( | |
| reduceOnly: !!base.reduceOnly, | ||
| remainingSize: MustBigNumber(base.size).minus(MustBigNumber(base.totalFilled)), | ||
| removalReason: base.removalReason, | ||
| // TWAP order parameters | ||
| duration: base.duration || undefined, | ||
| interval: base.interval || undefined, | ||
| priceTolerance: base.priceTolerance || undefined, | ||
| }; | ||
| order = maybeUpdateOrderIfExpired(order, protocolHeight); | ||
| return order; | ||
|
|
@@ -232,6 +236,8 @@ function calculateBaseOrderStatus( | |
| return OrderStatus.Canceling; | ||
| case IndexerOrderStatus.UNTRIGGERED: | ||
| return OrderStatus.Untriggered; | ||
| case IndexerOrderStatus.ERROR: | ||
| return OrderStatus.Canceled; // Treat ERROR status as canceled | ||
|
Comment on lines
+239
to
+240
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this case is already handled in line 232 |
||
| default: | ||
| assertNever(status); | ||
| return undefined; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ import { getCurrentMarketIdIfTradeable } from '@/state/currentMarketSelectors'; | |
| import { convertBech32Address } from '@/lib/addressUtils'; | ||
| import { BIG_NUMBERS } from '@/lib/numbers'; | ||
|
|
||
| import { IndexerOrderType } from '@/types/indexer/indexerApiGen'; | ||
| import { calculateBlockRewards } from '../calculators/blockRewards'; | ||
| import { calculateFills } from '../calculators/fills'; | ||
| import { getMarketEffectiveInitialMarginForMarket } from '../calculators/markets'; | ||
|
|
@@ -29,7 +30,7 @@ import { | |
| import { calculateTransfers } from '../calculators/transfers'; | ||
| import { mergeLoadableStatus } from '../lib/mapLoadable'; | ||
| import { selectParentSubaccountInfo } from '../socketSelectors'; | ||
| import { SubaccountTransfer } from '../types/summaryTypes'; | ||
| import { OrderFlags, SubaccountTransfer } from '../types/summaryTypes'; | ||
| import { selectLatestIndexerHeight, selectLatestValidatorHeight } from './apiStatus'; | ||
| import { | ||
| selectRawBlockTradingRewardsLiveData, | ||
|
|
@@ -138,6 +139,16 @@ export const selectOrderHistory = createAppSelector([selectAccountOrders], (orde | |
| return calculateOrderHistory(orders); | ||
| }); | ||
|
|
||
| export const selectTWAPOrders = createAppSelector([selectAccountOrders], (orders) => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there need for selecting TWAP orders that aren't open?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can simplify 148 to just filtering TWAP from selectOpenOrders instead |
||
| return orders.filter((order) => | ||
| order.orderFlags === OrderFlags.TWAP && order.type === IndexerOrderType.TWAP | ||
| ); | ||
| }); | ||
|
|
||
| export const selectActiveTWAPOrders = createAppSelector([selectTWAPOrders], (twapOrders) => { | ||
| return calculateOpenOrders(twapOrders); | ||
| }); | ||
|
|
||
| export const selectCurrentMarketOpenOrders = createAppSelector( | ||
| [getCurrentMarketIdIfTradeable, selectOpenOrders], | ||
| (currentMarketId, orders) => | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this