# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['trading_bots',
 'trading_bots.bots',
 'trading_bots.conf',
 'trading_bots.contrib',
 'trading_bots.contrib.converters',
 'trading_bots.contrib.exchanges',
 'trading_bots.contrib.exchanges.bitfinex',
 'trading_bots.contrib.exchanges.bitstamp',
 'trading_bots.contrib.exchanges.buda',
 'trading_bots.contrib.exchanges.kraken',
 'trading_bots.core',
 'trading_bots.core.management']

package_data = \
{'': ['*'],
 'trading_bots.conf': ['bot_template/snake_case_bot_name/*',
                       'bot_template/snake_case_bot_name/configs/*',
                       'project_template/*',
                       'project_template/snake_case_project_name/*']}

install_requires = \
['cached-property>=1.5.1,<2.0.0',
 'click>=7.0,<8.0',
 'jinja2>=2.11.0,<3.0.0',
 'maya>=0.6.1,<0.7.0',
 'pygogo>=0.12.0,<0.13.0',
 'pyyaml>=5.3,<6.0',
 'requests>=2.22.0,<3.0.0',
 'simple-settings>=0.19.1,<0.20.0',
 'stringcase>=1.2.0,<2.0.0',
 'trading-api-wrappers>=0.16.10,<0.17.0']

entry_points = \
{'console_scripts': ['bots-admin = trading_bots.core.management:cli']}

