breakout orders

This commit is contained in:
tim
2024-10-31 16:54:57 -04:00
parent 4eb15355a6
commit a65bc94dac
9 changed files with 87 additions and 28 deletions

View File

@@ -1,5 +1,6 @@
<template>
<rung-builder name="Diagonal" :order="order" :builder="builder" v-model="endpoints"
<rung-builder :name="name" :description="description"
:order="order" :builder="builder" v-model="endpoints"
:shape="DLine" :mode="0"
:get-model-value="getModelValue" :set-model-value="setModelValue"
:set-values="setLines" :set-weights="setWeights"
@@ -122,6 +123,7 @@ builderDefaults(props.builder, {
extendRight: true,
rungs: 1,
skew: 0,
breakout: false,
color: defaultColor,
})
@@ -150,9 +152,11 @@ function buildTranches() {
// console.log('tranche start/end',
// t.startTime === DISTANT_PAST ? 'PAST' : t.startTime,
// t.endTime === DISTANT_FUTURE ? 'FUTURE' : t.endTime)
applyLinePoints(t, symbol, order.buy, ...line)
applyLinePoints(t, symbol, order.buy, ...line, builder.breakout)
tranches.push(t)
}
// if( flipped.value )
// tranches.reverse()
return tranches
}
@@ -395,6 +399,13 @@ function dirtyLine(a, b) {
return result
}
const name = computed(()=>(props.builder.breakout?'Breakout':'Limit')+' Diagonal'+(weights.value.length>1?'s':''))
const description = computed(()=>{
const buy = props.order.buy
const above = buy === props.builder.breakout
return (buy?'Buy ':'Sell ')+(above?'above':'below')+' the line'
})
</script>