[Passed] Peercoin FLOT Reserve

What are you coding in? I can probably show you if it’s something im familiar with.

All calculations should be done in units of US-NBT

  1. Calculate circulating nubuts
    A. N = blockchain nubits
    B. R = reserve nubits
    C. CN = N - R

Skip step 2 for now, this hasnt passed yet
2) Calculate outstanding nubits
A. S = stable reserves
B. ON = CN - S
C. ON = max( ON , 400000 )
from here on i will use CN and make no more mention of ON

  1. Calculate peercoin overflow
    A. P = value of ppc reserve using feed
    B. PO = P - 0.05CN
    C. PS = PO
    0.1
    D. If PS > 1000, take PS to be sold on the market for btc

  2. Calculate BTC overflow
    A. B = value of btc reserve using feed
    B. BO = B - 0.15CN
    C. BS = BO
    0.05
    D. BS is the bitcoin standard. If BS > 2500, take it to market to buy nsr.
    E. Is PO > 0?
    Y->do step D. in this list again, so 2*BS is used for nsr
    N->take another BS to market to buy ppc

Tada!

I have got most of it working. some details in your steps are still missing e.g.

at what rate? 10% as in NSR buyback?

BS is the standard. It’s given in units of US-NBT, so you would be buying $BS of ppc.

You’re probably thinking of BO, which is the bitcoin overflow. BS is the derived standard market velocity rate of change thingy. The letters for BS come from “Bitcoin Sell”, to be honest. ‘S’ being ‘standard’ is a happy coincidence.

Also, note there are 4 constants in this equation that are less than 1. 3 of them are 5% (2 market velocities and 1 reserve size), one of them is 15% (btc reserve size). In theory, all 4 could be different numbers.

OK the script is working but this week’s result is banal.

Using these testing parameters

# testing# parameters
#circNBT=xxx000
#ppcReserve=yy000
#nuSafe=30000
#bp=400 # BTC price
#pp=0.0010 # PPC price
# total btc buyside
#echo 300 > templist

# the reserved amount of Nubits excluded for buyback calculation.
reserve_fraction=0.15
# PPC reserve against circulating NBT
PPC_res_ratio=0.05
# rate of PPC reserve overflow buying BTC
PPC_buy_BTC_rate=0.1
# NSR buyback ratio against buyback pool
NSR_bb_ratio=0.05
# PPC reserve fill ratio against buyback pool
PPCres_fill_ratio=0.05
# NSR buyback threshold
NSR_bb_threshold=2500
# threshold of PPC reserve overflow buying BTC
PPC_buy_BTC_threshold=1000

Here are some sample test results of the calculation part:

Tier 4 buy side funds total 200.000000 BTC, 110000.000000 PPC, and $30000.000000, valued $154000.000000 (385.000000 BTC)

Of the 800000.000000 NBT in circulation, 15.00 percent (120000.000000 NBT) plus NuSafe are reserved and excluded from the share buyback calculation (375.000000 BTC).

385.000000 - 375.000000 = 10.000000 BTC in the share buyback pool.
The standard is 5.00 percent of this, 0.5000 BTC (equivalent to approximately 200.00 USD)

0.5000 BTC (~200.00 USD) will be used for share buyback next week, subject to a $2500 threshold.

PPC reserve (110.000000 BTC) exceeds 5.00 percent of all circulating NBT by 10.000000 BTC, 10.00 percent of which 1000.0000 PPC (equivalent to approximately 400.00 USD) will be sold for BTC, subject to a $1000 threshold.

Another one

Tier 4 buy side funds total 100.000000 BTC, 110000.000000 PPC, and $30000.000000, valued $114000.000000 (285.000000 BTC)

Of the 800000.000000 NBT in circulation, 15.00 percent (120000.000000 NBT) plus NuSafe are reserved and excluded from the share buyback calculation (375.000000 BTC).

285.000000 - 375.000000 = -90.000000 BTC in the share buyback pool.
The standard is 5.00 percent of this, -4.5000 BTC (equivalent to approximately -1800.00 USD)

