Skip to content

Commit

Permalink
Pull request #5390: [DXCF-5719] VWAP provider improvements
Browse files Browse the repository at this point in the history
Merge in DXCHARTS/dxchart5 from feature/DXCF-5719-vwap-provider-improvements to master

* commit 'd35721ff46aeed221be90ae26ebdab0590f9ce93':
  [DXCF-5719] VWAP provider improvements // code style and type fixes
  [DXCF-5719] VWAP provider improvements // code style and type fixes
  [DXCF-5719] VWAP provider improvements // docs vwap explanation
  [DXCF-5719] VWAP provider improvements // demo and docs dx-feed provider version update
  [DXCF-5719] VWAP provider improvements // dx-feed provider wvap version update

GitOrigin-RevId: db8f9b550523a1ea0da648b5efa4ccb4aee7681d
  • Loading branch information
artskar authored and dxcity committed Jan 13, 2025
1 parent 2298632 commit 822cb4f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/chart/components/chart/candle.functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const prepareCandle = (candle: PartialCandle): Candle | undefined => {
const preparedCandleLo = finite(candle.lo, Math.min(candle.open, candle.close), settlementPrice);
const preparedCandleOpen = finite(candle.open, candle.lo, settlementPrice);
const preparedCandleClose = finite(candle.close, candle.hi, settlementPrice);
const preparedVwap = Number.isNaN(candle.vwap) ? undefined : candle.vwap;
return {
id: candle.id,
hi: preparedCandleHi,
Expand All @@ -35,6 +36,7 @@ export const prepareCandle = (candle: PartialCandle): Candle | undefined => {
expansion: candle.expansion,
idx: candle.idx,
impVolatility: candle.impVolatility,
vwap: preparedVwap,
};
} catch (e) {
console.warn(e);
Expand All @@ -45,6 +47,7 @@ export const prepareCandle = (candle: PartialCandle): Candle | undefined => {
/**
* Adds index to candles according to their array index.
* @param candles
* @param startIdx {number}
*/
export const reindexCandles = (candles: Array<Candle>, startIdx: number = 0) => {
for (let i = startIdx; i < candles.length; ++i) {
Expand Down

0 comments on commit 822cb4f

Please sign in to comment.