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 77)
67fn load_actual_index_dumps(moex_client: &Client) -> Result<Vec<IndexDump>, ExampleError> {
68 let indexes = with_retry(retry_policy(), || moex_client.indexes())?.into_actual_by_till();
69 let page_limit = NonZeroU32::new(INDEX_ANALYTICS_PAGE_LIMIT)
70 .expect("INDEX_ANALYTICS_PAGE_LIMIT constant must be greater than zero");
71
72 indexes
73 .into_iter()
74 .map(|index| {
75 let components = with_retry(retry_policy(), || {
76 moex_client
77 .index(index.id().clone())
78 .expect("index id from payload must be valid")
79 .analytics_pages(page_limit)
80 .all()
81 })?
82 .into_actual_by_session()
83 .into_sorted_by_weight_desc();
84 Ok(IndexDump {
85 index_id: index.id().as_str().to_owned().into_boxed_str(),
86 short_name: index.short_name().to_owned().into_boxed_str(),
87 components,
88 })
89 })
90 .collect()
91}Sourcepub fn short_name(&self) -> &str
pub fn short_name(&self) -> &str
Краткое наименование индекса.
Examples found in repository?
examples/actual_indexes_dump.rs (line 86)
67fn load_actual_index_dumps(moex_client: &Client) -> Result<Vec<IndexDump>, ExampleError> {
68 let indexes = with_retry(retry_policy(), || moex_client.indexes())?.into_actual_by_till();
69 let page_limit = NonZeroU32::new(INDEX_ANALYTICS_PAGE_LIMIT)
70 .expect("INDEX_ANALYTICS_PAGE_LIMIT constant must be greater than zero");
71
72 indexes
73 .into_iter()
74 .map(|index| {
75 let components = with_retry(retry_policy(), || {
76 moex_client
77 .index(index.id().clone())
78 .expect("index id from payload must be valid")
79 .analytics_pages(page_limit)
80 .all()
81 })?
82 .into_actual_by_session()
83 .into_sorted_by_weight_desc();
84 Ok(IndexDump {
85 index_id: index.id().as_str().to_owned().into_boxed_str(),
86 short_name: index.short_name().to_owned().into_boxed_str(),
87 components,
88 })
89 })
90 .collect()
91}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