Pool is not positive. There will be no buyback next week.
PPC reserve (110.000000 BTC) exceeds 5.00 percent of all circulating NBT by 10.000000 BTC, 10.00 percent of which 1000.0000 PPC (equivalent to approximately 400.00 USD) will be sold for BTC, subject to a $1000 threshold.

yet another one

Tier 4 buy side funds total 300.000000 BTC, 90000.000000 PPC, and $30000.000000, valued $186000.000000 (465.000000 BTC)

Of the 800000.000000 NBT in circulation, 15.00 percent (120000.000000 NBT) plus NuSafe are reserved and excluded from the share buyback calculation (375.000000 BTC).

465.000000 - 375.000000 = 90.000000 BTC in the share buyback pool.
The standard is 5.00 percent of this, 4.5000 BTC (equivalent to approximately 1800.00 USD)

4.5000 BTC (~1800.00 USD) will be used for share buyback next week, subject to a $2500 threshold.

PPC reserve (90.000000 BTC) is less than 5.00 percent of all circulating NBT by 10.000000 BTC,. 5.00 percent of buyback pool 4.5000 BTC (equivalent to approximately 1800.00 USD.) will be used to buy PPC to fill PPC reserve.

2 Likes

This BTC goes with the BS below?

Where in the motion said the above?

What if BS<0 ? What if BS would over-fill PPC reserve?

Right, this is the only place where i forgot to place a threshold. It would be consistent to just say 2500 minimum.

Then we take care of it next week. If it isn’t full this week, we buy more. The ppc price can change a lot in a week.

No, this btc doesnt exist yet. Taking peercoin to market is a week long process. The proceeds from PS will be used for BO next week, but this week just give the ppc to the executor and let them do their thing.

I mean if BS<0 there won’t be any fund to buy ppc, so the above logic is incomplete (missed a case where BS<0.)

I mean another case missed is e.g. BC=5btc PPC_reserve should be 10btc but now only has 6btc in it. If you take another BS (5btc) you will not only fill the PPC_reserve to 10 btc you even have an extra 1 btc left. Now what do you do with that 1 btc? I assume the 1 btc is sent back to the btc pool.

“do step D. in this list again, so 2*BS is used for nsr” means to me that “if the PPC_reserve is full, take another 5% of btc buyback pool to buyback NSR”. I don’t think the motion said that. The quote you made

also means extra BTC should not be used to buy NSR.

So in this post it should be

Y -> do nothing besides D in 3.

Again, if BS < 2500, don’t use the btc for anything. I’m sorry i didnt explicitly specify this in the motion, but clearly the logic is incomplete without it. Just use 2500 as the minimum, it has precident.

You’re assuming both 100% efficiency and a constant peercoin price. If you lift those assumptions you can see that it would be prudent to perform a full standard of peercoin purchases even when ppc is just a hair under the filling threshold. This means every week that btc is overflowing we will be either buying or selling ppc. That is by design, because dynamic pools change value rapidly anyway and trying to design for a stable dynamic price is a futile venture.

Im honestly confused by you here. If both ppc and btc are overflowing, use 10% (2*BS) for nsr. If only btc is overflowing, use 5% (1 BS) for nsr and another 5% (1 BS) for ppc. This means a total of 2 BS of btc will be brought to market each week that we are overflowing, despite how full ppc is.

Before the comprehensive liquidity model passes, I will treat the 2500 threshold an execution praticality issue. That means BS>0, <0, ==0 will be treated as distinctive cases. The end result will be the same in the calculator output anyway, like shown above

2 Likes

I am not assuming a constant PPC price. All we have for NBR buyback and PPC reserve ops are spot prices of BTC and PPC. We have been doing buybacks based on spot prices. There was no assumption of constant prices.

What is a “full standard of peercoin purchases”? I assume “standard” here mean

This was not in the motion and is your interpretation. Not that is necessarily bad, but it’s important to understand.

