Commit Graph

56 Commits

Author SHA1 Message Date
ekzyis 74aa41d5f4 Add orders.created_at column 2024-08-26 16:15:51 -05:00
ekzyis bd7b2715bd Calculate probabilities using LMSR 2024-08-25 00:48:03 -05:00
ekzyis d87b97d235 Move postgresql.conf into db/ 2024-08-25 00:45:52 -05:00
ekzyis 845157c954 Add market form + page
* market form with question, description and end date
* markets cost 1k sats
* a goroutine polls pending invoices from the db and checks LND for their status
* markets are listed on front page (after paid)
* market page contains buttons to bet yes or no
* users have names now

TODO:
* show correct market percentage
* show how percentage changed over time in chart
* validate end date
* implement betting / order form
2024-08-24 02:35:15 -05:00
ekzyis 2653e816bb Implement LNURL-auth 2024-07-12 15:18:44 +02:00
ekzyis ee3e5e82e4 Remove old code
* removed code that will not be used
* removed code that will most likely be rewritten
2024-07-12 11:00:51 +02:00
ekzyis 4ba568951d Update db schema 2024-07-12 10:59:57 +02:00
ekzyis f280898582 Fix tests 2024-07-09 12:33:56 +02:00
ekzyis 4a8981400d Fix market_id column nullable 2023-12-04 04:56:01 +01:00
ekzyis 5969b23a31 Fix undefined CTE execution order
"""
The sub-statements in WITH are executed concurrently with each other and with the main query.
Therefore, when using data-modifying statements in WITH, the order in which the specified updates actually happen is unpredictable.
"""
-- https://www.postgresql.org/docs/14/queries-with.html

Also see https://stackoverflow.com/questions/47622827/cte-execution-order
2023-12-04 04:45:27 +01:00
ekzyis 0ea0cecfc3 Show market outcome 2023-12-04 02:36:09 +01:00
ekzyis fe5feccfee Implement market settlement 2023-12-04 01:36:59 +01:00
ekzyis 51e204b64a Add frontend for market settlement 2023-12-03 08:51:40 +01:00
ekzyis 938bff20e6 Add pubkey column to market table 2023-12-03 07:22:13 +01:00
ekzyis ceefec61cd Fix sell order not increasing user balance on match 2023-12-03 07:01:08 +01:00
ekzyis c7ae559777 Implement withdrawal 2023-12-03 06:21:57 +01:00
ekzyis 3f22f12707 Fix unpaid orders shown 2023-12-03 03:10:00 +01:00
ekzyis 305e248310 Fix wrong share balance if sell order canceled 2023-12-03 02:41:03 +01:00
ekzyis ce95a2111b Update matchmaking 2023-12-03 02:03:48 +01:00
ekzyis ac3008ec74 Show canceled orders to user 2023-12-03 00:33:10 +01:00
ekzyis f6d04f021c Fix order creation not setting invoice_id 2023-12-02 23:41:32 +01:00
ekzyis 28546962f3 Add msats to session 2023-12-02 23:30:48 +01:00
ekzyis 49cacb266c Order cancelation 2023-12-02 23:22:14 +01:00
ekzyis 7a913d0f27 Use PENDING for unpaid invoices 2023-12-02 21:47:20 +01:00
ekzyis 26fb7b3178 Remove unused table matches 2023-12-02 21:11:25 +01:00
ekzyis 38318688b9 Fix user balance query 2023-12-02 02:56:58 +01:00
ekzyis c92557cd2a Fix timestamp of sell orders
For some reason, I had to put o.invoice_id at the end of the select list. Else, sell orders would receive wrong/empty data.
2023-12-02 02:56:04 +01:00
ekzyis 16e6efe6c2 Fix unpaid market orders shown 2023-12-02 02:45:37 +01:00
ekzyis 272591b015 Fix empty stats 2023-12-02 02:24:48 +01:00
ekzyis ad7778302b Fix definition of 'confirmed' 2023-11-30 22:09:38 +01:00
ekzyis c6d81d5848 Fix market orders not showing sell orders 2023-11-29 19:06:32 +01:00
ekzyis fd6111b590 Create sell orders 2023-11-29 18:48:21 +01:00
ekzyis 0ae9f671d4 Add sell order form 2023-11-29 08:11:56 +01:00
ekzyis dc082ec4f2 Remove log.Println 2023-11-29 05:53:52 +01:00
ekzyis c9de76ac75 Add market stats page 2023-11-29 04:11:46 +01:00
ekzyis 8098daab8c Highlight matching orders 2023-11-28 22:10:16 +01:00
ekzyis 1944b04d07 Run matchmaking 2023-11-28 21:39:58 +01:00
ekzyis 3445693ef4 Use context during invoice polling 2023-11-27 22:09:51 +01:00
ekzyis 10eaecdf0d Rename status to PENDING 2023-11-27 18:12:00 +01:00
ekzyis f91080da27 Add order status column 2023-11-27 17:45:07 +01:00
ekzyis b2d8c089c9 Only fetch paid orders 2023-11-27 02:46:48 +01:00
ekzyis e84db076a4 Use router-view for markets 2023-11-27 00:59:15 +01:00
ekzyis c96eeb7668 Show user orders 2023-11-27 00:21:39 +01:00
ekzyis aa6db6a5e1 Fix foreign key constraint violation during market creation 2023-11-26 23:48:55 +01:00
ekzyis 73162155d5 Fix orphaned invoices with Tx and Context usage
txs are now rolled back on order error
2023-11-26 23:22:34 +01:00
ekzyis 6d7cd2573d Show user invoices 2023-11-26 22:35:51 +01:00
ekzyis 0daddb8e5d Add quantity constraint 2023-11-26 18:40:57 +01:00
ekzyis 0827451f5e Fix "relation does not exist" error 2023-11-20 14:18:50 +01:00
ekzyis 7b649c4d7d Replace market status with JOIN 2023-11-20 03:09:55 +01:00
ekzyis ce64608894 Allow creation of markets 2023-11-20 02:52:08 +01:00