Simple prediction market on django and django-rest-framework.
- Install requirements:
pip install -r requirements.txt
; - Create
market
database; - Run migrations:
python manage.py migrate
; - Populate database:
python manage.py loaddata data.json
; - Login with default admin credentials:
admin/admin
; - If you want to use custom config set
MARKET_CONF
environment variable to your config name, config should be in theconfig
folder, otherwisedefault.ini
will be used.
api/settings/
: API settings info, onlyGET
allowed;api/auth/
: rest auth endpoints;api/outcomes/
: read-only actions forOutcome
model;api/markets/
: provides all actions forMarket
model;api/markets/<market_id>/resolve/
: onlyPATCH
allowed, resolve market byoutcome_pk
field;api/orders/
: provides all actions forOrder
model;api/orders/asset/<outcome_pk>/
: get asset (total amount from all orders) for specific outcome.
Default pagination structure:
{
"count": "results length",
"next": "next page url",
"previous": "previous page url",
"results": ["result0", "result1", "..."]
}
- page max size: 50.
- ordering: from newest to oldest.
- Markets filter parameters:
proposal
,category
.
For example, filter markets by category Other
and proposal True
:
GET /api/markets/?category=OTH&proposal=true
- Orders filter parameters:
user
,type
.
Filter orders by user 1
and order type sell
:
GET /api/orders/?user=1&type=sell
.