No one wants to design a stable dynamic price here. The motion says that the PPC reserve should be 5% of all circulating Nubits and that is how would I program my PPC ops calculator. The PPC reserve executor has room to set some parameters, but buying “a full standard of peercoin purchases even when ppc is just a hair under the filling threshold”, if not countered by an over-reaction in the opposite direction, seem to leave the reserve in an over-filled status on average.

If buying a full Standard is because you don’t want to do the calculation, then the calculator can help – it will give you a numer of PPC to sell or BTC to buy PPC for the week and that is it.

For example, in this test case (round numbers are chosen to make it easy to verify)

# testing# parameters
circNBT=800000
ppcReserve=93000
nuSafe=30000
bp=400 # BTC price in USD
pp=0.0010 # PPC price in BTC
# total T4 btc buyside
echo 300 > templist

The output is

Tier 4 buy side funds total 300.000000 BTC, 93000.000000 PPC, and $30000.000000, valued $187200.000000 (468.000000 BTC)

Of the 800000.000000 NBT in circulation, 15.00 percent (120000.000000 NBT) plus NuSafe are reserved and excluded from the share buyback calculation (375.000000 BTC).

468.000000 - 375.000000 = 93.000000 BTC in the share buyback pool.
The Standard is 5.00 percent of this, 4.6500 BTC (equivalent to approximately 1860.00 USD)

4.6500 BTC (~1860.00 USD) will be used for share buyback next week, subject to a $2500 threshold.

PPC reserve (93.000000 BTC) is less than 5.00 percent of all circulating NBT by 7.000000 BTC,. 5.00 percent of buyback pool 4.6500 BTC (equivalent to approximately 1860.00 USD) will be used to buy PPC to fill PPC reserve.

You can see that the Standard is less than needed to fill the reserve, so all 4.65BTC of the Standard is used.

In the next case on the other hand, ppcReserve has more fund than before (97k instead of 93k), but still not full, at current BTC and PPC prices,

circNBT=800000
ppcReserve=97000
nuSafe=30000
bp=400 # BTC price in USD
pp=0.0010 # PPC price in BTC
# total T4 btc buyside
echo 300 > templist

the output is

Tier 4 buy side funds total 300.000000 BTC, 97000.000000 PPC, and $30000.000000, valued $188800.000000 (472.000000 BTC)

Of the 800000.000000 NBT in circulation, 15.00 percent (120000.000000 NBT) plus NuSafe are reserved and excluded from the share buyback calculation (375.000000 BTC).

472.000000 - 375.000000 = 97.000000 BTC in the share buyback pool.
The Standard is 5.00 percent of this, 4.8500 BTC (equivalent to approximately 1940.00 USD)

4.8500 BTC (~1940.00 USD) will be used for share buyback next week, subject to a $2500 threshold.

PPC reserve (97.000000 BTC) is less than 5.00 percent of all circulating NBT by 3.000000 BTC,. 3.0000 BTC (equivalent to approximately 1200.00 USD.) will be used to buy PPC to fill PPC reserve.

The Standard has more fund (4.85BTC) than needed (3BTC), so 3BTC is allocated to buy PPC.

This issue has no analogy with either the btc or nsr reserve. This issue is a new phenomenon having to do with the ppc reserve having both an inflow and a cap. The nsr reserve has no cap, the btc reserve has no inflow. This issue is unique so far.

So if we aim for filling instead of overflowing then we need a minimum amount to avoid taking tiny little amounts to market. We could make that minimum $1000k and say ‘if 5% circulating - ppc reserve < 1000, assume reserve is full’. I’m just worried that taking part of the standard for ppc and part for nsr will get very confusing.

So what is the condition for ppc overflow? It requires $1000 off 10%, meaning the ppc reserve has to be $10k over threshold before it overflows. Basically, my point is that the reserve will average above the ‘full’ mark anyway, even if we aim to just fill it. I don’t think we should avoid overfilling for this reason.

