applyFills() fixes
This commit is contained in:
8
order.js
8
order.js
@@ -19,7 +19,7 @@ export function sendVaultOrders( socket, chainId, vault ) {
|
|||||||
for( let [orderIndex, status] of recents ) {
|
for( let [orderIndex, status] of recents ) {
|
||||||
if( !(orderIndex in statuses) ) {
|
if( !(orderIndex in statuses) ) {
|
||||||
// only write the database version if there's no open order in the memcache
|
// only write the database version if there's no open order in the memcache
|
||||||
const orderKey = `${vault}|${orderIndex}`
|
const orderKey = `${vault}|${orderIndex.toString().padStart(5,'0')}`
|
||||||
proms.push(fillOrderStatus(chainId, orderKey, status))
|
proms.push(fillOrderStatus(chainId, orderKey, status))
|
||||||
statuses[orderIndex] = status
|
statuses[orderIndex] = status
|
||||||
}
|
}
|
||||||
@@ -72,13 +72,13 @@ export async function recentOrders( socket, chainId, vault, limit=25 ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function applyFills( orderStatus, filled ) {
|
function applyFills( orderStatus, filled ) {
|
||||||
console.log('apply fills', orderStatus, filled)
|
// console.log('apply fills', orderStatus, filled)
|
||||||
orderStatus[5] = filled[0][0]
|
orderStatus[5] = filled[0][0]
|
||||||
orderStatus[6] = filled[0][1]
|
orderStatus[6] = filled[0][1]
|
||||||
for( const i in filled[1] ) {
|
for( const i in filled[1] ) {
|
||||||
const {filledIn, filledOut} = filled[1][i]
|
const [filledIn, filledOut] = filled[1][i]
|
||||||
orderStatus[7][i] = filledIn
|
orderStatus[7][i] = filledIn
|
||||||
orderStatus[8][i] = filledOut
|
orderStatus[8][i] = filledOut
|
||||||
}
|
}
|
||||||
console.log('applied fills', orderStatus)
|
// console.log('applied fills', orderStatus)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user