The new DB design made it so the old InstantDEX code was not quite right. I ended up rewriting it and most of it is gone! this is good as the less code, the less bugs. Still not fully debugged, but via DHT all orderbooks exist in the cloud
./b SuperNET '{"requestType":"placebid","baseid":"11060861818140490423","relid":"4551058913252105307","volume":"1.01","price":"0.006"}'
./b SuperNET '{"requestType":"placeask","baseid":"11060861818140490423","relid":"4551058913252105307","volume":"1.0","price":"0.0065"}'
You can dynamically create any orderbook between any two assets and the pricing is using arbitrary precision volume and price. this is converted internally to 64bit ints.
./b SuperNET '{"requestType":"orderbook","baseid":"11060861818140490423","relid":"4551058913252105307"}'
./b SuperNET '{"requestType":"orderbook","baseid":"4551058913252105307","relid":"11060861818140490423"}'
By changing the order of the base currency to relative currency, you can flip the orderbook to whichever orientation is more natural to you. Internally, there is only one orderbook with the "key" being (baseid XOR relid)
{
"key": "12008998766472701676",
"baseid": "11060861818140490423",
"relid": "4551058913252105307",
"bids": [["0.00600000000", "1.01000000"], ["0.00600000000", "1.01000000"], ["0.00500000000", "1.10000000"], ["0.00500000000", "1.10000000"]],
"asks": [["0.00500000000", "1.10000000"]]
}
{
"key": "12008998766472701676",
"baseid": "4551058913252105307",
"relid": "11060861818140490423",
"bids": [["200.00000000000", "0.00550000"]],
"asks": [["166.66666666667", "0.00606000"], ["166.66666666667", "0.00606000"], ["200.00000000000", "0.00550000"], ["200.00000000000", "0.00550000"]]
}
you can get more info by adding an "allfields":1, the most important is the address of the one making the bid/ask, that way you can directly "negotiate" the trade, so this means you can complete a trade offchain. To do this you need to use the makeoffer API and it will invoke the default tradebot on the other side, so I need to port the tradebots next.
{
"key": "12008998766472701676",
"baseid": "4551058913252105307",
"relid": "11060861818140490423",
"bids": [["200.00000000000", "0.00550000", 0, "7581814105672729429"]],
"asks": [["166.66666666667", "0.00606000", 0, "7581814105672729429"], ["166.66666666667", "0.00606000", 0, "7581814105672729429"], ["200.00000000000", "0.00550000", 0, "7581814105672729429"], ["200.00000000000", "0.00550000", 0, "7581814105672729429"],]
}
I have only tested this in some simple cases, so not sure how solid it is, but now I can maintain orderbooks for Telepods, so the needed components are coming into place.
James
P.S. Until the BTC bear market is over, I would not expect any big price increase, but there is still chances for this as things can happen very quickly in crypto
I've never been sexually arroused by code before.... That's the last time I'll be able to say that.