rate limit DCA

This commit is contained in:
tim
2025-03-19 20:27:10 -04:00
parent cd84e7c3c9
commit 8750951de5
14 changed files with 651 additions and 325 deletions

View File

@@ -36,6 +36,7 @@ export const ShapeType = {
HLine: {name: 'Horizontal Line', code: 'horizontal_line', drawingProp: 'linetoolhorzline'},
VLine: {name: 'Vertical Line', code: 'vertical_line', drawingProp: 'linetoolvertline'},
PriceRange: {name: 'Price Range', code: 'price_range'},
DateRange: {name: 'Date Range', code: 'date_range', drawingProp: 'linetooldaterange'},
}
@@ -335,6 +336,8 @@ export class Shape {
onPoints(points) {} // the control points of an existing shape were changed
onDrag(points) { console.log('shape ondrag'); this.onPoints(points) }
setProps(props) {
if (!props || Object.keys(props).length===0) return
if (this.debug) console.log('setProps', this.id, props)
@@ -384,7 +387,6 @@ export class Shape {
onUndraw() {} // drawing was canceled by clicking on a different tool
onAddPoint() {} // the user clicked a point while drawing (that point is added to the points list)
onMove(points) {} // the shape was moved by dragging a drawing element not the control point
onDrag(points) {}
onHide(props) {}
onShow(props) {}
onClick() {} // the shape was selected
@@ -479,16 +481,6 @@ class ShapeTVCallbacks {
export class Line extends Shape {
onDrag(points) {
const s = this.tvShape();
if (this.debug) {
console.log('shape', s.id, s)
console.log('currentMovingPoint', s._source.currentMovingPoint())
console.log('startMovingPoint', s._source.startMovingPoint())
console.log('isBeingEdited', s._source.isBeingEdited())
console.log('state', s._source.state())
}
}
}
@@ -656,3 +648,17 @@ export class DLine extends Line {
}
*/
}
export class DateRange extends Shape {
constructor(model, onModel=null, onDelete=null, props=null) {
super(ShapeType.DateRange, onModel, onDelete, props)
}
setModel(model) {
super.setModel(model);
if (model.startTime !== this.model.startTime || model.endTime !== this.model.endTime)
this.setPoints([{time: model.startTime}, {time: model.endTime}])
}
}