<commit_before>.. highlight:: javascript

Installation
************

Installing on a Computer
========================

Installing the bot on a computer is drag-and-drop and platform independent.

Prerequisites
-------------

You will need:

    - Python 2.7.x (Must be added to PATH)

Recommended for easier use:

    - git
    - pip (to install Numpy)
    - Numpy (if using Analysis module)

Downloading
-----------

To download the bot you can either:

- (Recommended) Run ``git clone https://github.com/Mikadily/poloniexlendingbot`` if you have git installed. Using this method will allow you to do ``git pull`` at any time to grab updates.
- Download the source .zip file from the GitHub repo page or from `this link <https://github.com/Mikadily/poloniexlendingbot/archive/master.zip>`_. Extract it into an empty folder you won't accidentally delete.

(Optional) Automatically Run on Startup
---------------------------------------

* Windows using Startup Folder:

    Add a shortcut to ``lendingbot.py`` to the startup folder of the start menu.
    Its location may change with OS version, but for Windows 8/10 is ``C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp``

* Linux using systemd:

    Create the file ``/lib/systemd/system/lendingbot.service`` which contains the following text::

        [Unit]
        Description=LendingBot service
        After=network.target

        [Service]
        Type=simple
        ExecStart=/usr/bin/python <INSTALLATION DIRECTORY>/lendingbot.py
        WorkingDirectory=<INSTALLATION DIRECTORY>
        RestartSec=10
        Restart=on-failure

        [Install]
        WantedBy=multi-user.target
    Credit to GitHub user utdrmac.

    Modify the ExecStart and WorkingDirectory to match your setup.

* OSx:

    Help needed! If you have a solution for OSx and would like to share, you can either share it directly with us or make a PR with the edits.

Configuring
-----------

To configure the bot with your settings:

    #. Copy ``default.cfg.example`` to ``default.cfg`` (Running lendingbot.py also does this for you if default.cfg doesn't already exist.)
    #. Open ``default.cfg`` and enter your desired settings `(information on settings here) <http://poloniexlendingbot.readthedocs.io/en/latest/configuration.html>`_.
    #. Save ``default.cfg``

You are now ready to run the bot.

Running
-------

To run, either:

    - Double-click lendingbot.py (if you have .py associated with the Python executable)
    - Run ``python lendingbot.py`` in command prompt or terminal.

.. note:: You can use arguments to specify a specific config file ``-cfg`` or to do dry runs ``-dry``. To see these args do: ``python lendingbot.py -h``

Installing on Pythonanywhere.com
================================

`Pythonanywhere.com <https://www.pythonanywhere.com>`_ is a useful website that will host and run Python code for you. This is perfect for our bot.<commit_msg>Update installation.rst<commit_after>.. highlight:: javascript

Installation
************

Installing on a Computer
========================

Installing the bot on a computer is drag-and-drop and platform independent.

Prerequisites
-------------

You will need:

    - Python 2.7.x (Must be added to PATH)

Recommended for easier use:

    - git
    - pip (to install Numpy)
    - Numpy (if using Analysis module)

Downloading
-----------

To download the bot you can either:

- (Recommended) Run ``git clone https://github.com/Mikadily/poloniexlendingbot`` if you have git installed. Using this method will allow you to do ``git pull`` at any time to grab updates.
- Download the source .zip file from the GitHub repo page or from `this link <https://github.com/Mikadily/poloniexlendingbot/archive/master.zip>`_. Extract it into an empty folder you won't accidentally delete.

(Optional) Automatically Run on Startup
---------------------------------------

* Windows using Startup Folder:

    Add a shortcut to ``lendingbot.py`` to the startup folder of the start menu.
    Its location may change with OS version, but for Windows 8/10 is ``C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp``

* Linux using systemd:

    Create the file ``/lib/systemd/system/lendingbot.service`` which contains the following text::

        [Unit]
        Description=LendingBot service
        After=network.target

        [Service]
        Type=simple
        ExecStart=/usr/bin/python <INSTALLATION DIRECTORY>/lendingbot.py
        WorkingDirectory=<INSTALLATION DIRECTORY>
        RestartSec=10
        Restart=on-failure

        [Install]
        WantedBy=multi-user.target
    Credit to GitHub user utdrmac.

    Modify the ExecStart and WorkingDirectory to match your setup.
    
    Enable the service using ``sudo systemctl enable lendingbot.service``

* OSx:

    Help needed! If you have a solution for OSx and would like to share, you can either share it directly with us or make a PR with the edits.

Configuring
-----------

To configure the bot with your settings:

    #. Copy ``default.cfg.example`` to ``default.cfg`` (Running lendingbot.py also does this for you if default.cfg doesn't already exist.)
    #. Open ``default.cfg`` and enter your desired settings `(information on settings here) <http://poloniexlendingbot.readthedocs.io/en/latest/configuration.html>`_.
    #. Save ``default.cfg``

You are now ready to run the bot.

Running
-------

To run, either:

    - Double-click lendingbot.py (if you have .py associated with the Python executable)
    - Run ``python lendingbot.py`` in command prompt or terminal.

.. note:: You can use arguments to specify a specific config file ``-cfg`` or to do dry runs ``-dry``. To see these args do: ``python lendingbot.py -h``

Installing on Pythonanywhere.com
================================

`Pythonanywhere.com <https://www.pythonanywhere.com>`_ is a useful website that will host and run Python code for you. This is perfect for our bot.
{'fraction_non_alphanumeric': 0.12973883740522324, 'fraction_numerical': 0.002358887952822241, 'mean_word_length': 3.1079584775086504, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1032115', 'n_tokens_mistral': 1674, 'n_tokens_neox': 1576, 'n_words': 666}