Git Product home page Git Product logo

scrtsibyl-oracle's People

Contributors

balloonbox-hongbin avatar irene-bbox avatar m3mayllon avatar michaelbrink avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

taunicreed

scrtsibyl-oracle's Issues

Documentation Milestone #2

Description

Explain the algorithm for a specific target audience: users interacting with the SCRTSibyl UI Web app.

Required fields

  • metric captions for the donut charts featured in the Web app landing page
  • legend for the nonlinear score scale and its associated bins of USD amount the user qualified for
  • draft application for SCRTSibyl_phase2 grant

create plaid model

Scope

  • Create a model to calculate the credit score when user's only link their plaid account

Features

  • create models file
  • define scope for each model
  • define metrics for each model
  • define weights for scope and metrics

Models

create flask app

Scope

  • Build flask app

Features

  • create app.py
  • create wsgi.py
  • create debugging mode

Wire together 4 Coinbase metrics

Scope

  • Execute locally the Coinbase credit score algorithm. Feed it fake user data. Return a score.

Testing

  • test each metric function on fake data

Documenting

  • redesign decision tree for Coinbase algorithm

Features

  • support.metrics.py
  • support_model.py
  • support_score.py

Optimization

  • increase granularity of ALL scoring grids

metric-velocity

The 'Velocity' metric assesses frequency, regularity, volume, count, and behaviour of a user's checking account. It's the second most prominent metric in the model and comprises of the following functions:

  • withdraws()
  • deposits()
  • month_net_flow()
  • month_txn_count()
  • slope()

Loan Terms (timeframe)

Description

Specify the Loan Terms: i.s., the conditions and terms for being issued a loan:

  • amount
    (how much money to you qualify for?) [done]
  • timeframe
    (when will you be able to pay back your credit by?) [to do]
  • interest rate
    (how much interest should you be charged for the loan?) [future]

Timeframe

  • function to retrieve loan due date
  • add a new key-value pair in the 'feedback' dictionary:
    feedback = { 'duedate': float (in months) }
  • incorporate description loan duedate in the 'feedback' dict
  • do the same twice (Plaid & Coinbase)

metric-diversity

The 'Diversity' metric assesses how well a user is diversifying his financial assets. The metric calls on these functions:

  • account_mix()
  • profile()

connect with Plaid

Scope

  • Build a connection with Plaid and integrate sandbox environment

Features

  • connect with plaid
  • integrate with sandbox

Improve risk indicator

Description

Increase the output accuracy of the credit scoring model by returning low / medium / high-risk indicators on the scoring bin assigned to the user.

Features

  • calculate low, medium, high risk
  • return low, medium, high risk loan amounts

Wire together 4 Plaid metrics

Scope

  • Execute locally the Plaid credit score algorithm. Feed it real users Mobi data. Return a score.

Testing

  • test each metric function on Mobi data

Documenting

  • redesign decision tree for Plaid algorithm

Features

  • support.metrics.py
  • support_model.py
  • support_score.py

Optimization

  • increase granularity of ALL scoring grids
  • present current Algo, obtain feedback, implement them

create credit score endpoint

Scope

  • Build an endpoint for calculate the credit score

Feature

  • create app_route
  • connect to plaid
  • connect to coinbase
  • guide the calculation based on front-end response from plaid and coinbase

Bin Git files into folders

Description

Organize by topic and functionality the .py files in the Git Repo for the SCRTSibyl algorithm.

metric-stability

The 'Stability' metric checks the historical legacy across ALL accounts of a user. The metric is computed through the functions:

  • tot_balance_now()
  • min_running_balance()

deploy Plaid Quickstart functions

  • Import and customize Plaid Quickstart functions
  • Use the functions to create Plaid items
    and fetch data through Plaid API
  • Write new metric functions that are compatible with Quickstart

QA analysis - Coinbase

Testing

Test the Coinbase model, expose its weaknesses, and strengthen it.

  • test algorithm on 3 fake local data sets and 2 real and remote (API) user data
  • start linspace() at 0.1
  • refactor 'send' type transactions
  • refactor except-statements
  • use uniform scoring grids
  • use penalties in Coinbase model, too, for consistency sake with Plaid (only for overdraft)
  • debug bad weighted average in activity_consistency() function

Code Review

Code review 3 .py files:

  • support_metrics_coinbase.py
  • support_models.py
  • support_score.py

Deploy on Heroku

Summary

Integrate the credit score API.

