Browse Source

Feature/increase fear and greed index to 30 days (#571)

* Increase Fear & Greed index to 30 days

* Update changelog
pull/572/head
Thomas Kaul 3 years ago
committed by GitHub
parent
commit
ffaaa14dba
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      CHANGELOG.md
  2. 10
      apps/api/src/app/symbol/symbol.service.ts
  3. 2
      apps/client/src/app/components/home-market/home-market.html

6
CHANGELOG.md

@ -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/),
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
### Added

10
apps/api/src/app/symbol/symbol.service.ts

@ -8,7 +8,7 @@ import { MarketDataService } from '@ghostfolio/api/services/market-data.service'
import { PrismaService } from '@ghostfolio/api/services/prisma.service';
import { DATE_FORMAT } from '@ghostfolio/common/helper';
import { Injectable, Logger } from '@nestjs/common';
import { DataSource, MarketData } from '@prisma/client';
import { DataSource } from '@prisma/client';
import { format, subDays } from 'date-fns';
import { LookupItem } from './interfaces/lookup-item.interface';
@ -36,17 +36,17 @@ export class SymbolService {
let historicalData: HistoricalDataItem[];
if (includeHistoricalData) {
const days = 10;
const days = 30;
const marketData = await this.marketDataService.getRange({
dateQuery: { gte: subDays(new Date(), days) },
symbols: [dataGatheringItem.symbol]
});
historicalData = marketData.map(({ date, marketPrice }) => {
historicalData = marketData.map(({ date, marketPrice: value }) => {
return {
date: date.toISOString(),
value: marketPrice
value,
date: date.toISOString()
};
});
}

2
apps/client/src/app/components/home-market/home-market.html

@ -12,7 +12,7 @@
<div class="no-gutters row w-100">
<div class="col-xs-12 col-md-8 offset-md-2">
<div class="mb-2 text-center text-muted">
<small i18n>Last 10 Days</small>
<small i18n>Last 30 Days</small>
</div>
<gf-line-chart
class="mb-5"

Loading…
Cancel
Save