Type/to search
Getting Started
Platform Basics
Writing Strategies
Development Tools
Backtesting System
Advanced Topics
Data and Research
Extended API Interface
AI Integration
Create ApiKey
Authentication Methods
Token Authentication
Direct Verification
Extended API Interface Details
Extended API Interface Return Codes
Live Trading Status Codes

Signature authentication signs the request parameters with an MD5 hash that includes the SecretKey, so the SecretKey itself never travels over the network; programs calling the extended API should use it.

Request format

Send a POST request to https://www.fmz.com/api/v1 with the parameters as a form (application/x-www-form-urlencoded). The server also accepts the same parameters in the URL query string of a GET request, but then they end up in access logs along the way, so POST is recommended.

ParameterDescription
versionVersion, always 1.0.
access_keyThe AccessKey of the API KEY.
methodMethod name, e.g. GetNodeList.
argsMethod parameters as a JSON string (an array or an object, see below the table); [] when omitted.
nonceMillisecond timestamp, within 1 hour of server time and greater than this API key's previous nonce.
signSignature, computed as described below.

args is either an array in parameter order (e.g. [], [123, "ok"]) or an object keyed by parameter name (e.g. {"robotId": 123}); see Extended API Interface Details. The request does not contain the SecretKey.

Signature

Concatenate the string below, where args is the exact JSON string being submitted:

plaintext
version + "|" + method + "|" + args + "|" + nonce + "|" + secretKey

Compute the MD5 of the result and use its 32-character lowercase hexadecimal form as sign.

Python example
python
import hashlib import json import time import urllib.parse import urllib.request ACCESS_KEY = '' # AccessKey of the API KEY SECRET_KEY = '' # SecretKey of the API KEY def api(method, *args, **kwargs): d = { 'version': '1.0', 'access_key': ACCESS_KEY, 'method': method, # Positional arguments are sent as an array, keyword arguments as an object (by name) 'args': json.dumps(kwargs if kwargs else list(args)), 'nonce': int(time.time() * 1000), } s = '%s|%s|%s|%d|%s' % (d['version'], d['method'], d['args'], d['nonce'], SECRET_KEY) d['sign'] = hashlib.md5(s.encode('utf-8')).hexdigest() body = urllib.parse.urlencode(d).encode('utf-8') with urllib.request.urlopen('https://www.fmz.com/api/v1', body, timeout=10) as resp: return json.loads(resp.read().decode('utf-8')) print(api('GetNodeList')) # Docker list print(api('GetRobotList', appId='member2')) # By name: robots labeled member2 print(api('CommandRobot', 123, 'ok')) # Send an interactive command to robot 123 print(api('GetRobotDetail', 123)) # Details of robot 123
Go example
mylang
package main import ( "crypto/md5" "encoding/hex" "encoding/json" "fmt" "io" "net/http" "net/url" "strconv" "time" ) const ( accessKey = "" // AccessKey of the API KEY secretKey = "" // SecretKey of the API KEY baseAPI = "https://www.fmz.com/api/v1" ) var client = &http.Client{Timeout: 10 * time.Second} func api(method string, args ...interface{}) (string, error) { if args == nil { args = []interface{}{} } b, err := json.Marshal(args) if err != nil { return "", err } nonce := strconv.FormatInt(time.Now().UnixMilli(), 10) sum := md5.Sum([]byte("1.0|" + method + "|" + string(b) + "|" + nonce + "|" + secretKey)) form := url.Values{ "version": {"1.0"}, "access_key": {accessKey}, "method": {method}, "args": {string(b)}, "nonce": {nonce}, "sign": {hex.EncodeToString(sum[:])}, } resp, err := client.PostForm(baseAPI, form) if err != nil { return "", err } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) return string(body), err } func main() { ret, err := api("GetNodeList") fmt.Println(ret, err) // restart robot 123 with a new configuration; settings: see Extended API Interface Details settings := map[string]interface{}{ "name": "hedge test", "strategy": 456, "period": 60, "node": 789, "exchanges": []interface{}{ map[string]interface{}{"pid": 1001, "pair": "BTC_USDT"}, }, } ret, err = api("RestartRobot", 123, settings) fmt.Println(ret, err) }