Tasks

  • create a staging and production app on Heroku
  • set up Heroku procfile, requirements and env vars
  • test endpoints on Postman
    • Plaid
    • Coinbase

build Coinbase model

Description

  • (1) The KYC (Know Your Customer) metric checks whether a user's Coinbase account has been verified, thus proving that the user is a trusted real human being.
  • (2) The History metric considers the longevity of a user's Coinbase account.
  • (3) The Liquidity metric accounts for the volume and duration of the value stored in the user's account.
  • (4) The Activity metric rewards the user based on the volume and count of historical transactions (credit and debit).

Functions

  • kyc:
    • kyc()
  • history:
    • history_acc_longevity()
  • liquidity
    • liquidity_tot_balance()
    • liquidity_min_running_balance()
  • activity:
    • activity_tot_volume_tot_count()
    • activity_consistency()
    • activity_profit_since_ inception()
    • activity_buy_sell_ratio()

build Plaid credit score

Scope

  • Develop different methodologies based on different inputs to calculate the credit score

Features

  • create different score methodologies (path-logic wise, not calculation) @m3mayllon

  • connection w/ Plaid only @m3mayllon

    • fetch transactions
    • fetch identity
    • fetch holdings
    • fetch investments
  • Plaid credit score modelling @irene-bbox

    • build credit model
    • build velocity model
    • build stability model
    • build diversity model
  • connection w/ Coinbase only @m3mayllon

    • fetch accounts
    • fetch transactions
    • fetch buys
    • fetch sells
    • fetch deposits
    • fetch withdrawals
  • Coinbase credit score modelling @MichaelBrink @irene-bbox

Connect with Coinbase

Scope

  • Build a connection with Coinbase and fetch data from dummy account

Features

  • connect with coinbase
  • fetch data

procure Coinbase data

Description

Procure real Coinbase user data which you'll use to build your credit score algorithm

Data procurement

  • user 1 data
  • Coinbase Cloud data
  • external user data

Data filtering

  • integrate with Coinmarketcap
  • write helper functions to filter data

QA analysis - Plaid

Testing

Test the Plaid model, expose its weaknesses, and strengthen it.

  • test algorithm on 24 real-Mobi-users accounts
  • start linspace() at 0.1
  • refactor except-statements
  • adopt lenient scoring grids - make the model less conservative
  • use logarithmic scoring matrices
  • retrieve real-user data from Plaid 'production' environment, format such data, feed it into the score calculator

Expand validator options

Description

Binance is a well-established and growing crypto exchange platform. Users should have the choice to connect to their Binance account as well.

Features

  • integrate with Binance API
  • create a score model
  • split the model into metrics

Files to create/update

  • main.py
  • config/params.py
  • images/logic_binance.png
  • validator/binance.py
  • support/score.py
  • support/models.py
  • support/metrics_binance.py
  • support/feedback.py
  • testing/data/test_binance.json
  • testing/tests/test_binance.py
  • documentation/README.md

metric_history

The 'History' metric considers the longevity of a user's Coinbase account:

  • history_acc_longevity()

API Documentation

Objective

Creating a API documentation is key to enhancing the developer experience. Developers will find it easy to use, leading to increased adoption of your products and services.

Attributes

  • Authentication: how to get the access credentials and how the keys work for making requests.
  • Resources: endpoints, parameters, etc.
  • Error messages: error messages and how the errors can be solved.

Expand loan range

Description

Refining the accuracy of the credit score will allow the initial P2P micro-lending loans to increase beyond the initial USD 25,000.

Features

  • add input of intended loan
  • refine model to fit greater loans, such as 0-25k | 25-50k | 50-100k (templating)
  • return interest rate, payment timeframe and frequency

Documentation Milestone #1

Documentation

Document the algorithm. Make it understandable and viable for the user.

Tasks

  • in line doc in .py files
  • GitHub README.md file for Repo landing page
  • infographics displaying the algorithm flow
  • Score-to-money fuel gauge diagram
  • Prep Milestone #1 slide presentation + demo for Yonatan Erez and the SCRT Labs team

Alter Score Message

Objective

Alter the content, syntax, and parameters included in the UI message returned to the user to explicate their credit score.

Tasks breakdown

  • USD amount must have format $ X,XXX USD
  • USD to SCRT live-conversion --> loan amount in SCRT
  • return field 'bank' displaying the Plaid bank name
  • return comma separated list of algorithm metrics where an error occurred
  • test in production (front end)

