User avatar
nandibear
Global Moderator
Global Moderator
Posts: 2612
Joined: Sat Jan 30, 2016 7:04 am

Donate BTC of your choice to 1DYss8ztWEgcM93SJtnpfYVt6fp7cwmjBk

Contact: Website Twitter Telegram

Local Bitcoin custom equation and aggregate functions examples guide

Sun Mar 22, 2020 9:12 pm

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)))
Image

User avatar
nandibear
Global Moderator
Global Moderator
Posts: 2612
Joined: Sat Jan 30, 2016 7:04 am

Donate BTC of your choice to 1DYss8ztWEgcM93SJtnpfYVt6fp7cwmjBk

Contact: Website Twitter Telegram

Re: Local Bitcoin custom equation and aggregate functions examples guide

Sun Mar 22, 2020 10:04 pm

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%
Image

User avatar
nandibear
Global Moderator
Global Moderator
Posts: 2612
Joined: Sat Jan 30, 2016 7:04 am

Donate BTC of your choice to 1DYss8ztWEgcM93SJtnpfYVt6fp7cwmjBk

Contact: Website Twitter Telegram

Re: Local Bitcoin custom equation and aggregate functions examples guide

Mon Mar 23, 2020 2:25 am

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)
Image

User avatar
nandibear
Global Moderator
Global Moderator
Posts: 2612
Joined: Sat Jan 30, 2016 7:04 am

Donate BTC of your choice to 1DYss8ztWEgcM93SJtnpfYVt6fp7cwmjBk

Contact: Website Twitter Telegram

Re: Local Bitcoin custom equation and aggregate functions examples guide

Mon Mar 23, 2020 2:45 am

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
Image

Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 28 guests