pub struct Index { /* private fields */ }Expand description
Индекс MOEX (indices).
Implementations§
Source§impl Index
impl Index
Sourcepub fn try_new(
id: String,
short_name: String,
from: Option<NaiveDate>,
till: Option<NaiveDate>,
) -> Result<Self, ParseIndexError>
pub fn try_new( id: String, short_name: String, from: Option<NaiveDate>, till: Option<NaiveDate>, ) -> Result<Self, ParseIndexError>
Построить индекс из wire-значений ISS с валидацией инвариантов.
Sourcepub fn id(&self) -> &IndexId
pub fn id(&self) -> &IndexId
Идентификатор индекса (indexid).
Examples found in repository?
examples/actual_indexes_dump.rs (line 93)
83fn load_actual_index_dumps(moex_client: &Client) -> Result<Vec<IndexDump>, ExampleError> {
84 let indexes = with_retry(retry_policy(), || moex_client.indexes())?.into_actual_by_till();
85 let page_limit = NonZeroU32::new(INDEX_ANALYTICS_PAGE_LIMIT)
86 .expect("INDEX_ANALYTICS_PAGE_LIMIT constant must be greater than zero");
87
88 indexes
89 .into_iter()
90 .map(|index| {
91 let components = with_retry(retry_policy(), || {
92 moex_client
93 .index(index.id().clone())
94 .expect("index id from payload must be valid")
95 .analytics_pages(page_limit)
96 .all()
97 })?
98 .into_actual_by_session()
99 .into_sorted_by_weight_desc();
100 Ok(IndexDump {
101 index_id: index.id().as_str().to_owned().into_boxed_str(),
102 short_name: index.short_name().to_owned().into_boxed_str(),
103 components,
104 })
105 })
106 .collect()
107}Sourcepub fn short_name(&self) -> &str
pub fn short_name(&self) -> &str
Краткое наименование индекса.
Examples found in repository?
examples/actual_indexes_dump.rs (line 102)
83fn load_actual_index_dumps(moex_client: &Client) -> Result<Vec<IndexDump>, ExampleError> {
84 let indexes = with_retry(retry_policy(), || moex_client.indexes())?.into_actual_by_till();
85 let page_limit = NonZeroU32::new(INDEX_ANALYTICS_PAGE_LIMIT)
86 .expect("INDEX_ANALYTICS_PAGE_LIMIT constant must be greater than zero");
87
88 indexes
89 .into_iter()
90 .map(|index| {
91 let components = with_retry(retry_policy(), || {
92 moex_client
93 .index(index.id().clone())
94 .expect("index id from payload must be valid")
95 .analytics_pages(page_limit)
96 .all()
97 })?
98 .into_actual_by_session()
99 .into_sorted_by_weight_desc();
100 Ok(IndexDump {
101 index_id: index.id().as_str().to_owned().into_boxed_str(),
102 short_name: index.short_name().to_owned().into_boxed_str(),
103 components,
104 })
105 })
106 .collect()
107}Sourcepub fn is_active_on(&self, date: NaiveDate) -> bool
pub fn is_active_on(&self, date: NaiveDate) -> bool
Проверить, что индекс активен на указанную дату.
Trait Implementations§
impl Eq for Index
impl StructuralPartialEq for Index
Auto Trait Implementations§
impl Freeze for Index
impl RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnsafeUnpin for Index
impl UnwindSafe for Index
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