-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
188 lines (155 loc) · 3.11 KB
/
schema.graphql
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
scalar DateTime
enum Side {
BUY
SELL
}
enum Direction {
IN
OUT
}
enum OrderType {
MARKET
LIMIT
}
enum OrderStatus {
NEW
PLACED
EXECUTED
CANCELED
}
enum TransactionType {
CASH_TRANSFER
TRADE
}
type DataPoint {
x: Float!
y: Float!
}
type Series {
name: String!
data: [DataPoint!]!
}
type User {
id: ID!
email: String!
name: String!
}
type UserInfo {
user: User!
accessToken: String!
}
input SignUpInput {
email: String!
name: String!
password: String!
}
input Credentials {
email: String!
password: String!
}
input TransferCashInput {
accountId: ID!
direction: Direction!
amount: Float!
}
input OrderInput {
accountId: ID!
side: Side!
symbol: ID!
quantity: Int!
type: OrderType!
limitPrice: Float
}
type Security {
id: ID!
name: String!
price: Float!
}
type AssetAllocation {
categoryId: String!
categoryName: String!
value: Float!
percentage: Float!
children: [AssetAllocation!]
}
type Account {
id: ID!
name: String!
owner: User!
cashBalance: Float!
holdings: [Holding!]!
orders: [Order!]!
transactions: [Transaction!]!
investmentTotal: Float!
assetAllocations: [AssetAllocation!]!
performance: [Series!]!
}
type Holding {
id: ID!
security: Security!
quantity: Int!
account: Account!
value: Float!
}
type Order {
id: ID!
side: Side!
security: Security!
quantity: Int!
type: OrderType!
limitPrice: Float
status: OrderStatus!
account: Account!
createdAt: DateTime!
createdBy: ID!
}
type CashTransfer {
id: ID!
type: TransactionType!
account: Account!
createdAt: DateTime!
createdBy: ID!
direction: Direction!
amount: Float!
}
type Trade {
id: ID!
type: TransactionType!
account: Account!
createdAt: DateTime!
createdBy: ID!
side: Side!
security: Security!
quantity: Int!
price: Float!
amount: Float!
}
union Transaction = CashTransfer | Trade
type Query {
"returns the user identified by the access token in the request header"
user: User!
"returns all securities whose id or name matches the query string"
securities(query: String!): [Security!]!
"returns the accounts owned by the requesting user"
accounts: [Account!]!
"returns the account with the specified accountId"
account(accountId: ID!): Account
"returns the holdings for the specified account"
holdings(accountId: ID!): [Holding!]!
"returns the orders for the specified account"
orders(accountId: ID!): [Order!]!
"returns the transactions for the specified account"
transactions(accountId: ID!): [Transaction!]!
}
type Mutation {
"signs in the user with the specified credentials and returns an access token for future requests"
signIn(credentials: Credentials!): UserInfo!
"signs up a new user and returns an access token for future requests"
signUp(signUpInput: SignUpInput!): UserInfo!
"invalidates the access token that was used to sign in and returns it"
signOut: String!
"transfers cash in or out of an account"
transferCash(transferCashInput: TransferCashInput!): CashTransfer!
"place a buy or sell order for a security"
placeOrder(orderInput: OrderInput!): Order!
}