-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjson-structure-docs
67 lines (66 loc) · 2.09 KB
/
json-structure-docs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
this populates the ids/ folder, with files named <user id>
user:
{
"id": "<user id>",
"money": 100,
"createdStocks": [<list of stock names>],
"ownedStocks": {
"<stock name>": {
"name": "<stock name>",
"shares": amount of shares
},
"<stock name>": {
"name": "<stock name>",
"shares": amount of shares
},
...
}
"openOrders": [
{
"name": "<stock name>",
"uuid": "<transaction uuid>"
},
{
"name": "<stock name>",
"uuid": "<transaction uuid>"
},
...
]
}
this populates the stocks/ folder, with files named <stock name>
stock:
{
--names can be up to 10 characters long
"name": "<stock name>",
--descriptions can be up to 100 characters long
"desc": "<stock description>",
"time": <unix timestamp>
--minimum amount of shares to start a stock with is 200
"shares": 200,
"createdBy": "<id of user>",
"history": [
{
"transaction": "buy", "sell", or "done"
--IMPORTANT NOTE: BUY denotes the fact that someone has created a buy order.
--SELL denotes that someone has created a sell order.
--DONE denotes that the stock has changed hands
"time": <unix timestamp>,
"amount": <total shares to transfer>,
"amountDone": <shares transferred>,
"value": <monetary value of 1 share>,
"uuid": <special id of the transaction>,
"userId": <internal identification of the seller. SHOULD BE SANITIZED>
},
{
"transaction": "buy" or "sell",
"time": <unix timestamp>,
"amount": <total shares to transfer>,
"amountDone": <shares transferred>,
"value": <monetary value of 1 share>,
"uuid": <special id of the transaction>,
"userId": <internal identification of the seller. SHOULD BE SANITIZED>
}
...
],
"averageValue": <value, set by get_stock_value in helper-functions.rb>
}