Ignore:
Timestamp:
09/24/26 17:43:19 (6 days ago)
Author:
Stefan <trsunovstefan@…>
Branches:
main
Children:
0cee8ec
Parents:
a531b45
Message:

Wiki docs, phase 6 and phase 7 added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/db/data_load.sql

    ra531b45 ref1c1c7  
    88--
    99-- All sample users have the password: test123
     10--
     11-- One transaction: the P7 checks in advanced_db.sql compare balances with
     12-- the ledger at COMMIT, and the users are inserted with their balances
     13-- before the deposit rows that back them. In an auto-commit client
     14-- (DBeaver) every statement would otherwise be checked on its own.
     15
     16BEGIN;
    1017
    1118SET search_path TO project, public;
    … …  
    104111-- Shows a fully-filled market buy and its resulting holding & ledger entry.
    105112-- ============================================================================
    106 INSERT INTO project.orders (id, user_id, market_id, side, type, status, quantity, price, placed_at, executed_at) VALUES
     113-- Imported as already completely filled (filled_quantity = quantity).
     114INSERT INTO project.orders (id, user_id, market_id, side, type, status, quantity, filled_quantity, price, placed_at, executed_at) VALUES
    107115    ('c1111111-1111-1111-1111-111111111111',
    108116     'b1111111-1111-1111-1111-111111111111',
    109117     'a2222222-2222-2222-2222-222222222222',
    110      'buy', 'market', 'executed', 0.5000, 3500.000000,
     118     'buy', 'market', 'executed', 0.5000, 0.5000, 3500.000000,
    111119     now() - interval '1 hour', now() - interval '1 hour');
    112120
    … …  
    118126INSERT INTO project.transactions (user_id, type, amount, currency, related_order, description) VALUES
    119127    ('b1111111-1111-1111-1111-111111111111', 'deposit',  10000.0000, 'USD', NULL,
     128        'Initial virtual deposit'),
     129    ('b2222222-2222-2222-2222-222222222222', 'deposit',   5000.0000, 'USD', NULL,
     130        'Initial virtual deposit'),
     131    ('b3333333-3333-3333-3333-333333333333', 'deposit',   2500.0000, 'USD', NULL,
    120132        'Initial virtual deposit'),
    121133    ('b1111111-1111-1111-1111-111111111111', 'buy',      -1750.0000, 'USD',
    … …  
    143155    ('d2222222-2222-2222-2222-222222222222', '11111111-1111-1111-1111-111111111111'),
    144156    ('d2222222-2222-2222-2222-222222222222', '55555555-5555-5555-5555-555555555555');
     157
     158COMMIT;
Note: See TracChangeset for help on using the changeset viewer.