Bitcoin Forum
May 07, 2024, 09:05:54 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: TradeHill appears to be using floats  (Read 1434 times)
phantomcircuit (OP)
Sr. Member
****
Offline Offline

Activity: 463
Merit: 252


View Profile
August 23, 2011, 09:53:13 AM
 #1

If you take a look at their API you can see that they list trades with 10 places after the decimal.

{"date": 1314083175, "tid": 114770, "price": "11.0980810956", "amount": "0.2500000000"}

In order to store that in users accounts that would require storing 20 places after the decimal.

It seems highly unlikely to me that they are actually using 20 places after the decimal to store user account balances.

Possibly someone from trade hill would care to comment.

PS: yes im aware it is dealing with very small amounts
1715072754
Hero Member
*
Offline Offline

Posts: 1715072754

View Profile Personal Message (Offline)

Ignore
1715072754
Reply with quote  #2

1715072754
Report to moderator
1715072754
Hero Member
*
Offline Offline

Posts: 1715072754

View Profile Personal Message (Offline)

Ignore
1715072754
Reply with quote  #2

1715072754
Report to moderator
"You Asked For Change, We Gave You Coins" -- casascius
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715072754
Hero Member
*
Offline Offline

Posts: 1715072754

View Profile Personal Message (Offline)

Ignore
1715072754
Reply with quote  #2

1715072754
Report to moderator
1715072754
Hero Member
*
Offline Offline

Posts: 1715072754

View Profile Personal Message (Offline)

Ignore
1715072754
Reply with quote  #2

1715072754
Report to moderator
davout
Legendary
*
Offline Offline

Activity: 1372
Merit: 1007


1davout


View Profile WWW
August 23, 2011, 10:08:08 AM
 #2

In order to store that in users accounts that would require storing 20 places after the decimal.
Um. why ?

phantomcircuit (OP)
Sr. Member
****
Offline Offline

Activity: 463
Merit: 252


View Profile
August 23, 2011, 10:16:39 AM
 #3

In order to store that in users accounts that would require storing 20 places after the decimal.
Um. why ?

You place a bid at 0.0000000001 for 0.0000000001 you now need to record this as a change in your balance of 0.00000000000000000001 BTC and 0.0000000001 USD
davout
Legendary
*
Offline Offline

Activity: 1372
Merit: 1007


1davout


View Profile WWW
August 23, 2011, 10:36:33 AM
 #4

You place a bid at 0.0000000001 for 0.0000000001 you now need to record this as a change in your balance of 0.00000000000000000001 BTC and 0.0000000001 USD
I doubt they allow orders to be placed with such precise amounts.
Anyway I'm not TH so I should just step aside and let them answer Smiley

Sukrim
Legendary
*
Offline Offline

Activity: 2618
Merit: 1006


View Profile
August 23, 2011, 12:16:11 PM
 #5

The minimum abount you're able to bid in the webUI is 1 USD.

https://www.coinlend.org <-- automated lending at various exchanges.
https://www.bitfinex.com <-- Trade BTC for other currencies and vice versa.
enki
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
August 23, 2011, 06:22:02 PM
 #6

actually they just use higher-precision decimals in their database than needed
Jered Kenna (TradeHill)
Sr. Member
****
Offline Offline

Activity: 420
Merit: 250



View Profile WWW
August 23, 2011, 06:37:43 PM
 #7

actually they just use higher-precision decimals in their database than needed

Hi Folks,

Enki is correct. We use high precision decimals (not floats) in our database. Additionally, we limit the minimum sizes of transactions.

Regards,
Adam - Tradehill

moneyandtech.com
@moneyandtech @jeredkenna
phantomcircuit (OP)
Sr. Member
****
Offline Offline

Activity: 463
Merit: 252


View Profile
August 23, 2011, 06:41:59 PM
 #8

actually they just use higher-precision decimals in their database than needed

Hi Folks,

Enki is correct. We use high precision decimals (not floats) in our database. Additionally, we limit the minimum sizes of transactions.

Regards,
Adam - Tradehill

So you are saying that you use a NUMERIC(X,22) for account balances?
helloworld
Sr. Member
****
Offline Offline

Activity: 266
Merit: 250



View Profile
August 24, 2011, 04:49:02 AM
 #9

The minimum abount you're able to bid in the webUI is 1 USD.

Minimum sizes alone wouldn't help the precision issue, so it's good to know they also use high-precision decimals.

example: What if you wanted to trade 5.00000001 btc at a rate of $10.00000001? Minimums don't come into play at all in that case but you still need the precision.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!