Skip to content

EMA Bot Example

This example demonstrates how to create a bot using the Exponential Moving Average (EMA) strategy.

from traderion import TraderionBot
from traderion.strategies import EMA

class EMABot(TraderionBot):
    def __init__(self, username, password, room_id):
        super().__init__(username, password, room_id)
        self.strategy = EMA(self.api, {
            'short_period': 12,
            'long_period': 26
        })

    def on_market_price_change(self, old_prices, new_prices):
        # Implement EMA strategy logic
        self.strategy.execute(new_prices)

Running the Bot

if __name__ == "__main__":
    bot = EMABot('username', 'password', room_id=123)
    bot.run()

Next Steps