Front end

  • add pop-up window containing tips on how to improve both the Plaid and the Coinbase score

metric_kyc

Description

  • (1) The KYC (Know Your Customer) metric checks whether a user's Coinbase account has been verified, thus proving that the user is a trusted real human being.
  • (2) The History metric considers the longevity of a user's Coinbase account.
  • (3) The Liquidity metric accounts for the volume and duration of the value stored in the user's account.
  • (4) The Activity metric rewards the user based on the volume and count of historical transactions (credit and debit).

Functions

  • kyc:
  • kyc()
  • history:
  • history_acc_longevity()
  • liquidity
    • liquidity_tot_balance()
    • liquidity_min_running_balance()
  • activity:
    • activity_credits()
    • activity_debits()

Allow smart currency selection

Description

The user interacts with the SCRTSibyl UI to custom-choose their preferred currency (fiat or crypto) for score calculation. The dApp will automatically standardize all the metrics in the credit scoring algorithm to the chosen currency.

Features

  • integrate with real-time currency conversion e.g. CoinAPI.io
  • add USD, EUR, BTC, ETH, USDT, USDC, BNB, XRP
  • allow users to select multiple currencies, then use them as a restriction to the score calculation.
    • allow multiple currency selections
    • calculate score based on selected currencies only

Merge Git branches

Description

Merge and clean up all Git branches before Milestone #1 deliverable

Unit tests for algorithm

Description

Run Unit Tests the algorithm for SCRTSibyl

Tasks

  • test Plaid algo
  • test Coinbase algo

metric-credit

The 'Credit' metric assesses the health of a user's line of credit. This metric impacts our credit score model most heavily. To calculate the 'Credit' metric you'll need to code the following functions:

  • credit_mix()
  • credit_limit()
  • credit_util_ratio()
  • interest()
  • credit_length()
  • credit_livelihood()

Doc for SCRTSibyl-oracle Repo

Expand and substantiate GitHub doc

  • add algo_demo.py file to execute the credit scoring algorithm independently from the entire DApp frontend flow and return a sample result, comprising of numerical score + descriptive score feedback
  • include documentation with high-level overview of how the algorithm Git repo (called SCRTSibyl_oracle) fits into the larger picture of the DApp flow
  • add Data Privacy section in the documentation: Where is data stored? What data is ever stored in the first place? What data is written to chain?
  • publish a tree depicting the GitHub repo dependencies among directories --> tried, but the repo is too big for the tree to be of any utility
  • remove local_helper.py. Bake in those functions in the file where they're imported to right now
  • update requirement.txt file

Code Optimization

Objective

Although performance optimization is a never-ending process, there are always chances to improve and make code
run faster and using less memory.

Attributes

  • Remove redundant code without changing the meaning of the program.
  • Reduce execution speed.
  • Reduce memory consumption.

Run Plaid API + Algorithm concurrently

Description

  • Fetch real user data through Plaid API using access token (in 'production' environment)
  • Write function to serialize dictionary into json converting datetime objects into strings
  • Feed formatted API data into Plaid credit score algorithm
  • Compute score through app_route.py

Combine Plaid with Coinbase

Description

Integrate the two models in the same .py file. Let SCRTSybil choose dynamically which algorithm to run based on user's selection in the oracle UI (Coinbase OR Plaid).

Integrate

  • app_route.py (both)
  • support_score.py (both)
  • support_models.py (both)
  • support_metrics_plaid.py (Plaid only)
  • support_metrics_coinbase.py (Coinbase only)

Format Feedback

Description

Return granular quantitative data motivating why the user obtained a given score and extrapolate a descriptive qualitative summary (i.e., a qualitative feedback) associated with the numerical score.

Formatting - Round #1

  • add 'feedback' parameter to every function
  • return the 'feedback' dictionary for every function the model runs
  • add/alter the feedback string content
  • replace lists with dictionaries
  • discuss feedback format with Matteo
  • store this granular quantitative feedback data somewhere. Access this data whenever you need to error-handle a bad score output.

Formatting - Round #2

Adopt the chosen format uniformly for both Plaid and Coinbase model

  • return different string feedback for each of the 4 output scenarios (all smooth, no credit card, score got rounded down, fetch error)
  • give quantitative explanation of why a user got the score that he got. Make the explanation dynamic and automatized
  • include in the feedback user-advices on how to improve the score
  • always return an error message when an error occurs. The error message should include:
    • what went wrong?
    • what's the error? Nonetype, IndexError, etc.

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.