Strategy vault / Tools & templates
Simple Iceberg order to sell Copy
Very simple, just for learn. Code is best annotation. Iceberg order selling, which divides orders into small sells to avoid market shocks, is a great strategy for beginners in Bitcoin quantitative trading The plug-in…
Very simple, just for learn. Code is best annotation.
Iceberg order selling, which divides orders into small sells to avoid market shocks, is a great strategy for beginners in Bitcoin quantitative trading The plug-in can be started with one click on the trading terminal, free of charge, and convenient for manual trading. Detailed introduction:https://www.fmz.com/digest-topic/5051
Parameters
| Name | Default | What it controls |
|---|---|---|
| SELLAMOUNT | 2 | amount to sell |
| SELLSIZE | 0.1 | sell orders size |
| INTERVAL | 3 | order exist time(second) |
Source JavaScript
function main(){
var initAccount = _C(exchange.GetAccount)
if (initAccount.Stocks < SELLAMOUNT){
throw 'check your account amount to sell'
}
while(true){
var account = _C(exchange.GetAccount)
var dealAmount = initAccount.Stocks - account.Stocks
var ticker = _C(exchange.GetTicker)
if(SELLAMOUNT - dealAmount >= SELLSIZE){
var id = exchange.Sell(ticker.Buy, SELLSIZE)
Sleep(INTERVAL*1000)
if(id){
exchange.CancelOrder(id) // May cause error log when the order is completed, which is all right.
}else{
throw 'sell error'
}
}else{
account = _C(exchange.GetAccount)
var avgCost = (account.Balance - initAccount.Balance)/(initAccount.Stocks - account.Stocks)
return 'Iceberg order to sell is done, avg price is ' + avgCost
}
}
}Published by 小草 on the FMZ strategy square · last modified 2020-03-24. 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/Simple-Iceberg-order-to-sell-Copy.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