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