Understanding IEEE Floating Point Numbers from crypto exchange - numbers

I read as much as I could within my ability to grasp concepts before posting. This is a photo from a crpto currency exchange website (https://www.btse.com/en/futures/ETHPFC). I asked the administrator in the telegram group why is there a difference between the interest rate shown and the number shown once hovering the mouse over the rate (it also returns the same lengthy decimal in scientific notation via API call).
His response was: "Note the website shows 0.00101%. Which is identical to 0.0000101 (the other differences are there because of IEEE floating point numbers)".
Can someone (kindly) explain to me what I am missing?
Here are their calculation methods and example:
(https://support.btse.com/en/support/solutions/articles/43000460020)
Funding Fees Calculation
Funding Fee = Notional Value x Funding Rate
Funding Rates will be updated every minute. When settling the fee, the system will use every minutes' average results in the past 1 hour to calculate the fee.
Minimum funding rate for long positions: 0.001%
Minimum funding rate for short positions: -0.001%
Notional Value = Mark Price x Position Size x Contract Multiplier
Funding Rate = [Max (0, Impact Bid-Perp Index) - Max (0, Perp Index-Impact Ask)] / Perp Index / 24
When the funding rate is positive, Longs pay Shorts; when the funding rate is negative, Shorts pay Longs
Impact Bid Price: The average buy price of the first 10,000 highest bid orders in the Order Book
Impact Ask Price: The average sell price of the first 10,000 lowest ask orders in the Order Book
For example:
BTC Perpetual
Index Price: 1230 USD
Mark Price: 1250 USD
Impact Bid: 1299 USD
Impact Ask: 1300 USD
Position Size: 1000 contracts
Contract Multiplier: 0.001
Notional Value = 1250 x 1000 x 0.001 = 1250
Funding Rate = [Max (0 , 1299-1230) - Max (0, 1230-1300)] / 1230 / 24 = (69-0) / 1230 / 24 = 0.002337
Funding Fee = 1250 * 0.002337 = 2.92125 USD (Long pays to Short)

Related

Calculating the mean for fluctuating data

Suppose we want to calculate the average annual balance of a customer in the bank.
If we want to have a normal average, we will add up the customer balance in the year and then dividing by the number of days in the year.
Now consider a customer who had a high balance only in the last month of the year and for the last 11 months his account balance has been very low. But because he had a high account balance only in the last month, his annual average shows a high number.
How can we design the annual average balance indicator in a way that 11 months of low customer balance affects his annual average and in fact the annual average of the customer does not increase only because of the last month?

Paypal Subscriptions - Quantity based - Charge variable amount

On my application, I need to charge users a different amount at a set frequency.
Hourly Fee * No. of Hours = Sum to be charged
(user is expected to fill the timesheet basis which the number of hours will be calculated
and Hourly fee is fixed)
We will charge this sum every week or every month. I thought of using the Paypal's quantity based subscriptions API, but I am not able to find a way to change the number of hours for every period (since the number of hours would change in every period).
Please advise.

What is the difference between Coefficient of Regression and Elasticity

I am studying elasticity of demand and how to get the optimal price from elasticity using regression. I have referred Rbloggers and medium blogs to understand the concepts. But still I have a doubt. Say I have a linear equation as below
Sales of Eggs = 137.37 – (16.12)Price.Eggs + 4.15 (Ad.Type) – (8.71)Price.Cookies
Mean of Price.Eggs= 4.43,
Mean of Price.Cookies= 4.37,
Mean of Sales of Eggs= 30
We can deduce the equation as : increase in sales of eggs increases the price of cookies by 8.71 and price of eggs by 16.12.
But in the case of elasticity, we calculate the formula and the elasticity of price of eggs is -2.38 and elasticity of price of cookies is -1.27 which also tells the unit increase in value with respect to dependant variable. What is the difference between these two ? I know the values are different but both meant the same right ? Please advice and correct if I am wrong
Well it depends. I'm going to simplify the model a bit to one product (eggs for example):
Assuming elasticity is not constant and the demand curve is linear:
E = Elasticity
Q = Quantity Demanded
P = Price
t = time
b0 = constant
b1 = coefficient (slope)
See the breakdown for elasticity here
Picture a graph of the Demand Curve with Q on the vertical axis and P on the horizontal axis - because we're assuming Quantity Demanded will change in response to changes in Price.
I can't emphasize this enough - in the case where demand is linear and elasticity is not constant along the entire demand curve:
The coefficient (slope) is the change (difference) in the dependent variable (Q) divided by the change in the independent variable (P) measured in units - it is the derivative of your linear equation. The coefficient is the change in Q units with respect to a change in P units. Using your eggs example, increasing the price of eggs by 1 unit will decrease the quantity demanded of eggs by 16.12 units - regardless of whether the price of eggs increases from 1 to 2 or 7 to 8, the quantity demanded will decrease by 16.12 units.
From the link above, you can see that Elasticity adds a bit more information. That is because elasticity is the percent change in Quantity Demanded divided by the percent change in Price - ie the relative difference in Quantity Demanded with respect to the relative difference in Price. Let's use your eggs model but exclude Ad.Type and Price.Cookies
Sales of Eggs = 137.37 - 16.12 * Price.Eggs
"P" "Qd" "E"
1.00 121.25 -0.13
2.00 105.13 -0.31
3.00 89.01 -0.54
4.00 72.89 -0.88
5.00 56.77 -1.42
6.00 40.65 -2.38
7.00 24.53 -4.60
8.00 8.41 -15.33
See graph of Demand Curve vs Elasticity
In the table you can see that as P increases by 1.00, Qd decreases by 16.12 regardless if it's from 1.00 to 2.00 or 7.00 to 8.00.
Elasticity, however, does change rather significantly relative to changes in price, so even if the change in units for each variable remains the same, the percent change for each variable will change.
A price increase from 1 to 2 is a 100% increase and would result in a change in quantity demanded from 121.25 to 105.13 which is a 13% decrease.
A price change from 7 to 8 is a 14% increase and would result in a quantity demanded change from 24.53 to 8.41 which is a 66% decrease.
If you're interested in learning more about different ways to measure elasticity I highly recommend These lecture slides especially slide 6.26.

What do you do if the sample size for an A/B test is larger than the population?

I have a list of 7337 customers (selected because they only had one booking from March-August 2018). We are going to contact them and are trying to test the impact of these activities on their sales. The idea is that contacting them will cause them to book more and increase the sales of this largely inactive group.
I have to setup an A/B test and am currently stuck on the sample size calculation.
Here's my sample data:
Data
The first column is their IDs and the second column is the total sales for this group for 2 weeks in January (i took 2 weeks as the customers in this group purchase very infrequently).
The metric I settled on was Revenue per customer (RPC = total revenue/total customer) so I can take into account both the number of orders and the average order value of the group.
The RPC for this group is $149,482.7/7337=$20.4
I'd like to be able to detect at least a 5% increase in this metric at 80% power and 5% significance level. First I calculated the effect size.
Standard Deviation of the data set = 153.9
Effect Size = (1.05*20.4-20.4)/153.9 = 0.0066
I then used the pwr package in R to calculate the sample size.
pwr.t.test(d=0.0066, sig.level=.05, power = .80, type = 'two.sample')
Two-sample t test power calculation
n = 360371.048
d = 0.0066
sig.level = 0.05
power = 0.8
alternative = two.sided
The sample size I am getting however is 360,371. This is larger than the size of my population (7337).
Does this mean I can not run my test at sufficient power? The only way I can determine to lower the sample size without compromising on significance or power is to increase the effect size to determine a minimum increase of 50% which would give me an n=3582.
That sounds like a pretty high impact and I'm not sure that high of an impact is reasonable to expect.
Does this mean I can't run an A/B test here to measure impact?

Calculating percentage commission without losing desire markup

Suppose I am selling an item with the following conditions:
cost = $100
markup = 10%
commission = 15%
If the item sells at $110, there is a $16.50 commission paid. This obviously takes me below the cost after paying commission.
If I add the commission on top of the $110 as a buffer I get $126.50, at which point a 15% commission of $18.98 comes off that. Subtracting $18.98 from $126.50 gives me $107.52, which is below my desired 10% markup.
What formula would I use to consistently calculate how much commission must be accounted for to ensure the profit markup is always met no matter how the variables change?
The sale price must be greater than
(Cost + Cost * markup) / (1 - commission)
or in your example
(100 + 100 * .10) / (1 - .15)
110 / .85
129.42 (round UP)
Giving a commission of 19.41 and a net of 110.01, less your cost gives you your 10% markup
Or equivalently, cost × (1+markup)/(1-commission)