create dynmic formuler for the follwoing ....Overview
Win’it is a unique marketplace where merchants can create offers for players, giving them the opportunity to win their money back from a purchase. The tables have been created using xano.com and we no need to add the logic for the game
Chance to win
The platform incentivizes customers to make a purchase by offering a chance to win their money back, which is funded by the merchant as outlined below.
Wheel of fortune
Each game is played via a wheel of fortune that, when button play is pressed, starts spinning and sends an API request to our xanao.com backend, which generate a random number to select the winner.
Bank it
Before a game is played, players have the option to “bank’it” e.g. take the credit that was going to fund the chance to win, the credit would be for the cost plus margin discount.
Merchant credit
If the player wins, they're giving a merchant credit to spend with the merchant on later purchases, this will be for the full face value of the win.
Cost of wins and Credits
Win it calculates taking into account the merchant's gross profit e.g. if a player play to win back a £10 and the merchant profit margin is 50% the cost of the win would be £5
Points
Win’it has a point exchange system where exchange rate of 1 point = £0.01. This means that 100 points would be worth £1.
Bonus retries
Bonus retries are used in the game when a player plays and loses.
Players obtain bonus retry in two ways
Purchasing them with their points,
In return for refereeing, friends who then make a purchase.
Bonus retries can only be used one per game, unless the player has invited 3 new players who have made a purchase, In this case, the player can use unlimited bonus per game
The odds are based on the cost of winning against the value of the retry.
For example, a bonus retry with a value of 100 points will give odds of 1-5 to win £10 credit.
Bonus points a player during a merchant campaign should be reporting, but as an appendix to merchant reporting, and they should not affect the dynamic odds.
Credit Reward Campaign:
Marchant inputs
Gross profit margin
Desired sales
Desired odds of winning to players
Avenge historical transaction value
Win’it displays Probable
COGS
Number of games
Number of winning games
Face value of winnings
% discount of sale to fund promotion
Campaign reporting
Marchant
Campaign name
Start Date end date
Sale generated
COGS
Amount of winners
Amount of games won
Amount of games played
Avenge credit value won by player
Credit banked
Credit won
Total credit issued
Credits redeemed
Assistant
Here is a dynamic formula for the Win’it platform:
Calculation of the cost of the win:
Cost of the win = face value of the win x (1 - gross profit margin)
Calculation of the value of bonus retries:
Value of bonus retry = cost of the win x odds of winning / 100
Calculation of the odds of winning with bonus retries:
Odds of winning with bonus retries = (face value of the win / value of bonus retry) - 1
Calculation of the number of bonus retries earned by referring friends:
Number of bonus retries earned = number of friends referred x bonus retry reward per referral
Calculation of the cost of the promotion:
Cost of the promotion = (number of games x face value of the win) + (number of bonus retries x value of bonus retry)
Calculation of the discount to fund the promotion:
Discount to fund the promotion = (cost of the promotion / total sales) x 100
Calculation of the number of games won:
Number of games won = number of games x (1 - (1 - odds of winning with bonus retries) ^ number of bonus retries)
Calculation of the face value of winnings:
Face value of winnings = number of games won x face value of the win
Calculation of the credit won:
Credit won = face value of winnings x (1 - gross profit margin)
Calculation of the credit banked:
Credit banked = face value of winnings - credit won
Calculation of the total credit issued:
Total credit issued = credit banked + credit won
These formulas can be used to dynamically calculate the different parameters of the Win’it platform based on the inputs provided by the merchant. The results can then be used to display probable COGS, number of games, number of winning games, face value of winnings, % discount of sale to fund promotion, and other campaign reporting metrics.
User
create this in pyton
Assistant
Here's an implementation of the dynamic formulas for the Win'it platform in Python:
You can call these functions with the appropriate inputs to calculate the different parameters of the Win'it platform, such as the cost of the win, value of bonus retries, number of games won, and credit banked/won. For example:
User
snipots needed in xano to create this
Assistant
To implement the Win'it platform on Xano, you will need to create a few resources and endpoints to handle the different features of the platform. Here are some snippets that show how you can create these resources and endpoints:
POST /bonus_retries/earn_by_referral
{
"player_id": 456,
"num_referrals": 3
}
Endpoint to use bonus retries:
javascript
POST /bonus_retries/use
{
"player_id": 456,
"num_retries": 1,
"game_id": 789
}
These snippets are just examples, and you will need to modify them to fit the specific requirements of your application. You will also need to create additional resources and endpoints to handle things like player accounts, credit rewards, and campaign reporting.
User
SHOULD THE bonus not also refree to the bonus id ?
Assistant
Yes, you are correct. The bonus retries resource should include a reference to the game or games that the bonus retries were used in. This allows you to track which games were played using bonus retries and which were played using regular credits.
Here is an updated snippet for the bonus retries resource that includes a reference to the game:
This new field, game_id, is a reference to the game resource and allows you to associate the bonus retries with a specific game. When a player uses bonus retries to play a game, you can update the used_in_game field to true and set the game_id to the ID of the game that was played using the bonus retries. This way, you can keep track of which games were played using bonus retries and which were played using regular credits.
User
is this overall formuler dynmaic ? if so what data points those it use to change odds ?
Assistant
Yes, the overall formula is dynamic and can be adjusted based on various inputs, such as the face value of the win, gross profit margin, desired odds of winning, number of games played, and number of bonus retries earned by the player.
The odds of winning with bonus retries can be adjusted based on the value of the bonus retries, which is calculated using the cost of the win and the odds of winning. The odds with bonus retries are then used to calculate the number of games won by the player, which is based on the number of games played and the number of bonus retries used.
Here is an overview of the data points used to adjust the odds:
Face value of the win: This is the value of the prize that the player can win when playing the game.
Gross profit margin: This is the profit margin that the merchant makes on each sale, and it is used to calculate the cost of the win.
Desired odds of winning: This is the desired probability of winning that the merchant wants to offer to players.
Number of games played: This is the number of games that have been played on the platform.
Number of bonus retries earned: This is the number of bonus retries that the player has earned through referrals or other means.
Cost of the win: This is the cost to the merchant to fund the prize based on the face value of the win and the gross profit margin.
Value of bonus retries: This is the value of each bonus retry, which is calculated based on the cost of the win and the odds of winning.
Odds with bonus retries: This is the probability of winning when using bonus retries, which is based on the face value of the win and the value of the bonus retries.
Number of games won: This is the number of games that the player wins based on the odds with bonus retries and the number of bonus retries used.
By adjusting these data points, the Win'it platform can dynamically change the odds of winning and offer players different incentives to make purchases or refer friends to the platform.
User
are the odds dynamic
Assistant
Yes, the odds of winning on the Win'it platform can be dynamic and can change based on various factors such as the face value of the win, cost of the win, and the number of bonus retries used.
The odds of winning with bonus retries are calculated dynamically based on the value of the bonus retries, which is determined by the cost of the win and the odds of winning. The value of bonus retries can change based on changes in the cost of the win, the desired odds of winning, or other factors that affect the probability of winning.
Additionally, the odds can change based on the number of bonus retries used by the player. The more bonus retries that are used, the higher the probability of winning, which means that the odds can change dynamically during gameplay.
Finally, the odds can be adjusted based on other factors such as the gross profit margin or the historical transaction value of the merchant. These factors can affect the cost of the win and, therefore, the value of bonus retries and the odds of winning.
Overall, the Win'it platform is designed to be flexible and dynamic, allowing merchants to adjust the odds of winning and offer different incentives to players based on various factors.
User
what about players not playing and taking the crdit before a game
Assistant
Players on the Win'it platform have the option to "bank" their credit before playing a game. This means that they can choose to take the credit that was going to fund the chance to win, instead of using it to play the game. The credit would be for the cost of the win plus a margin discount.
When a player banks their credit, they forfeit their chance to win the prize, but they receive a discount on their purchase. This discount is based on the cost of the win and the gross profit margin of the merchant, which determines the cost of the win.
The option to bank credit before playing a game is designed to give players more flexibility and control over their purchases. Players can choose to take the credit and use it to purchase other items on the platform or save it for later, instead of playing a game and risking the chance of losing.
The ability to bank credit before playing a game does not directly affect the odds of winning, but it does affect the number of games played on the platform and the amount of credit issued by the merchant. This is because players who bank their credit are not using it to play games, which means that fewer games are played and fewer credits are issued.
User
should it effect the odds?
Assistant
Banking credit before playing a game should not directly affect the odds of winning on the Win'it platform. This is because the odds of winning are based on the number of games played, the cost of the win, and the number of bonus retries used, and not on the amount of credit that is banked before playing a game.
The option to bank credit before playing a game is designed to give players more flexibility and control over their purchases, and to provide them with a discount on their purchase. This discount is based on the cost of the win and the gross profit margin of the merchant, and it does not affect the probability of winning.
However, the option to bank credit can indirectly affect the odds of winning by reducing the number of games played on the platform. This is because players who bank their credit are not using it to play games, which means that fewer games are played and the probability of winning for other players may be slightly affected.
Overall, the option to bank credit is designed to provide players with more flexibility and control over their purchases, and it should not directly affect the odds of winning on the Win'it platform.
User
create the merchent reproting
Assistant
Here is an example of how the merchant reporting for Win'it could be structured:
This resource would track various metrics for each merchant campaign, such as the sales generated, cost of goods sold, number of winners, number of games won, number of games played, average credit value won, credit banked, credit won, total credit issued, and credits redeemed.
Endpoint to get details of a specific merchant reporting:
javascript
GET /merchant_reportings/:id
These endpoints would allow merchants to create, update, and view their campaign reporting data, as well as track key metrics for their campaigns such as sales generated, number of winners, and credits issued. The data in the merchant reporting resource can be updated dynamically based on the activity on the platform, and can provide valuable insights into the success of each merchant campaign.
User
create compelate script for merchent repriting with xano end points
Assistant
Sure, here is a complete script for merchant reporting with Xano endpoints:
javascript
// Merchant Reporting Resource
{
"name": {"type": "text", "required": true},
"start_date": {"type": "datetime", "required": true},
"end_date": {"type": "datetime", "required": true},
"sales_generated": {"type": "decimal", "default": 0},
"cost_of_goods_sold": {"type": "decimal", "default": 0},
"num_winners": {"type": "number", "default": 0},
"num_games_won": {"type": "number", "default": 0},
"num_games_played": {"type": "number", "default": 0},
"avg_credit_value_won": {"type": "decimal", "default": 0},
"credit_banked": {"type": "decimal", "default": 0},
"credit_won": {"type": "decimal", "default": 0},
"total_credit_issued": {"type": "decimal", "default": 0},
"credits_redeemed": {"type": "decimal", "default": 0}
}
// Create a new merchant reporting
POST /merchant_reporting
{
"name": "Spring Sale",
"start_date": "2023-03-01T00:00:00Z",
"end_date": "2023-03-31T23:59:59Z"
}
// Get a list of merchant reportings
GET /merchant_reporting
// Get details of a specific merchant reporting
GET /merchant_reporting/:id
// Update a merchant reporting
PUT /merchant_reporting/:id
{
"name": "Spring Sale",
"start_date": "2023-03-01T00:00:00Z",
"end_date": "2023-03-31T23:59:59Z",
"sales_generated": 5000,
"cost_of_goods_sold": 2500,
"num_winners": 50,
"num_games_won": 100,
"num_games_played": 500,
"avg_credit_value_won": 10,
"credit_banked": 500,
"credit_won": 1000,
"total_credit_issued": 1500,
"credits_redeemed": 500
}
// Delete a merchant reporting
DELETE /merchant_reporting/:id
You can use these endpoints to create, read, update, and delete merchant reportings on the Win'it platform. When a merchant creates a new campaign, they can use the POST /merchant_reporting endpoint to create a new merchant reporting with the relevant campaign details. The GET /merchant_reporting endpoint can be used to retrieve a list of all merchant reportings, while the GET /merchant_reporting/:id endpoint can be used to retrieve the details of a specific merchant reporting.
Merchants can update their reporting data using the PUT /merchant_reporting/:id endpoint, which allows them to update the sales generated, number of winners, credits issued, and other relevant metrics for their campaign. Finally, the DELETE /merchant_reporting/:id endpoint can be used to delete a merchant reporting if it is no longer needed.
These endpoints can be integrated with the Xano platform to provide powerful reporting and analytics capabilities for merchants on the Win'it platform.