GithubHelp home page GithubHelp logo

binance-pump's Introduction

Binance Pump

Module for loading data from the Binance exchange into a relational database under the control of PostgresSQL. It doesn't load account data and user orders because they are stored in exchange.

1. Instalation

All instructions made with assumption that Ubuntu is used as server OS.

1.1 PostgreSQL instalation

As described in Apt - PostgreSQL Wiki

1.1.1. Import the repository key from https://www.postgresql.org/media/keys/ACCC4CF8.asc:

 $ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

Create /etc/apt/sources.list.d/pgdg.list. The distributions are called codename-pgdg. In the example, replace stretch with the actual distribution you are using:

 deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main

(You may determine the codename of your distribution by running lsb_release -c). For a shorthand version of the above, presuming you are using a supported release:

 $ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

Finally, update the package lists, and start installing packages:

 $ sudo apt-get update
 $ sudo apt-get upgrade
 $ sudo apt-get install postgresql-10

Alternately, this shell script will automate the repository setup. Note that the shell script leaves the source package repo (deb-src) commented out; if you need source packages, you will need to modify /etc/apt/sources.list.d/pgdg.list to enable it.

1.1.2. Initial configuration

Open psql cli:

 $ sudo -u postgres psql template1

Set password for user postgres:

 \password <password>

Change authorization method in /etc/postgresql/10/main/pg_hba.conf to enable login with PostgreSQL roles: was:

 # Database administrative login by Unix domain socket
 local   all        postgres                      peer

 # "local" is for Unix domain socket connections only
 local   all        all                           peer

should be:

 # Database administrative login by Unix domain socket
 local   all        postgres                      md5

 # "local" is for Unix domain socket connections only
 local   all        all                           md5

Enable TCP/IP connections to PostgreSQL in /etc/postgresql/10/main/postgresql.conf:

 listen_addresses = 'localhost'

Enable IO buffering in /etc/postgresql/10/main/postgresql.conf:

 fsync = off

Restart PostgreSQL service:

 $ sudo /etc/init.d/postgresql restart

1.1.3. Setup binancedb database:

Open psql cli:

 $ psql -U postgres template1

Creeate the binance user:

 CREATE ROLE binance WITH LOGIN ENCRYPTED PASSWORD '<password>';

Create the binancedb database:

 CREATE DATABASE "binancedb";

Set access rights to binancedb for user binance:

 GRAND ALL ON "binancedb" TO "binance";

Initialize binancedb database with sql/pgdb.sql script:

 \i <binance-pump root>/sql/pgdb.sql

Configure binance-pump in bncpump.conf:

 DATABASE_CONNECTION = {
     "host"     : "localhost",
     "port"     : "5432",
     "database" : "binancedb",
     "user"     : "binance",
     "password" : "<password>"
 }

Start bncpump with --initdb to load symbols and generate tables for them:

 $ ./bncpump.py --initdb

Setup data to collect in bncpump.conf in Data to collect section.

binance-pump's People

Contributors

fmaksim74 avatar

Stargazers

 avatar

Watchers

 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.