From 78537edd66b2b1122fc0702d8ced9e8e52e1274e Mon Sep 17 00:00:00 2001 From: "Rong(Rex) Fan" Date: Sat, 30 Jul 2022 18:01:09 -0400 Subject: [PATCH] 1 added optimization for the xml comment for function FetchOHLCVsAsync 2 added equals function for OHLCVItem, so that Distinct() works --- src/exchanges/hk/binance/public/publicApi.cs | 4 ++-- src/shared/standard/public/ohlcvs.cs | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/exchanges/hk/binance/public/publicApi.cs b/src/exchanges/hk/binance/public/publicApi.cs index 62a3b84..706ec30 100644 --- a/src/exchanges/hk/binance/public/publicApi.cs +++ b/src/exchanges/hk/binance/public/publicApi.cs @@ -315,8 +315,8 @@ public override async ValueTask FetchOrderBooksAsync(string base_nam /// The type of trading base-currency of which information you want to query for. /// The type of trading quote-currency of which information you want to query for. /// time frame interval (optional): default "1d" - /// return committed data since given time (milli-seconds) (optional): default 0 - /// maximum number of items (optional): default 20 + /// return committed data since given time (milli-seconds) (optional): default 0, since = UnixTimeStamps * (long)1000 + /// maximum number of items (optional): default 20, uplimit:1000 /// Add additional attributes for each exchange /// public override async ValueTask FetchOHLCVsAsync(string base_name, string quote_name, string timeframe = "1d", long since = 0, int limits = 20, Dictionary args = null) diff --git a/src/shared/standard/public/ohlcvs.cs b/src/shared/standard/public/ohlcvs.cs index d6d9c6d..9b34c33 100644 --- a/src/shared/standard/public/ohlcvs.cs +++ b/src/shared/standard/public/ohlcvs.cs @@ -203,6 +203,25 @@ public virtual long count get; set; } + + public override bool Equals(object obj) + { + // Check for null and compare run-time types. + if ((obj == null) || !this.GetType().Equals(obj.GetType())) + { + return false; + } + else + { + var objItem = (OHLCVItem)obj; + return (timestamp == objItem.timestamp) + && (highPrice == objItem.highPrice) + && (lowPrice == objItem.lowPrice) + && (closePrice == objItem.closePrice) + && (openPrice == objItem.openPrice) + && (volume == objItem.volume); + } + } } ///