Develop a Fantasy League webapp with Glide

Hi Glide Community,

I’m developing a web app on Glide that functions as a fantasy league for the cryptocurrency market. Users start with $1 billion to invest in a portfolio by buying and selling assets.

Each transaction they make creates a row in the “Orders” sheet.

My challenge is figuring out how to track which tokens each user holds and their quantities. How can I set up my sheets to dynamically track each user’s holdings after every transaction?

Any advice or tips would be greatly appreciated!

Thanks in advance for your help!

1 Like

When you say sheet, do you mean spreadsheet such as Google Sheet or Excel worksheet? Or Do you mean Glide tables?

How would you present this in the front end?
Can I assume that you would first select a player, and then navigate to a screen that would present a table with a list of tokens that player holds, and the current balance of each?

1 Like

That would be just a matter of relation + rollup to get the balance, and “unique” to show only one row for each token at that point, but yeah, need more context here.

Ty for the help.

Users participate in a “Crypto Fantasy League” by creating portfolios composed of crypto tokens.
Users can view available tokens and use a buy/sell button for each token to open an edit screen.
This screen includes a number entry field where they can specify the amount of tokens to buy or sell.
Every submitted transaction creates a row in the “Orders” table (Glide Table) with details such as “User ID, Token ID, and Quantity Transacted” (as shown in the attached image).

My question is:
Is it possible, by creating a relationship between the “Orders” and “Users” tables, or in some other way, to have all the portfolio-related information in the “Users” table?
For example, if a user has made three transactions:

  • Bought +10 tokens of A
  • Bought +10 tokens of B
  • Sold -5 tokens of A

I would like the “Users” table to reflect that the user owns 5 tokens of A and 10 tokens of B.

Thank you very much for your help!

I hope this post provides you with more context. Thank you very much for your help.

atm the app uses mainly 3 tables:
“tokens” is a Google Sheet because I need external data
“users” Glide Table
“orders” Glide Table

In your Orders table:

  • Create a query pointing to that same table, filter by token iD is this row > token ID and User ID is this row > user ID.
  • Add a rollup column on top of that query, target the math_Token quantity and do a sum, you should get your total quantity of a token for a user here.
  • Add a single value column on top of the query, get back the first rowID.

In your users table, add a relation to the orders table that matches multiple records using the User ID.

On the front end, add a collection component that is powered by the users relation with the orders table, filter by rowID is “first rowID” (from the single value column) so that we have “unique” records, then the quantity would come from the rollup.

1 Like

You’re great! Ty so much!

1 Like

Glad to help! Playing Fantasy myself on Basketball and Premier League.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.