Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #28 from auto-trading-temp-name/master
Browse files Browse the repository at this point in the history
fix me
  • Loading branch information
CelestialCrafter authored Nov 3, 2023
2 parents 059c57d + 57001d9 commit 262296d
Show file tree
Hide file tree
Showing 19 changed files with 421 additions and 116 deletions.
151 changes: 151 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
48 changes: 48 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Docker

on:
push:
branches:
- 'master'

jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
steps:
-
name: Check out the repo
uses: actions/checkout@v4
-
name: Create env file
run: |
echo '${{ toJSON(secrets) }}' | jq -r 'to_entries | map("\(.key)=\"\(.value)\"") | @sh' | tr ' ' '\n' | tr -d \' > .env
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
-
name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "ta-lib"]
path = ta-lib
url = https://github.com/TA-Lib/ta-lib
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM continuumio/miniconda3
WORKDIR /app
COPY environment.yml .
RUN conda env create -f environment.yml

COPY . .
EXPOSE 80
CMD ["conda", "run", "--no-capture-output", "-n", "auto-trading", "waitress-serve", "--port=80", "--call", "app:get_app"]
2 changes: 1 addition & 1 deletion algorithms/bollinger_bands.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def algorithm(prices, window_size=20, standard_deviations=2):
return upper_band, lower_band, middle_band

def signal(prices, data):
upper_band, lower_band, middle_band, prices = data
upper_band, lower_band, middle_band = data
if prices[-1] > upper_band[-1]:
return 'sell', 1
elif prices[-1] < lower_band[-1]:
Expand Down
6 changes: 3 additions & 3 deletions algorithms/rsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def algorithm(prices, window_size=14):
def signal(prices, data, high=70, low=30):
rsi = data
if rsi[-1] > high:
return 'sell'
return 'sell', 0.5
elif rsi[-1] < low:
return 'buy'
return 'no_action'
return 'buy', 0.5
return 'no_action', 0
10 changes: 7 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dotenv import load_dotenv
from flask import Flask
from werkzeug.middleware.proxy_fix import ProxyFix
from views import bot_net_worth, internal_checker, plot
from views import internal_checker, plot, worth

load_dotenv()

Expand All @@ -10,6 +10,10 @@

app.add_url_rule('/plot/<algorithm>', view_func=plot.plot)
app.add_url_rule('/internal_checker', view_func=internal_checker.internal_checker)
app.add_url_rule('/profit/<bot_id>', view_func=bot_net_worth.bot_net_worth)
app.add_url_rule('/worth/<bot_id>', view_func=worth.worth)

app.run()
if __name__ == '__main__':
app.run()

def get_app():
return app
Loading

0 comments on commit 262296d

Please sign in to comment.