Git Product home page Git Product logo

8916stockgql's Introduction

#GraphQL Stock Service

This project is based on flask and ariadne.

Installation

  1. Clone/Download repo
  2. Open the project in VS Code.
  3. In VS Code, open the Command Palette (View > Command Palette or (⇧⌘P)). Then select the Python: Create Environment command to create a virtual environment in your workspace. Select venv and then the Python environment (Python V3.x) you want to use to create it.
  4. Install with pip:
$ pip install -r requirements.txt

Flask Application Structure

.
| |────api/
| | |────__init__.py
| | |────mutations.py
| | |────queries.py
| |────models/
| | |────__init__.py
| | |────stock.py
|──────app.py
|──────available_stock.py

  1. Run the app python app.py

  2. Use the app

Once it is launched, the graphql client GUI tool can be accessied by http://127.0.0.1:5000/graphql

##Query:

###Get Stock List

{
  getStocks {
    symbol
    name
    currentPrice
    minPrice
    maxPrice
  }
}

###Get A Certain Stock (stock price will be a randomized as well as the volume)

{
  getStock(symbol:"AAPL") {
    symbol
    name
    volume
    currentPrice
    minPrice
    maxPrice
  }
}

###Add Stock

mutation{
    addStock(symbol:"NVDA", name:"Nvidia", currentPrice:33.33, volume: 3000) {
    symbol
    name
    currentPrice
    minPrice
    maxPrice
  }
}

8916stockgql's People

Contributors

boyuansyntronic avatar

Watchers

Bo Yuan avatar

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.