Skip to content

Commit

Permalink
Fix python examples imports
Browse files Browse the repository at this point in the history
  • Loading branch information
samtin0x committed Aug 27, 2024
1 parent ddcafd9 commit 6440c73
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 11 deletions.
2 changes: 1 addition & 1 deletion v4-client-py-v2/examples/account_endpoints.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio

from dydx_v4_client.indexer.rest import IndexerClient
from dydx_v4_client.indexer.rest.constants import TradingRewardAggregationPeriod
from dydx_v4_client.indexer.rest.indexer_client import IndexerClient
from dydx_v4_client.network import TESTNET
from tests.conftest import TEST_ADDRESS

Expand Down
5 changes: 4 additions & 1 deletion v4-client-py-v2/examples/batch_cancel_example.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import asyncio
import random

from dydx_v4_client import MAX_CLIENT_ID, NodeClient, Order, OrderFlags
from v4_proto.dydxprotocol.clob.order_pb2 import Order

from dydx_v4_client import MAX_CLIENT_ID, OrderFlags
from dydx_v4_client.indexer.rest.constants import OrderType
from dydx_v4_client.indexer.rest.indexer_client import IndexerClient
from dydx_v4_client.network import TESTNET
from dydx_v4_client.node.client import NodeClient
from dydx_v4_client.node.market import Market
from dydx_v4_client.wallet import Wallet
from tests.conftest import DYDX_TEST_MNEMONIC, TEST_ADDRESS
Expand Down
10 changes: 9 additions & 1 deletion v4-client-py-v2/examples/long_term_order_cancel_example.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import asyncio
import random
import time

from dydx_v4_client import MAX_CLIENT_ID, NodeClient, Order, OrderFlags
from v4_proto.dydxprotocol.clob.order_pb2 import Order

from dydx_v4_client import MAX_CLIENT_ID, OrderFlags
from dydx_v4_client.indexer.rest.constants import OrderType
from dydx_v4_client.indexer.rest.indexer_client import IndexerClient
from dydx_v4_client.network import TESTNET
from dydx_v4_client.node.client import NodeClient
from dydx_v4_client.node.market import Market, since_now
from dydx_v4_client.wallet import Wallet
from tests.conftest import DYDX_TEST_MNEMONIC, TEST_ADDRESS
Expand All @@ -29,6 +34,7 @@ async def test():
wallet,
market.order(
order_id,
OrderType.LIMIT,
Order.Side.SIDE_SELL,
size=0.01,
price=40000,
Expand All @@ -41,6 +47,8 @@ async def test():
# FIXME(piwonskp): Remove
wallet.sequence += 1

time.sleep(5)

cancel = await node.cancel_order(
wallet,
order_id,
Expand Down
4 changes: 3 additions & 1 deletion v4-client-py-v2/examples/market_order_example.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import asyncio
import random

from dydx_v4_client import MAX_CLIENT_ID, NodeClient, OrderFlags, Wallet
from dydx_v4_client import MAX_CLIENT_ID, OrderFlags
from v4_proto.dydxprotocol.clob.order_pb2 import Order

from dydx_v4_client.indexer.rest.constants import OrderType
from dydx_v4_client.indexer.rest.indexer_client import IndexerClient
from dydx_v4_client.network import TESTNET
from dydx_v4_client.node.client import NodeClient
from dydx_v4_client.node.market import Market
from dydx_v4_client.wallet import Wallet
from tests.conftest import DYDX_TEST_MNEMONIC, TEST_ADDRESS

MARKET_ID = "ETH-USD"
Expand Down
6 changes: 5 additions & 1 deletion v4-client-py-v2/examples/short_term_order_cancel_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
import random
import time

from dydx_v4_client import MAX_CLIENT_ID, NodeClient, Order, OrderFlags, Wallet
from v4_proto.dydxprotocol.clob.order_pb2 import Order

from dydx_v4_client import MAX_CLIENT_ID, OrderFlags
from dydx_v4_client.indexer.rest.constants import OrderType
from dydx_v4_client.indexer.rest.indexer_client import IndexerClient
from dydx_v4_client.network import TESTNET
from dydx_v4_client.node.client import NodeClient
from dydx_v4_client.node.market import Market
from dydx_v4_client.wallet import Wallet
from tests.conftest import DYDX_TEST_MNEMONIC, TEST_ADDRESS

MARKET_ID = "ETH-USD"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
import time
from pathlib import Path

from dydx_v4_client import MAX_CLIENT_ID, NodeClient, Order, OrderFlags, Wallet
from v4_proto.dydxprotocol.clob.order_pb2 import Order

from dydx_v4_client import MAX_CLIENT_ID, OrderFlags
from dydx_v4_client.indexer.rest.constants import OrderType
from dydx_v4_client.indexer.rest.indexer_client import IndexerClient
from dydx_v4_client.network import TESTNET
from dydx_v4_client.node.client import NodeClient
from dydx_v4_client.node.market import Market
from dydx_v4_client.wallet import Wallet
from tests.conftest import DYDX_TEST_MNEMONIC, TEST_ADDRESS

MARKET_ID = "ETH-USD"
Expand Down
2 changes: 1 addition & 1 deletion v4-client-py-v2/examples/transfer_example_deposit.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio

from dydx_v4_client import NodeClient
from dydx_v4_client.network import TESTNET
from dydx_v4_client.node.client import NodeClient
from dydx_v4_client.node.message import subaccount
from dydx_v4_client.wallet import Wallet
from tests.conftest import DYDX_TEST_MNEMONIC, TEST_ADDRESS
Expand Down
2 changes: 1 addition & 1 deletion v4-client-py-v2/examples/transfer_example_transfer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio

from dydx_v4_client import NodeClient
from dydx_v4_client.network import TESTNET
from dydx_v4_client.node.client import NodeClient
from dydx_v4_client.node.message import subaccount
from dydx_v4_client.wallet import Wallet
from tests.conftest import DYDX_TEST_MNEMONIC, TEST_ADDRESS
Expand Down
2 changes: 1 addition & 1 deletion v4-client-py-v2/examples/transfer_example_withdraw.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio

from dydx_v4_client import NodeClient
from dydx_v4_client.network import TESTNET
from dydx_v4_client.node.client import NodeClient
from dydx_v4_client.node.message import subaccount
from dydx_v4_client.wallet import Wallet
from tests.conftest import DYDX_TEST_MNEMONIC, TEST_ADDRESS
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio
from functools import partial

from dydx_v4_client import NodeClient
from dydx_v4_client.network import TESTNET
from dydx_v4_client.node.client import NodeClient
from dydx_v4_client.node.message import subaccount, withdraw
from dydx_v4_client.wallet import Wallet
from tests.conftest import DYDX_TEST_MNEMONIC, TEST_ADDRESS
Expand Down
4 changes: 3 additions & 1 deletion v4-client-py-v2/examples/validator_post_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
import time
from pathlib import Path

from dydx_v4_client import MAX_CLIENT_ID, NodeClient, Wallet
from dydx_v4_client import MAX_CLIENT_ID
from dydx_v4_client.network import TESTNET
from dydx_v4_client.node.client import NodeClient
from dydx_v4_client.node.message import order, order_id
from dydx_v4_client.wallet import Wallet
from tests.conftest import DYDX_TEST_MNEMONIC, TEST_ADDRESS
from google.protobuf.json_format import MessageToJson

Expand Down

0 comments on commit 6440c73

Please sign in to comment.