Statistics quantitative - statistics

1% of customers are interested in a vertical for snow removal. We run a survey on the
customers that tells with 99% accuracy whether the customer is interested in this vertical. All
customers answer the survey.
If the survey indicates that the customer is interested what is the probability that the
customer wants the vertical?

Related

Why when the market price is below a limit buy, why is it not fullfilled?

I am writing a trading bot in C++. I am making limit orders that allow for 1% leniency. As you can see there is a market price of 2.2532, and I made a limit buy at 2.2757. Logically, if the limit buy should be activated once the market price is at or below the limit price. However, as you can see from the pictures below, this is not the case. I posted pictures of both the order book and the trade history. What I am wondering is why. Does this have something to do with the order book? I also noticed when placing market values generally there is a fairly large discrepancy between the price of the market and the average price it is filled at.
Since getting the market price on Binance does not seem to actually tell you if the market order will be full-filled at that price, or if the limit order can go through at a price around there. Is there a way to actually programmatically/mathematically find out if a limit order will go through. Or, find out what the actual average price of a market order will be if bought in that moment?
UPDATE
So when I go to place a market order, I get this message:
Your order price will be 8% higher than the latest market price. Please proceed cautiously. When I want to buy at the market price. Partially I want to know why. But also, is there a way to get the exact number in which this price will be? Also, Is there a way to get this on the API exactly what the next market buy/sell will be?
After some more research on the question. According to investopedia
A trade will only occur when someone is willing to sell the security at the bid price, or buy it at the ask price.
Meaning, the price at which the asset will be sold at has less to do with the current market price, and a lot more to do with the order book. Looking at the pictures above, at that time according to limit orders the lowest someone was willing to sell the asset was, was 2.500 and the highest someone was willing to buy the asset for was 2.499. These are the ask price and bid price respectively. Since no one was willing to buy at the ask price or sell at the bid price, the transaction did not go through. Notice that the quantities are also important for knowing how much of the order will be filled, for your future reference.
For those that might be a little confused, you need to buy at the lowest someone is willing to sell. You need to sell at the highest someone is willing to buy. These come from the limit orders.
Back to the original question, the update on the 8% difference makes sense, the ask price probably dropped a little. However, if you notice 2.2532 * 1.08 is 2.433456 which is much closer to the 2.5 price above than the limit buy created at 2.2757 meaning the 8% notification makes sense.
I will now explain how you would calculate this using mathematics and coding. You need to pull from the order book ticker. This api request is /api/v3/ticker/bookTicker
I am going to use the example of wanting a market buy for GRTUSD. The dictionary you get back from the link https://api.binance.us/api/v3/ticker/bookTicker?symbol=GRTUSD is {"symbol":"GRTUSD","bidPrice":"0.1391","bidQty":"3613.45000000","askPrice":"0.1393","askQty":"5183.18000000"}
Some quick math shows that 5183.18000000 of GRT is the equivalent of a little over 722 USD at the ask price. This means if I placed a market buy for GRTUSD. As long as the amount of USD I was investing at that moment was equivalent to or less than 722 USD it would get filled at the ask price of 0.1393

