예제 #1
0
 def handle(self, *args, **options):
     logger.info("Update all orders.")
     update_all_open_orders()
     logger.info("Run trading mode rising chart.")
     run_rising_chart()
     logger.info("Run trading mode wave rider.")
     run_wave_rider()
예제 #2
0
    def test_order_stop_loss(self):
        order: Order = RisingChartOrderFactory()
        order.last_price_tick = Decimal(10)
        order.save()

        self.set_tickers_cache(order.bot.account.exchange)

        run_rising_chart(test=True)

        order_buy: Order = Order.objects.get(pk=order.pk)

        assert order_buy.next_order is not None
예제 #3
0
    def test_init_buy_order(self):
        bot: Bot = RisingChartBotFactory()
        bot.save()

        self.set_tickers_cache(bot.account.exchange)

        run_rising_chart(test=True)

        order_buy: Order = Order.objects.get(bot=bot)

        assert order_buy.next_order is None
        assert order_buy.market is not None
        assert order_buy.market.symbol.upper() == "ETH/BNB"
예제 #4
0
    def test_order_update_order(self):
        order: Order = RisingChartOrderFactory()
        order.last_price_tick = Decimal(0.5)
        order.save()

        self.set_tickers_cache(order.bot.account.exchange)

        run_rising_chart(test=True)

        order_buy: Order = Order.objects.get(pk=order.pk)

        assert order_buy.last_price_tick is not None
        assert "{:0.1f}".format(order_buy.last_price_tick) == "1.0"
        assert order_buy.next_order is None
예제 #5
0
    def run(self):
        ct: CronTab = CronTab("30 * * * * * *")

        while True:
            # get how long to wait for next cron
            now: datetime = datetime.utcnow()
            delay: float = ct.next(now, default_utc=True)

            sleep(delay)

            # run trade cron
            logger.info("Update all orders.")
            update_all_open_orders()
            logger.info("Run trading mode rising chart.")
            run_rising_chart()
            logger.info("Run trading mode wave rider.")
            run_wave_rider()