From 0ea8a55a7f7f1411387a7b7d34a0734da07d4ba9 Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Wed, 13 Jan 2021 09:04:58 +0000 Subject: [PATCH] BfxWrapper -> BfxConnector --- rustybot/src/connectors.rs | 8 ++++---- rustybot/src/main.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rustybot/src/connectors.rs b/rustybot/src/connectors.rs index e1591b5..2abbfbc 100644 --- a/rustybot/src/connectors.rs +++ b/rustybot/src/connectors.rs @@ -28,16 +28,16 @@ pub trait Connector { ) -> Result<(), BoxError>; } -pub struct BfxWrapper { +pub struct BitfinexConnector { bfx: Bitfinex, affiliate_code: Option, // account_info: String, // ledger: String, } -impl BfxWrapper { +impl BitfinexConnector { pub fn new(api_key: &str, api_secret: &str) -> Self { - BfxWrapper { + BitfinexConnector { bfx: Bitfinex::new(Some(api_key.into()), Some(api_secret.into())), affiliate_code: None, } @@ -97,7 +97,7 @@ impl From<&OrderKind> for bitfinex::orders::OrderKind { } #[async_trait] -impl Connector for BfxWrapper { +impl Connector for BitfinexConnector { async fn active_positions(&self, pair: &SymbolPair) -> Result, BoxError> { let active_positions = self.bfx.positions.active_positions().await?; diff --git a/rustybot/src/main.rs b/rustybot/src/main.rs index dea442d..22ce0de 100644 --- a/rustybot/src/main.rs +++ b/rustybot/src/main.rs @@ -1,7 +1,7 @@ use tokio::time::{delay_for, Duration}; use crate::bot::BfxBot; -use crate::connectors::BfxWrapper; +use crate::connectors::BitfinexConnector; use crate::currency::{Symbol, SymbolPair}; use crate::events::SignalKind; use crate::strategy::TrailingStop; @@ -23,7 +23,7 @@ pub type BoxError = Box; async fn main() -> Result<(), BoxError> { let test_api_key = "P1EVE68DJByDAkGQvpIkTwfrbYXd2Vo2ZaIhTYb9vx2"; let test_api_secret = "1nicg8z0zKVEt5Rb7ZDpIYjVYVTgvCaCPMZqB0niFli"; - let bfx = BfxWrapper::new(test_api_key, test_api_secret) + let bfx = BitfinexConnector::new(test_api_key, test_api_secret) .with_affiliate_code(Some("XPebOgHxA".into())); let mut bot = BfxBot::new(