Skip to content

Commit

Permalink
Fixed up/down key events on edit orders inputs.
Browse files Browse the repository at this point in the history
████ ███  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 <[email protected]>
 _________________________________________
/ Hello, WORLD!                           \
|                                         |
\ pssst.. 1.00000000 BTC = 61626.16 EUR.  /
 -----------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
  • Loading branch information
ctubio committed Oct 16, 2024
1 parent fea4795 commit 576de33
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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$\
Expand Down
15 changes: 7 additions & 8 deletions src/bin/+portfolios/+portfolios.client/Orders.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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) => '<span style="display: inline-block;">&#9998;</span>' + params.value,
cellRenderer: (params) => '<span style="display: inline-block;">&#9998;</span>' + params.value.toFixed(params.data.pricePrecision),
cellClassRules: {
'sell': 'data.side == "Ask"',
'buy': 'data.side == "Bid"'
Expand Down Expand Up @@ -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],
Expand Down

0 comments on commit 576de33

Please sign in to comment.