You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.7 KiB
58 lines
1.7 KiB
use crate::data::*;
|
|
use crate::DynResult;
|
|
|
|
/*
|
|
A data service must implement at lease one of the following traits
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Important to note that Paramaters can be typed as Option<P> during implemenation
|
|
and that the actual strucut/type passed into these is flexable. This should allow
|
|
each services library to implement a paramates trait that works for them, or
|
|
leave paramaters as 'None'
|
|
|
|
This way you can lock down what paramaters are required for each indiviudual service
|
|
while still allowing the RustyTrade framework to reliably obtain the expected struct
|
|
from each trait interface.
|
|
|
|
struct ExamplePriceHistoryParams {
|
|
start_date: i64,
|
|
end_date: i64
|
|
}
|
|
|
|
struct ExampleDataService {};
|
|
impl GetPriceHistory for ExampleDataService {
|
|
type Paramaters = ExamplePriceHistoryParmas;
|
|
fn get_price_history(&mut self, paramaters: Self::Paramaters)-> DynResult<PriceHistory> {
|
|
|
|
}
|
|
}
|
|
|
|
*/
|
|
pub trait GetEquity {
|
|
type Paramaters;
|
|
fn get_equity(&mut self, paramaters: Self::Paramaters) -> DynResult<equity::Equity>;
|
|
}
|
|
pub trait GetCrypto {
|
|
type Paramaters;
|
|
fn get_crypto(&mut self, paramaters: Self::Paramaters) -> DynResult<crypto::Crypto>;
|
|
}
|
|
pub trait GetOptionContract {
|
|
type Paramaters;
|
|
fn get_option_contract(&mut self, paramaters: Self::Paramaters) -> DynResult<options::OptionContract>;
|
|
}
|
|
pub trait GetOptionChain {
|
|
type Paramaters;
|
|
fn get_options_chain_vec(&mut self, paramaters: Self::Paramaters) -> DynResult<Vec<options::OptionContract>>;
|
|
fn get_options_chain_dataframe(&mut self, paramaters: Self::Paramaters) -> DynResult<options::OptionChainDataFrame>;
|
|
}
|
|
pub trait GetPriceHistory{
|
|
type Paramaters;
|
|
fn get_price_history(&mut self, paramaters: Self::Paramaters)-> DynResult<price_history::PriceHistory>;
|
|
}
|
|
|
|
|