From 576de33382c020c9c94fc7e556d9b86f95b0dcbd Mon Sep 17 00:00:00 2001 From: Carles Tubio Date: Wed, 16 Oct 2024 06:47:54 +0000 Subject: [PATCH] Fixed up/down key events on edit orders inputs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ████ ███ To request new features or in case this commit breaks something for you, ████ ███ please, create a new github issue with all possible information for me, ▓███▀█▄ but never share your API Keys! ▒▓██ ███ ░▒▓█ ███ Signed-off-by: Carles Tubio _________________________________________ / Hello, WORLD! \ | | \ pssst.. 1.00000000 BTC = 61626.16 EUR. / ----------------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || --- Makefile | 2 +- src/bin/+portfolios/+portfolios.client/Orders.ts | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 7e36a353d..04a418ee5 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ K ?= K.sh MAJOR = 0 MINOR = 7 PATCH = 0 -BUILD = 36 +BUILD = 37 OBLIGATORY = DISCLAIMER: This is strict non-violent software: \n$\ if you hurt other living creatures, please stop; \n$\ diff --git a/src/bin/+portfolios/+portfolios.client/Orders.ts b/src/bin/+portfolios/+portfolios.client/Orders.ts index f2cb9a848..9143ce510 100644 --- a/src/bin/+portfolios/+portfolios.client/Orders.ts +++ b/src/bin/+portfolios/+portfolios.client/Orders.ts @@ -1,6 +1,6 @@ import {Component, Input} from '@angular/core'; -import {GridOptions, GridApi, CellValueChangedEvent} from 'ag-grid-community'; +import {GridOptions, GridApi, CellValueChangedEvent, INumberCellEditorParams} from 'ag-grid-community'; import {Shared, Socket, Models} from 'lib/K'; @@ -116,16 +116,15 @@ export class OrdersComponent { headerName: 'price', sort: 'desc', editable: true, - cellEditor: 'agNumberCellEditor', cellEditorSelector: (params) => { - return { params: { - min: 0, + return { component: "agNumberCellEditor", params: { precision: params.data.pricePrecision, - step: Math.pow(10, -params.data.pricePrecision), + min: parseFloat(Math.pow(10, -params.data.pricePrecision).toFixed(params.data.pricePrecision)), + step: parseFloat(Math.pow(10, -params.data.pricePrecision).toFixed(params.data.pricePrecision)), showStepperButtons: true - } }; + } as INumberCellEditorParams }; }, - cellRenderer: (params) => '' + params.value, + cellRenderer: (params) => '' + params.value.toFixed(params.data.pricePrecision), cellClassRules: { 'sell': 'data.side == "Ask"', 'buy': 'data.side == "Bid"' @@ -233,7 +232,7 @@ export class OrdersComponent { orderId: o.orderId, exchangeId: o.exchangeId, side: Models.Side[o.side], - price: o.price.toFixed(-Math.log10(o.pricePrecision)), + price: o.price, value: o.quantity * o.price, type: Models.OrderType[o.type], tif: Models.TimeInForce[o.timeInForce],