SwapOrder.inverted
This commit is contained in:
@@ -68,7 +68,7 @@ const FAUCET_CONFIG = {
|
||||
USXD: 0,
|
||||
WETH: 0,
|
||||
ARB: 0,
|
||||
USDC: 10000,
|
||||
USDC: 1000000,
|
||||
}
|
||||
|
||||
function gib() {
|
||||
|
||||
@@ -20,14 +20,14 @@ const s = useStore()
|
||||
const price = computed(()=>{
|
||||
if (props.m === 0)
|
||||
return props.b === 0 ? null : props.b
|
||||
console.log('raw line price', props.b + props.m * s.clock)
|
||||
// console.log('raw line price', props.b + props.m * s.clock)
|
||||
return props.b + props.m * s.clock
|
||||
})
|
||||
|
||||
const description = computed(()=>{
|
||||
if( props.m !== 0 )
|
||||
return 'diagonal'
|
||||
return props.isMin ? 'limit' : 'dont-chase'
|
||||
return props.isBreakout ? 'breakout' : 'limit'
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ function placeOrder() {
|
||||
const amt = FixedNumber.fromString(os.totalAmount.toString(), {decimals: os.amountToken.decimals}).value
|
||||
const ts = props.tranches()
|
||||
console.log('new order', symbol)
|
||||
const order = newOrder(tokenIn, tokenOut, symbol.e, symbol.fee, amt, os.amountIsInput, ts) // todo: minAmount, outputToOwner, conditionalOrder
|
||||
const order = newOrder(tokenIn, tokenOut, symbol.e, symbol.fee, amt, os.amountIsInput, symbol.inverted, ts) // todo: minAmount, outputToOwner, conditionalOrder
|
||||
pendOrder(order)
|
||||
}
|
||||
|
||||
|
||||
@@ -95,12 +95,12 @@
|
||||
<div>
|
||||
<div class="mx-3" v-if="t.marketOrder">market order</div>
|
||||
<line-price class="mx-3" v-if="!t.marketOrder"
|
||||
:base="item.order.tokenIn" :quote="item.order.tokenOut"
|
||||
:b="t.minLine.intercept" :m="t.minLine.slope" :is-min="true"
|
||||
:base="item.base" :quote="item.quote"
|
||||
:b="t.minLine.intercept" :m="t.minLine.slope" :is-breakout="!item.minIsLimit"
|
||||
:show-btn="true"/>
|
||||
<line-price class="mx-3" v-if="!t.marketOrder"
|
||||
:base="item.order.tokenIn" :quote="item.order.tokenOut"
|
||||
:b="t.maxLine.intercept" :m="t.maxLine.slope" :is-min="false"
|
||||
:base="item.base" :quote="item.quote"
|
||||
:b="t.maxLine.intercept" :m="t.maxLine.slope" :is-breakout="item.minIsLimit"
|
||||
:show-btn="true"/>
|
||||
</div>
|
||||
|
||||
@@ -181,6 +181,7 @@ const props = defineProps(['vault'])
|
||||
const vaultAddr = computed(()=>props.vault?props.vault:s.vault)
|
||||
const selected = ref([])
|
||||
|
||||
// Draw Shapes
|
||||
watch(selected, async ()=>{
|
||||
const statusIndex = {}
|
||||
for (const order of orders.value)
|
||||
@@ -335,6 +336,24 @@ const orders = computed(()=>{
|
||||
}
|
||||
}
|
||||
}
|
||||
// elaborate
|
||||
for (const st of result) {
|
||||
let low, high;
|
||||
console.log('elab', st.order)
|
||||
const buy = st.order.tokenIn > st.order.tokenOut;
|
||||
if (buy) {
|
||||
low = st.order.tokenOut
|
||||
high = st.order.tokenIn
|
||||
}
|
||||
else {
|
||||
low = st.order.tokenIn
|
||||
high = st.order.tokenOut
|
||||
}
|
||||
st.base = st.order.inverted ? high : low;
|
||||
st.quote = st.order.inverted ? low : high;
|
||||
st.minIsLimit = buy !== st.order.inverted // whether limit/breakout is flipped
|
||||
console.log('elaborated', st.order)
|
||||
}
|
||||
result.sort((a,b)=>b.startTime-a.startTime)
|
||||
// console.log('orders', result)
|
||||
return result
|
||||
|
||||
@@ -125,7 +125,7 @@ function buildOrder() {
|
||||
tranches = [...tranches, ...ts]
|
||||
}
|
||||
|
||||
return newOrder(tokenIn.value.a, tokenOut.value.a, symbol.exchangeId, symbol.fee, amount, amountIsInput, tranches)
|
||||
return newOrder(tokenIn.value.a, tokenOut.value.a, symbol.exchangeId, symbol.fee, amount, amountIsInput, symbol.inverted, tranches)
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user