From a65bc94dac05c3727291800a7a320994a531d30a Mon Sep 17 00:00:00 2001 From: tim Date: Thu, 31 Oct 2024 16:54:57 -0400 Subject: [PATCH] breakout orders --- src/charts/ordershapes.js | 6 ++--- src/charts/shape.js | 14 ++++++++++- src/components/LinePrice.vue | 9 +++---- src/components/Status.vue | 4 ++-- src/components/chart/BuilderPanel.vue | 3 +-- src/components/chart/ChartOrder.vue | 30 ++++++++++++++++++------ src/components/chart/DiagonalBuilder.vue | 15 ++++++++++-- src/components/chart/LimitBuilder.vue | 19 ++++++++++----- src/components/chart/RungBuilder.vue | 15 +++++++++++- 9 files changed, 87 insertions(+), 28 deletions(-) diff --git a/src/charts/ordershapes.js b/src/charts/ordershapes.js index 355153f..6a78a4c 100644 --- a/src/charts/ordershapes.js +++ b/src/charts/ordershapes.js @@ -98,13 +98,13 @@ class TrancheShapes { const amountSymbol = buy ? this.symbol.base.s : this.symbol.quote.s const color = buy ? 'green' : 'red' if (intercept !== 0 || slope !== 0) { - console.log('tranche line', intercept, slope) + // console.log('tranche line', intercept, slope) // line active if (slope === 0) { let price = intercept price *= scale // horizontal line - console.log('hline', price) + // console.log('hline', price) const model = {price, color, maxAllocation: status.order.amount, amount, amountSymbol}; const s = new HLine(model, null, null, null, true) this.shapes.push(s) @@ -120,7 +120,7 @@ class TrancheShapes { let endPrice = (intercept + slope * endTime); startPrice *= scale endPrice *= scale - console.log('dline', startTime, endTime, DISTANT_FUTURE, startPrice, endPrice) + // console.log('dline', startTime, endTime, DISTANT_FUTURE, startPrice, endPrice) // noinspection EqualityComparisonWithCoercionJS const model = { pointA: {time: startTime, price: startPrice}, diff --git a/src/charts/shape.js b/src/charts/shape.js index 44803ac..55a7a56 100644 --- a/src/charts/shape.js +++ b/src/charts/shape.js @@ -108,6 +108,8 @@ export class Shape { // both amount and amountSymbol must be set in order to display amount text this.model.amount = null this.model.amountSymbol = null + this.model.extraText = null + this.model.textLocation = 'above' // LEAF SUBCLASSES MUST CALL setModel(model) AFTER ALL CONSTRUCTION. } @@ -127,6 +129,10 @@ export class Shape { this.model.amount = model.amount if (model.amountSymbol) this.model.amountSymbol = model.amountSymbol + if (model.extraText) + this.model.extraText = model.extraText + if (model.textLocation) + this.model.textLocation = model.textLocation const newProps = {} @@ -152,12 +158,18 @@ export class Shape { // text label let text = allocationText(this.model.allocation, this.model.amount, this.model.amountSymbol) + if (this.model.extraText) + text += ' '+this.model.extraText if (this.debug) text = `${this.id} ` + text if (!text.length) newProps.showLabel = false else { newProps.text = text newProps.showLabel = true + newProps.textLocation = this.model.textLocation + newProps.vertLabelsAlign = + this.model.textLocation === 'above' ? 'bottom' : + this.model.textLocation === 'below' ? 'top' : null; } if (this.debug && this.id) @@ -612,7 +624,7 @@ export class DLine extends Line { } -/* +/* todo tim pointsToTvOhlcStart(points, periodSeconds = null) { if (points === null) return null const [v,w] = points diff --git a/src/components/LinePrice.vue b/src/components/LinePrice.vue index 82731f5..c2a25bd 100644 --- a/src/components/LinePrice.vue +++ b/src/components/LinePrice.vue @@ -1,6 +1,6 @@