Bitcoin Forum
October 01, 2026, 10:39:08 AM *
News: Latest Bitcoin Core release: 31.1 [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 75458 times)
dooglus
Legendary
*
Offline

Activity: 2940
Merit: 1335



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

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

Activity: 1232
Merit: 1097


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

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

Activity: 1232
Merit: 1097


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

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

Activity: 3
Merit: 0


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

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



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

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


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

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



View Profile
June 26, 2011, 08:57:14 PM
Last edit: June 27, 2011, 03:11:20 AM by dooglus
 #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.

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

Activity: 107
Merit: 10


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

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

Activity: 2940
Merit: 1335



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

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



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

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

Activity: 1232
Merit: 1097


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

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

Activity: 2940
Merit: 1335



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

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

Activity: 1232
Merit: 1097


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

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

Activity: 826
Merit: 1112


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

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

Activity: 61
Merit: 10



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

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

Activity: 2940
Merit: 1335



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

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



View Profile
June 30, 2011, 06:22:16 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.

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

Activity: 2940
Merit: 1335



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

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

Activity: 17
Merit: 0


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

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
dooglus
Legendary
*
Offline

Activity: 2940
Merit: 1335



View Profile
July 01, 2011, 04:52:14 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

I get that all the time.

It only seems to affect the code that transfers bitcoins from the bitcoin client into the exchange database.  I just ignore it, and deposit funds by doing something like:

Code:
  update purses set amount = 123e8 where uid=99 and type='GBP';

Everything seems to work other than this.

Just-Dice                 ██             
          ██████████         
      ██████████████████     
  ██████████████████████████ 
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
    ██████████████████████   
        ██████████████       
            ██████           
   Play or Invest                 ██             
          ██████████         
      ██████████████████     
  ██████████████████████████ 
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
    ██████████████████████   
        ██████████████       
            ██████           
   1% House Edge
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!