Skip to content

Commit

Permalink
Merge pull request #12 from BlockchainCommons/development-signed
Browse files Browse the repository at this point in the history
Development signed
  • Loading branch information
ChristopherA authored Aug 14, 2020
2 parents 100d0b6 + f876e4a commit 57b75c7
Show file tree
Hide file tree
Showing 5 changed files with 272 additions and 56 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,25 @@ To run the server, run `python3.8 server.py`. Spotbit will then start making htt
* `/configure`
- Shows the current config settings for this server, including what exchanges and currencies are supported.

#### Config Options
Spotbbit uses a config file located at `~/.spotbit/spotbit.config` to change settings. The allowed fields are:
* `keepWeeks`
- The number of weeks worth of data to keep in the database for exchanges that you are not retrieving history for. This setting does not apply to exchanges that have a long term history.
* `exchanges`
- The exchanges you want to get current data for. They should be supplied as a list of lowercase names separated by spaces.
* `currencies`
- The fiat currencies you want to get data for. They should be supplied as a list of currency codes (eg USD, AUD, CAD, etc) separated by spaces
* `interval`
- The time in seconds spotbit should wait between making GET requests to API servers. This value should be between 5-15 seconds for best results.
* `exchange_limit`
- The number of exchanges to allow to be run in one thread, before performance mode is turned on and spotbit distributes exchanges to multiple threads. Set the threshold higher if you want to reduce Spotbit's impact on your system, and lower the threshold if you want Spotbit to run as fast as possible with many exchanges supported.
* `averaging_time`
- The time window in hours that Spotbit will consider "current" when calculating an average price. It is useful to set this to at least an hour or so if you are supporting several dozen or more exchanges, because in these situations some exchanges may occasionally fall slightly behind in the request queue, depending on what you have set as your `interval` and `exchange_limit`.
* `historicalExchanges`
- Exchanges that you want to request past data for in addition to current data. Should be supplied in the same format as the `exchanges` field.
* `historyEnd`
- A millisecond timestamp that represents the oldest point in history you want to keep in storage.

## Origin, Authors, Copyright & Licenses

Unless otherwise noted (either in this [/README.md](./README.md) or in the file's header comments) the contents of this repository are Copyright © 2020 by Blockchain Commons, LLC, and are [licensed](./LICENSE) under the [spdx:BSD-2-Clause Plus Patent License](https://spdx.org/licenses/BSD-2-Clause-Patent.html).
Expand Down
35 changes: 20 additions & 15 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ fi

# install python dependencies
# need to force python3.8 as well
pip install -r requirements.txt
# TODO: compile and install python3.8
pip3.8 install -r requirements.txt

################################################################################################################################
#install tor - Below lines taken from Bitcoin standup
Expand All @@ -25,19 +26,23 @@ sudo apt install apt-transport-https
# We need to set up our package repository before you can fetch Tor. First, you need to figure out the name of your distribution:
DEBIAN_VERSION=$(lsb_release -c | awk '{ print $2 }')
# You need to add the following entries to /etc/apt/sources.list:
#cat >> /etc/apt/sources.list << EOF
#deb https://deb.torproject.org/torproject.org $DEBIAN_VERSION main
#deb-src https://deb.torproject.org/torproject.org $DEBIAN_VERSION main
#EOF
cat >> /etc/apt/sources.list << EOF
deb https://deb.torproject.org/torproject.org $DEBIAN_VERSION main
deb-src https://deb.torproject.org/torproject.org $DEBIAN_VERSION main
EOF
# Then add the gpg key used to sign the packages by running:
#sudo apt-key adv --recv-keys --keyserver keys.gnupg.net 74A941BA219EC810
#sudo wget -qO- https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --import
#sudo gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -
sudo apt-key adv --recv-keys --keyserver keys.gnupg.net 74A941BA219EC810
sudo wget -qO- https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --import
sudo gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -
# Update system, install and run tor as a service
#sudo apt update
#sudo apt install tor deb.torproject.org-keyring
sudo apt update
sudo apt install tor deb.torproject.org-keyring
################################################################################################################################
# TODO support btc standup by not wiping out that config if it is already there, use an if statement (the lmsith version)
# Configure the Spotbit user
/usr/sbin/useradd -m -p `perl -e 'printf("%s\n",crypt($ARGV[0],"spotbit"))' "spotbit"` -g sudo -s /bin/bash spotbit
/usr/sbin/adduser spotbit sudo
echo "created spotbit user in sudo group"

mkdir /var/lib/tor/Spotbit
chown -R debian-tor:debian-tor /var/lib/tor/Spotbit
chmod 700 /var/lib/tor/Spotbit
Expand All @@ -54,12 +59,12 @@ service tor start

################################################################################################################################
# Copy the default config to file
if test -f "~/.spotbit/spotbit.config"; then
if test -f "/home/spotbit/.spotbit/spotbit.config"; then
echo "configs already configured"
else
mkdir ~/.spotbit
touch ~/.spotbit/spotbit.config
cat spotbit_example.config >> ~/.spotbit/spotbit.config
mkdir /home/spotbit/.spotbit
touch /home/spotbit/.spotbit/spotbit.config
cat spotbit_example.config >> /home/spotbit/.spotbit/spotbit.config
fi

# show the URL of the hidden service
Expand Down
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
## Requirements for running Spotbit ##
celery
flask
sqlite
ccxt
Loading

0 comments on commit 57b75c7

Please sign in to comment.