Updated OrderForm construction for Bitfinex following updates on lib
This commit is contained in:
parent
5e39f2767f
commit
f31c778d66
@ -318,44 +318,36 @@ impl Connector for BitfinexConnector {
|
|||||||
let amount = order.amount();
|
let amount = order.amount();
|
||||||
|
|
||||||
let order_form = {
|
let order_form = {
|
||||||
let pre_leverage = {
|
match order.kind() {
|
||||||
match order.kind() {
|
OrderKind::Limit { price } => {
|
||||||
OrderKind::Limit { price } => {
|
bitfinex::orders::OrderForm::new(symbol_name, price, amount, order.into())
|
||||||
bitfinex::orders::OrderForm::new(symbol_name, price, amount, order.into())
|
}
|
||||||
}
|
OrderKind::Market => {
|
||||||
OrderKind::Market => {
|
bitfinex::orders::OrderForm::new(symbol_name, 0.0, amount, order.into())
|
||||||
bitfinex::orders::OrderForm::new(symbol_name, 0.0, amount, order.into())
|
}
|
||||||
}
|
OrderKind::Stop { price } => {
|
||||||
OrderKind::Stop { price } => {
|
bitfinex::orders::OrderForm::new(symbol_name, price, amount, order.into())
|
||||||
bitfinex::orders::OrderForm::new(symbol_name, price, amount, order.into())
|
}
|
||||||
}
|
OrderKind::StopLimit { stop_price: price, limit_price } => {
|
||||||
OrderKind::StopLimit { stop_price: price, limit_price } => {
|
bitfinex::orders::OrderForm::new(symbol_name, price, amount, order.into())
|
||||||
bitfinex::orders::OrderForm::new(symbol_name, price, amount, order.into())
|
.with_price_aux_limit(Some(limit_price))?
|
||||||
.with_price_aux_limit(limit_price)?
|
}
|
||||||
}
|
OrderKind::TrailingStop { distance } => {
|
||||||
OrderKind::TrailingStop { distance } => {
|
bitfinex::orders::OrderForm::new(symbol_name, 0.0, amount, order.into())
|
||||||
bitfinex::orders::OrderForm::new(symbol_name, 0.0, amount, order.into())
|
.with_price_trailing(Some(distance))?
|
||||||
.with_price_trailing(distance)?
|
}
|
||||||
}
|
OrderKind::FillOrKill { price } => {
|
||||||
OrderKind::FillOrKill { price } => {
|
bitfinex::orders::OrderForm::new(symbol_name, price, amount, order.into())
|
||||||
bitfinex::orders::OrderForm::new(symbol_name, price, amount, order.into())
|
}
|
||||||
}
|
OrderKind::ImmediateOrCancel { price } => {
|
||||||
OrderKind::ImmediateOrCancel { price } => {
|
bitfinex::orders::OrderForm::new(symbol_name, price, amount, order.into())
|
||||||
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 =
|
let response =
|
||||||
|
Loading…
Reference in New Issue
Block a user