I started a little something:
Its Python so far, but in the end I am planning to implement the server logic in PHP and the client in Java. You can see that implementing a compatible client is extremely easy and can be accomplished in very few lines in every modern programming language. The server code is a little bit hacky, i’ll try to clean it up later.
Client
The client reads a file called users.dat
which contains one login per line in the form:
payout-address units exchange api-key api-secret
e.g.
BQRKF4X8gFLyHGVeym8tuff57PcJczYPVg BTC poloniex 85BQTQG1-N3D3PFKX-YUNIHIO1-WQCWTRER 1234abc
Afterwards you can call the client by providing the server you want to connect to, e.g.:
./client.py 104.245.36.10:2019
(this is in fact a running server on a VPS and you can test with it as much as you want)
The client will internally start NuBots for each key and currency, configure them automatically, and guard their existence.
Server
You will need a running nud with all customized parameters specified in the default config file in order to make payouts, but this is currently disabled. To start the server just run
./server.py
and everything should work. On the top of the server.py
file you can adjust several parameters like:
- The supported exchanges, pairs, and corresponding interest rate curves and maximum liquidity
- How often per minute requests should be validated
- How much the price of an order may deviate from the price of the ticker (right now its only bitfinex)
The payout is calculated at each validation point, and interest is payed up to a maximum cap, controlled by a soft thresholding function (inverse logistic sigmoid). This ensures that the maximum liquidity by an operation, and therefore the fee for the shareholders, is not unbounded. The order ID determines the order in which competing client liquidity is considered when the interest is calculated.
The server further supports a very simple public JSON API (which I am planning to extent). So for example for the key above you can query some statistics by simply opening:
http://104.245.36.10:2019/85BQTQG1-N3D3PFKX-YUNIHIO1-WQCWTRER
Experiments
I am using a sampling rate of 12 validations per minute. This means every 5 seconds the server checks if the clients sent a new order request and validates them correspondingly. Experiments on localhost always lead to 12 / 12 accepted requests.
My VPS is not very response from my location, and pings of more than 100 ms are normal. Here it happens sometimes that one request cannot be validated, maybe in 1 of 12 cases. I think this can still be improved by cheating a little bit with the nonce on the client side.
In total the experiments are extremely encouraging! It would be great if someone could give it a try (with very small funds of course) to see how easy it is 