Open dhn0906 opened 1 year ago
Which settle currency are you in? BTC settled?
yes the i'm trading based on the BTC i'm holding
Which API endpoint you're sending your request? 3Commas's or Gate's? Can you please provide your detailed API request.
sorry for the ignorance.. Not understanding what API endpoint means.. Where can i find those out?
I have a tradebot set-up in 3commas where i hooked up with Gate.IO's API to trade in Gate.IO... i'm pretty sure this is not information you are asking for.. but just trying..
So I'm assuming you create a Gate APIv4 key with futures read/write permission enabled, and import the API key and secret to 3Commas. Is that correct? You mentioned you can trade with 20x leverage on the web. Does the web means Gate's Web UI?
Yes that's correct. I have both futures read/write permission enabled. And i import that Gate.IO's API key and PW to 3commas.
I mentioned just for try i did trade 2x (not 20x, which is what I actually want ) on the Gate.IO web as see below
Can you by any chance understand a little Python code? From the information I gathered. I think you might still need to contact 3Comma's to resolve the problem. So maybe I can provide you with a python code snippet, and you can edit by your own to make sure that using Gate's API, you can do the job, while in 3Commas you can't.
you can consider i understand pretty much zero on Python but if you help me start (with what you mentioned above), i will try to figure things out..
Well, in that case, I think it's be a little hard for me to help you. Setting up a Python environment does require some basic knowledge. But if you can do the job on Gate's web UI, then you should contact 3Commas to confirm them that it's their problem you can't do the same thing with 3Commas' bot.
just to correct myself... i have phycharm installed through anaconda.. (i did go through some basic course on this but never did anything with it). I think some basic set-up is already in place..
@revilwang , could you share with me the python code snippet you mentioned above? Thanks
@Anyone else... any other help you guys can provide?
TODO
# coding: utf-8
import requests
import time
import hashlib
import hmac
import json
import sys
def gen_sign(method, url, query_string=None, payload_string=None, user='A'):
key = '' # TODO: api_key
secret = '' # TODO: api_secret
t = time.time()
m = hashlib.sha512()
m.update((payload_string or "").encode('utf-8'))
hashed_payload = m.hexdigest()
s = '%s\n%s\n%s\n%s\n%s' % (method, url, query_string or "", hashed_payload, t)
sign = hmac.new(secret.encode('utf-8'), s.encode('utf-8'), hashlib.sha512).hexdigest()
return {'KEY': key, 'Timestamp': str(t), 'SIGN': sign}
if __name__ == '__main__':
host = "https://api.gateio.ws"
prefix = "/api/v4"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
url = '/futures/btc/orders'
query_param = ''
body = json.dumps({
"contract": "BTC_USD",
"size": 1, # TODO: 1 means open long with 1 contract, change to -1 to open short.
"price": "", # TODO: input the price,
})
sign_headers = gen_sign('POST', prefix + url, query_param, body)
headers.update(sign_headers)
r = requests.request('POST', host + prefix + url, headers=headers, data=body)
print(r.json())
thanks revilwang. I guess i can run the code with adding on additional information you kindly mentioned. But in terms of "input the price", why would it be the case? I would want 3commas to send out signal to Gate.IO to trade on that particular condition's price (thus there won't be fixed price to it). Maybe i'm understanding this intention of the code differently..
It is just an example. In 3Comma's bot, the price is, like you said, should be calculated and set with a particular condition's price.
ok thanks for the clarification. Its probably too advanced for me to handle all the adjustments to above code to make it work.. But anyways thanks for your help revilwang!
Please help!! I'm having trouble to trade with leverage on the BTC/USD futures via API (3Commas). The trade does happen but with only 1x leverage.
I'm trying to have 20x leverage on the BTC/USD via API (3Commas) on 50USD worth account.
I had initial inquiry on the live chat and the lady told me i'm from restricted country which I believe she is mistaken because i'm from South Korea, not North Korea. I reached out again for live support and then she told me that it cannot be addressed in live chat but asked me to submit the ticket. Then i submitted the ticket and got response that i should check here.. (very inefficient way to guide people.. )
Just for my purpose, I did try 2x leverage trade on the Web (not via API) manually, and i was able to trade with 2x leverage. So it seems like there is some API related issue..
please let me know how i could potentially solve this issue. thank you.