Author Topic: BitUSD Market Maker Live  (Read 18043 times)

0 Members and 1 Guest are viewing this topic.

Offline robrigo

I haven't run the CLI version yet but I assume this requires the CLI version? Just wondering I tried to get it to work but keep getting connection refused:

Code: [Select]
Initializing with URL:  http://robrigo-market-maker:************@localhost:8000/rpc
Init price:  0.039835
Init price:  25.103530
Traceback (most recent call last):
  File "main.py", line 107, in <module>
    init_usd_balance = client.get_balance("USD")
  File "/Users/rob/Documents/repos/bitshares_toolkit/programs/market_maker/btsx.py", line 57, in get_balance
    response = self.request("wallet_account_balance", [self.account_name, asset])
  File "/Users/rob/Documents/repos/bitshares_toolkit/programs/market_maker/btsx.py", line 29, in request
    response = requests.post(self.url, data=json.dumps(payload), headers=headers)
  File "/Library/Python/2.7/site-packages/requests/api.py", line 92, in post
    return request('post', url, data=data, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/api.py", line 48, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/sessions.py", line 451, in request
    resp = self.send(prep, **send_kwargs)
  File "/Library/Python/2.7/site-packages/requests/sessions.py", line 557, in send
    r = adapter.send(request, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/adapters.py", line 407, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(61, 'Connection refused'))

So I assume I would need to build / run the bitshares_toolikit? If so, is there any danger of building the client when I already have the GUI installed (i.e. will it modify my current data directory?).

Edit: just remember reading somewhere I can pass an argument to make a 2nd data directory. So that should do the trick!

Thanks! I have been meaning to dig into running a delegate but my less interesting full time job comes first.

Can we have an instruction manual for how you got it to work?

I will certainly publish anything useful I can find... hoping to look into this more tonight after I finish up some more work for my employer.

Offline luckybit

  • Hero Member
  • *****
  • Posts: 2921
    • View Profile
  • BitShares: Luckybit
I haven't run the CLI version yet but I assume this requires the CLI version? Just wondering I tried to get it to work but keep getting connection refused:

Code: [Select]
Initializing with URL:  http://robrigo-market-maker:************@localhost:8000/rpc
Init price:  0.039835
Init price:  25.103530
Traceback (most recent call last):
  File "main.py", line 107, in <module>
    init_usd_balance = client.get_balance("USD")
  File "/Users/rob/Documents/repos/bitshares_toolkit/programs/market_maker/btsx.py", line 57, in get_balance
    response = self.request("wallet_account_balance", [self.account_name, asset])
  File "/Users/rob/Documents/repos/bitshares_toolkit/programs/market_maker/btsx.py", line 29, in request
    response = requests.post(self.url, data=json.dumps(payload), headers=headers)
  File "/Library/Python/2.7/site-packages/requests/api.py", line 92, in post
    return request('post', url, data=data, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/api.py", line 48, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/sessions.py", line 451, in request
    resp = self.send(prep, **send_kwargs)
  File "/Library/Python/2.7/site-packages/requests/sessions.py", line 557, in send
    r = adapter.send(request, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/adapters.py", line 407, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(61, 'Connection refused'))

So I assume I would need to build / run the bitshares_toolikit? If so, is there any danger of building the client when I already have the GUI installed (i.e. will it modify my current data directory?).

Edit: just remember reading somewhere I can pass an argument to make a 2nd data directory. So that should do the trick!

Thanks! I have been meaning to dig into running a delegate but my less interesting full time job comes first.

Can we have an instruction manual for how you got it to work?
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline luckybit

  • Hero Member
  • *****
  • Posts: 2921
    • View Profile
  • BitShares: Luckybit
We have produced a python script that can be used by anyone who wants to help make the BitUSD market and are looking for developers to help make it better!

https://github.com/BitShares/bitshares_toolkit/tree/develop/programs/market_maker

It is a tad crude right now, but we have plans to make this kind of script configurable for anyone who wants to perform this function. 

The rules are simple:
1) Buy BitUSD cheap (a few percent discount)
2) Sell BitUSD at the median price feed (or the latest feed from BTER) which ever is higher (in dollars per BTSX)
3) Adjust orders anytime they deviate from what the new orders would be by more than some tolerance.

Under this plan no *NEW* bitUSD will be created until the peg is hit *AND* everyone buying BitUSD can expect liquidity within just a few percent.   Meanwhile profits can be made every time someone switches sides of the market.

We are providing the script for others so that we can increase liquidity and decrease the spread (as our bots compete against each other ;) )

Users can now purchase BitUSD with confidence that they can sell it when they need to.   

Usage:
Code: [Select]
python main.py USER PASS PORT REAL_NETWORK
Example:
Code: [Select]
  python main.py user pass 8000 true
You can tweak the parameters by editing:
  main.py

Code: [Select]
SPREAD_PERCENT = 0.05  # 5%
TOLERANCE = 0.01 # should be less than SPREAD_PERCENT / 2, the closer the tolerance the more often orders are canceled/updated

MIN_USD_BALANCE = 10  #make sure you retain enough USD to pay fees to update your orders
MIN_BTSX_BALANCE = 100  # make sure you retain enough BTSX to pay fees to update your orders
MIN_USD_ORDER_SIZE = 2  # prevent dust orders
MIN_BTSX_ORDER_SIZE = 100  # minimum order size to prevent dust

MEDIAN_EDGE_MULTIPLE = 1.001 # how far in front of the median price feed do you want to sell.

Excellent. I think I will use this.

