Refactoring (#727)

pull/731/head
Thomas Kaul 3 years ago committed by GitHub
parent e3f8b0cf52
commit 93d6746739
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,6 @@
import { LookupItem } from '@ghostfolio/api/app/symbol/interfaces/lookup-item.interface';
import { ConfigurationService } from '@ghostfolio/api/services/configuration.service';
import { DataProviderInterface } from '@ghostfolio/api/services/data-provider/interfaces/data-provider.interface';
import {
IDataProviderHistoricalResponse,
IDataProviderResponse
@ -10,7 +11,6 @@ import { Injectable, Logger } from '@nestjs/common';
import { DataSource, SymbolProfile } from '@prisma/client';
import { isAfter, isBefore, parse } from 'date-fns';
import { DataProviderInterface } from '../interfaces/data-provider.interface';
import { IAlphaVantageHistoricalResponse } from './interfaces/interfaces';
@Injectable()

@ -1,5 +1,6 @@
import { LookupItem } from '@ghostfolio/api/app/symbol/interfaces/lookup-item.interface';
import { ConfigurationService } from '@ghostfolio/api/services/configuration.service';
import { DataProviderInterface } from '@ghostfolio/api/services/data-provider/interfaces/data-provider.interface';
import {
IDataProviderHistoricalResponse,
IDataProviderResponse,
@ -14,8 +15,6 @@ import { DataSource, SymbolProfile } from '@prisma/client';
import * as bent from 'bent';
import { format, subMonths, subWeeks, subYears } from 'date-fns';
import { DataProviderInterface } from '../interfaces/data-provider.interface';
@Injectable()
export class RakutenRapidApiService implements DataProviderInterface {
public static FEAR_AND_GREED_INDEX_NAME = 'Fear & Greed Index';

@ -1,5 +1,6 @@
import { LookupItem } from '@ghostfolio/api/app/symbol/interfaces/lookup-item.interface';
import { CryptocurrencyService } from '@ghostfolio/api/services/cryptocurrency/cryptocurrency.service';
import { DataProviderInterface } from '@ghostfolio/api/services/data-provider/interfaces/data-provider.interface';
import {
IDataProviderHistoricalResponse,
IDataProviderResponse,
@ -19,9 +20,7 @@ import * as bent from 'bent';
import Big from 'big.js';
import { countries } from 'countries-list';
import { addDays, format, isSameDay } from 'date-fns';
import yahooFinance2 from 'yahoo-finance2';
import { DataProviderInterface } from '../interfaces/data-provider.interface';
import yahooFinance from 'yahoo-finance2';
@Injectable()
export class YahooFinanceService implements DataProviderInterface {
@ -80,7 +79,7 @@ export class YahooFinanceService implements DataProviderInterface {
try {
const symbol = this.convertToYahooFinanceSymbol(aSymbol);
const assetProfile = await yahooFinance2.quoteSummary(symbol, {
const assetProfile = await yahooFinance.quoteSummary(symbol, {
modules: ['price', 'summaryProfile']
});
@ -143,7 +142,7 @@ export class YahooFinanceService implements DataProviderInterface {
const yahooFinanceSymbol = this.convertToYahooFinanceSymbol(aSymbol);
try {
const historicalResult = await yahooFinance2.historical(
const historicalResult = await yahooFinance.historical(
yahooFinanceSymbol,
{
interval: '1d',
@ -202,7 +201,7 @@ export class YahooFinanceService implements DataProviderInterface {
try {
const response: { [symbol: string]: IDataProviderResponse } = {};
const quotes = await yahooFinance2.quote(yahooFinanceSymbols);
const quotes = await yahooFinance.quote(yahooFinanceSymbols);
for (const quote of quotes) {
// Convert symbols back

Loading…
Cancel
Save