Separate Buy and Sell Market history.



  • I think it would be really useful to have market history separated by sell vs buy orders as well.

    I asked for this when Game.market.getHistory() was first introduced, and was told the data wasn't available. I recently looked at the stats collection cron. I can see a way to add split statistics without increasing the number of passes over the data.

    if(i.user === i.market.dealer) {
      result[r][i.dateStr].sumBuyPrice += i.change
      ...
    } else {
      result[r][i.dateStr].sumSellAmount += i.market.amount
      ...
    }
    

    If I wrote a pull request for this is it something @o4kapuk would be willing to integrate?


    While I'm there I could convert the stddev algorithm to use Welford's Online which is more numerically stable than the two pass algorithm. It would reduce the to a single pass which would would be more cpu efficient if that matters.

    👍


  • FWIW, I'd welcome having buys and sells separated out, in the API and the in-game UI.