Coder Social home page Coder Social logo

ramonwill / data-app Goto Github PK

View Code? Open in Web Editor NEW
47.0 3.0 23.0 1.69 MB

A Web Application that allows users to create dummy portfolios or watchlists to monitor or test their trading strategies. Written in Python using the Flask web framework.

Home Page: https://ramonprescient.eu.pythonanywhere.com/

License: MIT License

Python 63.44% HTML 24.56% Mako 0.40% CSS 10.36% JavaScript 1.23%
portfolio strategies flask finance stock-market stock-data paper-trading python performance

data-app's Introduction

Forks Stargazers Issues MIT License

Data App Project (Prescient Finance)

A Web Application that allows users to create dummy portfolios or watchlists to monitor or test their trading strategies. Written in Python using the Flask web framework.

  • Front-End: HTML, CSS, JS, ChartJS, Plotly
  • Back-End: Flask(Python), SQL-Alchemy, MySQL
  • Other Libraries: Pandas

Table of Contents

Introduction

Prescient Finance allows users to create an unlimited number of portfolios/watchlists to test out their strategies, monitor potential performance, or to simply track certain sectors. Users have a choice of over 1500+ equities from 10 different countries.

Features

Other features of Prescient Finance include:

  • Time-series Performance charts at a portfolio and security level
  • Daily unrealised P&L breakdowns of their positions
  • Perform CRUD operations on their portfolios
  • View the daily Holding Period Return on a portfolio
  • Statistical graphics to help visualise portfolio exposure.

How it Works

After Registration and logging in, A user can create a portfolio. The user can then start adding securities to the portfolio and enter the economics of the trade. The site will then display the various features based on the information entered by the user. If the security does not yet have a prices stored in the database, an api call will be made to Alpha Vantage and the last 100 End of Day (EOD) prices will be stored to the database. EOD prices are updated before midnight on every weekday.

Credits

A big thank you to the Flask community for designing an interesting and flexible Framework. I would also like to thank Alpha Vantage again for the easy access to a wide range of financial data. Finally, a special thanks to the Pandas/Numpy community, Miguel Grinberg and the SQL-Alchemy Community.

  • Disclaimer: This project is not valid financial tool. It is a project that I've created to help me learn more about Python. You should in no way use it to make investment decisions.

Video-Demo

The image below will redirect you to the video demo on Youtube

Screenshots

data-app's People

Contributors

ramonwill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

data-app's Issues

Dialect issue when running the app wsgi.py

running "wsgi.py" , this error popped up :
C:\Users\nisha\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\flask_sqlalchemy\model.py:154: SAWarning: Can't validate argument 'on_delete'; can't locate any SQLAlchemy dialect named 'on'
return sa.Table(*args, **kwargs)

Command Prompt 02-04-2023 20_31_14

(1045, "Access denied for user 'root'@'localhost' (using password: YES)")

After clicking the register button with a username and password, I get this error screen:

image

