Comments (6)
... Would be fantastic, if this were implemented in a simply way into the dydx-v3 python wrapper, any plans of doing that ?
something like:
response = client.private.close_position(order_id=order_id)
from dydx-v3-python.
I'm searching for a solution too. Something like market sell, to sell imminently.
To sell with limit orders does not work so often...
from dydx-v3-python.
That is what i was trying all the time. But if the orderbook is low, the order will not be filled. I real MARKET order shout not need a price variable.
from dydx-v3-python.
@Bennch , @gabrielfior , this is possible.
You need to fetch your open positions via a call to private_client.private.get_account()
The open positions will have a market and a size (amount).
Then simply for that market / size create a sell order, for example,
r = private_client.private.create_order(
position_id=position_id,
market=MARKET_ETH_USD,
side=ORDER_SIDE_SELL,
order_type=ORDER_TYPE_MARKET,
post_only=False,
size='0.01',
price='2020.0',
limit_fee='0.015',
expiration_epoch_seconds=1652619576,
time_in_force=TIME_IN_FORCE_FOK
)
from dydx-v3-python.
That is what i was trying all the time. But if the orderbook is low, the order will not be filled. I real MARKET order shout not need a price variable.
Yeah, I found that confusing as well. I traced the UI and I noticed that the price is +100 above or below the index price. And checking the result the order was executed for the actual index price. So I'm guessing the backend is doing BEST(price, index).
So far, my orders do get executed and never stuck.
from dydx-v3-python.
Another possible way to do it as sugested by @hbeijeman could be tracking your current open positions with
all_positions = client.private.get_positions( market=MARKET_ETH_USD, status=POSITION_STATUS_OPEN, )
filter then by any desired conditions (such as entryPrice) then just getting the side (either LONG or SHORT) and creating an opposite order.
from dydx-v3-python.
Related Issues (20)
- get_orders DOES NOT WORK FOR FILLED! HOT 1
- order submission gets an error: Invalid signature for order. HOT 5
- OHLC on DYDX does not match "current price".
- "STOP_MARKET" order ?.
- ImportError: cannot import name 'getargspec' from 'inspect' HOT 3
- {"msg":"Unauthorized"} + limitFee scale of 6 HOT 1
- HTTP 401 on https://api.stage.dydx.exchange/v3/fills?xxxx=yyyy
- Cancel order failing with authorization issues
- Error using the example order.py HOT 1
- Onboarding on Sepolia failes HOT 6
- WebSocket : OrderBook : Data sent is pre-maching-engine data, yielding "invalid" order books
- Python-only onboarding fails at source_client.eth.transfer_token with ERC20: transfer amount exceeds balance
- On opening some trades: 'NoneType' object is not subscriptable HOT 1
- Error: Incorrect padding
- There is not enough liquidity to fill this market order, please try a smaller order amount.
- JSONDecodeError: Expecting value: line 1 column 1 (char 0)
- DydxApiError: DydxApiError(status_code=400, response={'errors': [{'msg': 'Order expiration cannot be less than 1 minute(s) in the future'}]})
- '[Errno 111] Connection refused' when trying to 'get_markets()'
- Can't Close Positions when Margin Utilization Gets Too High
- Request to add a limit on how often the websocket interface can fetch public data
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dydx-v3-python.