From 524fed35755f72a05e3430d6d665f1730648fd31 Mon Sep 17 00:00:00 2001 From: Gadi Cohen Date: Mon, 29 Mar 2021 20:56:16 +0300 Subject: [PATCH] fix(quote): {regular,pre}MarketTime is Date (like postMT) --- docs/modules/quote.md | 2 +- schema.json | 24 ++++++++++++------------ src/modules/quote.ts | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/modules/quote.md b/docs/modules/quote.md index 50223eb7..6bffb626 100644 --- a/docs/modules/quote.md +++ b/docs/modules/quote.md @@ -53,7 +53,7 @@ const result = await yahooFinance.quote('AAPL'); postMarketChange: -0.0800018, regularMarketChange: -0.42500305, regularMarketChangePercent: -0.30980286, - regularMarketTime: 1612558802, + regularMarketTime: new Date("2021-02-05T21:00:02.000Z"), regularMarketPrice: 136.76, regularMarketDayHigh: 137.41, regularMarketDayRange: { low: 135.86, high: 137.41 }, diff --git a/schema.json b/schema.json index b10b65fa..987f86fd 100644 --- a/schema.json +++ b/schema.json @@ -2558,7 +2558,7 @@ "yahooFinanceType": "number" }, "preMarketTime": { - "yahooFinanceType": "number" + "yahooFinanceType": "date" }, "priceEpsCurrentYear": { "yahooFinanceType": "number" @@ -2603,7 +2603,7 @@ "yahooFinanceType": "number" }, "regularMarketTime": { - "yahooFinanceType": "number" + "yahooFinanceType": "date" }, "regularMarketVolume": { "yahooFinanceType": "number" @@ -2852,7 +2852,7 @@ "yahooFinanceType": "number" }, "preMarketTime": { - "yahooFinanceType": "number" + "yahooFinanceType": "date" }, "priceEpsCurrentYear": { "yahooFinanceType": "number" @@ -2898,7 +2898,7 @@ "yahooFinanceType": "number" }, "regularMarketTime": { - "yahooFinanceType": "number" + "yahooFinanceType": "date" }, "regularMarketVolume": { "yahooFinanceType": "number" @@ -3155,7 +3155,7 @@ "yahooFinanceType": "number" }, "preMarketTime": { - "yahooFinanceType": "number" + "yahooFinanceType": "date" }, "priceEpsCurrentYear": { "yahooFinanceType": "number" @@ -3201,7 +3201,7 @@ "yahooFinanceType": "number" }, "regularMarketTime": { - "yahooFinanceType": "number" + "yahooFinanceType": "date" }, "regularMarketVolume": { "yahooFinanceType": "number" @@ -3438,7 +3438,7 @@ "yahooFinanceType": "number" }, "preMarketTime": { - "yahooFinanceType": "number" + "yahooFinanceType": "date" }, "priceEpsCurrentYear": { "yahooFinanceType": "number" @@ -3484,7 +3484,7 @@ "yahooFinanceType": "number" }, "regularMarketTime": { - "yahooFinanceType": "number" + "yahooFinanceType": "date" }, "regularMarketVolume": { "yahooFinanceType": "number" @@ -3721,7 +3721,7 @@ "yahooFinanceType": "number" }, "preMarketTime": { - "yahooFinanceType": "number" + "yahooFinanceType": "date" }, "priceEpsCurrentYear": { "yahooFinanceType": "number" @@ -3767,7 +3767,7 @@ "yahooFinanceType": "number" }, "regularMarketTime": { - "yahooFinanceType": "number" + "yahooFinanceType": "date" }, "regularMarketVolume": { "yahooFinanceType": "number" @@ -4100,7 +4100,7 @@ "yahooFinanceType": "number" }, "preMarketTime": { - "yahooFinanceType": "number" + "yahooFinanceType": "date" }, "priceEpsCurrentYear": { "yahooFinanceType": "number" @@ -4146,7 +4146,7 @@ "yahooFinanceType": "number" }, "regularMarketTime": { - "yahooFinanceType": "number" + "yahooFinanceType": "date" }, "regularMarketVolume": { "yahooFinanceType": "number" diff --git a/src/modules/quote.ts b/src/modules/quote.ts index 62485fe3..596566ce 100644 --- a/src/modules/quote.ts +++ b/src/modules/quote.ts @@ -60,12 +60,12 @@ export interface QuoteBase { firstTradeDateMilliseconds?: DateInMs; // 917015400000 -> Date priceHint: number; // 2, postMarketChangePercent?: number; // 0.093813874, - postMarketTime?: Date; // 1612573179, + postMarketTime?: Date; // 1612573179 -> new Date() postMarketPrice?: number; // 544.15, postMarketChange?: number; // 0.51000977, regularMarketChange?: number; // -2.9299927, regularMarketChangePercent?: number; // -0.53606904, - regularMarketTime?: number; // 1612558802, + regularMarketTime?: Date; // 1612558802 -> new Date() regularMarketPrice?: number; // 543.64, regularMarketDayHigh?: number; // 549.19, regularMarketDayRange?: TwoNumberRange; // "541.867 - 549.19" -> { low, high } @@ -74,7 +74,7 @@ export interface QuoteBase { regularMarketPreviousClose?: number; // 546.57, preMarketChange?: number; // -2.9299927, preMarketChangePercent?: number; // -0.53606904, - preMarketTime?: number; // 1612558802, + preMarketTime?: Date; // 1612558802 -> new Date() preMarketPrice?: number; // 543.64, bid?: number; // 543.84, ask?: number; // 544.15,