Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix get_quote_period_interval() where interval/range doesn't work (Issue #60) #62

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/dividends.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::time::{Duration, UNIX_EPOCH};

use time::{macros::datetime, OffsetDateTime};
use time::macros::datetime;
use time::OffsetDateTime;

use yahoo_finance_api as yahoo;

Expand Down
3 changes: 2 additions & 1 deletion examples/splits.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::time::{Duration, UNIX_EPOCH};

use time::{macros::datetime, OffsetDateTime};
use time::macros::datetime;
use time::OffsetDateTime;

use yahoo_finance_api as yahoo;

Expand Down
4 changes: 2 additions & 2 deletions src/async_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ impl YahooConnector {
pub async fn get_quote_period_interval(
&self,
ticker: &str,
period: &str,
range: &str,
interval: &str,
prepost: bool,
) -> Result<YResponse, YahooError> {
let url = format!(
YCHART_PERIOD_INTERVAL_QUERY!(),
url = self.url,
symbol = ticker,
period = period,
range = range,
interval = interval,
prepost = prepost,
);
Expand Down
4 changes: 2 additions & 2 deletions src/blocking_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ impl YahooConnector {
pub fn get_quote_period_interval(
&self,
ticker: &str,
period: &str,
range: &str,
interval: &str,
prepost: bool,
) -> Result<YResponse, YahooError> {
let url = format!(
YCHART_PERIOD_INTERVAL_QUERY!(),
url = self.url,
symbol = ticker,
period = period,
range = range,
interval = interval,
prepost = prepost,
);
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,13 @@ macro_rules! YCHART_PERIOD_QUERY {
};
}
macro_rules! YCHART_RANGE_QUERY {
() => {
"{url}/{symbol}?symbol={symbol}&interval={interval}&range={range}&events=div|split|capitalGains"
};
() => {
"{url}/{symbol}?symbol={symbol}&interval={interval}&range={range}&events=div|split|capitalGains"
};
}
macro_rules! YCHART_PERIOD_INTERVAL_QUERY {
() => {
"{url}/{symbol}?symbol={symbol}&period={period}&interval={interval}&includePrePost={prepost}"
"{url}/{symbol}?symbol={symbol}&range={range}&interval={interval}&includePrePost={prepost}"
};
}
macro_rules! YTICKER_QUERY {
Expand Down
10 changes: 5 additions & 5 deletions src/quotes.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use std::{collections::HashMap, fmt};
use std::collections::HashMap;
use std::fmt;

use serde::{
de::{self, Deserializer, MapAccess, SeqAccess, Visitor},
Deserialize, Serialize,
};
use serde::de::{self, Deserializer, MapAccess, SeqAccess, Visitor};
use serde::{Deserialize, Serialize};

use super::YahooError;

Expand Down Expand Up @@ -104,6 +103,7 @@ impl YResponse {
}
Ok(vec![])
}

/// This method retrieves information about the dividends that have
/// been recorded during the considered time period.
///
Expand Down
Loading