Skip to content

Instantly share code, notes, and snippets.

@beshup
Created May 14, 2021 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beshup/cf68ca20dd3de7b3989263b24a40e953 to your computer and use it in GitHub Desktop.
Save beshup/cf68ca20dd3de7b3989263b24a40e953 to your computer and use it in GitHub Desktop.
@app.route('/to_send_per_entity/<int:entity_id>/<int:shares_owned>/<int:shares_in_circulation>/<int:dividend_fund>', methods=['GET'])
@cross_origin()
def to_send(entity_id, shares_owned, shares_in_circulation, dividend_fund):
if entity_id > LEAGUE_SIZE:
entity_id -= LEAGUE_SIZE
league = league_data()
entity_held_score = float(league[entity_id - 1]['fantasy_points'])
sum_scores = 0.0
for entity in league:
sum_scores += float(entity["fantasy_points"])
res = (shares_owned/shares_in_circulation)*(entity_held_score / sum_scores)*dividend_fund
return {"to_send": int(res)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment