-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackup_trade_tracker.sql
More file actions
307 lines (211 loc) · 17.6 KB
/
backup_trade_tracker.sql
File metadata and controls
307 lines (211 loc) · 17.6 KB
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
--
-- PostgreSQL database dump
--
-- Dumped from database version 17.5
-- Dumped by pg_dump version 17.5
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: positions; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.positions (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
deleted_at timestamp with time zone,
owner_id bigint NOT NULL,
ticker text NOT NULL,
total_qty numeric NOT NULL,
invested_total numeric NOT NULL,
position_type character varying(20) DEFAULT 'stocks'::character varying NOT NULL,
position_direction character varying(10) DEFAULT 'LONG'::character varying NOT NULL,
take_profit numeric,
stop_loss numeric
);
ALTER TABLE public.positions OWNER TO postgres;
--
-- Name: positions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.positions_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.positions_id_seq OWNER TO postgres;
--
-- Name: positions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.positions_id_seq OWNED BY public.positions.id;
--
-- Name: transactions; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.transactions (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
deleted_at timestamp with time zone,
owner_id bigint NOT NULL,
transaction_type text DEFAULT 'buy'::text NOT NULL,
transaction_fee numeric NOT NULL,
quantity numeric NOT NULL,
base_price numeric NOT NULL,
price numeric NOT NULL,
ticker text NOT NULL,
notes character varying(255)
);
ALTER TABLE public.transactions OWNER TO postgres;
--
-- Name: transactions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.transactions_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.transactions_id_seq OWNER TO postgres;
--
-- Name: transactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.transactions_id_seq OWNED BY public.transactions.id;
--
-- Name: users; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.users (
id bigint NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
deleted_at timestamp with time zone,
name text NOT NULL,
email text NOT NULL,
username text NOT NULL,
password text NOT NULL,
verified boolean DEFAULT false NOT NULL,
balance bigint DEFAULT 0 NOT NULL,
owner_id text
);
ALTER TABLE public.users OWNER TO postgres;
--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.users_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.users_id_seq OWNER TO postgres;
--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
--
-- Name: positions id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.positions ALTER COLUMN id SET DEFAULT nextval('public.positions_id_seq'::regclass);
--
-- Name: transactions id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.transactions ALTER COLUMN id SET DEFAULT nextval('public.transactions_id_seq'::regclass);
--
-- Name: users id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
--
-- Data for Name: positions; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.positions (id, created_at, updated_at, deleted_at, owner_id, ticker, total_qty, invested_total, position_type, position_direction, take_profit, stop_loss) FROM stdin;
25 2026-02-24 14:33:30.626969+07 2026-02-24 14:33:30.626969+07 \N 1 ADRO 4000 9200000 stocks LONG 0 0
20 2026-02-18 17:02:52.593648+07 2026-02-24 22:45:13.632002+07 \N 3 BBRI 600 2037000 stocks LONG 0 0
9 2026-02-12 10:38:11.423621+07 2026-02-26 11:56:42.077442+07 \N 1 KRAS 10000 12900000 stocks LONG 0 0
6 2026-02-12 10:36:06.260608+07 2026-03-02 15:50:03.516728+07 \N 1 CDIA 2000 2095000 stocks LONG 0 0
3 2026-02-12 10:34:44.208365+07 2026-02-12 10:34:44.208365+07 \N 1 CBDK 1000 6025000 stocks LONG 0 0
7 2026-02-12 10:37:07.308899+07 2026-02-12 10:37:07.308899+07 \N 1 DGIK 20000 5513800 stocks LONG 0 0
8 2026-02-12 10:37:36.923133+07 2026-02-12 10:37:36.923133+07 \N 1 KKGI 10000 8643535 stocks LONG 0 0
\.
--
-- Data for Name: transactions; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.transactions (id, created_at, updated_at, deleted_at, owner_id, transaction_type, transaction_fee, quantity, base_price, price, ticker, notes) FROM stdin;
1 2026-03-02 15:47:53.775736+07 2026-03-02 15:47:53.775736+07 \N 1 sell 4685 6900 558900 1338600 BNBR Sold 6900 lot of BNBR for Rp1338600.
2 2026-03-02 15:50:03.554382+07 2026-03-02 15:50:03.554382+07 \N 1 buy 1507 1000 1005000 1006507 CDIA Bought 1000 lot of CDIA for Rp1005000
\.
--
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.users (id, created_at, updated_at, deleted_at, name, email, username, password, verified, balance, owner_id) FROM stdin;
2 2026-02-10 14:52:31.048782+07 2026-02-10 14:52:31.048782+07 \N Testing abc@gmail.com abcd $argon2id$v=19$m=65536,t=1,p=16$MdJI6T4EdirgkEd8oS4Sdg$AyNCzIdYYNbQNIxBv9gX3xIfHYY0LifePDtX6qBpM/0 f 0
1 2026-02-10 12:04:57.693418+07 2026-03-02 15:50:03.470373+07 \N test bang test@gmail.com test $argon2id$v=19$m=65536,t=1,p=16$Ez+OBMUqnBHs6+JL28WqKA$ICOPosNic73Nd8lCUIat6H5bUseUEhKblHGQNUMwedc f 2029526
3 2026-02-12 16:49:20.023122+07 2026-02-25 21:46:28.493295+07 \N Lmao bang lmao@gma.com lmao1 $argon2id$v=19$m=65536,t=1,p=16$zoyvjNaP57TJ/ZGXGYdsEA$lxmhsVAmc7VKkF6MY0qBnuK9BtKGRNwQQ4qXH2gc+B4 f 5702000
\.
--
-- Name: positions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.positions_id_seq', 31, true);
--
-- Name: transactions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.transactions_id_seq', 2, true);
--
-- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.users_id_seq', 3, true);
--
-- Name: positions positions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.positions
ADD CONSTRAINT positions_pkey PRIMARY KEY (id);
--
-- Name: transactions transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.transactions
ADD CONSTRAINT transactions_pkey PRIMARY KEY (id);
--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
--
-- Name: idx_positions_deleted_at; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX idx_positions_deleted_at ON public.positions USING btree (deleted_at);
--
-- Name: idx_positions_owner_id; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX idx_positions_owner_id ON public.positions USING btree (owner_id);
--
-- Name: idx_positions_ticker; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX idx_positions_ticker ON public.positions USING btree (ticker);
--
-- Name: idx_transactions_deleted_at; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX idx_transactions_deleted_at ON public.transactions USING btree (deleted_at);
--
-- Name: idx_users_deleted_at; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX idx_users_deleted_at ON public.users USING btree (deleted_at);
--
-- Name: idx_users_owner_id; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX idx_users_owner_id ON public.users USING btree (owner_id);
--
-- Name: positions fk_users_position; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.positions
ADD CONSTRAINT fk_users_position FOREIGN KEY (owner_id) REFERENCES public.users(id);
--
-- PostgreSQL database dump complete
--