Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true

[*.{py}]
indent_style = space
indent_size = 4


[*.json]
indent_style = space
indent_size = 2

[*.yaml]
indent_style = space
indent_size = 2
quote_type = single
30 changes: 0 additions & 30 deletions .github/workflows/tests.yaml

This file was deleted.

24 changes: 24 additions & 0 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Test

on:
push:
branches: [ main ]
pull_request:

jobs:
build-lint-test:
name: Test
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9.10

- run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .

- name: Run Tests
run: make test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ lib64/
parts/
sdist/
var/
venv/

# files
.env
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ init:
pip install -r requirements.txt

test:
pytest -s
pytest -s

fmt:
black ./.
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<img src='https://img.shields.io/pypi/v/py-order-utils.svg' alt='PyPI'/>
</a>

Python utilities used to generate and sign limit and market orders on Polymarket's CLOB

Python utilities used to generate and sign orders from Polymarket's Exchange

### Install

Expand All @@ -16,27 +15,24 @@ pip install py-order-utils
### Usage

```py
from py_order_utils.builders import LimitOrderBuilder
from py_order_utils.builders import OrderBuilder
from py_order_utils.signer import Signer
from pprint import pprint

def main():
exchange_address = "0x...."
chain_id = 80001
signer = Signer("0x....")
builder = LimitOrderBuilder(exchange_address, chain_id, signer)

# Create and sign the limit order
limit_order = builder.create_limit_order(
LimitOrderData(
maker_asset_address="0x...",
taker_asset_address="0x...",
taker_asset_id=1,
builder = OrderBuilder(exchange_address, chain_id, signer)

# Create and sign the order
order = builder.build_signed_order(
OrderData(
...
)
)

# Generate the Order and Signature json to be sent to the CLOB API
pprint(json.dumps(limit_order.dict()))
pprint(json.dumps(order.dict()))

```
Loading