pub struct InstrumentKey {
pub ticker: String,
pub class_code: String,
}Expand description
Names one instrument for the broker: a ticker and a class code (board).
The same ticker can trade on several boards (for example SBER on TQBR), so the broker always
wants both. The class code is the code of the board on the exchange, TQBR for most Russian
shares.
§Examples
use brokapi_bcs_protocol::models::instrument::InstrumentKey;
let key = InstrumentKey::new("SBER", "TQBR");
assert_eq!(serde_json::to_string(&key)?, r#"{"ticker":"SBER","classCode":"TQBR"}"#);Fields§
§ticker: StringExchange ticker, for example SBER.
class_code: StringClass code (board) of the ticker, for example TQBR.
Implementations§
Source§impl InstrumentKey
impl InstrumentKey
Sourcepub fn new(ticker: impl Into<String>, class_code: impl Into<String>) -> Self
pub fn new(ticker: impl Into<String>, class_code: impl Into<String>) -> Self
Builds a key from a ticker and a class code.
§Examples
use brokapi_bcs_protocol::models::instrument::InstrumentKey;
let key = InstrumentKey::new(String::from("GAZP"), "TQBR");
assert_eq!((key.ticker.as_str(), key.class_code.as_str()), ("GAZP", "TQBR"));Trait Implementations§
Source§impl Clone for InstrumentKey
impl Clone for InstrumentKey
Source§fn clone(&self) -> InstrumentKey
fn clone(&self) -> InstrumentKey
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InstrumentKey
impl Debug for InstrumentKey
Source§impl<'de> Deserialize<'de> for InstrumentKey
impl<'de> Deserialize<'de> for InstrumentKey
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for InstrumentKey
Source§impl Hash for InstrumentKey
impl Hash for InstrumentKey
Source§impl PartialEq for InstrumentKey
impl PartialEq for InstrumentKey
Source§fn eq(&self, other: &InstrumentKey) -> bool
fn eq(&self, other: &InstrumentKey) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for InstrumentKey
impl Serialize for InstrumentKey
impl StructuralPartialEq for InstrumentKey
Auto Trait Implementations§
impl Freeze for InstrumentKey
impl RefUnwindSafe for InstrumentKey
impl Send for InstrumentKey
impl Sync for InstrumentKey
impl Unpin for InstrumentKey
impl UnsafeUnpin for InstrumentKey
impl UnwindSafe for InstrumentKey
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.