Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how do I get the orderId? #103

Closed
1767083130 opened this issue Dec 23, 2023 · 8 comments
Closed

how do I get the orderId? #103

1767083130 opened this issue Dec 23, 2023 · 8 comments

Comments

@1767083130
Copy link

After placing an order, how do I get the orderId? Used to call the function getOrder

@vincent7q
Copy link

orderid is clientId when you placed order

from v4_client_py import {
OrderExecution, OrderSide, OrderTimeInForce, OrderType
}

subaccount = SubaccountClient(wallet, 0)
clientId = 123 # set to a number, can be used by the client to identify the order
market = "BTC-USD" # perpertual market id
type = OrderType.LIMIT # order type
side = OrderSide.BUY # side of the order

@wx2480
Copy link

wx2480 commented Dec 30, 2023

orderid is clientId when you placed order

from v4_client_py import { OrderExecution, OrderSide, OrderTimeInForce, OrderType }

subaccount = SubaccountClient(wallet, 0) clientId = 123 # set to a number, can be used by the client to identify the order market = "BTC-USD" # perpertual market id type = OrderType.LIMIT # order type side = OrderSide.BUY # side of the order

but the python package is only for testnet,if I want to trade at the mainnet, how should i do by python package?

@vincent7q
Copy link

#97

you can find the mainnet configuration here

@wx2480
Copy link

wx2480 commented Dec 31, 2023

#97

you can find the mainnet configuration here
so cool, and i test the $97. i think the orderid can be found in the file(mainnet_ws_get_fills.py)

@wx2480
Copy link

wx2480 commented Dec 31, 2023

#97

you can find the mainnet configuration here

or the orderid can be found in function(_fix_message)

@1767083130
Copy link
Author

market

but I think the function placeOrder should return the param "orderid",
Used to call the function getOrder

@ratfury ratfury mentioned this issue May 26, 2024
@samtin0x
Copy link
Contributor

Hey, you can either rely on clientId or get user current open positions using:

import asyncio
from dydx_v4_client.indexer.rest.indexer_client import IndexerClient
from dydx_v4_client.network import TESTNET

async def get_open_orders(address):
    client = IndexerClient(TESTNET.rest_indexer)
    orders = await client.account.get_subaccount_orders(
        address,
        0,
        status="OPEN"
    )
    print("Open orders:", orders)

# Replace with your actual address
address = "dydx14zzueazeh0hj67cghhf9jypslcf9sh2n5k6art"
asyncio.run(get_open_orders(address))

@Akrasia-kefa
Copy link

#97
you can find the mainnet configuration here

or the orderid can be found in function(_fix_message)

Could you provide an example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants