diff --git a/src/connectors.rs b/src/connectors.rs index 8d508ee..fc2214e 100644 --- a/src/connectors.rs +++ b/src/connectors.rs @@ -318,44 +318,36 @@ impl Connector for BitfinexConnector { let amount = order.amount(); let order_form = { - let pre_leverage = { - match order.kind() { - OrderKind::Limit { price } => { - bitfinex::orders::OrderForm::new(symbol_name, price, amount, order.into()) - } - OrderKind::Market => { - bitfinex::orders::OrderForm::new(symbol_name, 0.0, amount, order.into()) - } - OrderKind::Stop { price } => { - bitfinex::orders::OrderForm::new(symbol_name, price, amount, order.into()) - } - OrderKind::StopLimit { stop_price: price, limit_price } => { - bitfinex::orders::OrderForm::new(symbol_name, price, amount, order.into()) - .with_price_aux_limit(limit_price)? - } - OrderKind::TrailingStop { distance } => { - bitfinex::orders::OrderForm::new(symbol_name, 0.0, amount, order.into()) - .with_price_trailing(distance)? - } - OrderKind::FillOrKill { price } => { - bitfinex::orders::OrderForm::new(symbol_name, price, amount, order.into()) - } - OrderKind::ImmediateOrCancel { price } => { - bitfinex::orders::OrderForm::new(symbol_name, price, amount, order.into()) - } + match order.kind() { + OrderKind::Limit { price } => { + bitfinex::orders::OrderForm::new(symbol_name, price, amount, order.into()) + } + OrderKind::Market => { + bitfinex::orders::OrderForm::new(symbol_name, 0.0, amount, order.into()) + } + OrderKind::Stop { price } => { + bitfinex::orders::OrderForm::new(symbol_name, price, amount, order.into()) + } + OrderKind::StopLimit { stop_price: price, limit_price } => { + bitfinex::orders::OrderForm::new(symbol_name, price, amount, order.into()) + .with_price_aux_limit(Some(limit_price))? + } + OrderKind::TrailingStop { distance } => { + bitfinex::orders::OrderForm::new(symbol_name, 0.0, amount, order.into()) + .with_price_trailing(Some(distance))? + } + OrderKind::FillOrKill { price } => { + bitfinex::orders::OrderForm::new(symbol_name, price, amount, order.into()) + } + OrderKind::ImmediateOrCancel { price } => { + bitfinex::orders::OrderForm::new(symbol_name, price, amount, order.into()) } - .with_meta(OrderMeta::new( - BitfinexConnector::AFFILIATE_CODE.to_string(), - )) - }; - - // adding leverage, if any - match order.leverage() { - // TODO: CHANGEME!!!! - Some(_leverage) => pre_leverage.with_leverage(15), - // Some(leverage) => pre_leverage.with_leverage(leverage.round() as u32), - None => pre_leverage, } + .with_meta(Some(OrderMeta::new( + BitfinexConnector::AFFILIATE_CODE.to_string(), + ))) + // TODO: CHANGEME! + .with_leverage(Some(15)) }; let response =