Bitcoin Forum

Other => Meta => Topic started by: npuath on January 30, 2023, 04:50:36 AM



Title: Use this BBCode to insert historical BTC quote in your post
Post by: npuath on January 30, 2023, 04:50:36 AM
When I fooled around with the BTC value at msg date (https://bitcointalk.org/index.php?topic=5436755) demo, I implemented a simple API to get the BTC price in dollars at a specific date, as an image.


For dates between 2010-10-17 and 2023-01-27, I'm using the closing quotes from a static list, downloaded from https://coincodex.com.

From 2023-01-28, I'm appending this list daily, with the XBX average from https://www.coindesk.com.

Queries specifying dates before 2010-10-17 yield 0. Queries with dates in the future yield the latest known quote (this limitation will be removed in a future version ;)).

I store each quote in whole dollars - queries with large quantities (specified with nof) may suffer from rounding errors.

Because of time zones and daily volatility, the quotes should be considered approximate; in any case, I take no responsibility for the accuracy, performance or longevity of this service.


Syntax examples

[img]https://ztt.se/btc:quote[/img]  =>   https://ztt.se/btc:quote    No date equals today.
[img]https://ztt.se/btc:quote?date=2013-06-09[/img]  =>   https://ztt.se/btc:quote?date=2013-06-09    Specific date.
[img]https://ztt.se/btc:quote?date=2013-06-09&nof=2[/img]  =>   https://ztt.se/btc:quote?date=2013-06-09&nof=2    Number of coins.
[img]https://ztt.se/btc:quote?img=col:green[/img]  =>   https://ztt.se/btc:quote?img=col:green    Image colour.

Here's a long one with date and nof parameters and an img parameter with options pointsize, colour, background colour (semi-transparent), font and border (remove white-space):
Code:
[img]
  https://ztt.se/btc:quote ?
    date=2021-11-09 &
    nof=1.5 &
    img=ps:24 + col:DeepSkyBlue4 + bcol:$FECC0280 + font:Snap-ITC + border:10x4
[/img]
https://ztt.se/btc:quote?date=2021-11-09&nof=1.5&img=ps:24+col:DeepSkyBlue4+bcol:$FECC0280+font:Snap-ITC+border:10x4


The basic URI is https://ztt.se/btc:quote which yields a PNG image with text on a transparent background.

Append a questionmark ? to this if you want to add parameters.

Separate multiple parameters with ampersand &.

Separate multiple parameter options with plus +.

A parameter can be a singleton, or a name-value pair; use the equal sign = to separate name and value.

A parameter option can be a singleton, or a name-value pair; use a colon : to separate name and value.

Dates must be specified in YYYY-MM-DD format.


Note: This gives the price in dollars for bitcoin (1 coin or as many as specified with the nof parameter) at a specific date (specified with the date parameter). On its own, it does not show address balancies or anything else.




Title: Re: Use this BBCode to insert historical BTC quote in your post
Post by: digaran on January 30, 2023, 06:01:43 AM
Do we need to do it ourselves or is this for the Boss theymos to add to the forum? I'm going back editing my posts adding BTCBTC.🙃 thanks for the work done.👍


Title: Re: Use this BBCode to insert historical BTC quote in your post
Post by: npuath on January 30, 2023, 06:26:28 AM
It should work on its own  :)


Title: Re: Use this BBCode to insert historical BTC quote in your post
Post by: PX-Z on January 30, 2023, 06:28:59 AM
There is an existing thread made by TryNinja[1]. Here's also the reference thread[2] but seems both are not working now. So i suggest you to create a thread for this on Project Development[3], maybe you can create it as version 3 with some conversions too? Idk.
But anyway this is a useful site, especially to sellers in Marketplace and those who are active in auctions who usually use a dynamic price in USD, BTC or EUR.

[1] https://bitcointalk.org/index.php?topic=5160033
[2] https://bitcointalk.org/index.php?topic=151565.0
[3] https://bitcointalk.org/index.php?board=12.0


Title: Re: Use this BBCode to insert historical BTC quote in your post
Post by: npuath on January 30, 2023, 06:34:33 AM
Thanks, I'll check them out.


Title: Re: Use this BBCode to insert historical BTC quote in your post
Post by: joker_josue on January 30, 2023, 07:57:26 AM
Interesting information, good job.

In the image that sets the price based on a date, I think you should also include the date.
Thus, it is easier for the reader to understand what price that value refers to.


Title: Re: Use this BBCode to insert historical BTC quote in your post
Post by: npuath on January 30, 2023, 12:21:50 PM
Thanks! And you're right, but as it is, you can choose if and how to include a date using normal text, so that you could write "The price in dollars was https://ztt.se/btc:quote?date=2022-11-09 for one (1) BTC at 9 november 2022" quite fluidly (that's why I also don't include a $ sign).



Title: Re: Use this BBCode to insert historical BTC quote in your post
Post by: joker_josue on January 30, 2023, 12:32:05 PM
But taking into account that the information is always in dollars and, in this case, from a specific date, it would be better for the image itself to include this information to avoid misinterpretations, if whoever makes the post does not include all the information.


Title: Re: Use this BBCode to insert historical BTC quote in your post
Post by: npuath on January 30, 2023, 12:52:56 PM
But it should be optional, don't you think? After all, we're not Apple; we actually let people decide things for themselves.  :D


Title: Re: Use this BBCode to insert historical BTC quote in your post
Post by: joker_josue on January 30, 2023, 02:48:16 PM
But it should be optional, don't you think? After all, we're not Apple; we actually let people decide things for themselves.  :D

There it is true.  :D
But at least the indication that the value is in dollars, I think it made sense. Here's the suggestion.


Title: Re: Use this BBCode to insert historical BTC quote in your post
Post by: noorman0 on January 30, 2023, 03:32:00 PM
Loved this, exactly what I was hoping for in my request in another tool (https://bitcointalk.org/index.php?topic=5410693.msg60991204#msg60991204). Can you retrieve prices with a shorter time history for no date query (eg closing price in the last 1 hour).

For everyone's information: use "&" to combine multiple queries like color and date at once. Example https://ztt.se/btc:quote?img=col:blue&date=2017-12-27 (BTC price per 2017-12-27)

Code:
[img]https://ztt.se/btc:quote?img=col:blue&date=2017-12-27[/img]


Title: Re: Use this BBCode to insert historical BTC quote in your post
Post by: npuath on February 01, 2023, 10:30:18 AM
... Can you retrieve prices with a shorter time history for no date query (eg closing price in the last 1 hour). ...

Sure, [img]https://ztt.se/btc:quote[/img] (and all other no-date queries) now yields the real-time XBT average (disregarding forum image proxy caches).




Title: Re: Use this BBCode to insert historical BTC quote in your post
Post by: npuath on February 01, 2023, 12:20:45 PM
For everyone's information: use "&" to combine multiple queries like color and date at once.

Right, I'll update the OP to be clearer on that, thanks!

Also, I'll add some examples on other formating options.