· 6 years ago · Sep 04, 2019, 01:06 PM
1Use POST-request to end point in order to send signals to 3Commas,
2`https://3commas.io/signals/v1/publish_bot_signal`
3
4Request Parameters:
5- marketplace_item_id *(signal source id, you can find in the following link, it will be provided by us https://3commas.io/marketplace/{id})*
6- pair *(in format from-currency_to-currency, ex: BTC_ETH or USDT_BTC)*
7- exchange *(Your signal is valid for this exchange, for example: binance)*
8- direction *(strategy:long or short)*
9- date_param *(unix timestamp in sec. used to validate request signature)*
10- sign *(request signature)*
11
12Signal endpoint require an additional parameter, “sign”, to be sent in the query string.
13Endpoint use HMAC SHA256 signatures. The HMAC SHA256 signature is a keyed HMAC SHA256 operation. Use your “Api Secret” as the key and params as the value for the HMAC operation.
14
15Example:
16
17`check_string = "#{params[:pair]}#{params[:exchange]}#{params[:direction]}#{params[:marketplace_item_id]}{params[:date_param]}"`\
18`valid_sign = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), item.api_secret, check_string)`
19
20At the time of signature verification, date_param should not differ from the current time by more than 5 minutes.
21
22Ready Request Example:
23
24`curl -X POST
25https://3commas.io/signals/v1/publish_bot_signal
26-H 'cache-control: no-cache'
27-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW'
28-F marketplace_item_id=6
29-F pair=BTC_ETH
30-F exchange=binance
31-F direction=long
32-F date_param=1559732025
33-F sign=...`