genjix (OP)
Legendary
Offline
Activity: 1232
Merit: 1076
|
|
June 26, 2011, 01:42:30 AM |
|
... Order 14: We are offering 10 GBP for 1 BC ... Order 18: They are offering 2.5 BC for 5 GBP ...
We need to calculate how much of our order will be chipped off, while preserving their exchange rate.
... Order 14-1: We are offering 5 GBP for 2.5 BC Order 14-2: We are offering 5 GBP for 2.5 BC ...
We fulfill our order and close their order.
... Order 14-2: We are offering 5 GBP for 2.5 BC ...
A new transaction is created for record keeping purposes and the users funds are updated accordingly.
I'm not sure this is a good way of doing it. Suppose I'm trying to buy 1,000 BTC at 10 GBP each. The sellers are wanting 12 GBP each at the moment, so no trade happens. I'm waiting for a seller to ask for less. Then some joker comes along and offers to sell 1 BTC for 1 GBP. His offer matches my request to buy, and so, working the example as before: ... Order 14: We are offering 10,000 GBP for 1,000 BC ... Order 18: They are offering 1 BC for 1 GBP ... We need to calculate how much of our order will be chipped off, while preserving their exchange rate. ... Order 14-1: We are offering 1 GBP for 1 BC Order 14-2: We are offering 9,999 GBP for 9,999 BC ... We fulfill our order and close their order. ... Order 14-2: We are offering 9,999 GBP for 9,999 BC ... A new transaction is created for record keeping purposes and the users funds are updated accordingly. After buying the joker's 1 BTC for 1 GBP, the rest of out order is now changed, offering only 1 GBP per BTC. Unless someone else comes along with a very cheap sale, our buy order will never get matched. Even if some 2nd guy comes and offers 1 BTC for 2 GBP, we won't get to buy it, because we're now only offering 1 GBP per BTC. What's the reasoning for changing the rate in "Order 14-2" above? I think it should either keep the GBP spend and rate the same, and buy more BTC with the saving we made from the joker, so if the 2nd part is matched at the rate we requested we end up getting a total of 1,000.9 BTC for 10,000 GBP: ... Order 14-1: We are offering 1 GBP for 1 BC Order 14-2: We are offering 9,999 GBP for 999.9 BC ... or keep the rate and BTC requested the same, and spend less GBP, so if the 2nd part is matched at the requested rate we end up getting 1,000 BTC for a total of 9991 GBP: ... Order 14-1: We are offering 1 GBP for 1 BC Order 14-2: We are offering 9,990 GBP for 999 BC ... Did I misunderstand something? Was the example I quoted wrong? Or is the current implementation kind of weird? Notice this is what happened to Caesium. He offered to sell BTC at a low price when someone was already trying to buy at a higher price and the trade was carried out at his low price. This is wrong since it uses the initial_amount and initial_want_amount to calculate the exchange rate you set. The amount left that you want is more for display purposes and isn't used internally.
|
|
|
|
dooglus
Legendary
Offline
Activity: 2940
Merit: 1333
|
|
June 26, 2011, 03:27:55 AM |
|
This is wrong since it uses the initial_amount and initial_want_amount to calculate the exchange rate you set. The amount left that you want is more for display purposes and isn't used internally.
Yes, I see that now after reading the code. I think you need to revise the example in the doc/process_order file: ... Order 14: We are offering 10 GBP for 1 BC ... Order 18: They are offering 2.5 BC for 5 GBP ...
We need to calculate how much of our order will be chipped off, while preserving their exchange rate.
... Order 14-1: We are offering 5 GBP for 2.5 BC Order 14-2: We are offering 5 GBP for 2.5 BC ...
We fulfill our order and close their order.
... Order 14-2: We are offering 5 GBP for 2.5 BC ...
The order 14-2 isn't right, and makes it look like the whole of our order is adjusted to match the incoming order's rate. What really happens is: ... Order 14-1: We are offering 5 GBP for 2.5 BC Order 14-2: We are offering 5 GBP for -1.5 BC ...
and since our want_amount is now negative, our order is closed too. We don't get to spend the other 5 GBP that we asked to spend on bitcoins because we already got more than the 1 BC we initially requested. We'll have to make a new request and hope that that time it all gets spent.
|
Just-Dice | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | Play or Invest | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | 1% House Edge |
|
|
|
genjix (OP)
Legendary
Offline
Activity: 1232
Merit: 1076
|
|
June 26, 2011, 01:08:15 PM |
|
Merged dooglus's gitorious branch after testing it today.
|
|
|
|
genjix (OP)
Legendary
Offline
Activity: 1232
Merit: 1076
|
|
June 26, 2011, 01:13:08 PM |
|
What really happens is: ... Order 14-1: We are offering 5 GBP for 2.5 BC Order 14-2: We are offering 5 GBP for -1.5 BC ...
and since our want_amount is now negative, our order is closed too. We don't get to spend the other 5 GBP that we asked to spend on bitcoins because we already got more than the 1 BC we initially requested. We'll have to make a new request and hope that that time it all gets spent. Ahh, I meant to actually say 0.5 instead of 2.5... But your reasoning is valid and correct. I updated the document in the repo :p (although it's no longer true since you fixed it)
|
|
|
|
BTC1472
Newbie
Offline
Activity: 3
Merit: 0
|
|
June 26, 2011, 05:40:23 PM |
|
BTW is anyone in London and want to meet up later? We might get a pizza or something with a few other community members.
I'm in London, and just bought my first handful of BTC of Britcoin. Would very much like to meet up and discuss techie stuff around BTC (I'm a newbie to bitcoin though, otherwise fairly experienced developer). PM if you're interested!
|
|
|
|
dooglus
Legendary
Offline
Activity: 2940
Merit: 1333
|
|
June 26, 2011, 06:40:08 PM |
|
We don't get to spend the other 5 GBP that we asked to spend on bitcoins because we already got more than the 1 BC we initially requested. We'll have to make a new request and hope that that time it all gets spent.
Ahh, I meant to actually say 0.5 instead of 2.5... But your reasoning is valid and correct. I updated the document in the repo :p (although it's no longer true since you fixed it) I think it would be best to just ignore both the want_amount values other than for determining the initial price, and only use the (have) amount values. If I have 10 GBP that I want to convert to BTC, I want to convert all 10. If you come at me with a better price than I was expecting, I want to end up with bonus bitcoins, not left over GBP. I've not fixed that bit (yet).
|
Just-Dice | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | Play or Invest | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | 1% House Edge |
|
|
|
genjix (OP)
Legendary
Offline
Activity: 1232
Merit: 1076
|
|
June 26, 2011, 07:58:18 PM |
|
You're right, we do ignore the want field. It's mostly left for display and is kind of redundant. It's not even needed.
|
|
|
|
dooglus
Legendary
Offline
Activity: 2940
Merit: 1333
|
|
June 26, 2011, 08:57:14 PM Last edit: June 27, 2011, 03:11:20 AM by dooglus |
|
You're right, we do ignore the want field. It's mostly left for display and is kind of redundant. It's not even needed.
I think that's not the case. You're closing orders when want_amount <= 0. See https://gitorious.org/intersango/intersango/blobs/master/cron/process_orders.php#line36 for example: 38 UPDATE orderbook 39 SET 40 status='CLOSED' 41 WHERE 42 orderid='$them_orderid' 43 AND ( 44 amount <= 0 45 OR want_amount <= 0 46 );
|
Just-Dice | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | Play or Invest | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | 1% House Edge |
|
|
|
saadtariq30
Member
Offline
Activity: 107
Merit: 10
|
|
June 27, 2011, 01:16:07 AM |
|
God are there some ridiculous orders..10000000 GBP wanted for 0.01 BTC....trolls be trollin.
|
|
|
|
dooglus
Legendary
Offline
Activity: 2940
Merit: 1333
|
|
June 27, 2011, 02:41:13 AM |
|
God are there some ridiculous orders..10000000 GBP wanted for 0.01 BTC....trolls be trollin.
My bad... Can't blame me for trying tho' can you? edit: oh, that's not me. I'm offering 1 bitcoin for 5k, 50k, 500k, and 5 million GBP. But someone has 1-up'ed me. How rude!
|
Just-Dice | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | Play or Invest | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | 1% House Edge |
|
|
|
dooglus
Legendary
Offline
Activity: 2940
Merit: 1333
|
|
June 27, 2011, 03:16:23 AM |
|
I updated the document in the repo :p (although it's no longer true since you fixed it)
Did you put my fixes live? It looks like you didn't (times are PST): Sun Jun 26 14:39:01 2011 10.130500 0.010887 Sun Jun 26 14:40:01 2011 10.149700 5.891817 Sun Jun 26 14:41:01 2011 12.220000 0.008183 Sun Jun 26 14:45:01 2011 10.153800 0.650000 Sun Jun 26 14:46:01 2011 10.240200 2.080043
That 12.2 in the middle there shouldn't have happened if you had applied my patch, given that you have people offering to sell at 8 different 11.x prices.
|
Just-Dice | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | Play or Invest | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | 1% House Edge |
|
|
|
genjix (OP)
Legendary
Offline
Activity: 1232
Merit: 1076
|
|
June 27, 2011, 11:45:06 AM |
|
yep, it was done a little afterwards since phantom forgot to do it.
|
|
|
|
dooglus
Legendary
Offline
Activity: 2940
Merit: 1333
|
|
June 28, 2011, 07:09:44 PM |
|
yep, it was done a little afterwards since phantom forgot to do it.
I was just watching the Britcoin market and saw a trade come in and get matched at the pre-existing market price, so my patch seems to be working: Market depth before the new order arrived: 11.000000 1.820000 : 10.761600 0.251498 11.000000 0.012811 : 10.909100 0.578283 10.994600 1.850000 : 10.989000 1.001001 sell buy
A buy order came in at 11.5, well over the best existing sell price. Previously this would have been matched at 11.5: : 10.761600 0.251498 11.000000 1.820000 : 10.909100 0.578283 11.000000 0.012811 : 10.989000 1.001001 10.994600 1.850000 : 11.563300 0.500000 sell buy
After the trade was done, the best sell offer has been reduced by 0.5BTC: 11.000000 1.820000 : 10.761600 0.251498 11.000000 0.012811 : 10.909100 0.578283 10.994600 1.324137 : 10.989000 1.001001 sell buy
and the trade went through at 10.9946, for 0.525863 BTC: Tue Jun 28 11:56:01 2011 10.994600 0.525863
The size of the order in GBP was kept the same. Since he got a better price than he asked for, he got correspondingly more BTC: >>> 10.994600 * 0.525863 5.7816533398 >>> 11.563300 * 0.500000 5.78165
|
Just-Dice | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | Play or Invest | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | 1% House Edge |
|
|
|
genjix (OP)
Legendary
Offline
Activity: 1232
Merit: 1076
|
|
June 29, 2011, 02:57:14 PM |
|
We were under-reporting our volume to bitcoinwatch/charts Thanks to dooglus, we fixed a bug where our trades were dropping 0s on the end in our volume. New exchange is coming along nicely. We will be in a feature lock-down soon and start a week long bug fixing mode.
|
|
|
|
ribuck
Donator
Hero Member
Offline
Activity: 826
Merit: 1060
|
|
June 29, 2011, 03:41:48 PM |
|
Thanks dooglus, your patch was an important improvement.
|
|
|
|
koopa
Member
Offline
Activity: 61
Merit: 10
|
|
June 30, 2011, 02:37:18 PM |
|
We were under-reporting our volume to bitcoinwatch/charts Thanks to dooglus, we fixed a bug where our trades were dropping 0s on the end in our volume. New exchange is coming along nicely. We will be in a feature lock-down soon and start a week long bug fixing mode. Hi genjix, Have you entered bug fixing mode yet? The reason I ask is because i am currently seeing PHP errors all over your website. I was about to make my first BTC deposit. Thanks, Matt
|
|
|
|
dooglus
Legendary
Offline
Activity: 2940
Merit: 1333
|
|
June 30, 2011, 05:07:41 PM |
|
Have you entered bug fixing mode yet? The reason I ask is because i am currently seeing PHP errors all over your website. I was about to make my first BTC deposit.
I don't believe they have. Can you show the errors you're getting, and/or tell us how to see them for ourselves? I've not noticed the errors.
|
Just-Dice | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | Play or Invest | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | 1% House Edge |
|
|
|
koopa
Member
Offline
Activity: 61
Merit: 10
|
|
June 30, 2011, 06:22:16 PM |
|
Have you entered bug fixing mode yet? The reason I ask is because i am currently seeing PHP errors all over your website. I was about to make my first BTC deposit.
I don't believe they have. Can you show the errors you're getting, and/or tell us how to see them for ourselves? I've not noticed the errors. Errors seem to have gone now. Was getting fopen() PHP errors when accessing profile or deposit pages. They were probably updating the site....
|
|
|
|
dooglus
Legendary
Offline
Activity: 2940
Merit: 1333
|
|
June 30, 2011, 07:28:43 PM |
|
This thing? Private user info
You are logged in.
User ID: 101
OpenID: https://www.google.com/accounts/o8/id?id=AItOawmmjsHzeUJPxKzlotok Warning: fopen(http://...@127.0.0.1:8332/): failed to open stream: Connection refused in /home/chris/Programs/dooglus-intersango/jsonRPCClient.php on line 132 Fatal error: Uncaught exception 'Exception' with message 'Unable to connect.' in /home/chris/Programs/dooglus-intersango/jsonRPCClient.php:140 Stack trace: #0 /home/chris/Programs/dooglus-intersango/util.php(108): jsonRPCClient->__call('getbalance', Array)
I think that means that the bitcoind on the server stopped accepting connections. I've seen it before and it never seems to last for long. It means the site is unable to communicate with the bitcoin client, but trades still work.
|
Just-Dice | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | Play or Invest | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | 1% House Edge |
|
|
|
JeevesNZ
Newbie
Offline
Activity: 17
Merit: 0
|
|
July 01, 2011, 02:45:09 AM |
|
So i've downloaded the code to have a play around. Im reasonably new at LAMP etc.. but have figured out most of the problems on my own. The thing is I am getting this on the profile page under balance: Warning: gmp_cmp(): Unable to convert variable to GMP - wrong type in /var/www/bcx/util.php on line 115 Im guessing GMP or something may not be configured properly? Any ideas?
|
|
|
|
|