use async_trait::async_trait;
use crate::broker::error::BrokerError;
use crate::broker::trait_::Broker;
use crate::domain::{
AssetProfile, BuyBlitzRequest, BuyDigitalRequest, OrderId, TechnicalIndicators,
};
#[async_trait]
pub trait IqOptionExtras: Broker {
async fn get_technical_indicators(
&self,
symbol: &str,
) -> Result<TechnicalIndicators, BrokerError>;
async fn get_asset_profile(&self, symbol: &str) -> Result<AssetProfile, BrokerError>;
async fn subscribe_live_deals(&self, symbol: &str) -> Result<(), BrokerError>;
async fn subscribe_commission_changes(&self) -> Result<(), BrokerError>;
async fn buy_blitz(&self, req: BuyBlitzRequest) -> Result<OrderId, BrokerError>;
async fn buy_digital_spot(&self, req: BuyDigitalRequest) -> Result<OrderId, BrokerError>;
}
use crate::broker::iq_option::IqOptionBroker;
#[async_trait]
impl IqOptionExtras for IqOptionBroker {
async fn get_technical_indicators(
&self,
symbol: &str,
) -> Result<TechnicalIndicators, BrokerError> {
self.get_technical_indicators(symbol).await
}
async fn get_asset_profile(&self, symbol: &str) -> Result<AssetProfile, BrokerError> {
self.get_asset_profile(symbol).await
}
async fn subscribe_live_deals(&self, symbol: &str) -> Result<(), BrokerError> {
self.subscribe_live_deals(symbol).await
}
async fn subscribe_commission_changes(&self) -> Result<(), BrokerError> {
self.subscribe_commission_changes().await
}
async fn buy_blitz(&self, req: BuyBlitzRequest) -> Result<OrderId, BrokerError> {
self.buy_blitz(req).await
}
async fn buy_digital_spot(&self, req: BuyDigitalRequest) -> Result<OrderId, BrokerError> {
self.buy_digital_spot(req).await
}
}