i am new to javascript. I am trying to use gate io api v4.I don't think there is a problem with my codes but i'm not sure it could be.
My code
function main() {
const key = "";
const secret = "";
const host = "https://api.gateio.ws";
const prefix = "/api/v4";
const method = "POST";
const url = "/spot/orders";
const query_param="";
const boyd_param = '{"text":"t-123456","currency_pair":"BTC_USDT","type":"limit","account":"spot","side":"buy","iceberg":"0","amount":"10","price":"0.30","time_in_force":"gtc","auto_borrow":false}';
const t = (Date.now() / 1000).toString();
const body_hash = CryptoJS.SHA512(boyd_param).toString();
const sign_string=method+"\n"+prefix+url+"\n"+query_param+"\n"+body_hash+"\n"+t;
const sign=CryptoJS.HmacSHA512(sign_string, secret).toString();
const headers = { "Access-Control-Allow-Headers":"Origin, X-Requested-With, Content-Type,Accept, x-client-key, x-client-token, x-client-secret, Authorization","Access-Control-Allow-Methods": "GET,HEAD,OPTIONS,POST,PUT" ,"Access-Control-Allow-Origin" : "*" , "Accept": "application/json", "Content-Type": "application/json", "muteHttpExceptions": true, "KEY": key, "Timestamp": t, "SIGN": sign };
fetch(host + prefix + url, { method, headers });
}
Please help me ;(