Skip to content

Commit 1ab9c71

Browse files
committed
Rename data::v2::last_quote to last_quotes
This change renames the data::v2::last_quote module to last_quotes to better reflect what it can be used for. Types contained in it are renamed accordingly.
1 parent 012f843 commit 1ab9c71

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Unreleased
22
----------
33
- Added support for historic trade retrieval via `data::v2::trades`
44
- Adjusted `data::v2::last_quote` module to work with multiple symbols
5+
and renamed it to `last_quotes`
56

67

78
0.25.1

src/data/v2/last_quote.rs src/data/v2/last_quotes.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::Str;
2121

2222
/// A GET request to be made to the /v2/stocks/quotes/latest endpoint.
2323
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
24-
pub struct LastQuoteReq {
24+
pub struct LastQuotesReq {
2525
/// The symbols to retrieve the last quote for.
2626
#[serde(rename = "symbols", serialize_with = "string_slice_to_str")]
2727
pub symbols: Vec<String>,
@@ -31,25 +31,25 @@ pub struct LastQuoteReq {
3131
}
3232

3333

34-
/// A helper for initializing [`LastQuoteReq`] objects.
34+
/// A helper for initializing [`LastQuotesReq`] objects.
3535
#[derive(Clone, Debug, Default, Eq, PartialEq)]
3636
#[allow(missing_copy_implementations)]
37-
pub struct LastQuoteReqInit {
38-
/// See `LastQuoteReq::feed`.
37+
pub struct LastQuotesReqInit {
38+
/// See `LastQuotesReq::feed`.
3939
pub feed: Option<Feed>,
4040
#[doc(hidden)]
4141
pub _non_exhaustive: (),
4242
}
4343

44-
impl LastQuoteReqInit {
45-
/// Create a [`LastQuoteReq`] from a `LastQuoteReqInit`.
44+
impl LastQuotesReqInit {
45+
/// Create a [`LastQuotesReq`] from a `LastQuotesReqInit`.
4646
#[inline]
47-
pub fn init<I, S>(self, symbols: I) -> LastQuoteReq
47+
pub fn init<I, S>(self, symbols: I) -> LastQuotesReq
4848
where
4949
I: IntoIterator<Item = S>,
5050
S: Into<String>,
5151
{
52-
LastQuoteReq {
52+
LastQuotesReq {
5353
symbols: symbols.into_iter().map(S::into).collect(),
5454
feed: self.feed,
5555
}
@@ -83,7 +83,7 @@ pub struct Quote {
8383
EndpointNoParse! {
8484
/// The representation of a GET request to the
8585
/// /v2/stocks/quotes/latest endpoint.
86-
pub Get(LastQuoteReq),
86+
pub Get(LastQuotesReq),
8787
Ok => Vec<(String, Quote)>, [
8888
/// The last quotes were retrieved successfully.
8989
/* 200 */ OK,
@@ -216,7 +216,7 @@ mod tests {
216216
let api_info = ApiInfo::from_env().unwrap();
217217
let client = Client::new(api_info);
218218

219-
let req = LastQuoteReqInit::default().init(["SPY"]);
219+
let req = LastQuotesReqInit::default().init(["SPY"]);
220220
let quotes = client.issue::<Get>(&req).await.unwrap();
221221
assert_eq!(quotes.len(), 1);
222222
assert_eq!(quotes[0].0, "SPY");
@@ -232,7 +232,7 @@ mod tests {
232232
let api_info = ApiInfo::from_env().unwrap();
233233
let client = Client::new(api_info);
234234

235-
let req = LastQuoteReqInit::default().init(["MSFT", "SPY", "AAPL"]);
235+
let req = LastQuotesReqInit::default().init(["MSFT", "SPY", "AAPL"]);
236236
let quotes = client.issue::<Get>(&req).await.unwrap();
237237
assert_eq!(quotes.len(), 3);
238238

@@ -251,7 +251,7 @@ mod tests {
251251
let api_info = ApiInfo::from_env().unwrap();
252252
let client = Client::new(api_info);
253253

254-
let req = LastQuoteReqInit {
254+
let req = LastQuotesReqInit {
255255
feed: Some(Feed::SIP),
256256
..Default::default()
257257
}
@@ -274,7 +274,7 @@ mod tests {
274274
let api_info = ApiInfo::from_env().unwrap();
275275
let client = Client::new(api_info);
276276

277-
let req = LastQuoteReqInit::default().init(["ABC123"]);
277+
let req = LastQuotesReqInit::default().init(["ABC123"]);
278278
let err = client.issue::<Get>(&req).await.unwrap_err();
279279
match err {
280280
RequestError::Endpoint(GetError::InvalidInput(_)) => (),
@@ -289,7 +289,7 @@ mod tests {
289289
let api_info = ApiInfo::from_env().unwrap();
290290
let client = Client::new(api_info);
291291

292-
let req = LastQuoteReqInit::default().init(["SPY", "NOSUCHSYMBOL"]);
292+
let req = LastQuotesReqInit::default().init(["SPY", "NOSUCHSYMBOL"]);
293293
let quotes = client.issue::<Get>(&req).await.unwrap();
294294
assert_eq!(quotes.len(), 1);
295295
}

src/data/v2/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ mod unfold;
66

77
/// Definitions for retrieval of market data bars.
88
pub mod bars;
9-
/// Functionality for retrieval of the most recent quote.
10-
pub mod last_quote;
9+
/// Functionality for retrieval of most recent quotes.
10+
pub mod last_quotes;
1111
/// Functionality for retrieving historic quotes.
1212
pub mod quotes;
1313
/// Definitions for real-time streaming of market data.

src/data/v2/quotes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::util::vec_from_str;
1414
use crate::Str;
1515

1616
/// A quote as returned by the /v2/stocks/<symbol>/quotes endpoint.
17-
pub use super::last_quote::Quote;
17+
pub use super::last_quotes::Quote;
1818

1919

2020
/// A collection of quotes as returned by the API. This is one page of

0 commit comments

Comments
 (0)