Strategy vault / Tools & templates
Transfer USDT from the Contract Account to the Spot Funding Account Supported Simultaneously on OKEx and Binance
JavaScript strategy by 夏天不打你.
JavaScriptTools & templates
The original spec has no written description. Read the source below.
Source JavaScript
function main() {
transferToMain(100);
}
// fromUTransfer the specified amount from the contract wallet to the spot walletUSDT
function transferToMain(amount){
var ret = null;
if (isOKexExchange()) {
let param = "ccy=USDT" + "&from=18" + "&amt=" + amount.toString() + "&to=6";
ret = exchange.IO("api", "POST", "/api/v5/asset/transfer", param);
} else if (isBinanceExchange()) {
let time = UnixNano() / 1000000;
let param = "type=UMFUTURE_MAIN" + "&asset=USDT" + "&amount=" + amount.toString() + "×tamp=" + time.toString();
exchange.SetBase('https://api.binance.com');
ret = exchange.IO("api", "POST", "/sapi/v1/asset/transfer", param);
exchange.SetBase('https://fapi.binance.com');
} else {
Log("Fund transfer failed, unsupported exchange!");
}
if (ret) {
Log("has been transferred from the contract to the spot account: ", amount, " USDT");
return true;
} else {
Log("Fund transfer failed!");
return false;
}
}
// Determine whether it is a Binance exchange
function isBinanceExchange() {
if (exchange.GetName() == "Futures_Binance") {
return true;
}
return false;
}
// Determine WhetherOKEXexchange
function isOKexExchange() {
if (exchange.GetName() == "Futures_OKCoin") {
return true;
}
return false;
}Published by 夏天不打你 on the FMZ strategy square · last modified 2021-12-30. 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.
/agenkit build a tested, production-ready module from strategies/Transfer-USDT-from-the-Contract-Account-to-the-Spot-Funding-Account-Supported-Simultaneously-on-OKEx-and-Binance.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- 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
- Binance Account Cross Transfer Small ToolJavaScript · Tools & templates
- Get cryptocurrency current and max supplyJavaScript · Tools & templates
- Interaction TemplateJavaScript · Tools & templates
- KuCoin Fund Transfer PluginJavaScript · Tools & templates
- Moving Average Bot 30 linesJavaScript · Tools & templates · 1d
- OKEx V5 Candlestick Data Paginated Query ExampleJavaScript · Tools & templates