pub struct DividendDb { /* private fields */ }Expand description
分红 LevelDB 查询句柄。
Implementations§
Source§impl DividendDb
impl DividendDb
Sourcepub fn new<P: AsRef<Path>>(path: P) -> Result<Self, DividendError>
pub fn new<P: AsRef<Path>>(path: P) -> Result<Self, DividendError>
打开 DividData 数据库目录。
注意:LevelDB 同时只能被一个进程加锁访问;如果 QMT 正在运行, 打开原目录可能失败,通常建议传入备份目录。
§Examples
use qmt_parser::dividend::DividendDb;
let _db = DividendDb::new("/path/to/DividData")?;Sourcepub fn query(
&mut self,
market: &str,
code: &str,
) -> Result<Vec<DividendRecord>, DividendError>
pub fn query( &mut self, market: &str, code: &str, ) -> Result<Vec<DividendRecord>, DividendError>
查询指定市场和证券代码的除权除息记录。
market 典型值为 SH、SZ、BJ。
§Examples
use qmt_parser::dividend::DividendDb;
let mut db = DividendDb::new("/path/to/DividData")?;
let records = db.query("SH", "600000")?;
println!("records = {}", records.len());Auto Trait Implementations§
impl Freeze for DividendDb
impl !RefUnwindSafe for DividendDb
impl Send for DividendDb
impl !Sync for DividendDb
impl Unpin for DividendDb
impl UnsafeUnpin for DividendDb
impl !UnwindSafe for DividendDb
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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