pub struct HistoricalDataHandle { /* private fields */ }Implementations§
Source§impl HistoricalDataHandle
impl HistoricalDataHandle
Sourcepub async fn ticks(
&self,
asset: String,
period: u32,
) -> PocketResult<Vec<(i64, f64)>>
pub async fn ticks( &self, asset: String, period: u32, ) -> PocketResult<Vec<(i64, f64)>>
Retrieves historical tick data (timestamp, price) for a specific asset and period.
§Expected Data Format
The response is expected to contain a list of ticks, where each tick is a tuple of (timestamp, price).
§Example
ⓘ
let ticks = handle.ticks("EURUSD_otc".to_string(), 60).await?;
for (timestamp, price) in ticks {
println!("Time: {}, Price: {}", timestamp, price);
}Sourcepub async fn candles(
&self,
asset: String,
period: u32,
) -> PocketResult<Vec<Candle>>
pub async fn candles( &self, asset: String, period: u32, ) -> PocketResult<Vec<Candle>>
Retrieves historical candle data for a specific asset and period.
§Expected Data Format
The response is expected to contain a list of Candle objects.
The server response typically includes OHLC data which is parsed into Candle structs.
§Example
ⓘ
let candles = handle.candles("EURUSD_otc".to_string(), 60).await?;
for candle in candles {
println!("Time: {}, Open: {}, Close: {}", candle.timestamp, candle.open, candle.close);
}Sourcepub async fn get_history(
&self,
asset: String,
period: u32,
) -> PocketResult<Vec<Candle>>
pub async fn get_history( &self, asset: String, period: u32, ) -> PocketResult<Vec<Candle>>
Deprecated: use ticks() or candles() instead.
Trait Implementations§
Source§impl Clone for HistoricalDataHandle
impl Clone for HistoricalDataHandle
Source§fn clone(&self) -> HistoricalDataHandle
fn clone(&self) -> HistoricalDataHandle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HistoricalDataHandle
impl !RefUnwindSafe for HistoricalDataHandle
impl Send for HistoricalDataHandle
impl Sync for HistoricalDataHandle
impl Unpin for HistoricalDataHandle
impl UnsafeUnpin for HistoricalDataHandle
impl !UnwindSafe for HistoricalDataHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more