Skip to main content

BullETS is a Python package designed to help with the development of algorithmic trading strategies.

Project description

BullETS

GitHub Workflow Status (branch)

BullETS is a Python library designed to help with the development of algorithmic trading strategies.

Upcoming features

  • Retrieve stock data
  • Trading portfolio management
  • Backtesting framework

Installation

This section will assume you have Python installed, if not, you can download & install it from here.

We strongly recommend using a virtual environment to keep BullETS and its dependencies from interfering with your system installs.

Initializing and running a virtual environment

Windows:

# Initializing a virtual environment in the ./venv directory
py -3 -m venv venv

# Activating the virtual environment
venv\Scripts\activate.bat

Mac OS & Linux:

# Initializing a virtual environment in the ./venv directory
python3 -m venv bot-env

# Activating the virtual environment (Mac OS & Linux)
source bot-env/bin/activate

Using BullETS to develop a strategy

  1. Register an account on the FinancialModelingPrep website and retrieve your API key

  2. Create a new folder, initialize and activate a virtual environment inside (see above)

  3. Install BullETS from PyPI

pip install BullETS
  1. Code your own strategy
from bullets.strategy import Strategy, Resolution
from bullets.runner import Runner
from bullets.data_source.data_source_fmp import FmpDataSource
from datetime import datetime

# Extend the default strategy from BullETS
class MyStrategy(Strategy):
   
   # You can access the `portfolio` and the `data_source` variables to retrieve information for your strategy
   # You are also free to add your own data sources here and use them

    # Redefine this function to perform a task when the strategy starts
    def on_start(self):
        pass

    # Redefine this function to perform a task on each resolution
    def on_resolution(self):
        self.portfolio.market_order("AAPL", 5)

    # Redefine this function to perform a task at the end of the strategy
    def on_finish(self):
        pass

        
# Initialize your new strategy
if __name__ == '__main__':
    resolution = Resolution.DAILY # Define your resolution (DAILY, HOURLY or MINUTE)
    start_time = datetime(2019, 3, 5) # Define your strategy start time
    end_time = datetime(2019, 4, 22) # Define your strategy end time
    data_source = FmpDataSource("Insert your key here", resolution) # Initialize the FMP data source with your API key and resolution
    strategy = MyStrategy(resolution=resolution,
                                start_time=start_time,
                                end_time=end_time,
                                starting_balance=5000,
                                data_source=data_source)
    
    runner = Runner(strategy) # Initialize the runner, which handles the execution of your strategy
    runner.start() # Start the runner and your strategy

This section only covers the basic features to develop a strategy. BullETS has other features, such as slippage, transaction fees, and many others. Stay updated for our upcoming detailed documentation that demonstrates how to use these features.

Development mode

This section covers the installation process if you wish to contribute to the library.

  1. Clone the repo and go to the library's root directory
# Clone this repository
git clone https://github.com/AlgoETS/BullETS

# Move to the BullETS directory
cd BullETS
  1. Initialize and run a virtual environment (see above)

  2. Install BullETS in editable mode (while the virtual environment is activated)

pip install -e .
  1. Setup environment variables
    1. Make a copy of the .env.sample file and name it .env
    2. Replace the required values inside the .env file

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

BullETS-0.1.1.tar.gz (21.4 kB view details)

Uploaded Source

File details

Details for the file BullETS-0.1.1.tar.gz.

File metadata

  • Download URL: BullETS-0.1.1.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for BullETS-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2e29e22a050cebbf42c9f548b4f5d9953d1cbbb04cdb9f02439489fd1f9965bf
MD5 2c524cc6d8c5b68937354555148f6537
BLAKE2b-256 11c397cfa85088882218393ccda0549a7005e9d1f04c2b7d4a2c1540d179f06a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page