-
Notifications
You must be signed in to change notification settings - Fork 109
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 to keep the same total price for each next purchase of the same crypto #145
Comments
In short, it seems you want to use a fixed amount of USDT to buy DOGE5S. You can try to set |
I got your point, but instead of using type to market, can I do the same thing when type is limit? Because I want to pass the buying price when I create the order, same for when whatever stop-loss user has set I need to sell the crypto at that stop-loss price. Any suggestion or idea would be great. |
Hmm, if using limit, your price is an absolute value, then I suppose in the case of selling, you can calculate the amount with your value divided by your price, with proper rounding |
Can you please provide me with an example? You can use the same value that I mentioned in my question. |
@revilwang Can you please provide me an update on my previous query? |
Please anyone help. |
Hello @akashc-25 the |
Got it. Thanks for the update. |
Below is not an issue, I need help regarding the problem that I'm facing
I'm using the
POST /spot/orders
API to create an Order. I'm passing the four things to create the Order.Below is the code snippet
Order(amount="50", price="0.043792", side="buy", currency_pair="DOGE5S_USDT")
amount=50 means, Total trades that the user request for DOGE5S_USDT
price=0.043792 means, At what price user want to buy this crypto
side=buy means, User wants to buy the crypto
currency_pair=DOGE5S_USDT means, User want to trade for this currency
Once I pass all the necessary details in the Order object, I call the POST /spot/orders API to create an order. So this API will send a request to Gate.io to buy the crypto at whatever price the user has been requested (In our case it's 0.043792). Now, Gate.io will do some calculations to find the total price. The formula is (amount * price), So if we put value in amount and price (50 * 0.043792) parameters it will become 2.1896 as a final price. Once the last price touches buying price they will buy the crypto and also sell the crypto at a random price(Provided by the user). Once the first buying and selling cycle is completed, User again wants to buy the same crypto with a different buying price, Code snippet is below
Order(amount="50", price="0.044792", side='buy', currency_pair="DOGE5S_USDT")
Only one change from our previous code snippet which is price, I just change the price value because now the user wants to buy the same crypto at this price. Again Gate.io will do some calculations to find the total price, let's just put our values in the above formula (50 * 0.044792) it will give the final price as 2.2396. Here is the problem, The problem is when we bought the crypto the first time that time the final price was 2.1896, and now for the second buying time our final is 2.2396. I want the same final price for each buying time.
So, How can I achieve these things?
The text was updated successfully, but these errors were encountered: