コード例 #1
0
        public static async Task <List <FinraRecord> > GetAllShortVolume(DateTime date)
        {
            string dateString = date.ToString("yyyyMMdd");
            string fileName   = $"CNMSshvol{dateString}.txt";
            string requestUrl = $"{BaseUrl}/{fileName}";

            var response = await Client.GetStringAsync(requestUrl);

            var finraResponse = FinraResponseParser.ParseResponse(response);

            return(await Task.FromResult(finraResponse));
        }
コード例 #2
0
        public void Should_ParseSampleResponse()
        {
            using (StreamReader reader = new StreamReader("finra_response.txt"))
            {
                string responseString = reader.ReadToEnd();

                var finraRecords = FinraResponseParser.ParseResponse(responseString);

                finraRecords[0].Date.Should().Be(new DateTime(2018, 11, 5));
                finraRecords[0].Market.Should().Be("Q,N");
                finraRecords[0].ShortExemptVolume.Should().Be(0);
                finraRecords[0].ShortVolume.Should().Be(80887);
                finraRecords[0].Symbol.Should().Be("A");
                finraRecords[0].TotalVolume.Should().Be(371966);
            }
        }