orders submitting but breaking due to fee send

This commit is contained in:
Tim
2024-03-23 19:17:26 -04:00
parent 68a820a9f6
commit 0d0200009e
7 changed files with 208 additions and 70 deletions

View File

@@ -60,9 +60,9 @@
</template>
<script setup>
import {computed, onBeforeUnmount, onMounted, watch} from "vue";
import {computed, onBeforeUnmount, onMounted, onUnmounted, watch} from "vue";
import {chart} from "@/charts/chart.js";
import {useChartOrderStore} from "@/orderbuild.js";
import {applyLine2, builderFuncs, useChartOrderStore} from "@/orderbuild.js";
import Color from "color";
import {HLine} from "@/charts/shape.js";
import {builderDefaults, lightenColor2, lineColor} from "@/misc.js";
@@ -70,6 +70,7 @@ import {useTheme} from "vuetify";
import {useOrderStore} from "@/store/store.js";
import RowBar from "@/components/chart/RowBar.vue";
import ColorBand from "@/components/chart/ColorBand.vue";
import {MAX_FRACTION, newTranche} from "@/blockchain/orderlib.js";
const os = useOrderStore()
const co = useChartOrderStore()
@@ -96,6 +97,33 @@ builderDefaults(props, emit, {
color: defaultColor,
})
function buildTranches() {
const builder = props.builder
const order = props.order
const tranches = []
if (!builder || !order) return
console.log('buildTranches', builder, order, tranches)
const ps = prices.value
const ws = weights.value
for(let i=0; i<ps.length; i++) {
const p = ps[i]
const w = ws[i]
const t = newTranche({
fraction: w * MAX_FRACTION,
})
const symbol = co.selectedSymbol
console.log('symbol', symbol)
applyLine2(t, !order.buy, p, 0, symbol.decimals, symbol.inverted)
tranches.push(t)
}
return tranches
}
onMounted(() => builderFuncs[props.builder.id] = buildTranches)
onUnmounted(() => delete builderFuncs[props.builder.id])
const skew100 = computed( {
get() {return props.builder.skew*100},
set(v) {props.builder.skew = v/100; adjustShapes()}
@@ -296,7 +324,7 @@ function allocationText(weight) {
function adjustShapes() {
// this is where all the lines are created or adjusted
console.log('adjustShapes()')
// console.log('adjustShapes()')
const limits = prices.value
const colorStrings = colors.value