I don’t know if that assuptioin makes a difference. Current circulating nbt is 820k, PPC reserve in full will be 41k. You only needs a meer 2.5% PPC price change over the week for the reserve to be over or under target by $1000.

Taking the calculation by hand, without automating, even only doing the nsr part can be confusing. Then we will have tether, bitusd, eur-nbt … So I think the strategy should be program the logic in the code and a calculator will do the splitting.

btw actually I (still) don’t see why buying nsr has anything in this. The OP motion says “Another 5% of the BTC overflow will be used to purchase PPC to place in the multisig account.” It doesn’t say this 5% of btc overflow will be used for nsr purchase (if PPC purchace doesn’t use all of it) at all. In fact the previous sentence says “The velocity of the NSR buyback … will be reduced to 5% of the BTC overflow” suggesting that if for example zero PPC needs to be bought, the fund for buying PPC shouldn;t be used for NSR otherwise the velocity is 10%, contradicting with “reduced to 5%”.
This was the last paragraph of this was about.

The 10% number isn’t well set for current reserve size. So be it until a modification is approved. Still I don’t think always buying a full Standard is good as a Standard can be 10k based on past buybacks, possibly trggering a PPC sell!

Another 5% of the BTC overflow will be used to purchase PPC to place in the multisig account.

If the value of the PPC reserve has exceeded its 5% of circulating NBT for the week, the overflow BTC that would be used for PPC purchase should be sent to the NSR buyback executor instead

So use a bitcoin standard for ppc purchase. If the reserve is already full, reroute the bitcoin to nsr purchase instead.

OK I see the mistake I had with reading the motion. I thought the “to” after instead to be “of”.

I have modified my calculator, would this output for the 2nd test case above be good?

Tier 4 buy side funds total 300.000000 BTC, 97000.000000 PPC, and $30000.000000, valued $188800.000000 (472.000000 BTC)

Of the 800000.000000 NBT in circulation, 15.00 percent (120000.000000 NBT) plus NuSafe are reserved and excluded from the share buyback calculation (375.000000 BTC).

472.000000 - 375.000000 = 97.000000 BTC in the share buyback pool.
The Standard is 5.00 percent of this, 4.8500 BTC (~ 1940.00 USD)

For the first Standard:
4.8500 BTC (~ 1940.00 USD) will be used for share buyback next week, subject to a $2500 threshold.

For the second Standard:
The PPC reserve (97.000000 BTC) is less than 5.00 percent of all circulating NBT by 3.000000 BTC,. 3.0000 BTC (~ 1200.00 USD) will be used to purchase PPC to fill the PPC reserve. 1.8500 BTC unspent for PPC purchase will also be used for share buyback besides that of the first Standard.

4.8500 + 1.8500 = 6.7000 BTC (~ 2680.00 USD) in total will be used for share buyback next week, subject to a $2500 threshold.

Yah, i think that’s good. I’m thinking about ways to simplify this so there’s only 1 standard each week instead of 2, but there are reasons for doing it this way.

Anyway, you’ve done a great job understanding my complicated ruleset and coding it up, thank you very much. It will make buybacks much more manageable.

2 Likes

I have to admit that I tried to follow, but at some point recognized that it requires more attention.
I’ll follow this up.
Kudos to @Nagalim and @mhps for preparing this (motion, coding) in such a sophisticated way!

1 Like

I am glad it is useful. Before coding it I didn’t really understand all of it correctly and underestimated the effort needed. It took a lot of time particularly when the complexity requires more effort to write understandable code. As the comprehensive liquidity model and more products coming I am not sure maintaining the calculator can go on like this.

Did you open source it? We can pass the comprehensive motion as a grant if need be, or simplify it. I’d love to see what you’ve done first though. Unless you’re hoping to get paid for what you’ve already done.

I’d open source it now if I simply give up maintaining it. But it would waste an opportunity to push for this

and automation is good to invest in as it usually saves money in the long term. Let me think about it.