Do you have a list of features which need to be developed to extend this? What sort of improvements are possible?
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline robrigo

I haven't run the CLI version yet but I assume this requires the CLI version? Just wondering I tried to get it to work but keep getting connection refused:

Code: [Select]
Initializing with URL:  http://robrigo-market-maker:************@localhost:8000/rpc
Init price:  0.039835
Init price:  25.103530
Traceback (most recent call last):
  File "main.py", line 107, in <module>
    init_usd_balance = client.get_balance("USD")
  File "/Users/rob/Documents/repos/bitshares_toolkit/programs/market_maker/btsx.py", line 57, in get_balance
    response = self.request("wallet_account_balance", [self.account_name, asset])
  File "/Users/rob/Documents/repos/bitshares_toolkit/programs/market_maker/btsx.py", line 29, in request
    response = requests.post(self.url, data=json.dumps(payload), headers=headers)
  File "/Library/Python/2.7/site-packages/requests/api.py", line 92, in post
    return request('post', url, data=data, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/api.py", line 48, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/sessions.py", line 451, in request
    resp = self.send(prep, **send_kwargs)
  File "/Library/Python/2.7/site-packages/requests/sessions.py", line 557, in send
    r = adapter.send(request, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/adapters.py", line 407, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(61, 'Connection refused'))

So I assume I would need to build / run the bitshares_toolikit? If so, is there any danger of building the client when I already have the GUI installed (i.e. will it modify my current data directory?).

Edit: just remember reading somewhere I can pass an argument to make a 2nd data directory. So that should do the trick!

Thanks! I have been meaning to dig into running a delegate but my less interesting full time job comes first.
« Last Edit: September 11, 2014, 09:25:18 pm by robrigo »

Offline betax

  • Hero Member
  • *****
  • Posts: 808
    • View Profile
 +5% sleep or not sleep that is the question :)
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline tonyk

  • Hero Member
  • *****
  • Posts: 3308
    • View Profile
Wow... You guys must not sleep?

I am pretty sure somebody has succeeded at cloning them... before I can do it, that is...
Lack of arbitrage is the problem, isn't it. And this 'should' solves it.

Offline Method-X

  • Hero Member
  • *****
  • Posts: 1131
  • VIRAL
    • View Profile
    • Learn to code
  • BitShares: methodx
Wow... You guys must not sleep?

Xeldal

  • Guest
 +5% Outstanding!
I guess I'll put off sleep for another day.

Offline oldman

  • Hero Member
  • *****
  • Posts: 556
    • View Profile
Would be great if these types of tools could be implemented in the GUI as wizards/robots.

I am not nearly sophisticated enough to compile/run/interface with a script.

However, I can:

- Open the "AutoTrade" tab

- Agree with a disclaimer

- Select the 'bitUSD Market Maker' bot

- Enter the amount of BTSX/bitUSD I want to trade

- Hit the 'Go' button

My suggestion would be for the devs to add a basic algo toolkit to the GUI that automates basic market operations and can be used on any asset class.

Such a feature set would bring a flood of liquidity *and* further the Bitshares competitive advantage over other platforms.

Already on the drawing board... this script is just a proof-of-concept while we work to make it easier for small players.

Damn, you folks never cease to impress!  +5%

Now, who said unsophisticated players are small players? ;D

Offline tonyk

  • Hero Member
  • *****
  • Posts: 3308
    • View Profile
Where did I loose track with those fast developments?

Code: [Select]
MIN_USD_ORDER_SIZE = 2  # prevent dust orders
Isn't min order 100 BTSX...or is it so just for short orders?

hmm, seeing my own orders I have one for less then 2 BTSX ???

Anybody has any idea what '100 BTSX min' pertains to and if this is still valid at all?

 
« Last Edit: September 11, 2014, 09:05:00 pm by tonyk »
Lack of arbitrage is the problem, isn't it. And this 'should' solves it.


Offline bytemaster

Would be great if these types of tools could be implemented in the GUI as wizards/robots.

I am not nearly sophisticated enough to compile/run/interface with a script.

However, I can:

- Open the "AutoTrade" tab

- Agree with a disclaimer

- Select the 'bitUSD Market Maker' bot

- Enter the amount of BTSX/bitUSD I want to trade

- Hit the 'Go' button

My suggestion would be for the devs to add a basic algo toolkit to the GUI that automates basic market operations and can be used on any asset class.

Such a feature set would bring a flood of liquidity *and* further the Bitshares competitive advantage over other platforms.

Already on the drawing board... this script is just a proof-of-concept while we work to make it easier for small players.
For the latest updates checkout my blog: http://bytemaster.bitshares.org
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

Offline oldman

  • Hero Member
  • *****
  • Posts: 556
    • View Profile
Would be great if these types of tools could be implemented in the GUI as wizards/robots.

I am not nearly sophisticated enough to compile/run/interface with a script.

However, I can:

- Open the "AutoTrade" tab

- Agree with a disclaimer

- Select the 'bitUSD Market Maker' bot

- Enter the amount of BTSX/bitUSD I want to trade

- Hit the 'Go' button

My suggestion would be for the devs to add a basic algo toolkit to the GUI that automates basic market operations and can be used on any asset class.

Such a feature set would bring a flood of liquidity *and* further the Bitshares competitive advantage over other platforms.

Offline GaltReport


Offline bytemaster

from my understanding you just run it like this

python main.py rpcuser rpcpass rpcport 1

gonna try this out tomorrow ..

I updated the OP with docs on how to use it :)
For the latest updates checkout my blog: http://bytemaster.bitshares.org
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.