There are a lot of factors that go into deciding what price we want to bid when buying ads. We need an API that implements the bid cap strategy generated by our data scientists to help us determine what the best the bid cap will be.
Implement a bid cap strategy in a REST api that can be POST
ed to.
A number of different factors go into determining whether or not we want to increase or decrease our current bid cap. Following the instructions laid out below, build an API that can take the following parameters and return an updated bid cap:
rpcAlpha: 3.0, // currency
rpcBeta: 3.2, // currency
ebRpc: 25 // currency
net: 29 // currency
nonSocialClicks: 0.30 // percentage
nonSocialClicksCutOff: 0.26 // percentage
socialClicks: 0.69 // percentage
socialClicksCutOff: 0.68 // percentage
currentBidCap: 5 // currency
factor: 1.45
A successful post should return the following format:
data: {
bidCap: 5.05 // currency
}
- New endpoint that needs to be built:
- POST
/bid-cap
- Return a bid cap percentage based on the decision tree.
- Validate that all necessary inputs are there and of the correct type of value.
- Return a 400 if the inputs are invalid.
- POST
- Tests
-
There are a total of 8 outcomes on the decision tree. Write a test for each outcome.
- Increase Bid Cap by 1%
- Decrease Bid Cap by 4%
- Increase Bid Cap by 1%
- Bid Cap = Max(EBRPC, Avg.(RPC Alpha, RPC Beta))
- Increase Bid Cap by 5%
- Increase Bid Cap by 5%
- Increase Bid Cap by 2%
- Bid Cap = Min(EBRPC, Avg.(RPC Alpha, RPC Beta))
-
Write a test for when the validation fails
-
How to attempt this challenge:
- Create a new repo in your account and note the git url
- Clone this repo
- Solve the challenge
- Set your new repo as the origin:
git remote set-url origin ${your repo url}
- Push your solution to your repo
You must follow these steps for your solution to be accepted -- forks or other methods will not be considered.