Installation

Gryphon is currently tested on the following systems:

  • Ubuntu 16.04
  • MacOSX Sierra and later

Users who simply want access to the gryphon libraries for use in another project can follow this document as far as Install the library. Users who want to use gryphon for trading should continue through Set up the trading harness. For advanced installations see Dashboard Server and Gryphon Data Service (GDS).

Ubuntu 16.04

Install the library

  1. First make sure you have the prerequisites: python2.7, pip, and mysqlclient.

    sudo apt update
    sudo apt install python2.7 python-pip libmysqlclient-dev
    
  1. While technically optional, we highly recommend that you use virtualenv to create an isolated python environment in which to install Gryphon.

  2. Install the gryphon package. You can install the latest version hosted in the python package index using pip.

    pip install gryphon
    
  3. Gryphon installs a command line tool for running it’s unit test suite. It’s good practice to run it at this stage.

    gryphon-runtests
    

The test runner will trigger a build of some of gryphon’s cython modules, which may take 2-3 minutes. During the build you might see a lot of cython log output–don’t worry, this is normal. Afterwards, you’ll hopefully see a long row of green dots indicating a successful test run.

At this stage, you can use many features of gryphon as a software library in other projects, but running strategies themselves requires a few more setup steps.

Set up the trading harness

The trading harness is the executable that runs trading strategies. It’s installed in the PATH as gryphon-exec. It has a few more dependencies than the pure library.

  1. Install memcached

    sudo apt install memcached libmemcached-dev zlib1g-dev
    
  2. Start a new mysql database and make it accessible to the machine you are running gryphon from. Create a user for gryphon with all read/write privileges to this database.

  3. Gryphon uses .env files to keep sensitive credentials on your machine. Please read Handling credentials with .env files to learn more about this and best practices. For now, create a file in your current working directory named ‘.env’, and add the mysql url for your new database to it as follows:

    TRADING_DB_CRED=mysql://[username]:[password]@[database_host]:3306/[database_name]
    
  4. Now migrate the database to the latest gryphon schema. This can be done with a script in the trading harness.

    gryphon-exec run-migrations --database trading --execute
    

That’s it! At this point you should be ready to move on to Using Gryphon for Trading to start running strategies.

MacOS

The installation steps for OSX are the same as for ubuntu, but instead of aptitude, use Homebrew to install prerequisites as follows.

brew install python@2
brew install mysql
brew install libmemcached
brew install memcached

The rest of the steps are identical to those for Ubuntu 16.04.

Some MacOS users have had issues installing mysql using brew. This stackoverflow answer provides a functioning fix.