0bps

Strategy vault / Other

OKEx Card Conversions to Euro or Italian Cards to Currency or Currency to Cards

As the title: By the way, I will undertake the ghostwriting of strategies.

JavaScriptOther
Author
Exodus[策略代写]
Complexity
Starter · 50 lines
Parameters
0

As the title: IMG
IMG IMG IMG

By the way, I will undertake the ghostwriting of strategies.

Source JavaScript

//Test Module
//The link can be initiated by any exchange, and you can enter the corresponding pair name, price, quantity, etc
function main() {
    
    let currency=_C(exchange.GetCurrency);//Currency Pair Name
    
    let curPrice=_C(exchange.GetTicker).Last;//Current Price
    
    let atz=AmountToZhang(currency,curPrice,1);//How many contracts one coin equals?
    
    let zta=ZhangToAmount(currency,curPrice,1);//How many coins equal one lot?
    
    
    Log(currency+"1One Coin Equals"+atz+"Zhang,","1sheets equal to"+zta+"Currency");
    
}

//currency to sheets
//currencyrepresents the currency pair name,pxPrice indicated during conversion,szRepresents the quantity of coins, calculate the number of contracts based on coin quantity(Leverage not calculated)
function AmountToZhang(currency,px,sz){
    
    //okThe trading pair format when requested by the exchange isETH-USDT-SWAP,instead ofETH_USDT,So be carefulinstIdThe underscore must be converted to-,That is, the minus sign
    let instId=currency.replace("_","-")+"-SWAP";
    
    
    let str="https://www.okx.com/api/v5/public/convert-contract-coin?"+"instId="+instId+"&px="+px+"&sz="+sz;
    let ret=JSON.parse(HttpQuery(str));
    
    Log("currency to sheetsHttpLink"+str,"Return Result:"+JSON.stringify(ret));
    
    
    return ret.data[0].sz;//Return how many contracts correspond to one coin
    
}

//Contracts to coins ratio, indicating how many coins one contract corresponds to
//currencyrepresents the currency pair name ,pxPrice indicated during conversion,szRepresents Number of Sheets,Pass in the number of sheets and obtain the corresponding number of coins (leverage is not calculated)
function ZhangToAmount(currency,px,sz){
    //okThe trading pair format when requested by the exchange isETH-USDT-SWAP,instead ofETH_USDT,So be carefulinstIdThe underscore must be converted to-,That is, the minus sign
    let instId=currency.replace("_","-")+"-SWAP";
    
    let str="https://www.okx.com/api/v5/public/convert-contract-coin?"+"type=2&instId="+instId+"&px="+px+"&sz="+sz;
    let ret=JSON.parse(HttpQuery(str));
    
    Log("sheets to currencyHttpLink"+str,"Return Result:"+JSON.stringify(ret));
    
    
    return ret.data[0].sz;//Note that the results do not calculate leverage, such asokA sheetBCH,Corresponding number of coins is10,If you want to place an order for a coin with the same amount of margin on other exchanges, you must calculate the leverage, that is, place an order10/20(leverage),0.5Currency.
    
}

Published by Exodus[策略代写] on the FMZ strategy square · last modified 2022-10-29. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.

Build this with AgenKit

A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/OKEx-Card-Conversions-to-Euro-or-Italian-Cards-to-Currency-or-Currency-to-Cards.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. Get tests, backtest, risk controls and a paper-trading switch

Understand it first

Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.

Related specs

esc

Try , , or .

↑↓ move↵ open