Ejemplo n.º 1
0
    def setUp(self):
        self.USE_IN_UNITTEST = None
        self.API_KEY = None
        self.API_SECRET = None

        # Open environment file to check with production credentials
        env_file = pathlib.Path(pathlib.PurePosixPath(pathlib.Path(__file__).resolve().parent.parent.parent, '.env'))
        if env_file.is_file():
            with open(env_file, 'r') as f:
                for line in f.readlines():
                    key, value = line.split('=')
                    setattr(self, key, value.replace('\n', ''))
            if self.USE_IN_UNITTEST is not None: self.USE_IN_UNITTEST = int(self.USE_IN_UNITTEST)
        # Set prod and dev env 
        if self.USE_IN_UNITTEST == 1: 
            self.pynance_prod = PyNance(api_key=self.API_KEY, api_secret=self.API_SECRET)
        self.pynance_test = PyNance(debug=True)
Ejemplo n.º 2
0
from flask_cors import CORS
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy

from backend.config import Config
from backend.views import ViewManager
from backend.jinja import CustomFunctions

from pynance import PyNance
import pathlib

db = SQLAlchemy()
cors = CORS()
migrate = Migrate()
pynance = PyNance('', '')

from backend.models.bot import BotModel
from backend.models.orders import OrderModel
from backend.models.preference import PreferenceModel
from backend.models.settings import SettingsModel
from backend.models.system import SystemModel


class Webserver(Flask):
    def __init__(self):
        public_folder = str(
            pathlib.PurePosixPath(
                pathlib.Path(__file__).resolve().parent.parent, 'frontend',
                'dist'))
        if not pathlib.Path(public_folder).exists():            raise Exception(
Ejemplo n.º 3
0
 def setUp(self):
     self.pynance = PyNance(debug=True)
     self.data = self.pynance.orders.open('LTCBTC')
Ejemplo n.º 4
0
from flask_cors import CORS
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy

from backend.config import Config
from backend.views import ViewManager
from backend.jinja import CustomFunctions

from pynance import PyNance
import pathlib

db = SQLAlchemy()
cors = CORS()
migrate = Migrate()
pynance = PyNance(flask_app=True)

class Webserver(Flask):
    def __init__(self):
        public_folder = str(
            pathlib.PurePosixPath(
                pathlib.Path(__file__).resolve().parent.parent,
                'frontend',
                'dist'
            )
        )
        if not pathlib.Path(public_folder).exists(): raise Exception(
            'Frontend needs to be compiled first\n\n' \
            'cd webserver/frontend && npm run watch\n' \
            'cd webserver/frontend && npm run build'
        )