How to filter the number of actual exchanges for multi-exchange objects in a multi-exchange strategy

Author: The Little Dream, Created: 2017-07-27 17:30:18, Updated:

How to filter the number of actual exchanges for multi-exchange objects in a multi-exchange strategy

Users have asked how to filter out how many configured trading accounts are actually available from a bunch of added exchanges (different currencies).

  • For example:

    img

    In fact, there are several exchanges.

  • Testing small code

function main(){
    var showArray = []
    for(var i = 0; i < exchanges.length ; i++){
        Log("Name:", exchanges[i].GetName(), "Label:", exchanges[i].GetLabel(), "#FF0000")
    }
    
    Log("筛选")
    for(var j = 0; j < exchanges.length; j++){
        var isFind = false
        for(var n = 0; n < showArray.length; n++){
            if(exchanges[j].GetLabel() == showArray[n].Label && exchanges[j].GetName() == showArray[n].Name){
                isFind = true
            }
        }
        if(!isFind){
            Log(exchanges[j].GetLabel())
            showArray.push({Name : exchanges[j].GetName() , Label : exchanges[j].GetLabel()})
        }
    }
    
    Log(showArray)
}
  • The test results

    img


More