Git Product home page Git Product logo

backtrader-example's Introduction

Backtrader-example

How to install and run Backtrader on your local machine.


Setup Pip and Virtual Enviroment for Python3.4

To begin setting up the environment 'cd' in your terminal to the project directory.

cd to/directory/of/project

Install Pip

For Linux install Pip by,

python3.4 -m pip install --user --upgrade pip

Install virtualenv

Once Pip is installed you can now install virtualenv.

virtualenv is used to manage Python packages for different projects. Using virtualenv allows you to avoid installing Python packages globally which could break system tools or other projects. You can install virtualenv using pip.

For Linux install virtualenv by,

python3.4 -m pip install --user virtualenv

Creating your Virtual environment

virtualenv allows you to manage separate package installations for different projects. It essentially allows you to create a “virtual” isolated Python installation and install packages into that virtual installation. When you switch projects, you can simply create a new virtual environment and not have to worry about breaking the packages installed in the other environments. It is always recommended to use a virtualenv while developing Python applications.

To create a virtual environment, go to your project’s directory and run virtualenv.

For Linux create virtualenv by,

python3.4 -m virtualenv env

You should now have a folder 'env' in your local directory.

Activating your virtualenv

After creating your virtualenv you will then need to 'activate' it. Failing to activate your virtualenv will cause you to use global libraries. This can cause problems with overwriting dependency versions if you install them globally.

To activate on Linux have a terminal open in the project folder where you created 'env'.

Then run this command for Linux,

source env/bin/activate

You can tell if it activate successfully if your terminal has prefix '(env)'

(env) jove:~/to/directory/of/project$

You can deactivate from the virtualenv by simply running,

deactivate

Installing Packages to virtualenv

To install libraries to your local library MAKE SURE you have ACTIVATED your virtualenv.

Normally Python virtualenvs come with a 'requirements.txt' file which contains all the dependencies for the source code to work. Hence you can install all the libraries in 'requirements.txt' with the following command,

pip install -r requirements.txt

You should now have the following dependencies installed,

  • backtrader==1.9.67.122
  • certifi==2018.10.15
  • chardet==3.0.4
  • cycler==0.10.0
  • idna==2.7
  • kiwisolver==1.0.1
  • matplotlib==2.2.3
  • numpy==1.15.2
  • pyparsing==2.2.2
  • python-dateutil==2.7.3
  • pytz==2018.5
  • requests==2.19.1
  • six==1.11.0
  • urllib3==1.23

You can check the installed dependencies on your ACTIVATED virtualenv with the command,

pip freeze

Congratulations, your Python virtualenv is setup!

Running the Script

Now that your Python virtual environment has been setup, make sure you have ACTIVATED it.

Once activated you can simply run the script by using the commannd,

python run.py

backtrader-example's People

Contributors

antoniogargaro avatar

Stargazers

 avatar

Watchers

James Cloos 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.