Merge branch 'master' into nymkappa/bugfix/index-blocks-prices-often

This commit is contained in:
Felipe Knorr Kuhn
2022-07-20 20:59:27 -07:00
committed by GitHub
49 changed files with 1663 additions and 90 deletions

View File

@@ -39,6 +39,13 @@ export async function $lookupNodeLocation(): Promise<void> {
[city.country?.geoname_id, JSON.stringify(city.country?.names)]);
}
// Store Country ISO code
if (city.country?.iso_code) {
await DB.query(
`INSERT IGNORE INTO geo_names (id, type, names) VALUES (?, 'country_iso_code', ?)`,
[city.country?.geoname_id, city.country?.iso_code]);
}
// Store Division
if (city.subdivisions && city.subdivisions[0]) {
await DB.query(

View File

@@ -62,7 +62,7 @@ class KrakenApi implements PriceFeed {
// CHF weekly price history goes back to timestamp 1575504000 (December 5, 2019)
// AUD weekly price history goes back to timestamp 1591833600 (June 11, 2020)
const priceHistory: any = {}; // map: timestamp -> Prices
let priceHistory: any = {}; // map: timestamp -> Prices
for (const currency of this.currencies) {
const response = await query(this.urlHist.replace('{GRANULARITY}', '10080') + currency);
@@ -83,6 +83,10 @@ class KrakenApi implements PriceFeed {
}
for (const time in priceHistory) {
if (priceHistory[time].USD === -1) {
delete priceHistory[time];
continue;
}
await PricesRepository.$savePrices(parseInt(time, 10), priceHistory[time]);
}