単純化されたバージョンの多プラットフォームヘジング安定化仲裁www.fmz.comこの戦略のオリジナルのバージョンはhttps://www.fmz.com/bbs-topic/2279規則について 具体的なコメントが含まれています
この短いバージョンは研究目的のみで,私たちのウェブサイトの技術改善のために,あなたの複雑な戦略のほとんどは,非常にコード部分に時間を節約することができます.我々は現在,私たちのAPI機能を再構築しています. 我々は,それらを読みやすくし,実行するより効率的に行う,基本的な機能に加えて,我々は,あなたが一度関数を呼び出すよりも,いくつかの特定の関数でより多くの方法を集める.
簡略化版は以下です
var preSumBalance = 0
var initSumBalance = 0
function UpdateAccount(isFirst){
var msg = ""
var sumStocks = 0
var sumBalance = 0
for(var i = 0; i < exchanges.length; i++){
if(exchanges[i].needUpdate == true || isFirst == true){
exchanges[i].account = _C(exchanges[i].GetAccount)
exchanges[i].needUpdate = false
if(isFirst == true){
initSumBalance += (exchanges[i].account.Balance + exchanges[i].account.FrozenBalance)
exchanges[i].SetPrecision(_CurrencyPrecision, _BaseCurrencyPrecision)
}
}
sumStocks += (exchanges[i].account.Stocks + exchanges[i].account.FrozenStocks)
sumBalance += (exchanges[i].account.Balance + exchanges[i].account.FrozenBalance)
msg += exchanges[i].GetName() + "coin:" + exchanges[i].account.Stocks + "Frozen coin:" + exchanges[i].account.FrozenStocks + "money:" + exchanges[i].account.Balance + "Frozen money:" + exchanges[i].account.FrozenBalance + "\n"
}
LogStatus(_D(), "Total Coins:" + sumStocks, "Total Money:" + sumBalance, "\n", msg)
if(preSumBalance != sumBalance){
LogProfit(sumBalance - initSumBalance, preSumBalance = sumBalance)
}
}
function main(){
UpdateAccount(true)
while(1){
for(var i = 0; i < exchanges.length; i++){
for(var j = 0; j < exchanges.length; j++){
if(i == 0 && j == 0){
for(var m = 0; m < exchanges.length; m++){
exchanges[m].thread = exchanges[m].Go("GetTicker")
}
for(var n = 0; n < exchanges.length; n++){
exchanges[n].ticker = exchanges[n].thread.wait()
}
}
if(exchanges[i].GetName() != exchanges[j].GetName() && exchanges[i].ticker && exchanges[j].ticker && exchanges[i].ticker.Buy - exchanges[j].ticker.Sell > _HedgePrice){
if(exchanges[i].account.Stocks > _HedgeAmount && exchanges[j].account.Balance / ((exchanges[i].ticker.Buy + exchanges[j].ticker.Sell) / 2) > _HedgeAmount){
var sellId_I = exchanges[i].Sell((exchanges[i].ticker.Buy + exchanges[j].ticker.Sell) / 2, _HedgeAmount, exchanges[i].GetName())
var buyId_J = exchanges[j].Buy((exchanges[i].ticker.Buy + exchanges[j].ticker.Sell) / 2, _HedgeAmount, exchanges[i].GetName())
exchanges[i].needUpdate = exchanges[j].needUpdate = true
}
}
}
}
UpdateAccount(false)
Sleep(300) // test
}
}
QQ4830163ザン
発明者 量化 - 微かな夢良かった!