Skip to content

Commit

Permalink
feat: update strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
fibonacci998 committed Oct 15, 2024
1 parent a7b37a6 commit fa91216
Showing 1 changed file with 28 additions and 14 deletions.
42 changes: 28 additions & 14 deletions scripts/create_mid_volumn.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,34 @@ def on_tick(self):
self.logger().info(f"Mid price: {mid_price}")
if (self.numberBuyOrder == 0 & self.numberSellOrder == 0):
amount = Decimal(random.randint(self.config.minimum_amount_limit, self.config.maximum_amount_limit))
self.buy(connector_name=connector_name,
amount=amount,
trading_pair=self.config.trading_pair,
order_type=OrderType.LIMIT,
price=mid_price,
)
self.numberBuyOrder += 1
self.sell(connector_name=connector_name,
amount=amount,
trading_pair=self.config.trading_pair,
order_type=OrderType.LIMIT,
price=mid_price)
self.numberSellOrder += 1

if (bool(random.getrandbits(1))):
self.buy(connector_name=connector_name,
amount=amount,
trading_pair=self.config.trading_pair,
order_type=OrderType.LIMIT,
price=mid_price,
)
self.numberBuyOrder += 1
self.sell(connector_name=connector_name,
amount=amount,
trading_pair=self.config.trading_pair,
order_type=OrderType.LIMIT,
price=mid_price)
self.numberSellOrder += 1
else:
self.sell(connector_name=connector_name,
amount=amount,
trading_pair=self.config.trading_pair,
order_type=OrderType.LIMIT,
price=mid_price)
self.numberSellOrder += 1
self.buy(connector_name=connector_name,
amount=amount,
trading_pair=self.config.trading_pair,
order_type=OrderType.LIMIT,
price=mid_price,
)
self.numberBuyOrder += 1
cron = croniter.croniter(self.config.cron_expression, current_time)
self.next_time = cron.get_next()
self.logger().debug(f"Next time is {self.next_time}")
Expand Down

0 comments on commit fa91216

Please sign in to comment.