cargo fix
This commit is contained in:
parent
64a687445d
commit
7de2a6ad77
@ -1,14 +1,11 @@
|
||||
use core::time::Duration;
|
||||
use std::collections::HashMap;
|
||||
|
||||
use log::{debug, error, info};
|
||||
use log::{error, info};
|
||||
use tokio::time::delay_for;
|
||||
|
||||
use crate::connectors::{Client, ExchangeDetails};
|
||||
use crate::connectors::ExchangeDetails;
|
||||
use crate::currency::{Symbol, SymbolPair};
|
||||
use crate::events::Event;
|
||||
use crate::managers::{ExchangeManager, OrderManager, PositionManager, PriceManager};
|
||||
use crate::strategy::PositionStrategy;
|
||||
use crate::managers::ExchangeManager;
|
||||
use crate::ticker::Ticker;
|
||||
use crate::BoxError;
|
||||
|
||||
|
@ -7,8 +7,6 @@ use async_trait::async_trait;
|
||||
use bitfinex::api::Bitfinex;
|
||||
use bitfinex::orders::{CancelOrderForm, OrderMeta, OrderResponse};
|
||||
use bitfinex::ticker::TradingPairTicker;
|
||||
use chrono::{DateTime, NaiveDate, NaiveDateTime, Utc};
|
||||
use log::debug;
|
||||
|
||||
use crate::currency::SymbolPair;
|
||||
use crate::models::{
|
||||
@ -64,7 +62,7 @@ impl Client {
|
||||
let (best_ask, best_bid) = (order_book.lowest_ask(), order_book.highest_bid());
|
||||
|
||||
// updating positions with effective profit/loss
|
||||
positions.iter_mut().flatten().for_each(|mut x| {
|
||||
positions.iter_mut().flatten().for_each(|x| {
|
||||
if x.is_short() {
|
||||
x.update_profit_loss(best_ask, 0.2);
|
||||
} else {
|
||||
|
@ -1,12 +1,11 @@
|
||||
use core::fmt;
|
||||
use std::borrow::Cow;
|
||||
use std::convert::TryFrom;
|
||||
use std::fmt::{Display, Formatter};
|
||||
use std::str::FromStr;
|
||||
|
||||
use regex::Regex;
|
||||
|
||||
use crate::BoxError;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[derive(Clone, PartialEq, Hash, Debug, Eq)]
|
||||
pub struct Symbol {
|
||||
|
@ -1,12 +1,8 @@
|
||||
use std::collections::HashMap;
|
||||
use std::future::Future;
|
||||
|
||||
use tokio::task::JoinHandle;
|
||||
|
||||
use crate::managers::{OptionUpdate, OrderManager, PositionManager, PriceManager};
|
||||
use crate::models::{OrderForm, OrderKind, Position, PositionProfitState};
|
||||
use tokio::sync::oneshot;
|
||||
|
||||
use crate::managers::OptionUpdate;
|
||||
use crate::models::OrderForm;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ActorMessage {
|
||||
pub(crate) message: Message,
|
||||
|
@ -1,15 +1,13 @@
|
||||
use std::collections::HashMap;
|
||||
use std::ops::{Deref, Neg};
|
||||
use std::ops::Neg;
|
||||
|
||||
use bitfinex::ticker::TradingPairTicker;
|
||||
use futures_util::stream::FuturesUnordered;
|
||||
use log::{debug, error, info, trace};
|
||||
use merge::Merge;
|
||||
use tokio::signal::unix::Signal;
|
||||
use tokio::stream::StreamExt;
|
||||
use tokio::sync::mpsc::channel;
|
||||
use tokio::sync::mpsc::{Receiver, Sender};
|
||||
use tokio::sync::{oneshot, RwLock};
|
||||
use tokio::sync::oneshot;
|
||||
|
||||
use crate::connectors::{Client, ExchangeDetails};
|
||||
use crate::currency::SymbolPair;
|
||||
@ -395,9 +393,7 @@ impl OrderManager {
|
||||
Message::Update { .. } => {
|
||||
self.update().await?;
|
||||
}
|
||||
Message::ClosePosition {
|
||||
position_id: position_id,
|
||||
} => self.close_position(position_id).await?,
|
||||
Message::ClosePosition { position_id } => self.close_position(position_id).await?,
|
||||
_ => {}
|
||||
};
|
||||
|
||||
@ -522,7 +518,7 @@ impl OrderManager {
|
||||
self.client.active_orders(&self.pair),
|
||||
self.client.active_positions(&self.pair)
|
||||
);
|
||||
let (open_orders, opt_open_positions) = (open_orders?, opt_open_positions?);
|
||||
let (_open_orders, _opt_open_positions) = (open_orders?, opt_open_positions?);
|
||||
|
||||
Ok((None, None))
|
||||
}
|
||||
|
@ -2,12 +2,8 @@ use std::fmt;
|
||||
use std::fmt::{Display, Formatter};
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
use chrono::{DateTime, TimeZone};
|
||||
use float_cmp::ApproxEq;
|
||||
|
||||
use crate::connectors::{Exchange, ExchangeDetails};
|
||||
use crate::connectors::Exchange;
|
||||
use crate::currency::SymbolPair;
|
||||
use crate::BoxError;
|
||||
|
||||
/***************
|
||||
* Prices
|
||||
@ -190,6 +186,7 @@ pub enum OrderKind {
|
||||
amount: f64,
|
||||
},
|
||||
}
|
||||
|
||||
impl OrderKind {
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
@ -460,6 +457,7 @@ impl PartialEq for Position {
|
||||
self.id() == other.id()
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for Position {}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
|
||||
|
@ -1,13 +1,9 @@
|
||||
use std::collections::HashMap;
|
||||
use std::fmt::{Debug, Formatter};
|
||||
use std::ops::Neg;
|
||||
|
||||
use dyn_clone::DynClone;
|
||||
use log::{debug, info};
|
||||
use tokio::sync::{oneshot, RwLock};
|
||||
|
||||
use crate::events::{Event, EventKind, EventMetadata, Message};
|
||||
use crate::managers::{OrderManager, PositionManager, TrackedPositionsMap};
|
||||
use crate::models::{
|
||||
ActiveOrder, OrderBook, OrderBookEntry, OrderForm, OrderKind, Position, PositionProfitState,
|
||||
PositionState, TradingPlatform,
|
||||
@ -228,7 +224,7 @@ impl PositionStrategy for TrailingStop {
|
||||
if let Some(profit_state) = position.profit_state() {
|
||||
match profit_state {
|
||||
PositionProfitState::Critical => {
|
||||
return (position, None, Some(vec![close_message]))
|
||||
return (position, None, Some(vec![close_message]));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user