Designing a domain model (class diagram) for a financial software [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
During my preparation for an exam in software engineering, I came across the following task in an old exam:
For a client, you create a new financial software whose task is, among other things, to perform tax calculations. The following requirements have been communicated to you by the Client:
The system must be able to:
calculate and display VAT for different countries and tax rates (Germany 19%, Austria 20%, Switzerland 8%).
calculate and display the income tax according to country-specific tax tables (separate table for Germany, Austria, Switzerland).
The system must allow the user to:
enter the tax relevant data (gross amount for VAT, annual income for income tax)
print the result of the tax calculation on a network printer.
send the result of the tax calculation to the appropriate tax office.
Task 1: Capture the requirements communicated by the client in a domain model (class diagram) with the following information: classes, attributes, methods, relationships, multiplicities, relationship name.
Solution:
I am not sure how to define the right classes, relationships and multiplicities. But I tried it and came to the following incomplete solution:
First Update:
Second Update:
Could someone help me with this? Thanks :)
Review of your diagram
I propose you to read your first diagram, and leave it as an exercise to cross-check if it really meets the requirements:
"A tax rate is composed of a country" (top composition). So countries do not exist independently of tax codes. Is this really what you meant? And does anything in the requirements tell that there is only one tax rate per country?
"A tax rate is composed of an (optional) income tax rate, and an (optional) VAT rate" (double composition in the middle). Ouh!?
"Every income tax rate has its own tax category(ies)" (bottom composition). Isn't the idea of categories to group similar income tax rates?
"A tax rate aggregates tax administrations, and a tax administration may appear in several aggregates" (aggregation). Why should an administration be aggregated in tax codes?
First recommentation: read in your course the difference between association, aggregation and composition. THe use of aggreegation and composition are in principle exceptional and there must be strong reasons to use use it.
Some more questions:
Where are the names of the relations?
What requirement justifies the tax administration? If it is justified, should'nt it be related to a country?
Is printing some elements really part of the domain model or does it already belong to some user-interface?
Second recommendation: only show elements taht you can reasonably derive from the requirements, and avoid any user-interface related behaviors.
Edit: your final diagram following our exchanges in the comment section represents much better what you wanted to represent initially. You could add the multiplicity 1..* rate for 1 category. You could also add a separator, in order to show classes consistently with a property and operation sections, even if one of the two is empty. The design is still basic, since all properties/attributes are public which is not recommended (but for I suppose you did this to avoid a lot of extra getters/setters in your design).
Alternate approach:
Your narrative describes one single use-case, which is perform tax calculation and consists of entering the calculation data, printing it and sending it. The actors are probably some clerc of your customer and perhaps tax offices.
I find the following candidates for classes chronologically, when reading the narrative: VAT, country, tax rate, income tax, "country-specific tax tables", gross amount, annual income, tax calculation, tax office. Let's have a closer look:
Tax office is very unclear: is there a network printer per tax office? how is the relevant tax office determined? are there one office per country, or can the organisation be more complex?
VAT and income tax are very different:
for VAT there are different rates per country. The applicable rate is always known, and the calculation is based on the applicable rate and the gross value.
For income tax the narrative speaks of country-specific tax tables: this means that the rate might not be known in advance, but depend on the taxable income level. (e.g. in Austria there is a minimum, and beyond it's flat rate; but in France, there is a normal rate, and a reduced rate for the first 500K€). In reality, income tax is much more complicated, since it may also depend on the legal form of the enterprise, or what is done with the income (re-invested vs. distributed), but let's keep it simple for the exercise. The wording leaves an ambiguity whether there is one table per country or several.
You could nevertheless generalize the concept of tax, if you'd want, considering in this exercise, that its amount is calculated for a base amount (gross amount or annual income).
The tax calculation is not fully clear: is it just the user interface, or is the calculation actually some domain object. This would give us:
This would lead to a diagram like:

Identifying abusive users in a Loyalty rewards program

Assume you have a loyalty rewards program, where every user who makes a purchase earns 200% of their order amount as reward points and when users return the item - the 200% points based on the current price of the product are deducted. We suspect some users have realized a gateway where they buy the product at full price but return when it is at discounted price so they keep the net difference in points (the refund always refunds full order amount). If user does this accidentally or if the impact is less than 5000 reward points then business wants to ignore but identify anyone who is abusing this - how will you identify such users based on last 6 months of order and refund data. How will you identify this in real time as new orders/refunds are processed.

question regarding randbetween in excel and revenue

The Doobie Brothers garage band is planning a concert. Tickets are set at $20. Based on what other bands have done, they figure they should sell 350 tickets, but that could fluctuate. They figure the standard deviation of sales at 50 tickets. No shows are uniformly distributed between 1 and 10. Fixed costs are 5000.
How profitable is the concert likely to be?
So I am able to enter the excel formula for revenue 50*20 and subtract 5000 for FC, but I am having trouble deciphering how to account for the no show costs. I know that I have to use RANDBETWEEN(1,10) formula, but I am not sure if it gets multiplied or divided by something. Again, I am looking for what to do with the formula in the context of a profit equation.
If it helps, the mean for the number of tickets sold is 350 and stdev is 50, so I used that to get the number of attendees in a simulated sense...That is, NORM.INV(RAND(),350,50)
Of course, this problem may not be realistic in real life because promoters keep the money, but for the purposes of the problem...just assume that no promoters exist here.

MS Access 2003 - Calculating an average based on qty sold/per site with supply %

Here is another question I have about being able to calculate this scenario in Access, or even at all for that matter:
I have a query that find the TOP 5 items sold in a given timeframe, and it groups by site. I use this to create a comparative chart between the site for ppt presentations. I do a lot of these but I have a problem with the presentation that I foresee they will have a problem with and it makes for bad metrics:
Some stores are bigger than others, and get much more supply. So a straight aggregate total of just qty of toping selling items, and comparing the locations is stacking the deck a little.
So if Site A gets 80% of the supply, and sells 500, Site B gets 15% supply and sell 75, and site C get 5% supply and sells 50 items, then Site C actually has the best sales for their size. I have exactly what I need in terms in the first chart (from my queries and such) to show the aggregate total, but what do I need to represent the idea mentioned above.
The factors that I have that go into this are:
ItemID - group by
Item - group by
qty sold - sum/descending (which is the variable that determines the Top 5)
Store/Location - Group By
and then I run a seperate query to get the total deliveries (supply) to each site
I realize that this may just be a lack of mathmatical understanding on my part, but can anyone help with this?
thanks
The first issue that I see isn't about SQL savvy; it's how to serve your data customer. What does he or she want to see? Metrics is a term with a holy ring, and for good reason: it's supposed to be what is used for the big business decisions, and it's scary easy to measure the wrong thing.
So I'd make sure I know what my customer wants. If you can't model it on a spreadsheet, you won't be able to develop your reporting effectively.
Every deck of cards is loaded. You have to know how they want it loaded.

Resources