rust #10
@ -28,16 +28,16 @@ pub trait Connector {
|
||||
) -> Result<(), BoxError>;
|
||||
}
|
||||
|
||||
pub struct BfxWrapper {
|
||||
pub struct BitfinexConnector {
|
||||
bfx: Bitfinex,
|
||||
affiliate_code: Option<String>,
|
||||
// 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<Vec<Position>, BoxError> {
|
||||
let active_positions = self.bfx.positions.active_positions().await?;
|
||||
|
||||
|
@ -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<dyn std::error::Error + Send + Sync>;
|
||||
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(
|
||||
|
Loading…
Reference in New Issue
Block a user