Skip to main content

TPOProfile

Struct TPOProfile 

Source
pub struct TPOProfile {
Show 17 fields pub session_date: DateTime<Utc>, pub tick_size: f64, pub instrument_tick: f64, pub row_ticks: u64, pub letters: Vec<TPOLetter>, pub price_tpo_count: HashMap<i64, usize>, pub poc_price: f64, pub value_area_high: f64, pub value_area_low: f64, pub initial_balance_high: f64, pub initial_balance_low: f64, pub profile_high: f64, pub profile_low: f64, pub opening_price: f64, pub single_prints: Vec<f64>, pub has_poor_high: bool, pub has_poor_low: bool,
}
Expand description

A complete TPO profile for one trading session.

Contains all TPO letters, statistical levels (POC, value area, initial balance), and structural flags (poor high/low, single prints).

Fields§

§session_date: DateTime<Utc>

Session timestamp

§tick_size: f64

Row height the profile’s prices are keyed on: row_ticks ticks of instrument_tick. It is the configured tick size, rounded up to whole instrument ticks when one is configured and widened to a whole number of rows when the bars span more than 1,000 of them, or the span divided into 1,000 rows without a usable tick size.

§instrument_tick: f64

Tick the rows are counted in: TPOConfig::instrument_tick, or tick_size itself, making every row one tick, without one or when prices are more than 2^50 ticks from zero.

§row_ticks: u64

Ticks of instrument_tick in each row. A row holds the ticks from a multiple of row_ticks up to the next and spans from half a tick below its first tick to half a tick below the next row’s, as footprint rows do.

§letters: Vec<TPOLetter>

All TPO letters in this profile

§price_tpo_count: HashMap<i64, usize>

TPO count at each price level

§poc_price: f64

Point of control: the price (lowest tick) of the row with the most TPOs. A tie takes the lower price.

§value_area_high: f64

Price of the highest row of the configured TPO-count value area. The area grows from the point of control toward whichever of the next two rows above or the next two rows below holds more TPOs; equal counts add one row on each side.

§value_area_low: f64

Price of its lowest row.

§initial_balance_high: f64

Highest price of the bars that open within the configured initial balance period, or f64::MIN when none does, so the profile has no initial balance.

§initial_balance_low: f64

Lowest price of those bars, or f64::MAX when none does.

§profile_high: f64

Profile high

§profile_low: f64

Profile low

§opening_price: f64

Opening price

§single_prints: Vec<f64>

Single prints: the prices of the rows with exactly one TPO, in ascending order

§has_poor_high: bool

Poor highs (multiple TPOs at high)

§has_poor_low: bool

Poor lows (multiple TPOs at low)

Implementations§

Source§

impl TPOProfile

Source

pub fn new(session_date: DateTime<Utc>, tick_size: f64) -> Self

Create a new empty TPO profile on rows of one tick of tick_size

Source

pub fn row_price(&self, price: f64) -> f64

Price of the row holding price: the row’s lowest tick.

Source

pub fn row_span(&self, price: f64) -> (f64, f64)

Lowest and highest price of the row holding price, from half a tick below its first tick to half a tick below the next row’s first tick.

Source

pub fn tpo_count_at(&self, price: f64) -> usize

Get the TPO count at a specific price level

Source

pub fn price_levels(&self) -> Vec<f64>

Get all unique price levels with TPOs

Source

pub fn is_in_value_area(&self, price: f64) -> bool

Check if a price is in the value area

Source

pub fn is_in_initial_balance(&self, price: f64) -> bool

Check if a price is in the initial balance

Source

pub fn width(&self) -> usize

Get profile width (number of periods)

Source

pub fn letters_at(&self, price: f64) -> Vec<&TPOLetter>

Get the letters at a specific price level

Source§

impl TPOProfile

Source

pub fn classify_shape(&self) -> ProfileShape

Classify the profile shape

Trait Implementations§

Source§

impl Clone for TPOProfile

Source§

fn clone(&self) -> TPOProfile

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TPOProfile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> MaybeSend for T
where T: Send + Sync + ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.