Page 1 of 1

Local Bitcoin custom equation and aggregate functions examples guide

Posted: Sun Mar 22, 2020 9:12 pm
by nandibear
Image

Create offer at: https://local.bitcoin.com/new-offer

The following is an example for setting a rate which will display the highest out of the two prices (static price and a price 1.5% above a dynamic market price).

Bitcoin Cash (BCH) current market price is approximately $204 USD at Kraken.

Code: Select all

max(250,(1.15 * market.kraken.bchusd.close))
at the moment returns $250 as it's higher than 1.15 x $204 (or $234.02).

Image

Code: Select all

max(210,(1.15 * market.kraken.bchusd.close))
at the moment returns $234.02 as it's higher than $210.

Image

or you may write the above in this way (although either way should work, if you have trouble with the above please try the following):

Code: Select all

max(250,(1.15 * (market.kraken.bchusd.close)))

Code: Select all

max(210,(1.15 * (market.kraken.bchusd.close)))

Re: Local Bitcoin custom equation and aggregate functions examples guide

Posted: Sun Mar 22, 2020 10:04 pm
by nandibear
Math is off in the above post.

In order to use 1.5% you must use 1.015 (rather than 1.15).

The examples in the post above are returning 15%

Re: Local Bitcoin custom equation and aggregate functions examples guide

Posted: Mon Mar 23, 2020 2:25 am
by nandibear
Average of last sale prices from Kraken, GDAX and Bitstamp:

Code: Select all

avg(market.kraken.bchusd.close, market.gdax.bch.close, market.bitstamp.bchusd.close)

Re: Local Bitcoin custom equation and aggregate functions examples guide

Posted: Mon Mar 23, 2020 2:45 am
by nandibear
1.5% above the average 24 hour highs from Kraken, GDAX and Bitstamp

Code: Select all

avg(market.kraken.bchusd.high24, market.gdax.bch.high24, market.bitstamp.bchusd.high24) * 1.015