In some cases, the user is allowed to buy 0 shares, which will corrupt the database with division by zero values
The server should refuse to handle 0 trades. This is the activity log in question:
{ _id: "Qaid9mMy9Xc29GYES",
timestamp: 1424264439357,
user_id: "2Hq9T4GPn7cycGCTv",
type: "trade",
value: { market_id: "CTMddDY5JMgkti9QB",
set_id: "JwaffaL8HjbmFcayd",
contract_id: "KuBzptNwS7aTr432X",
trade_amount: NaN,
owned_before: 0,
owned_after: NaN,
outstanding_before: 0,
outstanding_after: NaN,
cash_before: 15.29357415712525,
cash_after: 15.29357415712525,
set_id: "JwaffaL8HjbmFcayd",
thawed: 0,
trade_amount: Nan,
prices: { QjbMdnCgAzxHvZmSY: NaN,
KuBzptNwS7aTr432X: NaN,
htMpSWmhWLLhumanR: NaN }
}
}