|
@@ -956,7 +956,8 @@ impl Strategy {
|
|
|
if self.pos.long_pos > Decimal::ZERO {
|
|
if self.pos.long_pos > Decimal::ZERO {
|
|
|
if pd_order_num == 0 {
|
|
if pd_order_num == 0 {
|
|
|
let mut price = (short_lower + short_upper) * dec!(0.5);
|
|
let mut price = (short_lower + short_upper) * dec!(0.5);
|
|
|
- price = utils::clip(price, self.bp * dec!(0.9995), self.ap * dec!(1.03));
|
|
|
|
|
|
|
+ // 不限制大小
|
|
|
|
|
+ // price = utils::clip(price, self.bp * dec!(0.9995), self.ap * dec!(1.03));
|
|
|
price = utils::fix_price(price, self.tick_size);
|
|
price = utils::fix_price(price, self.tick_size);
|
|
|
|
|
|
|
|
let order_client_id = utils::generate_client_id(Some(self.broker_id.clone()));
|
|
let order_client_id = utils::generate_client_id(Some(self.broker_id.clone()));
|
|
@@ -976,7 +977,8 @@ impl Strategy {
|
|
|
if self.pos.short_pos > Decimal::ZERO {
|
|
if self.pos.short_pos > Decimal::ZERO {
|
|
|
if pk_order_num == 0 {
|
|
if pk_order_num == 0 {
|
|
|
let mut price = (long_upper + long_lower) * dec!(0.5);
|
|
let mut price = (long_upper + long_lower) * dec!(0.5);
|
|
|
- price = utils::clip(price, self.bp * dec!(0.97), self.ap * dec!(1.0005));
|
|
|
|
|
|
|
+ // 不限制大小
|
|
|
|
|
+ // price = utils::clip(price, self.bp * dec!(0.97), self.ap * dec!(1.0005));
|
|
|
price = utils::fix_price(price, self.tick_size);
|
|
price = utils::fix_price(price, self.tick_size);
|
|
|
|
|
|
|
|
let order_client_id = utils::generate_client_id(Some(self.broker_id.clone()));
|
|
let order_client_id = utils::generate_client_id(Some(self.broker_id.clone()));
|
|
@@ -1137,7 +1139,9 @@ impl Strategy {
|
|
|
// debug!(?buy_price_list);
|
|
// debug!(?buy_price_list);
|
|
|
if buy_price_list.len() == 0 {
|
|
if buy_price_list.len() == 0 {
|
|
|
let mut target_buy_price = (long_upper + long_lower) * dec!(0.5);
|
|
let mut target_buy_price = (long_upper + long_lower) * dec!(0.5);
|
|
|
- target_buy_price = utils::clip(target_buy_price, self.bp * dec!(0.97), self.ap * dec!(1.0005));
|
|
|
|
|
|
|
+ // 取消大小限制
|
|
|
|
|
+ target_buy_price = target_buy_price;
|
|
|
|
|
+ // target_buy_price = utils::clip(target_buy_price, self.bp * dec!(0.97), self.ap * dec!(1.0005));
|
|
|
target_buy_price = utils::fix_price(target_buy_price, self.tick_size);
|
|
target_buy_price = utils::fix_price(target_buy_price, self.tick_size);
|
|
|
let value = min(one_hand_long_value, long_free_value);
|
|
let value = min(one_hand_long_value, long_free_value);
|
|
|
let amount = utils::fix_amount(value / self.mp, self.step_size);
|
|
let amount = utils::fix_amount(value / self.mp, self.step_size);
|
|
@@ -1164,7 +1168,9 @@ impl Strategy {
|
|
|
// debug!(?sell_price_list);
|
|
// debug!(?sell_price_list);
|
|
|
if sell_price_list.len() == 0 {
|
|
if sell_price_list.len() == 0 {
|
|
|
let mut target_sell_price = (short_lower + short_upper) * dec!(0.5);
|
|
let mut target_sell_price = (short_lower + short_upper) * dec!(0.5);
|
|
|
- target_sell_price = utils::clip(target_sell_price, self.bp * dec!(0.9995), self.ap * dec!(1.03));
|
|
|
|
|
|
|
+ // target_sell_price = utils::clip(target_sell_price, self.bp * dec!(0.9995), self.ap * dec!(1.03));
|
|
|
|
|
+ // 取消大小限制
|
|
|
|
|
+ target_sell_price = target_sell_price;
|
|
|
target_sell_price = utils::fix_price(target_sell_price, self.tick_size);
|
|
target_sell_price = utils::fix_price(target_sell_price, self.tick_size);
|
|
|
let value = min(one_hand_short_value, short_free_value);
|
|
let value = min(one_hand_short_value, short_free_value);
|
|
|
let amount = utils::fix_amount(value / self.mp, self.step_size);
|
|
let amount = utils::fix_amount(value / self.mp, self.step_size);
|