setup_kwargs = {
    'name': 'trading-bots',
    'version': '0.5.0',
    'description': 'A simple framework for bootstrapping your Crypto Trading Bots',
    'long_description': '# Trading Bots 🤖\n\n> A simple framework for bootstrapping your **Crypto Trading Bots** on Python 3.6+\n>\n> **Disclaimer:** Still at an early stage of development. Rapidly evolving APIs.\n\n[![PyPI - License](https://img.shields.io/pypi/l/trading-bots.svg)](https://opensource.org/licenses/MIT)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/trading-bots.svg)\n[![PyPI](https://img.shields.io/pypi/v/trading-bots.svg)](https://pypi.org/project/trading-bots/)\n![PyPI - Status](https://img.shields.io/pypi/status/trading-bots.svg)\n\n**Trading-Bots** is a general purpose *mini-framework* for developing an [algorithmic trading bot](https://en.wikipedia.org/wiki/Algorithmic_trading) on **crypto currencies**, thus it makes no assumption of your trading goals.\n\n## Installation\n\n### Requirements\n\n* macOS, Windows or Linux\n* Python 3.6 or 3.7\n\nTo install Trading-Bots, simply use `poetry` (or `pip`, of course):\n\n    poetry add trading-bots\n\nRemember to activate the virtual environment\n\n    poetry shell\n\n## Getting started\n\nLet\'s learn by example creating a simple bot that fetches your **Bitcoin** balance on [Buda.com](https://www.buda.com)!\n\nWe\'ll assume you have Trading-Bots installed already, and your virtual environment is active.\n\n### Create a project\n\nIf this is your first time, you’ll have to take care of some initial setup. Namely, you’ll need to\nauto-generate some code that establishes a Trading-Bots project.\n\nFrom the command line, cd into a directory where you’d like to store your bots, then run the following command:\n\n    bots-admin startproject\n\n    TRADING BOTS 🤖\n    ===============\n\n    Name [MyAwesomeProject]: MyProject\n    Directory [.]: .\n\nThis will create a **my_project** directory in your current directory.\n\nLet’s look at what `startproject` created:\n\n    root/\n        bots.py\n        secrets.yml\n        settings.yml\n        my_project/\n            __init__.py\n\nThese files are:\n\n- The outer `root/` directory is just a container for your project. Its name doesn\'t matter to Trading-Bots; you can rename it to anything you like.\n- `bots.py`: A handy CLI that lets you interact with this Trading-Bots project in various ways.\n- `secrets.yml`: A configuration file to store your project secrets like API keys and wallets **DON\'T SHARE YOUR SECRETS WITH ANYONE!**\n- `settings.yml`: Global settings for this project.\n- The inner `my_project/` directory is the actual Python package for your project.\n- `my_project/__init__.py`: An empty file that tells Python that this directory should be considered a Python package.\n\n### Create a new bot\n\nNow that your "project" is set up, you\'re set to start doing work.\n\nLet\'s create a simple bot that fetches your **Bitcoin** balance on [Buda.com](https://www.buda.com)!\n\nEach bot you write in Trading-Bots consists of a Python package that follows a certain convention. Trading-Bots comes\nwith a utility that automatically generates the basic directory structure of a bot, so you can focus on writing code\nrather than creating directories.\n\nYour bots can live anywhere on your Python path. In this tutorial, we’ll create our bot as a submodule of `my_project`.\n\nTo create your bot, make sure you\'re in the same directory as `bots.py` and type this command:\n\n    python bots.py createbot\n\n    TRADING BOTS 🤖\n    ===============\n\n    Name [MyAwesomeBot]: MyBot\n    Directory (your projects dir): my_project\n\nThat’ll create a directory `my_bot`, which is laid out like this:\n\n    my_bot/\n        __init__.py\n        bot.py\n        configs/\n            default.yml\n\nThis directory structure will house the `MyBot` bot.\n\nYou\'ll also have to *"install"* your new bot, by adding it to the project\'s `settings.yml` file.\n\n`settings.yml`\n\n```yaml\ninstalled_bots:\n  - my_project.my_bot.bot.MyBot  \n```\n\nConfigure you Buda.com account\'s `API_KEY` and `API_SECRET` onto `secrets.yml` credentials:\n\n> You can request your API credentials on you account\'s profile on [Buda.com](hhtps://www.buda.com)\n\n`secrets.yml`\n\n```yaml\ncredentials:\n  Buda:\n    key: MY_API_KEY\n    secret: MY_API_SECRET\n```\n\n### Write yout first Bot logic\n\nNow let\'s write the code to fetch the Bitcoin balance on [Buda.com](https://www.buda.com) implementing the Bot\'s algorithm. The Bot\'s logic resides in the `my_project/my_bot/bot.py` module created by the `createbot` command:\n\n`my_project/my_bot/bot.py`\n\n```py\n# Base class that all Bots must inherit from\nfrom trading_bots.bots import Bot\n\n# The settings module contains all values from settings.yml and secrets.yml\nfrom trading_bots.conf import settings\n\n# API Wrapper for Buda.com\nfrom trading_api_wrappers import Buda\n\n\nclass MyBot(Bot):\n    # The label is a unique identifier you assign to your bot on Trading-Bots\n    label = \'MyBot\'\n\n    def _setup(self, config):\n        # Get API_KEY and API_SECRET from credentials\n        credentials = settings.credentials[\'Buda\']\n        key = credentials[\'key\']\n        secret = credentials[\'secret\']\n\n        # Initialize a Buda Auth client\n        self.buda = Buda.Auth(key, secret)\n\n    def _algorithm(self):\n        # Fetch the Bitcoin balance from Buda.com\n        balance = self.buda.balance(\'BTC\')\n\n        # Log the Bitcoin balance\n        self.log.info(f\'I have {balance.amount.amount} BTC\')\n\n    def _abort(self):\n        # Abort logic, runs on exception\n        self.log.error(f\'Something went wrong with MyBot!\')\n```\n\n### Bot execution\n\nRun the bot!\n\n    python bots.py run MyBot\n\n    TRADING BOTS 🤖\n    ===============\n\n    Global settings\n    - Settings files: None\n    - Logs file: log.txt\n\n    Bot: MyBot\n    - Config file: default\n\n    Starting MyBot 1530691595: 2018-07-04 08:06:35\n    I have 1.0 BTC\n    Run time: .9972 seconds\n    Ending MyBot 1530691595: 2018-07-04 08:06:36\n\nOr put it to work in a loop!\n\n    python bots.py loop MyBot --interval 5\n\n    TRADING BOTS 🤖\n    ===============\n\n    Global settings\n    - Settings files: None\n    - Logs file: log.txt\n\n    Bot: MyBot\n    - Config file: default\n    - Interval: 5s\n\n    Starting MyBot 1530692725: 2018-07-04 08:25:25\n    I have 1.0 BTC\n    Run time: 1.3611 seconds\n    Ending MyBot 1530692725: 2018-07-04 08:25:26\n\n    Starting MyBot 1530692735: 2018-07-04 08:25:31\n    I have 1.0 BTC\n    Run time: 1.3632 seconds\n    Ending MyBot 1530692735: 2018-07-04 08:25:32\n\n### Add more features\n\nWe can make our Bot a little more modular, let\'s now fetch our Ethereum balance adding a `currency` key on `MyBot` default config file on `my_project/my_bot/configs/default.yml`:\n\n`my_project/my_bot/configs/default.yml`\n\n```yaml\ncurrency: ETH\n```\n\nNow use the new `currency` config on `MyBot` by modifying the Bot\'s logic:\n\n`my_project/my_bot/bot.py`\n\n```py\nfrom trading_bots.bots import Bot\nfrom trading_bots.conf import settings\n\nfrom trading_api_wrappers import Buda\n\n\nclass MyBot(Bot):\n    label = \'MyBot\'\n\n    def _setup(self, config):\n        # Get currency from config\n        self.currency = config[\'currency\']\n\n        # Get API_KEY and API_SECRET from credentials\n        credentials = settings.credentials[\'Buda\']\n        key = credentials[\'key\']\n        secret = credentials[\'secret\']\n\n        # Initialize a Buda Auth client\n        self.buda = Buda.Auth(key, secret)\n\n    def _algorithm(self):\n        # Fetch the currency balance from Buda.com\n        balance = self.buda.balance(self.currency)\n\n        # Log the currency balance\n        self.log.info(f\'I have {balance.amount.amount} {self.currency}\')\n\n    def _abort(self):\n        # Abort logic, runs on exception\n        self.log.error(f\'Something went wrong with MyBot!\')\n```\n\nRun the bot!\n\n    python bots.py run MyBot\n\n    TRADING BOTS 🤖\n    ===============\n\n    Global settings\n    - Settings files: None\n    - Logs file: log.txt\n\n    Bot: MyBot\n    - Config file: default\n\n    Starting MyBot 1530691595: 2018-07-04 08:06:35\n    I have 5.0 ETH\n    Run time: .9972 seconds\n    Ending MyBot 1530691595: 2018-07-04 08:06:36\n\nOr put it to work in a loop!\n\n    python bots.py loop MyBot --interval 10\n\n    TRADING BOTS 🤖\n    ===============\n\n    Global settings\n    - Settings files: None\n    - Logs file: log.txt\n\n    Bot: MyBot\n    - Config file: default\n    - Interval: 5s\n\n    Starting MyBot 1530692725: 2018-07-04 08:25:25\n    I have 5.0 ETH\n    Run time: 1.3611 seconds\n    Ending MyBot 1530692725: 2018-07-04 08:25:26\n\n    Starting MyBot 1530692735: 2018-07-04 08:25:31\n    I have 5.0 ETH\n    Run time: 1.3632 seconds\n    Ending MyBot 1530692735: 2018-07-04 08:25:32\n\n## Bots CLI\n\nTrading-Bots comes with a handy `CLI` named... `bots-admin`!\n\n### Commands\n\n#### Start a project\n\n    python bots.py startproject\n\n```bash\nTRADING BOTS 🤖\n===============\n\nName [MyAwesomeProject]: MyProject\nDirectory [.]: .\n\nSuccess: \'MyProject\' project was successfully created on \'.\'\n```\n\n`startproject` creates a Trading-Bots project directory structure for the given project `NAME` in the current directory `.` or optionally in the given `DIRECTORY`.\n\n    project_dir/\n    - project_name/\n    - bots.py\n    - secrets.yml\n    - settings.yml\n\n#### Create a bot\n\n    python bots.py createbot\n\n```bash\nTRADING BOTS 🤖\n===============\n\nName [MyAwesomeBot]: MyBot\nDirectory (your projects dir): my_project\n\nSuccess: \'MyBot\' bot was successfully created on \'my_project\'\n```\n\n`createbot` creates a Bot\'s directory structure for the given bot `NAME` in the current directory `.` or optionally in the given `DIRECTORY`.\n\n    project_dir/\n    - project_name/\n    - bots.py\n    - secrets.yml\n    - settings.yml\n\nAfter creating or a new Bot, you must add it to `installed_bots` on `settings.yml`:\n\n```yaml\n# settings.yml\n\ninstalled_bots:\n  - trading_bots.mybot.bot.MyBot  \n```\n\n#### Run bot once\n\n    python bots.py run BOT [OPTIONS]\n\nRun a specified `BOT` by label. Options:\n\n|                |     |\n| ---            | --- |\n| `-c, --config` | Bot configuration filename (YAML format) |\n| `-l, --log`    | Log to this file |\n| `--settings`   | Global settings files (YAML format) |\n\n```bash\npython bots.py run Example\n\nTRADING BOTS 🤖\n===============\n\nGlobal settings\n- Settings files: None\n- Logs file: log.txt\n\nBot: Example\n- Config file: default\n\nStarting Example 1530691595: 2018-07-04 08:06:35\nThis is an example bot\nDoing work for 5 seconds...\nFinished!\nRun time: 5.9972 seconds\nEnding Example 1530691595: 2018-07-04 08:06:40\n```\n\n#### Run bot in a loop\n\n    python bots.py loop BOT [OPTIONS]\n\nSchedule a `BOT` (by label) to run on an interval. Options:\n\n|                |     |\n| ---            | --- |\n| `-i, --interval` | Loop interval (in seconds). |\n| `-c, --config`   | Bot configuration filename (YAML format) |\n| `-l, --log`      | Log to this file |\n| `--settings`     | Global settings files (YAML format) |\n\n```bash\npython bots.py loop Example -i 5\n\nTRADING BOTS 🤖\n===============\n\nGlobal settings\n- Settings files: None\n- Logs file: log.txt\n\nBot: Example\n- Config file: default\n- Interval: 5s\n\nStarting Example 1530692725: 2018-07-04 08:25:25\nThis is an example bot\nDoing work for 5 seconds...\nFinished!\nRun time: 5.3611 seconds\nEnding Example 1530692725: 2018-07-04 08:25:30\n\nStarting Example 1530692735: 2018-07-04 08:25:35\nThis is an example bot\nDoing work for 5 seconds...\nFinished!\nRun time: 5.3632 seconds\nEnding Example 1530692735: 2018-07-04 08:25:40\n\n...\n```\n\n### Disclaimer\n\n__USE THE SOFTWARE AT YOUR OWN RISK. YOU ARE RESPONSIBLE FOR YOUR OWN MONEY. PAST PERFORMANCE IS NOT NECESSARILY INDICATIVE OF FUTURE RESULTS.__\n\n__THE AUTHORS AND ALL AFFILIATES ASSUME NO RESPONSIBILITY FOR YOUR TRADING RESULTS.__\n',
    'author': 'Sebastian Aranguiz',
    'author_email': 'sarang575@gmail.com',
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://github.com/snake575/trading-bots',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'entry_points': entry_points,
    'python_requires': '>=3.6,<4.0',
}


setup(**setup_kwargs)
