Feature/increase timeout to load historical data in data provider service (#2887)
* Increase timeout to load historical data * Update changelog
This commit is contained in:
parent
bff60ddbe0
commit
00895b7bb1
@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Changed
|
||||
|
||||
- Increased the timeout to load historical data in the data provider service
|
||||
- Improved the asset profile validation for `MANUAL` data source in the activities import
|
||||
|
||||
## 2.40.0 - 2024-01-15
|
||||
|
@ -57,7 +57,8 @@ export class AlphaVantageService implements DataProviderInterface {
|
||||
aSymbol: string,
|
||||
aGranularity: Granularity = 'day',
|
||||
from: Date,
|
||||
to: Date
|
||||
to: Date,
|
||||
requestTimeout = this.configurationService.get('REQUEST_TIMEOUT')
|
||||
): Promise<{
|
||||
[symbol: string]: { [date: string]: IDataProviderHistoricalResponse };
|
||||
}> {
|
||||
|
@ -104,7 +104,8 @@ export class CoinGeckoService implements DataProviderInterface {
|
||||
aSymbol: string,
|
||||
aGranularity: Granularity = 'day',
|
||||
from: Date,
|
||||
to: Date
|
||||
to: Date,
|
||||
requestTimeout = this.configurationService.get('REQUEST_TIMEOUT')
|
||||
): Promise<{
|
||||
[symbol: string]: { [date: string]: IDataProviderHistoricalResponse };
|
||||
}> {
|
||||
@ -113,7 +114,7 @@ export class CoinGeckoService implements DataProviderInterface {
|
||||
|
||||
setTimeout(() => {
|
||||
abortController.abort();
|
||||
}, this.configurationService.get('REQUEST_TIMEOUT'));
|
||||
}, requestTimeout);
|
||||
|
||||
const { prices } = await got(
|
||||
`${
|
||||
|
@ -218,7 +218,7 @@ export class DataProviderService {
|
||||
if (dataProvider.canHandle(symbol)) {
|
||||
promises.push(
|
||||
dataProvider
|
||||
.getHistorical(symbol, undefined, from, to)
|
||||
.getHistorical(symbol, undefined, from, to, ms('30 seconds'))
|
||||
.then((data) => ({ data: data?.[symbol], symbol }))
|
||||
);
|
||||
}
|
||||
|
@ -68,7 +68,8 @@ export class EodHistoricalDataService implements DataProviderInterface {
|
||||
aSymbol: string,
|
||||
aGranularity: Granularity = 'day',
|
||||
from: Date,
|
||||
to: Date
|
||||
to: Date,
|
||||
requestTimeout = this.configurationService.get('REQUEST_TIMEOUT')
|
||||
): Promise<{
|
||||
[symbol: string]: { [date: string]: IDataProviderHistoricalResponse };
|
||||
}> {
|
||||
@ -79,7 +80,7 @@ export class EodHistoricalDataService implements DataProviderInterface {
|
||||
|
||||
setTimeout(() => {
|
||||
abortController.abort();
|
||||
}, this.configurationService.get('REQUEST_TIMEOUT'));
|
||||
}, requestTimeout);
|
||||
|
||||
const response = await got(
|
||||
`${this.URL}/eod/${symbol}?api_token=${
|
||||
@ -87,7 +88,7 @@ export class EodHistoricalDataService implements DataProviderInterface {
|
||||
}&fmt=json&from=${format(from, DATE_FORMAT)}&to=${format(
|
||||
to,
|
||||
DATE_FORMAT
|
||||
)}&period={aGranularity}`,
|
||||
)}&period=${aGranularity}`,
|
||||
{
|
||||
// @ts-ignore
|
||||
signal: abortController.signal
|
||||
@ -100,8 +101,7 @@ export class EodHistoricalDataService implements DataProviderInterface {
|
||||
marketPrice: this.getConvertedValue({
|
||||
symbol: aSymbol,
|
||||
value: historicalItem.close
|
||||
}),
|
||||
performance: historicalItem.open - historicalItem.close
|
||||
})
|
||||
};
|
||||
|
||||
return result;
|
||||
|
@ -58,7 +58,8 @@ export class FinancialModelingPrepService implements DataProviderInterface {
|
||||
aSymbol: string,
|
||||
aGranularity: Granularity = 'day',
|
||||
from: Date,
|
||||
to: Date
|
||||
to: Date,
|
||||
requestTimeout = this.configurationService.get('REQUEST_TIMEOUT')
|
||||
): Promise<{
|
||||
[symbol: string]: { [date: string]: IDataProviderHistoricalResponse };
|
||||
}> {
|
||||
@ -67,7 +68,7 @@ export class FinancialModelingPrepService implements DataProviderInterface {
|
||||
|
||||
setTimeout(() => {
|
||||
abortController.abort();
|
||||
}, this.configurationService.get('REQUEST_TIMEOUT'));
|
||||
}, requestTimeout);
|
||||
|
||||
const { historical } = await got(
|
||||
`${this.URL}/historical-price-full/${aSymbol}?apikey=${this.apiKey}`,
|
||||
|
@ -53,7 +53,8 @@ export class GoogleSheetsService implements DataProviderInterface {
|
||||
aSymbol: string,
|
||||
aGranularity: Granularity = 'day',
|
||||
from: Date,
|
||||
to: Date
|
||||
to: Date,
|
||||
requestTimeout = this.configurationService.get('REQUEST_TIMEOUT')
|
||||
): Promise<{
|
||||
[symbol: string]: { [date: string]: IDataProviderHistoricalResponse };
|
||||
}> {
|
||||
|
@ -27,7 +27,8 @@ export interface DataProviderInterface {
|
||||
aSymbol: string,
|
||||
aGranularity: Granularity,
|
||||
from: Date,
|
||||
to: Date
|
||||
to: Date,
|
||||
requestTimeout?: number
|
||||
): Promise<{
|
||||
[symbol: string]: { [date: string]: IDataProviderHistoricalResponse };
|
||||
}>; // TODO: Return only one symbol
|
||||
|
@ -61,7 +61,8 @@ export class ManualService implements DataProviderInterface {
|
||||
aSymbol: string,
|
||||
aGranularity: Granularity = 'day',
|
||||
from: Date,
|
||||
to: Date
|
||||
to: Date,
|
||||
requestTimeout = this.configurationService.get('REQUEST_TIMEOUT')
|
||||
): Promise<{
|
||||
[symbol: string]: { [date: string]: IDataProviderHistoricalResponse };
|
||||
}> {
|
||||
|
@ -50,7 +50,8 @@ export class RapidApiService implements DataProviderInterface {
|
||||
aSymbol: string,
|
||||
aGranularity: Granularity = 'day',
|
||||
from: Date,
|
||||
to: Date
|
||||
to: Date,
|
||||
requestTimeout = this.configurationService.get('REQUEST_TIMEOUT')
|
||||
): Promise<{
|
||||
[symbol: string]: { [date: string]: IDataProviderHistoricalResponse };
|
||||
}> {
|
||||
|
@ -104,7 +104,8 @@ export class YahooFinanceService implements DataProviderInterface {
|
||||
aSymbol: string,
|
||||
aGranularity: Granularity = 'day',
|
||||
from: Date,
|
||||
to: Date
|
||||
to: Date,
|
||||
requestTimeout = this.configurationService.get('REQUEST_TIMEOUT')
|
||||
): Promise<{
|
||||
[symbol: string]: { [date: string]: IDataProviderHistoricalResponse };
|
||||
}> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user