Author Topic: HERTZ - Oscillating Formula Based Asset  (Read 5141 times)

0 Members and 1 Guest are viewing this topic.

Offline Customminer

  • Sr. Member
  • ****
  • Posts: 454
  • Bitshares FTW!
    • View Profile
    • Gridcoin.US
  • GitHub: grctest
HERTZ - Oscillating Formula Based Asset
« on: May 17, 2017, 07:27:47 pm »

What is Hertz?

Hertz is a highly experimental Market Pegged Asset (MPA) created on the Bitshares network. Elected Bitshares witnesses will publish price feeds which are pegged against the United States Dollar (USD) and predictably oscillates using a sine wave algorithm. The sine wave has an amplitude of 14% and a period of 28 days, thus the price feed value changes 2% every day and a resulting max price feed value of $1.14 and min of $0.86 (Note: Depending on the combination of Bitshares price volatility and age of price feeds published by witnesses, these limits may not always hold).

Hertz tokens are shorted (borrowed) into existence by users on the Bitshares network with at least 175% backing collateral in Bitshares; there is no centralized issuance and asset creator permissions have been restricted for increased decentralization.

By implementing a sine wave phase offset (date/time), we are able to make each Wednesday (mid working week) the most important day for Hertz.

Price feeds:
Reference Python scripts & calculator (https://github.com/BTS-CM/scripts)
  hertz_calculator.xlsx : A spreadsheet for evaluating the effect of different sine wave variables (amplitude, period, etc).
  hertz-verification.py : Used for verifying that the phase offset lines up appropriately.
  hertz-feed.py : What you'd use if you don't use wackou or xeroc's price feed scripts.
Wackou's 'BTS_Tools' (Only use if pull request #36 is merged, OR if you change 1/3 to 0.14 yourself manually).
  https://github.com/wackou/bts_tools/blob/master/bts_tools/feeds.py#L275
  https://github.com/wackou/bts_tools/blob/master/bts_tools/feeds.py#L441
Xeroc's 'Bitshares-PriceFeed' (Issue #25 addresses the inaccurate amplitude comments)
  https://github.com/xeroc/bitshares-pricefeed/blob/master/bitshares_pricefeed/examples/hertz.yaml

Surrendered FBA settings
- Disable confidential transactions:
- Require holders to be white-listed:
- Issuer may transfer asset back to himself:
- Issuer must approve all transfers

TODO
- Get witnesses to publish price feeds for the Hertz MPA

Links
https://sites.google.com/view/hertz-aba/

Best regards,Customminer.
« Last Edit: January 12, 2018, 11:38:14 pm by Customminer »
Hertz, Beyond Bitshares, Gridcoin!

Offline Permie

  • Hero Member
  • *****
  • Posts: 607
  • BitShares is the mycelium of the financial-earth
    • View Profile
  • BitShares: krimduss
Re: HERTZ - Oscillating Formula Based Asset
« Reply #1 on: May 17, 2017, 09:25:40 pm »
BackingAssetValue = [USD | XDR] //Still need to decide on basing it against the USD or the XDR/SDR.
:(
....gold?

Love the idea. I understand the aim is a stable reliable price(?) but using an IMF product just seems icky. Maybe the USD isn't any better.
JonnyBitcoin votes for liquidity and simplicity. Make him your proxy?
BTSDEX.COM

Offline Customminer

  • Sr. Member
  • ****
  • Posts: 454
  • Bitshares FTW!
    • View Profile
    • Gridcoin.US
  • GitHub: grctest
Re: HERTZ - Oscillating Formula Based Asset
« Reply #2 on: May 17, 2017, 10:55:00 pm »
BackingAssetValue = [USD | XDR] //Still need to decide on basing it against the USD or the XDR/SDR.
:(
....gold?

Love the idea. I understand the aim is a stable reliable price(?) but using an IMF product just seems icky. Maybe the USD isn't any better.
We could remove reliance upon the IMF by simply calculating our own basket currency using the price feeds of several fiat currencies.
We could do Hertz.Gold and other variations, don't need to be limited to one asset.
Hertz, Beyond Bitshares, Gridcoin!

Offline Customminer

  • Sr. Member
  • ****
  • Posts: 454
  • Bitshares FTW!
    • View Profile
    • Gridcoin.US
  • GitHub: grctest
Re: HERTZ - Oscillating Formula Based Asset
« Reply #3 on: May 18, 2017, 08:49:13 pm »
I have produced a price feed generation script in Haskell for the HERTZ FBA:
https://github.com/grctest/HERTZ-Price-feed-script/blob/master/hertz.hs

It currently scrapes the price feed for XDR from cryptofresh, averages the last 10 published price feeds and outputs the results in a CSV file. It's outputting to a CSV for use in excel for charting.

Any suggestions?
Hertz, Beyond Bitshares, Gridcoin!

Offline Permie

  • Hero Member
  • *****
  • Posts: 607
  • BitShares is the mycelium of the financial-earth
    • View Profile
  • BitShares: krimduss
Re: HERTZ - Oscillating Formula Based Asset
« Reply #4 on: May 19, 2017, 05:54:26 pm »
Keep it up Customminer!
 +5% +5% +5% +5%
JonnyBitcoin votes for liquidity and simplicity. Make him your proxy?
BTSDEX.COM

Offline Customminer

  • Sr. Member
  • ****
  • Posts: 454
  • Bitshares FTW!
    • View Profile
    • Gridcoin.US
  • GitHub: grctest
Re: HERTZ - Oscillating Formula Based Asset
« Reply #5 on: May 21, 2017, 11:09:29 pm »


Rather than a simple sin wave, we could have a sin wave with a period on the way down where the asset would be equal to the backing asset for about a week?

What do you think about the use of Fourier series? https://en.wikipedia.org/wiki/Fourier_series

Think wave interference would be simpler? Combining a triangle/sawtooth wave with a sin wave to get the above desired effect?

Thoughts?
« Last Edit: May 21, 2017, 11:14:22 pm by Customminer »
Hertz, Beyond Bitshares, Gridcoin!

Offline Customminer

  • Sr. Member
  • ****
  • Posts: 454
  • Bitshares FTW!
    • View Profile
    • Gridcoin.US
  • GitHub: grctest
Re: HERTZ - Oscillating Formula Based Asset
« Reply #6 on: May 22, 2017, 01:35:04 am »
Regarding existing price feed scripts written in python such as bitshares-pricefeed by xeroc: https://github.com/xeroc/bitshares-pricefeed/

Reference hero file: https://github.com/xeroc/bitshares-pricefeed/blob/master/bitshares_pricefeed/examples/hero.yaml

hero formula (line 41):
Code: [Select]
formula: 1.05 ** ((date.today() - date(1913, 12, 23)).days / 365.2425) / {quoteSettlement_price}
The haskell script could be replicated in python, or we could use the haskell script to precompute a large CSV of blocknumbers to modify the latest price feed value with.
Code: [Select]
formula: quoteSettlement_price + read_CSV_For_Wave_Value(BlockNumber)
The python price feed script uses time/dates instead of block numbers, so perhaps there will be a difference in computed values between haskell and python.

python implementation? (I don't know python)
Code: [Select]
import math
import date

quoteSettlement_price = XDR
Time_In_Period = one month duration
amplitude = 0.5

x_value = (remainder of ((date.today() - date(Asset_Genesis_Date_Timestamp))/Time_In_Period) divided by 1.00)  // to return 0.xx

feed_price = quoteSettlement_price + (((quoteSettlement_price * amplitude)*(sin((x_value * Time_In_Period)) * ((2*math.pi)/Time_In_Period) ))))
« Last Edit: May 22, 2017, 03:03:57 am by Customminer »
Hertz, Beyond Bitshares, Gridcoin!

Offline Customminer

  • Sr. Member
  • ****
  • Posts: 454
  • Bitshares FTW!
    • View Profile
    • Gridcoin.US
  • GitHub: grctest
Re: HERTZ - Oscillating Formula Based Asset
« Reply #7 on: May 24, 2017, 06:01:15 pm »
What should the "Percent offset of forced settlements" value be for HERTZ?

Considering that the amplitude is 0.5 (50%), the value will fluctuate from 0.5 to 1.5, if someone was to short the asset into existence at the top and they were to hold the asset/debt until the y value was at 0.5, then the asset will be worth 66% less than when they bought it at the top. If we kept the 1% offset for forced settlement then many users would be force settled during each oscillation.

If we set the percent offset to 70% then the fluctuation of the sin wave wouldn't trigger force settlement, only the volatility of the backing asset.

Would there be any repercussions to setting such a high force settlement percent requirement?

---

Another concern would be whether or not users create tokens with enough collateral to take the change in feed price into account?

---

I've set the max price feed lifetime to 420 minutes, as 7hrs makes for a difference of almost 0.01*Base_reference_asset ($0.01 for example).

---

Any thoughts on the above? I'd appreciate any input.

CM.
Hertz, Beyond Bitshares, Gridcoin!

Offline Permie

  • Hero Member
  • *****
  • Posts: 607
  • BitShares is the mycelium of the financial-earth
    • View Profile
  • BitShares: krimduss
Re: HERTZ - Oscillating Formula Based Asset
« Reply #8 on: May 24, 2017, 10:21:58 pm »
I'm not sure I understand much of the above correctly, but if traders could make a 1% profit every ~1-4 hours by shorting the asset at the peak, and then buying again at the low, then holding until the peak.

A repetitive bot trading the 4 hour profit cycle (6 x 1% profit opportunities per 24 hours), would make 1.01x their initial investment.
Using a bot to trade each of these cycles every day for a month would create a (Initial-Investment * 1.01^(6*31) equals a 600% increase in capital, just from playing the tick-tock game of 1%

This asset needs to track the value of something that the mainstream will want to hold.
There will be lots of shorters wanting to earn the 1% profit 6 times a day.
BitShares-customers who want to buy CNY (?) at volume in a liquid market will not mind paying a 1% "fee" depending on where they are on the HERTZ cycle.
They won't even notice it

There would be lots of liquidity, shorters are guaranteed profits if there are buyers of the token.
High liquidity looks attractive to potential customers, and gets BitShares on the "front page" of crypto-news, because traders will see volume rankings and BitShares will be up there

Is this the kind of thing you're talking about?
JonnyBitcoin votes for liquidity and simplicity. Make him your proxy?
BTSDEX.COM

Offline Customminer

  • Sr. Member
  • ****
  • Posts: 454
  • Bitshares FTW!
    • View Profile
    • Gridcoin.US
  • GitHub: grctest
Re: HERTZ - Oscillating Formula Based Asset
« Reply #9 on: May 25, 2017, 12:22:16 am »
I'm not sure I understand much of the above correctly, but if traders could make a 1% profit every ~1-4 hours by shorting the asset at the peak, and then buying again at the low, then holding until the peak.

A repetitive bot trading the 4 hour profit cycle (6 x 1% profit opportunities per 24 hours), would make 1.01x their initial investment.
Using a bot to trade each of these cycles every day for a month would create a (Initial-Investment * 1.01^(6*31) equals a 600% increase in capital, just from playing the tick-tock game of 1%

This asset needs to track the value of something that the mainstream will want to hold.
There will be lots of shorters wanting to earn the 1% profit 6 times a day.
BitShares-customers who want to buy CNY (?) at volume in a liquid market will not mind paying a 1% "fee" depending on where they are on the HERTZ cycle.
They won't even notice it

There would be lots of liquidity, shorters are guaranteed profits if there are buyers of the token.
High liquidity looks attractive to potential customers, and gets BitShares on the "front page" of crypto-news, because traders will see volume rankings and BitShares will be up there

Is this the kind of thing you're talking about?
Yes, however I'm initially thinking of a large amplitude (50% fluctuation from feed value) and a period of 1 month, effectively 0.138..% every hour not 1% every 4 hours.

We also need to take into account that not all witnesses publish price feeds for all smartcoins, and frequency of price feed publishes is variable, see: https://roelandp.nl/bitshareswitnesslog/
Thus, high frequency price feed publishing would require convincing the witnesses to shell out.

But the idea can be applied to any amplitude, period, graph function and reference asset. You need to take into account the specific smartcoin options for different algorithms.

---

Edit: There's also phase shift to consider, you could have two tokens which have an opposite phase, canceling each other out.
« Last Edit: May 25, 2017, 02:05:16 am by Customminer »
Hertz, Beyond Bitshares, Gridcoin!

Offline Customminer

  • Sr. Member
  • ****
  • Posts: 454
  • Bitshares FTW!
    • View Profile
    • Gridcoin.US
  • GitHub: grctest
Re: HERTZ - Oscillating Formula Based Asset
« Reply #10 on: May 29, 2017, 01:08:59 pm »
Since CNY is one of the most popular smartcoins on the BTS DEX, perhaps it would be wise to use it as the reference asset instead of USD and/or XDR.

It appears to be leading the poll at the moment too.
« Last Edit: May 29, 2017, 01:19:52 pm by Customminer »
Hertz, Beyond Bitshares, Gridcoin!

Offline Customminer

  • Sr. Member
  • ****
  • Posts: 454
  • Bitshares FTW!
    • View Profile
    • Gridcoin.US
  • GitHub: grctest
Re: HERTZ - Oscillating Formula Based Asset
« Reply #11 on: May 31, 2017, 04:29:15 pm »
I've created issues for HERTZ potential inclusion in xeroc & wackou's price feed scripts (both use python)

https://github.com/wackou/bts_tools/issues/24
https://github.com/xeroc/bitshares-pricefeed/issues/3
Hertz, Beyond Bitshares, Gridcoin!

Offline Customminer

  • Sr. Member
  • ****
  • Posts: 454
  • Bitshares FTW!
    • View Profile
    • Gridcoin.US
  • GitHub: grctest
Re: HERTZ - Oscillating Formula Based Asset
« Reply #12 on: June 02, 2017, 02:01:19 pm »
It's be great if the price feed publishing fees were free so that we could have very high frequency HERTZ tokens.
Hertz, Beyond Bitshares, Gridcoin!

Offline Customminer

  • Sr. Member
  • ****
  • Posts: 454
  • Bitshares FTW!
    • View Profile
    • Gridcoin.US
  • GitHub: grctest
Re: HERTZ - Oscillating Formula Based Asset
« Reply #13 on: June 05, 2017, 11:06:25 pm »
https://github.com/grctest/HERTZ-Price-feed-script/blob/master/min_hertz.hs

I have created a simplified version of the Haskell HERTZ price feed script.

The script no longer scrapes cryptofresh for asset values, doesn't handle json, doesn't output to CSV nor use the turtle library.

The script now runs from the command line and takes 5 arguments:
Code: [Select]
./min_hertz.hs referenceBlock genesisBlock blocksInPeriod amplitude referenceAssetValue
example: ./min_hertz.hs 50 1 100 0.5 25
output: 25.784882

Since you can now enter values easily from the command line as arguments, it will be easier for everyone to test out their own hertz configurations (different frequencies, amplitudes and backing assets).

Any suggestions?

Steemit mirror: https://steemit.com/beyondbitcoin/@cm-steem/hertz-haskell-price-feed-script-update
« Last Edit: June 05, 2017, 11:35:40 pm by Customminer »
Hertz, Beyond Bitshares, Gridcoin!

Offline Customminer

  • Sr. Member
  • ****
  • Posts: 454
  • Bitshares FTW!
    • View Profile
    • Gridcoin.US
  • GitHub: grctest
Re: HERTZ - Oscillating Formula Based Asset
« Reply #14 on: June 07, 2017, 06:38:23 pm »
Wackao responded to the Github Issue: https://github.com/wackou/bts_tools/issues/24#issuecomment-306741609
"Thanks for the suggestion, I like the idea! Not sure if it's going to be useful (don't have enough understanding of economics yet), but just the fact that we are able to try things like that on BitShares is plain awesome.
A bit busy with the launch of PeerPlays right now, but I'll give it a try soon :)"
Hertz, Beyond Bitshares, Gridcoin!