chore(trading): upgrade pennant to v1.9.0 (#4235)

This commit is contained in:
John Walley 2023-07-04 13:10:38 +01:00 committed by GitHub
parent 74f2cfa4a5
commit 5040fbfd07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 21 deletions

View File

@ -126,7 +126,8 @@ describe(
{ name: 'Moving average', infoText: 'Moving average: 174.08302' }, { name: 'Moving average', infoText: 'Moving average: 174.08302' },
{ {
name: 'Price monitoring bounds', name: 'Price monitoring bounds',
infoText: 'Price Monitoring Bounds: Min -Max -Reference -', infoText:
'Price Monitoring Bounds: Min 162.56291Max 182.96869Reference 172.47489',
}, },
]; ];
@ -150,7 +151,7 @@ describe(
{ name: 'Force index', infoText: 'Force index: 987.48858' }, { name: 'Force index', infoText: 'Force index: 987.48858' },
{ name: 'MACD', infoText: 'MACD: S -0.06420D 0.00359MACD -0.06062' }, { name: 'MACD', infoText: 'MACD: S -0.06420D 0.00359MACD -0.06062' },
{ name: 'RSI', infoText: 'RSI: 47.08648' }, { name: 'RSI', infoText: 'RSI: 47.08648' },
{ name: 'Volume', infoText: 'Volume: 55,000.00000' }, { name: 'Volume', infoText: 'Volume: 55,000' },
]; ];
cy.get(indicatorInfo).eq(1).realHover(); cy.get(indicatorInfo).eq(1).realHover();
cy.get('.close-button-module_closeButton__2ifkl').click({ force: true }); cy.get('.close-button-module_closeButton__2ifkl').click({ force: true });

View File

@ -6,7 +6,7 @@ import {
differenceInHours, differenceInHours,
differenceInMinutes, differenceInMinutes,
} from 'date-fns'; } from 'date-fns';
import type { Candle, DataSource } from 'pennant'; import type { Candle, DataSource, PriceMonitoringBounds } from 'pennant';
import { Interval as PennantInterval } from 'pennant'; import { Interval as PennantInterval } from 'pennant';
import { addDecimal } from '@vegaprotocol/utils'; import { addDecimal } from '@vegaprotocol/utils';
@ -45,7 +45,6 @@ const defaultConfig = {
PennantInterval.I5M, PennantInterval.I5M,
PennantInterval.I1M, PennantInterval.I1M,
], ],
priceMonitoringBounds: [],
}; };
/** /**
@ -111,6 +110,27 @@ export class VegaDataSource implements DataSource {
this._decimalPlaces = data.market.decimalPlaces; this._decimalPlaces = data.market.decimalPlaces;
this._positionDecimalPlaces = data.market.positionDecimalPlaces; this._positionDecimalPlaces = data.market.positionDecimalPlaces;
let priceMonitoringBounds: PriceMonitoringBounds | undefined;
if (
data.market.data.priceMonitoringBounds &&
data.market.data.priceMonitoringBounds.length > 0
) {
const bounds = data.market.data.priceMonitoringBounds[0];
priceMonitoringBounds = {
maxValidPrice: Number(
addDecimal(bounds.maxValidPrice, this._decimalPlaces)
),
minValidPrice: Number(
addDecimal(bounds.minValidPrice, this._decimalPlaces)
),
referencePrice: Number(
addDecimal(bounds.referencePrice, this._decimalPlaces)
),
};
}
return { return {
decimalPlaces: this._decimalPlaces, decimalPlaces: this._decimalPlaces,
positionDecimalPlaces: this._positionDecimalPlaces, positionDecimalPlaces: this._positionDecimalPlaces,
@ -122,18 +142,7 @@ export class VegaDataSource implements DataSource {
PennantInterval.I5M, PennantInterval.I5M,
PennantInterval.I1M, PennantInterval.I1M,
], ],
priceMonitoringBounds: priceMonitoringBounds: priceMonitoringBounds,
data.market.data.priceMonitoringBounds?.map((bounds) => ({
maxValidPrice: Number(
addDecimal(bounds.maxValidPrice, this._decimalPlaces)
),
minValidPrice: Number(
addDecimal(bounds.minValidPrice, this._decimalPlaces)
),
referencePrice: Number(
addDecimal(bounds.referencePrice, this._decimalPlaces)
),
})) ?? [],
}; };
} else { } else {
return defaultConfig; return defaultConfig;

View File

@ -69,7 +69,7 @@
"js-sha3": "^0.8.0", "js-sha3": "^0.8.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"next": "13.3.0", "next": "13.3.0",
"pennant": "1.8.1", "pennant": "1.9.0",
"react": "18.2.0", "react": "18.2.0",
"react-copy-to-clipboard": "^5.0.4", "react-copy-to-clipboard": "^5.0.4",
"react-dom": "18.2.0", "react-dom": "18.2.0",

View File

@ -19952,10 +19952,10 @@ pend@~1.2.0:
resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50"
integrity sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg== integrity sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==
pennant@1.8.1: pennant@1.9.0:
version "1.8.1" version "1.9.0"
resolved "https://registry.yarnpkg.com/pennant/-/pennant-1.8.1.tgz#bb5f8fd2ae78e0e53ff43bea565765bf7e47b255" resolved "https://registry.yarnpkg.com/pennant/-/pennant-1.9.0.tgz#d7332548e17d5140e6655905e41bd6671bd37fc3"
integrity sha512-kUKRLfM8GdE+RSlS45Rz/QMQ6xorbzAqw/ybOVR/2gVO6L3sY16+vrgVSJd89RbR+sI/foWe5buXwFmjwFR7Kg== integrity sha512-HgM82NnjH94Hc0dhq9knZMOyGT0QyMfMsGFtB4S6UMe2wlSxMpnmQKjtVYmug4PYAkXXprqPrb+mUhjcsPtm5g==
dependencies: dependencies:
"@babel/runtime" "^7.13.10" "@babel/runtime" "^7.13.10"
"@d3fc/d3fc-technical-indicator" "^8.0.1" "@d3fc/d3fc-technical-indicator" "^8.0.1"