Giter Club home page Giter Club logo

tradingbot's Introduction

TradingBot (WIP)

This trading bot is a versatile and powerful tool that can help users automate their trading strategies, perform backtesting, and generate trading signals for various use cases, such as receiving notifications on platforms like Telegram. The bot's architecture is designed to manage trading signals, execute strategies, manage positions, and interact with crypto exchanges to execute trades. The core components of the trading bot are as follows:

Core Components

Signal Processor

The SignalProcessor is responsible for managing and processing trading signals generated by the SignalEngine. It interacts with the MarketDataProtocol to obtain market data. It uses the PositionManager to manage positions based on the signals generated. This component ensures that the trading bot can seamlessly integrate signals and execute trades based on those signals or send them as notifications to the user.

Signal Engine

The SignalEngine is at the heart of the trading bot, responsible for managing and executing trading strategies. It accepts a list of strategies (objects implementing the StrategyProtocol interface) and a configuration object (an instance of MainConfig class). The engine processes market data and generates trading signals based on the implemented strategies. Users can create custom strategies by implementing the StrategyProtocol interface.

Position Manager

The PositionManager is responsible for managing active positions, executing trades, and tracking the overall trading performance. It uses a TradeExecutor object to execute trades and manages active positions in a defaultdict. This component is essential in keeping track of open positions, handling buy and sell signals, and calculating the trading bot's performance metrics.

Trade Executor

The TradeExecutor class is responsible for submitting orders to a crypto exchange. It uses a CryptoExchangeProtocol object to interact with the exchange. This component ensures that the trading bot can place orders, such as buy and sell, on the desired crypto exchange. Users can utilize different exchanges by implementing the CryptoExchangeProtocol interface.

How It Works

The trading bot works by continuously processing market data through the SignalProcessor and SignalEngine. The SignalEngine analyzes the market data and generates trading signals based on the user-defined strategies. These signals are then passed to the PositionManager, which handles the signals and manages the active positions accordingly.

The PositionManager uses the TradeExecutor to submit orders to the crypto exchange based on the received signals. The TradeExecutor interacts with the CryptoExchangeProtocol to place orders on the desired exchange. The PositionManager keeps track of open positions, calculates the trading bot's performance metrics, and handles position closing when necessary.

With this architecture, users can easily implement custom trading strategies and manage their positions while interacting with various crypto exchanges. The trading bot offers a powerful and flexible solution for automating trading activities and maximizing profits in the world of cryptocurrencies.

Configuring Env

Create a new .env file.

BINANCE_API_KEY=
BINANCE_SECRET=


SYMBOL=BTCUSDT
INTERVAL=2h
LIMIT=1000
STARTING_BALANCE=10000
NOTIONAL=2000
MAX_OPEN_POSITIONS=4
BACKTEST=True
POLLING_INTERVAL_WEIGHT=1
START_DATE=2020-01-01  <--- OPTIONAL
END_DATE=2020-01-01  <--- OPTIONAL


CRYPTO_EXCHANGE=BinanceExchange  <--- OPTIONAL
MARKET_DATA_PROVIDER=BinanceMarketData
STRATEGIES=strategies.example_macd_strategy.MACDStrategy,strategies.example_rsi_strategy.SimpleRsiStrategy <--- Add your strategies here

tradingbot's People

Contributors

floris avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.