Bitcoin Forum
April 19, 2024, 07:33:34 AM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 [19] 20 21 22 23 24 25 26 27 28 29 30 31 32 »
  Print  
Author Topic: Intersango exchange (formerly Britcoin)  (Read 75292 times)
genjix (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1072


View Profile
June 26, 2011, 01:42:30 AM
 #361

    ...
    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.
1713512014
Hero Member
*
Offline Offline

Posts: 1713512014

View Profile Personal Message (Offline)

Ignore
1713512014
Reply with quote  #2

1713512014
Report to moderator
1713512014
Hero Member
*
Offline Offline

Posts: 1713512014

View Profile Personal Message (Offline)

Ignore
1713512014
Reply with quote  #2

1713512014
Report to moderator
"There should not be any signed int. If you've found a signed int somewhere, please tell me (within the next 25 years please) and I'll change it to unsigned int." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
dooglus
Legendary
*
Offline Offline

Activity: 2940
Merit: 1330



View Profile
June 26, 2011, 03:27:55 AM
 #362

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:

Code:
    ...
    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:

Code:
    ...
    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 Offline

Activity: 1232
Merit: 1072


View Profile
June 26, 2011, 01:08:15 PM
 #363

Merged dooglus's gitorious branch after testing it today. Grin
genjix (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1072


View Profile
June 26, 2011, 01:13:08 PM
 #364

What really happens is:

Code:
    ...
    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 Offline

Activity: 3
Merit: 0


View Profile
June 26, 2011, 05:40:23 PM
 #365

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 Offline

Activity: 2940
Merit: 1330



View Profile
June 26, 2011, 06:40:08 PM
 #366

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 Offline

Activity: 1232
Merit: 1072


View Profile
June 26, 2011, 07:58:18 PM
 #367

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 Offline

Activity: 2940
Merit: 1330



View Profile
June 26, 2011, 08:57:14 PM
Last edit: June 27, 2011, 03:11:20 AM by dooglus
 #368

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:

Code:
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 Offline

Activity: 107
Merit: 10


View Profile
June 27, 2011, 01:16:07 AM
 #369

God are there some ridiculous orders..10000000 GBP wanted for 0.01 BTC....trolls be trollin.
dooglus
Legendary
*
Offline Offline

Activity: 2940
Merit: 1330



View Profile
June 27, 2011, 02:41:13 AM
 #370

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 Offline

Activity: 2940
Merit: 1330



View Profile
June 27, 2011, 03:16:23 AM
 #371

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

Code:
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 Offline

Activity: 1232
Merit: 1072


View Profile
June 27, 2011, 11:45:06 AM
 #372

yep, it was done a little afterwards since phantom forgot to do it.
dooglus
Legendary
*
Offline Offline

Activity: 2940
Merit: 1330



View Profile
June 28, 2011, 07:09:44 PM
 #373

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:

Code:
      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:

Code:
      			        :       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:

Code:
      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:

Code:
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:

Code:
>>> 10.994600 * 0.525863
5.7816533398
>>> 11.563300 * 0.500000
5.78165

Just-Dice                 ██             
          ██████████         
      ██████████████████     
  ██████████████████████████ 
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
    ██████████████████████   
        ██████████████       
            ██████           
   Play or Invest                 ██             
          ██████████         
      ██████████████████     
  ██████████████████████████ 
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
    ██████████████████████   
        ██████████████       
            ██████           
   1% House Edge
genjix (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1072


View Profile
June 29, 2011, 02:57:14 PM
 #374

We were under-reporting our volume to bitcoinwatch/charts Grin

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 Offline

Activity: 826
Merit: 1039


View Profile
June 29, 2011, 03:41:48 PM
 #375

Thanks dooglus, your patch was an important improvement.
koopa
Member
**
Offline Offline

Activity: 61
Merit: 10



View Profile
June 30, 2011, 02:37:18 PM
 #376

We were under-reporting our volume to bitcoinwatch/charts Grin

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

Grin
dooglus
Legendary
*
Offline Offline

Activity: 2940
Merit: 1330



View Profile
June 30, 2011, 05:07:41 PM
 #377

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 Offline

Activity: 61
Merit: 10



View Profile
June 30, 2011, 06:22:16 PM
 #378

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....

Grin
dooglus
Legendary
*
Offline Offline

Activity: 2940
Merit: 1330



View Profile
June 30, 2011, 07:28:43 PM
 #379

This thing?

Code:
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 Offline

Activity: 17
Merit: 0


View Profile
July 01, 2011, 02:45:09 AM
 #380

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? Smiley
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 [19] 20 21 22 23 24 25 26 27 28 29 30 31 32 »
  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!