2121using QuantConnect . Data ;
2222using System . Collections . Generic ;
2323using Newtonsoft . Json ;
24+ using DateTimeUtilityFunctions = QuantConnect . Securities . Future . FuturesExpiryUtilityFunctions ;
2425
2526namespace QuantConnect . DataSource
2627{
@@ -30,6 +31,8 @@ namespace QuantConnect.DataSource
3031 [ ProtoContract ( SkipConstructor = true ) ]
3132 public class RegalyticsRegulatoryArticle : BaseData
3233 {
34+ private DateTime _endTime ;
35+
3336 /// <summary>
3437 /// Data source ID
3538 /// </summary>
@@ -89,6 +92,12 @@ public class RegalyticsRegulatoryArticle : BaseData
8992 [ JsonProperty ( PropertyName = "pdf_url" ) ]
9093 public string AnnouncementUrl { get ; set ; }
9194
95+ public override DateTime EndTime
96+ {
97+ get { return _endTime ; }
98+ set { _endTime = value ; }
99+ }
100+
92101 /// <summary>
93102 /// Return the URL string source of the file. This will be converted to a stream
94103 /// </summary>
@@ -98,13 +107,15 @@ public class RegalyticsRegulatoryArticle : BaseData
98107 /// <returns>String URL of source file.</returns>
99108 public override SubscriptionDataSource GetSource ( SubscriptionDataConfig config , DateTime date , bool isLiveMode )
100109 {
110+ var publicationDate = DateTimeUtilityFunctions . AddBusinessDays ( date . Date , - 1 , false ) ;
111+
101112 return new SubscriptionDataSource (
102113 Path . Combine (
103114 Globals . DataFolder ,
104115 "alternative" ,
105116 "regalytics" ,
106117 "articles" ,
107- $ "{ date : yyyyMMdd} .json"
118+ $ "{ publicationDate : yyyyMMdd} .json"
108119 ) ,
109120 SubscriptionTransportMedium . LocalFile
110121 ) ;
@@ -124,10 +135,12 @@ public override BaseData Reader(SubscriptionDataConfig config, string line, Date
124135
125136 // date == the day that the data was published (2021-05-21)
126137 // 2021-05-21 for example, contains aggregated data from 2021-05-19, 2021-05-20.
127- // Regalytics publishes at 07:30:00 Eastern time, EndTime should be at that time.
138+ // Regalytics publishes at around 07:30:00 Eastern Time, but is downloaded by
139+ // us around 08:00:00 Eastern Time.
128140
129141 article . Symbol = config . Symbol ;
130- article . EndTime = date . Date . AddHours ( 7 ) . AddMinutes ( 30 ) ;
142+ article . Time = article . LatestUpdate ;
143+ article . EndTime = DateTimeUtilityFunctions . AddBusinessDays ( article . LatestUpdate . Date , 1 , false ) . AddHours ( 8 ) ;
131144
132145 return article ;
133146 }
0 commit comments