Change evaluation for selling
This commit is contained in:
parent
7bdb130865
commit
3dbaab6365
|
|
@ -536,7 +536,7 @@ pub async fn monitoring_filled_buy_order(
|
||||||
|
|
||||||
// let target_profit_percent = average_amplitude + (standard_deviation_amplitude * (average_ratio_amp_body));
|
// let target_profit_percent = average_amplitude + (standard_deviation_amplitude * (average_ratio_amp_body));
|
||||||
let target_profit_percent =
|
let target_profit_percent =
|
||||||
(average_amplitude / 2.0) + (standard_deviation_amplitude * 1.0); // 2.0 sigma (recommand: 0.5 ~ 2.0(patient & greedy))
|
(average_amplitude / 2.0) + (standard_deviation_amplitude * 1.5); // 2.0 sigma (recommand: 0.5 ~ 2.0(patient & greedy))
|
||||||
|
|
||||||
// if scoreboard_list.first().unwrap().pos_liquidation_signal == 1
|
// if scoreboard_list.first().unwrap().pos_liquidation_signal == 1
|
||||||
// || scoreboard_list.first().unwrap().neg_liquidation_signal == 1
|
// || scoreboard_list.first().unwrap().neg_liquidation_signal == 1
|
||||||
|
|
@ -558,259 +558,27 @@ pub async fn monitoring_filled_buy_order(
|
||||||
if element.pure_profit_percent >= 0.0 {
|
if element.pure_profit_percent >= 0.0 {
|
||||||
let mut is_sell = false;
|
let mut is_sell = false;
|
||||||
if element.maximum_profit_percent >= target_profit_percent * 2.0
|
if element.maximum_profit_percent >= target_profit_percent * 2.0
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 1.5
|
&& element.pure_profit_percent >= target_profit_percent * 2.0
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 150% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 1.5
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 2.1
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 1.6
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 160% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 1.6
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 2.2
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 1.7
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 170% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 1.7
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 2.3
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 1.8
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 180% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 1.8
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 2.4
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 1.9
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 190% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 1.9
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 2.5
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 2.0
|
|
||||||
{
|
{
|
||||||
println!(
|
println!(
|
||||||
"Sold 200% target_profit_percent: {:.3}",
|
"Sold 200% target_profit_percent: {:.3}",
|
||||||
target_profit_percent * 2.0
|
target_profit_percent * 2.0
|
||||||
);
|
);
|
||||||
is_sell = true;
|
is_sell = true;
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 2.6
|
} else if element.maximum_profit_percent < target_profit_percent * 2.0
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 2.1
|
&& element.maximum_profit_percent >= target_profit_percent * 1.8
|
||||||
|
&& element.pure_profit_percent < target_profit_percent * 0.33
|
||||||
{
|
{
|
||||||
println!(
|
println!(
|
||||||
"Sold 210% target_profit_percent: {:.3}",
|
"Sold 33% target_profit_percent: {:.3}",
|
||||||
target_profit_percent * 2.1
|
target_profit_percent * 0.33
|
||||||
);
|
);
|
||||||
is_sell = true;
|
} else if server_epoch - element.transact_time > 12_600_000
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 2.7
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 2.2
|
|
||||||
{
|
{
|
||||||
println!(
|
println!(
|
||||||
"Sold 220% target_profit_percent: {:.3}",
|
"Sold time up {:.3}",
|
||||||
target_profit_percent * 2.2
|
element.pure_profit_percent
|
||||||
);
|
);
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 2.8
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 2.3
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 230% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 2.3
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 2.9
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 2.4
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 240% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 2.4
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 3.0
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 2.5
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 250% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 2.5
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 3.1
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 2.6
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 260% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 2.6
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 3.2
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 2.7
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 270% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 2.7
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 3.3
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 2.8
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 280% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 2.8
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 3.4
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 2.9
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 290% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 2.9
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 3.5
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 3.0
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 300% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 3.0
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 3.6
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 3.1
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 310% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 3.1
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 3.7
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 3.2
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 320% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 3.2
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 3.8
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 3.3
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 330% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 3.3
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 3.9
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 3.4
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 340% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 3.4
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 4.0
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 3.5
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 350% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 3.5
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 4.1
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 3.6
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 360% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 3.6
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 4.2
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 3.7
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 370% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 3.7
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 4.3
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 3.8
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 380% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 3.8
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 4.4
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 3.9
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 390% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 3.9
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 4.5
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 4.0
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 400% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 4.0
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 4.6
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 4.1
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 410% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 4.1
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 4.7
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 4.2
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 420% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 4.2
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 4.8
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 4.3
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 430% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 4.3
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 4.9
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 4.4
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 440% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 4.4
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.maximum_profit_percent >= target_profit_percent * 5.0
|
|
||||||
&& element.pure_profit_percent <= target_profit_percent * 4.5
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Sold 450% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 4.5
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
} else if element.pure_profit_percent >= target_profit_percent * 5.0 {
|
|
||||||
println!(
|
|
||||||
"Sold 500% target_profit_percent: {:.3}",
|
|
||||||
target_profit_percent * 5.0
|
|
||||||
);
|
|
||||||
is_sell = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if element.maximum_profit_percent >= target_profit_percent * 1.0 {
|
// if element.maximum_profit_percent >= target_profit_percent * 1.0 {
|
||||||
|
|
@ -858,7 +626,7 @@ pub async fn monitoring_filled_buy_order(
|
||||||
// limit_order_sell(&element, sell_price_ahead, base_qty_to_be_ordered, &client, &exchange_info_vec, &trade_fee_vec).await;
|
// limit_order_sell(&element, sell_price_ahead, base_qty_to_be_ordered, &client, &exchange_info_vec, &trade_fee_vec).await;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if element.pure_profit_percent < (target_profit_percent * -1.0) - 0.1 {
|
if element.pure_profit_percent < (target_profit_percent * -1.0) - 0.2 {
|
||||||
// -0.2 means about double trade fees.
|
// -0.2 means about double trade fees.
|
||||||
limit_order_sell(
|
limit_order_sell(
|
||||||
&element,
|
&element,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user