order status subscriptions

This commit is contained in:
Tim Olson
2023-11-06 23:49:08 -04:00
parent 8444f7af7e
commit 25aef69ea3
5 changed files with 37 additions and 8 deletions

23
order.js Normal file
View File

@@ -0,0 +1,23 @@
import {redis, vaultOpenOrders} from "./cache.js";
export function subVaultOrders( socket, chainId, vault ) {
vaultOpenOrders.get(chainId, vault).then(async (orderIndexes)=>{
for( const orderIndex of JSON.parse(orderIndexes) ) {
// there is a race condition here since we need multiple queries to get the complete order status,
// so we diligently check for nulls and exclude such an order, since it was deleted and no longer active.
const status = orderStatus( chainId, vault, orderIndex )
if( status != null ) {
}
}
})
}
export function unsubVaultOrders( socket, chainId, vault ) {
}
export function orderStatus( chainId, vault, orderIndex ) {
}