Show / Hide Table of Contents

Struct Price

Provides methods and properties for accessing price data.

Implements
IEquatable<Price>
IEquatable<decimal>
IComparable<Price>
IComparable<decimal>
Inherited Members
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetType()
Namespace: tt_net_sdk
Assembly: tt-net-api.dll
Syntax
public struct Price : IEquatable<Price>, IEquatable<decimal>, IComparable<Price>, IComparable<decimal>

Fields

Empty

Represents an empty price

Declaration
public static readonly Price Empty
Field Value
Type Description
Price

Invalid

Represents an invalid price

Declaration
public static readonly Price Invalid
Field Value
Type Description
Price

Properties

InstrumentDetails

Returns the instrument details associated with this price

Declaration
public InstrumentDetails InstrumentDetails { get; }
Property Value
Type Description
InstrumentDetails

InvalidTickValue

Declaration
public static int InvalidTickValue { get; }
Property Value
Type Description
int

InvalidValue

Declaration
public static decimal InvalidValue { get; }
Property Value
Type Description
decimal

IsTradable

Indicates whether this price is tradable for the associated Instrument

Declaration
public bool IsTradable { get; }
Property Value
Type Description
bool

IsValid

Indicates whether this price is valid for the associated instrument

Declaration
public bool IsValid { get; }
Property Value
Type Description
bool

Value

Returns the value of this field as a decimal value

Declaration
public decimal Value { get; }
Property Value
Type Description
decimal

Methods

Add(int)

Declaration
public Price Add(int tick)
Parameters
Type Name Description
int tick
Returns
Type Description
Price

Add(Price)

Addition operators.

Declaration
public Price Add(Price p1)
Parameters
Type Name Description
Price p1
Returns
Type Description
Price

AdjustPriceToTick(decimal, decimal, Rounding)

Declaration
public static decimal AdjustPriceToTick(decimal priceInPoints, decimal tickSize, Rounding round)
Parameters
Type Name Description
decimal priceInPoints
decimal tickSize
Rounding round
Returns
Type Description
decimal

CompareTo(decimal)

Declaration
public int CompareTo(decimal price)
Parameters
Type Name Description
decimal price
Returns
Type Description
int

CompareTo(Price)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

Declaration
public int CompareTo(Price other)
Parameters
Type Name Description
Price other

An object to compare with this instance.

Returns
Type Description
int

A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes other in the sort order. Zero This instance occurs in the same position in the sort order as other. Greater than zero This instance follows other in the sort order.

Divide(int)

Declaration
public Price Divide(int tick)
Parameters
Type Name Description
int tick
Returns
Type Description
Price

Divide(Price)

Division operators.

Declaration
public Price Divide(Price p1)
Parameters
Type Name Description
Price p1
Returns
Type Description
Price

Equals(decimal)

Declaration
public bool Equals(decimal price)
Parameters
Type Name Description
decimal price
Returns
Type Description
bool

