[−][src]Trait pikmin::downloader::Downloader
An abstraction of downloaders. You can make a new downloader by implementing this trait.
Associated Types
type IDT: DeserializeOwned + Display
A type of element which ID is made up of.
type ID: DownloaderID<Self::IDT> + From<Self::IDT> + DeserializeOwned + Serialize
A type of ID for specifying the downloading point in an API client.
type RAW
A type of downloaded trade data.
Required methods
fn start_id(&self) -> Self::IDT
Returns beginning ID for a downloading process.
fn end_id(&self) -> Self::IDT
Returns ending ID for a downloading process.
fn continue_condition(&self, current: &Self::IDT, end: &Self::IDT) -> bool
Judges whether to continue downloading or not.
fn fetch(&self, c: &Self::IDT) -> Result<Vec<Self::RAW>>
Fetches trade data from somewhere (typically API).
fn convert(&self, v: &Self::RAW) -> Result<Trade>
Converts a raw trade datum into a standard trade struct.
fn output(&self, u: Vec<Trade>, writer: &mut impl Writer) -> Result<Self::IDT>
Writes trade data to somewhere with a given writer. This must return an id for the next iteration, and this will be recorded on a progress file.
fn sleep_millis(&self) -> u64
Returns milli seconds to sleep between fetching processes.
Provided methods
fn init_id(
&self,
default: Self::IDT,
recorder: &mut impl ProgressRecorder
) -> Result<Self::ID>
&self,
default: Self::IDT,
recorder: &mut impl ProgressRecorder
) -> Result<Self::ID>
Returns initial ID from a progress file. If reading is failed, use a given default
value.
fn run(
&self,
writer: &mut impl Writer,
recorder: &mut impl ProgressRecorder
) -> Result<()>
&self,
writer: &mut impl Writer,
recorder: &mut impl ProgressRecorder
) -> Result<()>
Executes downloading.
Implementors
impl Downloader for BfDownloader
[src]
type IDT = u64
type ID = OrdID<Self::IDT>
type RAW = BfGetExecution
fn start_id(&self) -> Self::IDT
[src]
fn end_id(&self) -> Self::IDT
[src]
fn continue_condition(&self, current: &Self::IDT, end: &Self::IDT) -> bool
[src]
fn fetch(&self, c: &Self::IDT) -> Result<Vec<Self::RAW>>
[src]
fn convert(&self, v: &Self::RAW) -> Result<Trade>
[src]
fn output(&self, u: Vec<Trade>, writer: &mut impl Writer) -> Result<Self::IDT>
[src]
fn sleep_millis(&self) -> u64
[src]
fn init_id(
&self,
default: Self::IDT,
recorder: &mut impl ProgressRecorder
) -> Result<Self::ID>
[src]
&self,
default: Self::IDT,
recorder: &mut impl ProgressRecorder
) -> Result<Self::ID>
fn run(
&self,
writer: &mut impl Writer,
recorder: &mut impl ProgressRecorder
) -> Result<()>
[src]
&self,
writer: &mut impl Writer,
recorder: &mut impl ProgressRecorder
) -> Result<()>
impl Downloader for MexDownloader
[src]
type IDT = Pagination<DateTime<Utc>, DateTimeID>
type ID = PaginatedID<DateTime<Utc>, DateTimeID>
type RAW = MexGetExecution
fn start_id(&self) -> Self::IDT
[src]
fn end_id(&self) -> Self::IDT
[src]
fn continue_condition(&self, current: &Self::IDT, end: &Self::IDT) -> bool
[src]
fn fetch(&self, c: &Self::IDT) -> Result<Vec<MexGetExecution>>
[src]
fn convert(&self, v: &MexGetExecution) -> Result<Trade>
[src]
fn output(&self, u: Vec<Trade>, writer: &mut impl Writer) -> Result<Self::IDT>
[src]
Possibly some trades will be cut from the response if we just increment the starting timestamp since the API will return just requested number fo trades for single request. In order to avoid this, the last trades in terms of the traded timestamp should be ignored at the first time, and request again from the timestamp.
Mex API allows to send an offset parameter, so this will never get into an infinite loop.
fn sleep_millis(&self) -> u64
[src]
if we login, the API limit becomes 300/5min if not, it's 150/5min
fn init_id(
&self,
default: Self::IDT,
recorder: &mut impl ProgressRecorder
) -> Result<Self::ID>
[src]
&self,
default: Self::IDT,
recorder: &mut impl ProgressRecorder
) -> Result<Self::ID>
fn run(
&self,
writer: &mut impl Writer,
recorder: &mut impl ProgressRecorder
) -> Result<()>
[src]
&self,
writer: &mut impl Writer,
recorder: &mut impl ProgressRecorder
) -> Result<()>
impl Downloader for LiquidDownloader
[src]
type IDT = DateTime<Utc>
type ID = DateTimeID
type RAW = LiquidGetExecution
fn start_id(&self) -> DateTime<Utc>
[src]
fn end_id(&self) -> DateTime<Utc>
[src]
fn continue_condition(
&self,
current: &DateTime<Utc>,
end: &DateTime<Utc>
) -> bool
[src]
&self,
current: &DateTime<Utc>,
end: &DateTime<Utc>
) -> bool
fn fetch(&self, c: &Self::IDT) -> Result<Vec<LiquidGetExecution>>
[src]
fn convert(&self, v: &LiquidGetExecution) -> Result<Trade>
[src]
fn output(&self, u: Vec<Trade>, writer: &mut impl Writer) -> Result<Self::IDT>
[src]
Liquid (by Quoine) API has inconsistent statements in the document (https://developers.quoine.com/#get-executions-by-timestamp).
As Get Executions by Timestamp
won't return the complete executions at the same timestamp,
this function has to re-request the executions for the timestamp so as to obtain all of them.
Errors
In order to avoid an infinite loop, this function will return an error when there are more than 1,000 executions at the same timestamp.
fn sleep_millis(&self) -> u64
[src]
fn init_id(
&self,
default: Self::IDT,
recorder: &mut impl ProgressRecorder
) -> Result<Self::ID>
[src]
&self,
default: Self::IDT,
recorder: &mut impl ProgressRecorder
) -> Result<Self::ID>
fn run(
&self,
writer: &mut impl Writer,
recorder: &mut impl ProgressRecorder
) -> Result<()>
[src]
&self,
writer: &mut impl Writer,
recorder: &mut impl ProgressRecorder
) -> Result<()>