@roadscape I prefer to calculate with full data rather than with sample data. I'm going to write a snapshot plugin.
Data structure of one market pair (for example BTS/USD):
* a calculation period = snapshots
* a snapshot = time stamp, feed price, ask orders, bid orders
* a order = direction(ask/bid), price, volume, owner, create_time
Calculations:
[Note: the algorithm below is based on feed price, but not on "best prices"]
* at the beginning of a calculation period, take a snapshot, set everyone's score = 0
* Every time (after a new block is produced) when a new order is created or cancelled, or feed price is updated, or reached the end of a calculation period, take a new snapshot.
-> let LT= last snapshot time
let T = current snapshot time
let LFP = feed price of last snapshot
-> for each order,
let LV=volume of last snapshot,
calculate LV' = function1 (direction, price, LFP, LV), to filter out unqualified orders
calculate new score gained by this order after last snapshot
NOS = function2 (direction,LV', LT, T, create_time, price, LFP)
note: create_time may be needed here to judge whether this order is qualified.
-> for each account(owner) on each side,
let LAS = score on last snapshot
calculate TLV = sum(LV'), total volume of qualified orders at last snapshot
calculate ELV = function3(TLV), to filter out unqualified account if total volume is too low
calculate TNS = sum(NOS), total new score gained
calculate ENS = function4(TNS,ELV), to filter out too low total score/volume, and perhaps set a cap on new score
calculate AS = LAS + ENS, final score at this snapshot
* at the end of a calculation period, for each side, we have a set of (account, score), so we can calculate the final rewards.
//Update: I'm going to write a plugin to provide snapshot data, so you guys can use it to do whatever calculation as you like.