Struct sgip_signal::SgipSignal[][src]

pub struct SgipSignal { /* fields omitted */ }

An authenticated session with the SGIP Signal API.

After registering an account, create a new session using SgipSignal::login. The SGIP Signal API performs authentication using bearer tokens valid for 30 minutes; the SgipSignal type automatically refreshes the bearer tokens as required.

Implementations

impl SgipSignal[src]

pub async fn login(username: &str, password: &str) -> Result<Self, Error>[src]

Log in to the SGIP Signal API, producing a new session token on success.

pub async fn moer(&mut self, region: GridRegion) -> Result<Moer, Error>[src]

Fetch the latest MOER for the specified grid region.

Per the API description, this returns the latest MOER data, which may not be the current data:

Note that MOERs are usually available two to three minutes before the timestamp for which they are valid. For example, the MOER valid from 12:00 to 12:05 will typically become available through the API around 11:58 and will be published no later than 12:00. The availability of the next MOER datapoint is dependent on when CAISO market data becomes available and as such is somewhat variable.

pub async fn historic_moers(
    &mut self,
    region: GridRegion,
    start: DateTime<Utc>,
    end: Option<DateTime<Utc>>
) -> Result<Vec<Moer>, Error>
[src]

Fetch historic MOERs for the specified grid region.

If the end time is None, the query requests data from the start time to the present.

The API description notes that

Historical queries are limited to a maximum time span of 31 days.

pub async fn forecast(&mut self, region: GridRegion) -> Result<Forecast, Error>[src]

Fetch the latest forecast for future MOERs in the specified grid region.

pub async fn historic_forecasts(
    &mut self,
    region: GridRegion,
    start: DateTime<Utc>,
    end: DateTime<Utc>
) -> Result<Vec<Forecast>, Error>
[src]

Fetch the historic forecasts for future Marginal Operating Emissions Rates in the specified grid region.

Note that the start and end parameters select the time range when the forecasts were generated, not the time range predicted by those forecasts, as described in the API description:

Every five minutes, WattTime generates a new forecast which is 72 hours in duration. So, if you make a request to the forecast endpoint with starttime of Jan 1, 1:00 and endtime Jan 1, 1:05, you will receive the 72-hour forecast generated at 1:00, and the 72-hour forecast generated at 1:05 on January 1.

The following limits apply to historical queries:

Historical forecast queries are limited to a maximum time span of 1 day, so if you want to query more data than that, please break up your request into multiple queries. A year of historical forecast data is available for the CAISO grid regions.

Trait Implementations

impl Debug for SgipSignal[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.