Created
May 14, 2021 23:34
-
-
Save beshup/cf68ca20dd3de7b3989263b24a40e953 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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