Feature/increase fear and greed index to 30 days (#571)
* Increase Fear & Greed index to 30 days * Update changelog
This commit is contained in:
parent
c65746d119
commit
ffaaa14dba
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Increased the historical data chart of the _Fear & Greed Index_ (market mood) to 30 days
|
||||||
|
|
||||||
## 1.93.0 - 21.12.2021
|
## 1.93.0 - 21.12.2021
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -8,7 +8,7 @@ import { MarketDataService } from '@ghostfolio/api/services/market-data.service'
|
|||||||
import { PrismaService } from '@ghostfolio/api/services/prisma.service';
|
import { PrismaService } from '@ghostfolio/api/services/prisma.service';
|
||||||
import { DATE_FORMAT } from '@ghostfolio/common/helper';
|
import { DATE_FORMAT } from '@ghostfolio/common/helper';
|
||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable, Logger } from '@nestjs/common';
|
||||||
import { DataSource, MarketData } from '@prisma/client';
|
import { DataSource } from '@prisma/client';
|
||||||
import { format, subDays } from 'date-fns';
|
import { format, subDays } from 'date-fns';
|
||||||
|
|
||||||
import { LookupItem } from './interfaces/lookup-item.interface';
|
import { LookupItem } from './interfaces/lookup-item.interface';
|
||||||
@ -36,17 +36,17 @@ export class SymbolService {
|
|||||||
let historicalData: HistoricalDataItem[];
|
let historicalData: HistoricalDataItem[];
|
||||||
|
|
||||||
if (includeHistoricalData) {
|
if (includeHistoricalData) {
|
||||||
const days = 10;
|
const days = 30;
|
||||||
|
|
||||||
const marketData = await this.marketDataService.getRange({
|
const marketData = await this.marketDataService.getRange({
|
||||||
dateQuery: { gte: subDays(new Date(), days) },
|
dateQuery: { gte: subDays(new Date(), days) },
|
||||||
symbols: [dataGatheringItem.symbol]
|
symbols: [dataGatheringItem.symbol]
|
||||||
});
|
});
|
||||||
|
|
||||||
historicalData = marketData.map(({ date, marketPrice }) => {
|
historicalData = marketData.map(({ date, marketPrice: value }) => {
|
||||||
return {
|
return {
|
||||||
date: date.toISOString(),
|
value,
|
||||||
value: marketPrice
|
date: date.toISOString()
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<div class="no-gutters row w-100">
|
<div class="no-gutters row w-100">
|
||||||
<div class="col-xs-12 col-md-8 offset-md-2">
|
<div class="col-xs-12 col-md-8 offset-md-2">
|
||||||
<div class="mb-2 text-center text-muted">
|
<div class="mb-2 text-center text-muted">
|
||||||
<small i18n>Last 10 Days</small>
|
<small i18n>Last 30 Days</small>
|
||||||
</div>
|
</div>
|
||||||
<gf-line-chart
|
<gf-line-chart
|
||||||
class="mb-5"
|
class="mb-5"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user