Skip to content

Commit ddc400c

Browse files
authored
Add pre-commit hook for codestyle check, and also run codestyle (#59)
1 parent 3d3840c commit ddc400c

30 files changed

+72
-37
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,11 @@ repos:
3434
entry: poetry run black --config pyproject.toml
3535
types: [python]
3636
language: system
37+
38+
- repo: local
39+
hooks:
40+
- id: codestyle
41+
name: codestyle
42+
entry: make codestyle
43+
types: [python]
44+
language: system

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ make install
6969
<summary>Codestyle</summary>
7070
<p>
7171

72+
Install pre-commit hooks which will run isort, black and codestyle on your code:
73+
74+
```bash
75+
make pre-commit-install
76+
```
77+
7278
Automatic formatting uses `pyupgrade`, `isort` and `black`.
7379

7480
```bash

examples/basic_adding.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import threading
55
import time
66

7+
import example_utils
8+
79
from hyperliquid.exchange import Exchange
810
from hyperliquid.info import Info
911
from hyperliquid.utils import constants
@@ -21,7 +23,6 @@
2123
UserEventsMsg,
2224
UserEventsSubscription,
2325
)
24-
import example_utils
2526

2627
# How far from the best bid and offer this strategy ideally places orders. Currently set to .3%
2728
# i.e. if the best bid is $1000, this strategy will place a resting bid at $997

examples/basic_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import eth_account
2+
import example_utils
23
from eth_account.signers.local import LocalAccount
34

45
from hyperliquid.exchange import Exchange
56
from hyperliquid.utils import constants
6-
import example_utils
77

88

99
def main():

examples/basic_builder_fee.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from hyperliquid.utils import constants
21
import example_utils
32

3+
from hyperliquid.utils import constants
4+
45

56
def main():
67
address, info, exchange = example_utils.setup(constants.TESTNET_API_URL, skip_ws=True)

examples/basic_leverage_adjustment.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import json
22

3-
from hyperliquid.utils import constants
43
import example_utils
54

5+
from hyperliquid.utils import constants
6+
67

78
def main():
89
address, info, exchange = example_utils.setup(constants.TESTNET_API_URL, skip_ws=True)

examples/basic_market_order.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import time
22

3-
from hyperliquid.utils import constants
43
import example_utils
54

5+
from hyperliquid.utils import constants
6+
67

78
def main():
89
address, info, exchange = example_utils.setup(constants.TESTNET_API_URL, skip_ws=True)

examples/basic_order.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import json
22

3-
from hyperliquid.utils import constants
43
import example_utils
54

5+
from hyperliquid.utils import constants
6+
67

78
def main():
89
address, info, exchange = example_utils.setup(base_url=constants.TESTNET_API_URL, skip_ws=True)

examples/basic_order_modify.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import example_utils
2+
13
from hyperliquid.utils import constants
24
from hyperliquid.utils.types import Cloid
3-
import example_utils
45

56

67
def main():

examples/basic_order_with_cloid.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import example_utils
2+
13
from hyperliquid.utils import constants
24
from hyperliquid.utils.types import Cloid
3-
import example_utils
45

56

67
def main():

0 commit comments

Comments
 (0)