Formulae

From Bittylicious
Jump to navigation Jump to search

The price formula text box allow for the price of your Bitcoins to dynamically alter as market conditions change.

The calculation process allows for a wide variety of mathematical operators typical in computing terminology (e.g. * for multiplied by and ^ for to the power of). Other available functions include:

  • max - Maximum value from the parameters, e.g. max(80, mtgox_GBP_buy)
  • min - Minimum value from the parameters
  • average - Average (mean) value from the parameters

Figures from other Bitcoin markets can be used in the equation, and these take the form market_currency_type, e.g. mtgox_GBP_2bsr.

The current maximum length of a formula is 1024 characters.

Special Functions

bitty_lowest(<num BTC>)

Returns the price of the best value active broker (excluding yourself) with same offer characteristics as your offer. They must have at least <num BTC> available for sale.

Important notes:

  • This returns the lowest price offered by sellers if you are selling coins. If you are buying coins, it returns the highest price offered by sellers.
  • This is updated every time the formulae are updated (every ten seconds) so it may take a few iterations for this value to stabilise.
  • If you undercut others, you must undercut by at least 0.1% of the value. Anything significantly less than this and done repeatedly will be considered spammy.
  • If you undercut others, you should couple this with a max(...) modifier because your price could be dragged all the way down to 0 (or infinity when buying coins)
  • bitty_lowest should never be used on its own as it will return 999,999.99 if you are the only active offer (0 if you are buying coins). Make sure you use it in combination with a min(...).

Three recommended ways of using bitty_lowest other functions are:

  • Matching other seller offers with a minimum price of 600 and a maximum of 800: min(max(bitty_lowest(0.01), 600), 800)
  • Beating other seller offers by 5 down to a minimum price of 600 but a maximum of 800 in any case min(max(bitty_lowest(0.01) - 5, 600), 800)

bitty_num_lowest(<num BTC>, <num brokers>)

Returns a 1 or 0 based on the number of distinct brokers matching each other:

  • Returns 1 if there are at least num brokers, each offering at least num BTC coins, that all have exactly the same price (and this price is the cheapest price for this offer).
  • Returns 0 otherwise.

This call is particularly useful if you want to undercut others when you would be sharing trades with 5+ others offering 0.01 BTC, but you are happy to share with 0-4 others. This would be done, undercutting by 5, by using bitty_lowest(0.01) - (bitty_num_lowest(0.01, 5) * 5).

Remember that any formula using bitty_lowest should be coupled with appropriate mins and maxs as above.

median(<price 1>, <price 2>, <price 3>, ...)

This will return the median price between the set of prices in the brackets. If there is an even number, the mid-point of the two mid-point values is returned.

This is particularly useful to shield yourself from exchanges that are returning incorrect values, or have suffered a crash of some sort.

As an example:

  • Kraken EUR in GBP: ((kraken_BTCEUR_bid/ fx_USD_EUR) * fx_USD_GBP)
  • Bitstamp USD in GBP: (bitstamp_USD_bid * fx_USD_GBP)
  • Bitcoin Average USD in GBP: (btcavg_BTCUSD_last * fx_USD_GBP)

Therefore the median (midpoint) of all Exchanges Above is calcuated by:

median(((kraken_BTCEUR_bid/ fx_USD_EUR) * fx_USD_GBP),(bitstamp_USD_bid * fx_USD_GBP),(btcavg_BTCUSD_last * fx_USD_GBP))

Foreign Exchange Rates

Use fx_USD_code, e.g. fx_USD_GBP to get the number of GBP that make one USD (usually between 0.50 and 0.80). code can be almost any three character currency code.

Foreign exchange rates are derived from openexchangerates.org and are updated every hour.

Markets

Remember, you have to use the market, currency and type, e.g. btcavg_BTCGBP_ask.

BitcoinAverage

Bitcoin Average actually tracks multiple cryptocurrencies, so the format is <cryptocurrency><fiat currency>, e.g. BTCGBP for the costs of Bitcoin in British pounds.

There are dozens of fiat currencies support, and I believe it uses up to date conversion rates.

This is only updated approximately every ten minutes.

As an example, use btcavg_BTCGBP_last

  • btcavg_...

Types

  • 24h_avg - Weighted average price in the last rolling 24 hours
  • last - Weighted average last price that coins are sold at on the market

Bitstamp

  • bitstamp_BCHUSD
  • bitstamp_BCHEUR
  • bitstamp_BTCUSD
  • bitstamp_BTCEUR
  • bitstamp_ETHUSD
  • bitstamp_ETHEUR
  • bitstamp_LTCUSD
  • bitstamp_LTCEUR
  • bitstamp_XRPUSD
  • bitstamp_XRPEUR

Types

  • ask - Highest price that coins are bought at on the market
  • bid - Lowest price that coins are sold at on the market
  • high
  • low
  • last - The last price a trade was completed at
  • volume

CoinDesk BPI

  • coindesk_USD
  • coindesk_EUR
  • coindesk_GBP

Types

  • bpi - The Blended Price Index current price

Coin Market Cap

Coin Market Cap provides a list of almost every altcoin in existence and aggregates data from the major marketplaces and exchanges. This data is pulled from a RedHat cloud server and is updated every five minutes.

  • coinmarketcap_XXXYYY' - Price of XXX against YYY.
    • XXX is any of the virtual currencies traded on Coin Market Cap. More than three characters are supported, e.g. START.
    • YYY is a 'currency' and one of USD or BTC (Bitcoin).

Sometimes, there are cryptocurrencies with the same ticker. In these instances, you should not rely on this data. Let us know if this is actually an issue for you.

Types

  • last - The blended price as listed on Coin Market Cap.

Independent Reserve

This is primarily an Australasian exchange, with the following markets supported:

  • indreserve_BCHAUD
  • indreserve_BTCAUD
  • indreserve_ETHAUD

Types

  • last - Last traded price
  • ask - Current lowest offer on order book
  • bid - Current highest bid on order book

Kraken

  • kraken_BTCGBP
  • kraken_BTCEUR
  • kraken_BTCUSD
  • kraken_BTCJPY
  • kraken_ETHGBP
  • kraken_ETHEUR
  • kraken_ETHUSD
  • kraken_ETHJPY
  • kraken_LTCUSD
  • kraken_LTCEUR

Types

  • ask
  • bid
  • last
  • vol
  • low
  • high
  • 24h_avg - Weighted average price in the last rolling 24 hours

Shapeshift.io

Shapeshift.io is a service that converts one altcoin to another with no registration. Bittylicious only records currency pairs that involves BTC at some point, e.g. LTC -> BTC or BTC -> LTC, but not LTC -> DOGE.

Types

  • XXX - XXX is another coin ticker symbol, e.g. LTC.

Examples

  • shapeshiftio_LTC_BTC which is approximately 0.012 at the time of writing.
  • btcavg_GBP_bid * shapeshiftio_LTC_BTC which is the average GBP price to sell one Bitcoin multiplied by the amount of Bitcoins that 1 Litecoin buys.

X - Internally generated figures

Bittylicious tries to put a best guess on pricing based on the median of some of the above market figures. It is not recommended you use these values in any formulae, but they are used internally in Bittylicious.

  • xaverage_XXX_YYY where XXX is a currency from GBP, EUR and USD, and YYY is a coin from BTC and ETH.