Equals(object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
object obj
Returns
Type Description
bool
Overrides
ValueType.Equals(object)

Equals(Price)

Declaration
public bool Equals(Price obj)
Parameters
Type Name Description
Price obj
Returns
Type Description
bool

FromDecimal(Instrument, decimal, Rounding)

Creates a Price object from a decimal value with or without rounding

Declaration
public static Price FromDecimal(Instrument instr, decimal dPrice, Rounding rnd = Rounding.None)
Parameters
Type Name Description
Instrument instr

Instrument

decimal dPrice

Price

Rounding rnd

Rounding type

Returns
Type Description
Price

FromString(Instrument, string, Rounding)

Creates a Price object from a string value with or without rounding.

Declaration
public static Price FromString(Instrument instr, string sPrice, Rounding rnd = Rounding.None)
Parameters
Type Name Description
Instrument instr

Instrument

string sPrice

Price

Rounding rnd

Rounding type

Returns
Type Description
Price

FromTick(Instrument, int, Rounding)

Creates a Price object from a tick value with or without rounding

Declaration
public static Price FromTick(Instrument instr, int ticks, Rounding rnd = Rounding.None)
Parameters
Type Name Description
Instrument instr

Instrument

int ticks

Price

Rounding rnd

Rounding type

Returns
Type Description
Price

GetHashCode()

Hash code for the object

Declaration
public override int GetHashCode()
Returns
Type Description
int
Overrides
ValueType.GetHashCode()

GetTickPrice(int)

Rounds and then increments the price.

Declaration
public Price GetTickPrice(int offset)
Parameters
Type Name Description
int offset
Returns
Type Description
Price

IsEmpty(Price)

Indicates whether a price is empty

Declaration
public static bool IsEmpty(Price price)
Parameters
Type Name Description
Price price

The price to test

Returns
Type Description
bool

Multiply(int)

Declaration
public Price Multiply(int tick)
Parameters
Type Name Description
int tick
Returns
Type Description
Price

Multiply(Price)

Multiplication operators.

Declaration
public Price Multiply(Price p1)
Parameters
Type Name Description
Price p1
Returns
Type Description
Price

Offset(int, Rounding)

Return the current price which is offset for a given amount of ticks.

Declaration
public Price Offset(int offset, Rounding round)
Parameters
Type Name Description
int offset
Rounding round
Returns
Type Description
Price

Round(Rounding)

Rounds the current price.

Declaration
public Price Round(Rounding round)
Parameters
Type Name Description
Rounding round
Returns
Type Description
Price

Subtract(int)

Declaration
public Price Subtract(int tick)
Parameters
Type Name Description
int tick
Returns
Type Description
Price

Subtract(Price)

Subtraction operators.

Declaration
public Price Subtract(Price p1)
Parameters
Type Name Description
Price p1
Returns
Type Description
Price

ToCurrency(CurrencyCode)

Returns the price in the given currency.

Declaration
public Price ToCurrency(CurrencyCode toCurrency)
Parameters
Type Name Description
CurrencyCode toCurrency
Returns
Type Description
Price

ToDecimal()

Express the price as a decimal (in points).

Declaration
public decimal ToDecimal()
Returns
Type Description
decimal

ToDecimalFormattedString()

Express the price as a decimal formatted string.

Declaration
public string ToDecimalFormattedString()
Returns
Type Description
string

ToNativeCurrency()

Returns the price in the Instrument's native currency

Declaration
public Price ToNativeCurrency()
Returns
Type Description
Price

ToPrimaryCurrency()

Returns the price in the system's primary currency

Declaration
public Price ToPrimaryCurrency()
Returns
Type Description
Price

ToString()

Express the price as a string.

Declaration
public override string ToString()
Returns
Type Description
string
Overrides
ValueType.ToString()

ToTicks()

Express the price as a tick.

Declaration
public int ToTicks()
Returns
Type Description
int

Operators

operator +(int, Price)

Declaration
public static Price operator +(int tick, Price price)
Parameters
Type Name Description
int tick
Price price
Returns
Type Description
Price

operator +(Price, int)

Declaration
public static Price operator +(Price price, int tick)
Parameters
Type Name Description
Price price
int tick
Returns
Type Description
Price

operator +(Price, Price)

Declaration
public static Price operator +(Price left, Price right)
Parameters
Type Name Description
Price left
Price right
Returns
Type Description
Price

operator --(Price)

Declaration
public static Price operator --(Price price)
Parameters
Type Name Description
Price price
Returns
Type Description
Price

operator /(int, Price)

Declaration
public static Price operator /(int tick, Price price)
Parameters
Type Name Description
int tick
Price price
Returns
Type Description
Price

operator /(Price, int)

Declaration
public static Price operator /(Price price, int tick)
Parameters
Type Name Description
Price price
int tick
Returns
Type Description
Price

operator /(Price, Price)

Declaration
public static Price operator /(Price left, Price right)
Parameters
Type Name Description
Price left
Price right
Returns
Type Description
Price

operator ==(decimal, Price)

Declaration
public static bool operator ==(decimal left, Price right)
Parameters
Type Name Description
decimal left
Price right
Returns
Type Description
bool

operator ==(Price, decimal)

Declaration
public static bool operator ==(Price left, decimal right)
Parameters
Type Name Description
Price left
decimal right
Returns
Type Description
bool

operator ==(Price, Price)

Equality operators.

Declaration
public static bool operator ==(Price left, Price right)
Parameters
Type Name Description
Price left
Price right
Returns
Type Description
bool

operator >(decimal, Price)

Declaration
public static bool operator >(decimal left, Price right)
Parameters
Type Name Description
decimal left
Price right
Returns
Type Description
bool

operator >(Price, decimal)

Declaration
public static bool operator >(Price left, decimal right)
Parameters
Type Name Description
Price left
decimal right
Returns
Type Description
bool

operator >(Price, Price)

Declaration
public static bool operator >(Price left, Price right)
Parameters
Type Name Description
Price left
Price right
Returns
Type Description
bool

operator >=(decimal, Price)

Declaration
public static bool operator >=(decimal left, Price right)
Parameters
Type Name Description
decimal left
Price right
Returns
Type Description
bool

operator >=(Price, decimal)

Declaration
public static bool operator >=(Price left, decimal right)
Parameters
Type Name Description
Price left
decimal right
Returns
Type Description
bool

operator >=(Price, Price)

Declaration
public static bool operator >=(Price left, Price right)
Parameters
Type Name Description
Price left
Price right
Returns
Type Description
bool

implicit operator decimal(Price)

Conversion operator

Declaration
public static implicit operator decimal(Price obj)
Parameters
Type Name Description
Price obj
Returns
Type Description
decimal

operator ++(Price)

Declaration
public static Price operator ++(Price price)
Parameters
Type Name Description
Price price
Returns
Type Description
Price

operator !=(decimal, Price)

Declaration
public static bool operator !=(decimal left, Price right)
Parameters
Type Name Description
decimal left
Price right
Returns
Type Description
bool

operator !=(Price, decimal)

Declaration
public static bool operator !=(Price left, decimal right)
Parameters
Type Name Description
Price left
decimal right
Returns
Type Description
bool

operator !=(Price, Price)

Inequality operators.

Declaration
public static bool operator !=(Price left, Price right)
Parameters
Type Name Description
Price left
Price right
Returns
Type Description
bool

operator <(decimal, Price)

Declaration
public static bool operator <(decimal left, Price right)
Parameters
Type Name Description
decimal left
Price right
Returns
Type Description
bool

operator <(Price, decimal)

Declaration
public static bool operator <(Price left, decimal right)
Parameters
Type Name Description
Price left
decimal right
Returns
Type Description
bool

operator <(Price, Price)

Comparison operators

Declaration
public static bool operator <(Price left, Price right)
Parameters
Type Name Description
Price left
Price right
Returns
Type Description
bool

operator <=(decimal, Price)

Declaration
public static bool operator <=(decimal left, Price right)
Parameters
Type Name Description
decimal left
Price right
Returns
Type Description
bool

operator <=(Price, decimal)

Declaration
public static bool operator <=(Price left, decimal right)
Parameters
Type Name Description
Price left
decimal right
Returns
Type Description
bool

operator <=(Price, Price)

Declaration
public static bool operator <=(Price left, Price right)
Parameters
Type Name Description
Price left
Price right
Returns
Type Description
bool

operator *(int, Price)

Declaration
public static Price operator *(int tick, Price price)
Parameters
Type Name Description
int tick
Price price
Returns
Type Description
Price

operator *(Price, int)

Declaration
public static Price operator *(Price price, int tick)
Parameters
Type Name Description
Price price
int tick
Returns
Type Description
Price

operator *(Price, Price)

Declaration
public static Price operator *(Price left, Price right)
Parameters
Type Name Description
Price left
Price right
Returns
Type Description
Price

operator -(int, Price)

Declaration
public static Price operator -(int tick, Price price)
Parameters
Type Name Description
int tick
Price price
Returns
Type Description
Price

operator -(Price, int)

Declaration
public static Price operator -(Price price, int tick)
Parameters
Type Name Description
Price price
int tick
Returns
Type Description
Price

operator -(Price, Price)

Declaration
public static Price operator -(Price left, Price right)
Parameters
Type Name Description
Price left
Price right
Returns
Type Description
Price

Implements

IEquatable<T>
IEquatable<T>
IComparable<T>
IComparable<T>
In this article
Back to top