export class EodRequest extends Data.Class<{ dateFrom: Date; dateTo: Date; symbol: NonEmptyString255 }> {
// TODO: This is rediculous, it's required because Dates are compared by instance
[hashSymbol] = () =>
Hash
.structure({
dateFrom: this.dateFrom.getTime(),
dateTo: this.dateTo.getTime(),
symbol: this.symbol
});
[equalSymbol](this: EodRequest, that: Equal): boolean {
// yuk
if (!(that instanceof EodRequest)) return false
const self = { dateFrom: this.dateFrom.getTime(), dateTo: this.dateTo.getTime(), symbol: this.symbol }
const thatt = { dateFrom: that.dateFrom.getTime(), dateTo: that.dateTo.getTime(), symbol: that.symbol }
const selfKeys = Object.keys(self)
const thatKeys = Object.keys(thatt as object)
if (selfKeys.length !== thatKeys.length) {
return false
}
for (const key of selfKeys) {
if (!(key in (thatt as object) && Equal.equals((self as any)[key], (thatt as any)[key]))) {
return false
}
}
return true
}
}
export class EodRequest extends Data.Class<{ dateFrom: Date; dateTo: Date; symbol: NonEmptyString255 }> {
// TODO: This is rediculous, it's required because Dates are compared by instance
[hashSymbol] = () =>
Hash
.structure({
dateFrom: this.dateFrom.getTime(),
dateTo: this.dateTo.getTime(),
symbol: this.symbol
});
[equalSymbol](this: EodRequest, that: Equal): boolean {
// yuk
if (!(that instanceof EodRequest)) return false
const self = { dateFrom: this.dateFrom.getTime(), dateTo: this.dateTo.getTime(), symbol: this.symbol }
const thatt = { dateFrom: that.dateFrom.getTime(), dateTo: that.dateTo.getTime(), symbol: that.symbol }
const selfKeys = Object.keys(self)
const thatKeys = Object.keys(thatt as object)
if (selfKeys.length !== thatKeys.length) {
return false
}
for (const key of selfKeys) {
if (!(key in (thatt as object) && Equal.equals((self as any)[key], (thatt as any)[key]))) {
return false
}
}
return true
}
}