pub struct DCAContext(/* private fields */);Expand description
Dollar-cost averaging (DCA) plan management context.
Implementations§
Source§impl DCAContext
impl DCAContext
Sourcepub fn new(config: Arc<Config>) -> Self
pub fn new(config: Arc<Config>) -> Self
Create a DCAContext
Sourcepub fn log_subscriber(&self) -> Arc<dyn Subscriber + Send + Sync>
pub fn log_subscriber(&self) -> Arc<dyn Subscriber + Send + Sync>
Returns the log subscriber
Sourcepub async fn list(
&self,
status: Option<DCAStatus>,
symbol: Option<String>,
) -> Result<DcaList>
pub async fn list( &self, status: Option<DCAStatus>, symbol: Option<String>, ) -> Result<DcaList>
List DCA plans.
Path: GET /v1/dailycoins/query
Sourcepub async fn create(
&self,
symbol: impl Into<String>,
amount: impl Into<String>,
frequency: DCAFrequency,
day_of_week: Option<String>,
day_of_month: Option<u32>,
allow_margin: bool,
) -> Result<DcaCreateResult>
pub async fn create( &self, symbol: impl Into<String>, amount: impl Into<String>, frequency: DCAFrequency, day_of_week: Option<String>, day_of_month: Option<u32>, allow_margin: bool, ) -> Result<DcaCreateResult>
Create a new DCA plan.
Path: POST /v1/dailycoins/create
Sourcepub async fn update(
&self,
plan_id: impl Into<String>,
amount: Option<String>,
frequency: Option<DCAFrequency>,
day_of_week: Option<String>,
day_of_month: Option<u32>,
allow_margin: Option<bool>,
) -> Result<DcaCreateResult>
pub async fn update( &self, plan_id: impl Into<String>, amount: Option<String>, frequency: Option<DCAFrequency>, day_of_week: Option<String>, day_of_month: Option<u32>, allow_margin: Option<bool>, ) -> Result<DcaCreateResult>
Update a DCA plan.
Path: POST /v1/dailycoins/update
Sourcepub async fn resume(&self, plan_id: impl Into<String>) -> Result<()>
pub async fn resume(&self, plan_id: impl Into<String>) -> Result<()>
Resume a suspended DCA plan.
Sourcepub async fn stop(&self, plan_id: impl Into<String>) -> Result<()>
pub async fn stop(&self, plan_id: impl Into<String>) -> Result<()>
Stop (permanently finish) a DCA plan.
Sourcepub async fn history(
&self,
plan_id: impl Into<String>,
page: i32,
limit: i32,
) -> Result<DcaHistoryResponse>
pub async fn history( &self, plan_id: impl Into<String>, page: i32, limit: i32, ) -> Result<DcaHistoryResponse>
Get execution history for a DCA plan.
Path: GET /v1/dailycoins/query-records
Sourcepub async fn stats(&self, symbol: Option<String>) -> Result<DcaStats>
pub async fn stats(&self, symbol: Option<String>) -> Result<DcaStats>
Get DCA statistics.
Path: GET /v1/dailycoins/statistic
Sourcepub async fn check_support(
&self,
symbols: Vec<String>,
) -> Result<DcaSupportList>
pub async fn check_support( &self, symbols: Vec<String>, ) -> Result<DcaSupportList>
Check DCA support for a list of securities.
Path: POST /v1/dailycoins/batch-check-support
Sourcepub async fn calc_date(
&self,
symbol: impl Into<String>,
frequency: DCAFrequency,
day_of_week: Option<String>,
day_of_month: Option<u32>,
) -> Result<DcaCalcDateResult>
pub async fn calc_date( &self, symbol: impl Into<String>, frequency: DCAFrequency, day_of_week: Option<String>, day_of_month: Option<u32>, ) -> Result<DcaCalcDateResult>
Calculate the next projected trade date for a DCA plan with the given schedule parameters.
Path: POST /v1/dailycoins/calc-trd-date
Trait Implementations§
Source§impl Clone for DCAContext
impl Clone for DCAContext
Source§fn clone(&self) -> DCAContext
fn clone(&self) -> DCAContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DCAContext
impl !RefUnwindSafe for DCAContext
impl Send for DCAContext
impl Sync for DCAContext
impl Unpin for DCAContext
impl UnsafeUnpin for DCAContext
impl !UnwindSafe for DCAContext
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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