Coder Social home page Coder Social logo

python_assignment's Introduction

Financial

This project fetch stock price data, store parsed data into local db, and provide APIs for query.

Tech Stacks

  • storage: MySQL:8.0 is one of the top choices for RDBMS, it's reliable and extensible.
  • web framework: Flask is a popular lightweight Python web framework, which is suitable for this assignment.
  • SQL builder: SQLAlchemy 's SQL Expression Language is flexible to use.
  • MySQL client for Python: PyMySQL is implemented in pure Python, it's easy to install in some system.
  • object (de)serialization: marshmallow is a Python library that converts complex data types to native Python data types and vice versa, it can help reduce code duplication when serialize/deserialize objects.
  • environment variable loader: python-decouple is a tool to load env vars from .env or ini file.
  • HTTP library: requests to make HTTP requests.

How to run this project

  1. Clone this repo to local machine and enter project directory
    >>git clone [email protected]:fakepoet/python_assignment.git && cd python_assignment
  2. Generate .env file with .env.example and replace ALPHA_VANTAGE_API_KEY with yours (if you don't have one, you can apply for free from here)
    cp .env.example .env
  3. Run project via docker-compose
    docker-compose up -d
    Initial data is fetched with above command, if you want to manual update data, please run below command:
    docker exec financial-app python get_raw_data.py
  4. Verify status of containers
    docker ps -f name=financial-
    If you can see two containers with name financial-app / financial-db, then project is running properly.
  5. Test API
    curl -X GET 'http://localhost:5000/api/financial_data'

Manage secret keys

Local development

Secret keys for local development can be stored in .env file, as long as .env is included in .gitignore, it should not be included in repo history.

For safety concerns, you can also add extra protection via password management tools like 1Password, which can turn plain text into secret references

Production

In production environment, it's better to store & use secret via secret management services like Kubernetes secret or AWS secrets manager.

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.