updated SwapOrderStatus with Andrew's changes
This commit is contained in:
@@ -82,8 +82,14 @@ export function newTranche({
|
|||||||
} = {}) {
|
} = {}) {
|
||||||
if( minIntercept === 0 && minSlope === 0 && maxIntercept === 0 && maxSlope === 0 )
|
if( minIntercept === 0 && minSlope === 0 && maxIntercept === 0 && maxSlope === 0 )
|
||||||
marketOrder = true
|
marketOrder = true
|
||||||
if( marketOrder )
|
if( marketOrder ) {
|
||||||
|
if (minIntercept !== 0 || minSlope !== 0 || maxIntercept !== 0 || maxSlope !== 0)
|
||||||
|
console.warn('Ignoring line information in a market order')
|
||||||
minIntercept = encodeIEE754(slippage) // this is the slippage field for market orders
|
minIntercept = encodeIEE754(slippage) // this is the slippage field for market orders
|
||||||
|
minSlope = 0
|
||||||
|
maxIntercept = 0
|
||||||
|
maxSlope = 0
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
minIntercept = encodeIEE754(minIntercept)
|
minIntercept = encodeIEE754(minIntercept)
|
||||||
minSlope = encodeIEE754(minSlope)
|
minSlope = encodeIEE754(minSlope)
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ function chartMeanRange() {
|
|||||||
for (let barIndex = bars.size() - 1; barIndex >= final; barIndex--) {
|
for (let barIndex = bars.size() - 1; barIndex >= final; barIndex--) {
|
||||||
count++
|
count++
|
||||||
const [_time, _open, high, low, _close, _volume, _ms] = bars.valueAt(barIndex)
|
const [_time, _open, high, low, _close, _volume, _ms] = bars.valueAt(barIndex)
|
||||||
range += (high - low)
|
range += Math.abs(high - low)
|
||||||
}
|
}
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
range /= count
|
range /= count
|
||||||
|
|||||||
@@ -201,8 +201,6 @@ const orders = computed(()=>{
|
|||||||
// [730643660, 0], [min intercept, slope]
|
// [730643660, 0], [min intercept, slope]
|
||||||
// [0, 0], [max intercept, slope]
|
// [0, 0], [max intercept, slope]
|
||||||
// ],
|
// ],
|
||||||
// [...],
|
|
||||||
// [...],
|
|
||||||
// ]
|
// ]
|
||||||
// ],
|
// ],
|
||||||
// 4, state
|
// 4, state
|
||||||
@@ -210,8 +208,7 @@ const orders = computed(()=>{
|
|||||||
// null, oco group
|
// null, oco group
|
||||||
// "0", filled in
|
// "0", filled in
|
||||||
// "0", filled out
|
// "0", filled out
|
||||||
// ["0", "0", "0"], tranche filled in
|
// [...], trancheStatus
|
||||||
// ["0", "0", "0"] tranche filled out
|
|
||||||
// ]
|
// ]
|
||||||
const result = []
|
const result = []
|
||||||
|
|
||||||
|
|||||||
@@ -178,11 +178,11 @@ export function applyLine(tranche, isMinimum, intercept, slope) {
|
|||||||
m = encodeIEE754(m)
|
m = encodeIEE754(m)
|
||||||
b = encodeIEE754(b)
|
b = encodeIEE754(b)
|
||||||
if (isMinimum) {
|
if (isMinimum) {
|
||||||
tranche.minIntercept = b;
|
tranche.minLine.intercept = b;
|
||||||
tranche.minSlope = m;
|
tranche.minLine.slope = m;
|
||||||
} else {
|
} else {
|
||||||
tranche.maxIntercept = b;
|
tranche.maxLine.intercept = b;
|
||||||
tranche.maxSlope = m;
|
tranche.maxLine.slope = m;
|
||||||
}
|
}
|
||||||
tranche.marketOrder = false;
|
tranche.marketOrder = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,8 +97,8 @@ socket.on( 'of', (chainId, vault, orderIndex, filled)=>{
|
|||||||
status.filledOut = BigInt(filled[0][1])
|
status.filledOut = BigInt(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]
|
||||||
status.trancheFilledIn[i] = BigInt(filledIn)
|
status.trancheStatus[i].filledIn = BigInt(filledIn)
|
||||||
status.trancheFilledOut[i] = BigInt(filledOut)
|
status.trancheStatus[i].filledOut = BigInt(filledOut)
|
||||||
}
|
}
|
||||||
// s.orders[vault][orderIndex] = status
|
// s.orders[vault][orderIndex] = status
|
||||||
console.log('applied fills', status)
|
console.log('applied fills', status)
|
||||||
|
|||||||
Reference in New Issue
Block a user