pub struct Aggregations { /* fields omitted */ }Represents an endpoint that returns trade aggregations.
https://www.stellar.org/developers/horizon/reference/endpoints/trade_aggregations.html
use stellar_client::sync::Client;
use stellar_client::endpoint::{Direction, Order, trade};
use stellar_client::resources::AssetIdentifier;
use std::time::{SystemTime, UNIX_EPOCH};
let client = Client::horizon_test().unwrap();
let trades = trade::All::default().with_order(Direction::Asc);
let trades = client.request(trades).unwrap();
let trade = &trades.records()[0];
let base = trade.base_asset();
let counter = trade.counter_asset();
let now = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs() * 1000;
let agg = trade::Aggregations::new(base, counter)
.with_start_time(0)
.with_end_time(now)
.with_resolution(trade::SegmentResolution::OneWeek);
let records = client.request(agg).unwrap();
Creates a new aggregations endpoint. There are some defaults but generally
these can be constructed with the with_* commands.
Sets the resolution to bin by. The pagination will increment at this
interval of milliseconds.
use stellar_client::sync::Client;
use stellar_client::endpoint::trade;
use stellar_client::resources::AssetIdentifier;
let base = AssetIdentifier::native();
let counter = AssetIdentifier::native();
let endpoint = trade::Aggregations::new(&base, &counter)
.with_resolution(trade::SegmentResolution::FiveMin);
Sets the start_time to begin the aggregations at. Taken as milliseconds
from epoch.
use stellar_client::sync::Client;
use stellar_client::endpoint::trade;
use stellar_client::resources::AssetIdentifier;
let base = AssetIdentifier::native();
let counter = AssetIdentifier::native();
let endpoint = trade::Aggregations::new(&base, &counter)
.with_start_time(300_000);
Sets the end_time to begin the aggregations at. Taken as milliseconds
from epoch.
use stellar_client::sync::Client;
use stellar_client::endpoint::trade;
use stellar_client::resources::AssetIdentifier;
let base = AssetIdentifier::native();
let counter = AssetIdentifier::native();
let endpoint = trade::Aggregations::new(&base, &counter)
.with_end_time(300_000);
Formats the value using the given formatter. Read more
Performs copy-assignment from source. Read more
Sets a limit on the struct and returns an owned version.
Returns the limit or None.
Sets the order on the struct and returns an owned version.
Returns the order that has been set, if it has been set.
The deserializable type that is expected to come back from the stellar server.
The request body to be sent to stellar. Generally this is just a () unit. Converts the implementing struct into an http request. Read more