Looking at the traceback (it's quite long, but I think relevant stuff is at the bottom?), it says this:

[2022-03-06 16:45:32,138] ERROR in app: Exception on /auth/register [POST]
Traceback (most recent call last):
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\base.py", line 3212, in _wrap_pool_connect
    return fn()
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 307, in connect
    return _ConnectionFairy._checkout(self)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 767, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 425, in checkout
    rec = pool._do_get()
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\impl.py", line 146, in _do_get
    self._dec_overflow()
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\langhelpers.py", line 72, in __exit__
    with_traceback=exc_tb,
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\compat.py", line 207, in raise_
    raise exception
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\impl.py", line 143, in _do_get
    return self._create_connection()
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 253, in _create_connection
    return _ConnectionRecord(self)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 368, in __init__
    self.__connect()
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 611, in __connect
    pool.logger.debug("Error on connect(): %s", e)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\langhelpers.py", line 72, in __exit__
    with_traceback=exc_tb,
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\compat.py", line 207, in raise_
    raise exception
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 605, in __connect
    connection = pool._invoke_creator(self)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\create.py", line 578, in connect
    return dialect.connect(*cargs, **cparams)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\default.py", line 584, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\MySQLdb\__init__.py", line 130, in Connect
    return Connection(*args, **kwargs)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\MySQLdb\connections.py", line 185, in __init__
    super().__init__(*args, **kwargs2)
MySQLdb._exceptions.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask\app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask\app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask\app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\lib\site-packages\flask\app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "C:\Users\chalu\OneDrive\Desktop\Python_Scripts\StockPortfolioDashboard\Prescient_Finance_Web_App\Prescient\views\auth.py", line 25, in register
    if form.validate_on_submit():
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\flask_wtf\form.py", line 100, in validate_on_submit
    return self.is_submitted() and self.validate()
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\wtforms\form.py", line 318, in validate
    return super(Form, self).validate(extra)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\wtforms\form.py", line 150, in validate
    if not field.validate(self, extra):
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\wtforms\fields\core.py", line 226, in validate
    stop_validation = self._run_validation_chain(form, chain)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\wtforms\fields\core.py", line 246, in _run_validation_chain
    validator(form, self)
  File "C:\Users\chalu\OneDrive\Desktop\Python_Scripts\StockPortfolioDashboard\Prescient_Finance_Web_App\Prescient\forms.py", line 21, in validate_username
    user = User.query.filter_by(username=username.data).first()
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\orm\query.py", line 2762, in first
    return self.limit(1)._iter().first()
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\orm\query.py", line 2849, in _iter
    execution_options={"_sa_orm_load_options": self.load_options},
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\orm\session.py", line 1688, in execute
    conn = self._connection_for_bind(bind)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\orm\session.py", line 1530, in _connection_for_bind
    engine, execution_options
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\orm\session.py", line 747, in _connection_for_bind
    conn = bind.connect()
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\base.py", line 3166, in connect
    return self._connection_cls(self, close_with_result=close_with_result)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\base.py", line 96, in __init__
    else engine.raw_connection()
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\base.py", line 3245, in raw_connection
    return self._wrap_pool_connect(self.pool.connect, _connection)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\base.py", line 3216, in _wrap_pool_connect
    e, dialect, self
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\base.py", line 2070, in _handle_dbapi_exception_noconnection
    sqlalchemy_exception, with_traceback=exc_info[2], from_=e
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\compat.py", line 207, in raise_
    raise exception
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\base.py", line 3212, in _wrap_pool_connect
    return fn()
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 307, in connect
    return _ConnectionFairy._checkout(self)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 767, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 425, in checkout
    rec = pool._do_get()
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\impl.py", line 146, in _do_get
    self._dec_overflow()
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\langhelpers.py", line 72, in __exit__
    with_traceback=exc_tb,
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\compat.py", line 207, in raise_
    raise exception
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\impl.py", line 143, in _do_get
    return self._create_connection()
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 253, in _create_connection
    return _ConnectionRecord(self)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 368, in __init__
    self.__connect()
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 611, in __connect
    pool.logger.debug("Error on connect(): %s", e)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\langhelpers.py", line 72, in __exit__
    with_traceback=exc_tb,
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\util\compat.py", line 207, in raise_
    raise exception
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\pool\base.py", line 605, in __connect
    connection = pool._invoke_creator(self)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\create.py", line 578, in connect
    return dialect.connect(*cargs, **cparams)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\sqlalchemy\engine\default.py", line 584, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\MySQLdb\__init__.py", line 130, in Connect
    return Connection(*args, **kwargs)
  File "C:\Users\chalu\AppData\Roaming\Python\Python37\site-packages\MySQLdb\connections.py", line 185, in __init__
    super().__init__(*args, **kwargs2)
sqlalchemy.exc.OperationalError: (MySQLdb._exceptions.OperationalError) (1045, "Access denied for user 'root'@'localhost' (using password: YES)")
(Background on this error at: https://sqlalche.me/e/14/e3q8)
127.0.0.1 - - [06/Mar/2022 16:45:32] "POST /auth/register HTTP/1.1" 500 -
127.0.0.1 - - [06/Mar/2022 16:45:32] "GET /favicon.ico HTTP/1.1" 404 -

How to fix? Using Windows 10, Python 3.8. Thanks!

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.