Sumber dimuat naik... memuat...

Perpustakaan terbina dalam

Platform Perdagangan Kuantum FMZ mempunyai integrasi terbina dalam dengan beberapa perpustakaan biasa.

Perpustakaan Indikator TA

PeraturanTAperpustakaan penunjuk FMZ Quant Trading Platform telah mengoptimumkan algoritma penunjuk yang biasa digunakan untuk menyokong panggilan strategi yang ditulis dalamJavaScript, PythondanC++. Kod perpustakaan TA sumber terbuka, Manual API Platform Dagangan Kuantum FMZ.

function main(){
    // The length of records, when the length does not meet the parameter calculation requirements of indicator function, an invalid value will be returned
    var records = exchange.GetRecords()
    var macd = TA.MACD(records)
    var atr = TA.ATR(records, 14)
    
    // Print out the last set of indicator values
    Log(macd[0][records.length-1], macd[1][records.length-1], macd[2][records.length-1])
    Log(atr[atr.length-1])
}
def main():
    r = exchange.GetRecords()
    macd = TA.MACD(r)
    atr = TA.ATR(r, 14)
    Log(macd[0][-1], macd[1][-1], macd[2][-1])
    Log(atr[-1])
void main() {
    auto r = exchange.GetRecords();
    auto macd = TA.MACD(r);
    auto atr = TA.ATR(r, 14);
    Log(macd[0][macd[0].size() - 1], macd[1][macd[1].size() - 1], macd[2][macd[2].size() - 1]);
    Log(atr[atr.size() - 1]);
}

Talib Indikator Perpustakaan

Berikut adalah:CCIpenunjuk panggilan contoh kod, lebih banyak fungsi penunjuk talib boleh didapati diManual API Platform Dagangan Kuantum FMZ

function main() {
    var records = exchange.GetRecords()
    var cci = talib.CCI(records, 14)
    Log(cci)
}
# Python requires a separate installation of the talib library
import talib
def main():
    records = exchange.GetRecords()
    # The parameter 14 can be defaulted
    cci = talib.CCI(records.High, records.Low, records.Close, 14)   
    Log(cci)
void main() {
    auto records = exchange.GetRecords();
    auto cci = talib.CCI(records, 14);
    Log(cci);
}

Perpustakaan JavaScript

  • http://mikemcl.github.io/decimal.js/
    // Solve the problem of javascript language data calculation accuracy
    function main() {
        var x = -1.2
        var a = Decimal.abs(x)
        var b = new Decimal(x).abs()
        Log(a.equals(b))                           // true  
        
        var y = 2.2
        var sum = Decimal.add(x, y)
        Log(sum.equals(new Decimal(x).plus(y)))    // true    
    }
    
  • http://underscorejs.org/
    function main() {
        var sum = _.reduce([1, 2, 3], function(memo, num){return memo + num}, 0)
        Log(sum)
    }
    
  • http://ta-lib.org/
    function main(){
        var records = exchange.GetRecords()
        // Print all indicator data, and JavaScript written strategies have integrated a talib library on FMZ Quant Trading Platform
        Log(talib.MACD(records))
        Log(talib.MACD(records, 12, 26, 9))
    }
    
  • memuat pustaka JavaScript secara dinamik Jika anda perlu menggunakan perpustakaan JavaScript pihak ketiga yang lain, anda boleh menggunakan kaedah berikut untuk memuatnya secara dinamik:
    function main() {
        // via. https://cdnjs.com/libraries
        eval(HttpQuery("https://cdnjs.cloudflare.com/ajax/libs/mathjs/13.2.0/math.min.js"))
        
        Log(math.round(math.e, 3))                // 2.718
        Log(math.atan2(3, -3) / math.pi)          // 0.75
        Log(math.log(10000, 10))                  // 4
        Log(math.sqrt(-4))                        // {"mathjs":"Complex","re":0,"im":2}
    } 
    

Perpustakaan C++

  • https://nlohmann.github.io/json/
    void main() {
        json table = R"({"type": "table", "title": "Position Information", "cols": ["Column1", "Column2"], "rows": [["abc", "def"], ["ABC", "support color #ff0000"]]})"_json;
        LogStatus("`" + table.dump() + "`");
        LogStatus("Fist line message\n`" + table.dump() + "`\nThird line message");
        json arr = R"([])"_json;
        arr.push_back(table);
        arr.push_back(table);
        LogStatus("`" + arr.dump() + "`");
        
        table = R"({
            "type" : "table", 
            "title" : "Position Operation", 
            "cols" : ["Column1", "Column2", "Action"], 
            "rows" : [
                ["abc", "def", {"type": "button", "cmd": "coverAll", "name": "close position"}]
            ] 
        })"_json;
        LogStatus("`" + table.dump() + "`", "\n`" + R"({"type": "button", "cmd": "coverAll", "name": "close position"})"_json.dump() + "`");
    }
    
Web3 Antara muka API yang diperluaskan