BlockPo / BlockPo-to-Tradelayer

Incubation Repo for the TradeLayer protocol, 0.2.0
http://www.tradelayer.org
Other
8 stars 8 forks source link

Generalize the Settlement Algorithm for all Contracts #348

Closed patrickdugan closed 2 years ago

patrickdugan commented 4 years ago

We've done the hard work of merging in Lihki's code, now we have to finish adapting the global variables he used to be conditional parameters of the algorithm so that TradeLayer.cpp can pull the requisite vectors from levelDB, build the mFile, pass that, return something, keep looping, and settle every contract whose block-turn it is to expire (or all contracts if it is a settlement block).

patrickdugan commented 3 years ago

This has been in progress for much of December.

patrickdugan commented 3 years ago

We're testnet ready here, Lihki has a commit on his branch, we can give him a parallel testnet to play with for Friday.

patrickdugan commented 3 years ago

We should be able to run this on a parallel testnet and start experimenting before closing this.

patrickdugan commented 3 years ago

Ok we've been doing a lot of work here so to summarize where we are:

Partial overhaul of the basic SP details around contract positions balances, and margin/liquidation.

Trying to test the algo with a 3rd dev, but barring that we'll be running our own tests with detailed logs of every data structure and step, for a modest amount of trades/addresses (like 3 and 10) and then we'll scale that a bit, and we will refactor the algorithm to be object oriented and return a data set of the counterparties at settlement and the net payments.

All that should be its own ticket and we could reasonably close this one by finishing some of the quick generalization work. There is still a hardcore in the PNL function for example, we need to generalize that, it may be the last part. There is decent work already done loading mFile data from LevelDB and feeding multiple contracts into the settlement in a loop, calling a function multiple times, a year ago it was just a bracket block, yeesh.

If we can just get this to work with e.g. 2-3 Oracle contracts on testnet we can probably test derivatives in public beta. We will experience high processing times if the # of trades per hour goes >500-1000. But that's another ticket.

patrickdugan commented 2 years ago

We've pivoted off and this is closed.