資源の読み込みに... 荷物...

exchange.GetMarkets

についてexchange.GetMarkets()交換市場情報を入手するために使用されます.

{@struct/Market Market} 構造を含む辞書 オブジェクト

交換.GetMarkets (ゲットマーケットズ)

function main() {
    var markets = exchange.GetMarkets()
    var currency = exchange.GetCurrency()

    // Get the current contract code can also use exchange.GetContractType() function
    var ct = "swap"

    var key = currency + "." + ct
    Log(key, ":", markets[key])
}
def main():
    markets = exchange.GetMarkets()
    currency = exchange.GetCurrency()
    ct = "swap"

    key = currency + "." + ct
    Log(key, ":", markets[key])
void main() {
    auto markets = exchange.GetMarkets();
    auto currency = exchange.GetCurrency();

    auto ct = "swap";
    auto key = currency + "." + ct;
    Log(key, ":", markets[key]);
}

フューチャー取引対象へのコール例:

/*backtest
start: 2023-05-10 00:00:00
end: 2023-05-20 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

function main() {
    var arrSymbol = ["SOL_USDT.swap", "BTC_USDT.quarter", "ETH_USDT.swap", "ETH_USDT.quarter"]

    var tbl1 = {
        type: "table",
        title: "markets1",
        cols: ["key", "Symbol", "BaseAsset", "QuoteAsset", "TickSize", "AmountSize", "PricePrecision", "AmountPrecision", "MinQty", "MaxQty", "MinNotional", "MaxNotional", "CtVal"],
        rows: []
    }

    var markets1 = exchange.GetMarkets()
    for (var key in markets1) {
        var market = markets1[key]
        tbl1.rows.push([key, market.Symbol, market.BaseAsset, market.QuoteAsset, market.TickSize, market.AmountSize, market.PricePrecision, market.AmountPrecision, market.MinQty, market.MaxQty, market.MinNotional, market.MaxNotional, market.CtVal])
    }

    for (var symbol of arrSymbol) {
        exchange.GetTicker(symbol)
    }

    var tbl2 = {
        type: "table",
        title: "markets2",
        cols: ["key", "Symbol", "BaseAsset", "QuoteAsset", "TickSize", "AmountSize", "PricePrecision", "AmountPrecision", "MinQty", "MaxQty", "MinNotional", "MaxNotional", "CtVal"],
        rows: []
    }

    var markets2 = exchange.GetMarkets()
    for (var key in markets2) {
        var market = markets2[key]
        tbl2.rows.push([key, market.Symbol, market.BaseAsset, market.QuoteAsset, market.TickSize, market.AmountSize, market.PricePrecision, market.AmountPrecision, market.MinQty, market.MaxQty, market.MinNotional, market.MaxNotional, market.CtVal])
    }

    LogStatus("`" + JSON.stringify([tbl1, tbl2]) + "`")
}
'''backtest
start: 2023-05-10 00:00:00
end: 2023-05-20 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
'''

import json

def main():
    arrSymbol = ["SOL_USDT.swap", "BTC_USDT.quarter", "ETH_USDT.swap", "ETH_USDT.quarter"]

    tbl1 = {
        "type": "table",
        "title": "markets1",
        "cols": ["key", "Symbol", "BaseAsset", "QuoteAsset", "TickSize", "AmountSize", "PricePrecision", "AmountPrecision", "MinQty", "MaxQty", "MinNotional", "MaxNotional", "CtVal"],
        "rows": []
    }

    markets1 = exchange.GetMarkets()
    for key in markets1:
        market = markets1[key]
        tbl1["rows"].append([key, market["Symbol"], market["BaseAsset"], market["QuoteAsset"], market["TickSize"], market["AmountSize"], market["PricePrecision"], market["AmountPrecision"], market["MinQty"], market["MaxQty"], market["MinNotional"], market["MaxNotional"], market["CtVal"]])

    for symbol in arrSymbol:
        exchange.GetTicker(symbol)

    tbl2 = {
        "type": "table",
        "title": "markets2",
        "cols": ["key", "Symbol", "BaseAsset", "QuoteAsset", "TickSize", "AmountSize", "PricePrecision", "AmountPrecision", "MinQty", "MaxQty", "MinNotional", "MaxNotional", "CtVal"],
        "rows": []
    }

    markets2 = exchange.GetMarkets()
    for key in markets2:
        market = markets2[key]
        tbl2["rows"].append([key, market["Symbol"], market["BaseAsset"], market["QuoteAsset"], market["TickSize"], market["AmountSize"], market["PricePrecision"], market["AmountPrecision"], market["MinQty"], market["MaxQty"], market["MinNotional"], market["MaxNotional"], market["CtVal"]])

    LogStatus("`" + json.dumps([tbl1, tbl2]) + "`")
/*backtest
start: 2023-05-10 00:00:00
end: 2023-05-20 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

void main() {
    auto arrSymbol = {"SOL_USDT.swap", "BTC_USDT.quarter", "ETH_USDT.swap", "ETH_USDT.quarter"};

    json tbl1 = R"({
        "type": "table",
        "title": "markets1",
        "cols": ["key", "Symbol", "BaseAsset", "QuoteAsset", "TickSize", "AmountSize", "PricePrecision", "AmountPrecision", "MinQty", "MaxQty", "MinNotional", "MaxNotional", "CtVal"],
        "rows": []
    })"_json;

    auto markets1 = exchange.GetMarkets();
    for (auto& [key, market] : markets1.items()) {
        json arrJson = {key, market["Symbol"], market["BaseAsset"], market["QuoteAsset"], market["TickSize"], market["AmountSize"], market["PricePrecision"], market["AmountPrecision"], market["MinQty"], market["MaxQty"], market["MinNotional"], market["MaxNotional"], market["CtVal"]};
        tbl1["rows"].push_back(arrJson);
    }

    for (const auto& symbol : arrSymbol) {
        exchange.GetTicker(symbol);
    }

    json tbl2 = R"({
        "type": "table",
        "title": "markets2",
        "cols": ["key", "Symbol", "BaseAsset", "QuoteAsset", "TickSize", "AmountSize", "PricePrecision", "AmountPrecision", "MinQty", "MaxQty", "MinNotional", "MaxNotional", "CtVal"],
        "rows": []
    })"_json;

    auto markets2 = exchange.GetMarkets();
    for (auto& [key, market] : markets2.items()) {
        json arrJson = {key, market["Symbol"], market["BaseAsset"], market["QuoteAsset"], market["TickSize"], market["AmountSize"], market["PricePrecision"], market["AmountPrecision"], market["MinQty"], market["MaxQty"], market["MinNotional"], market["MaxNotional"], market["CtVal"]};
        tbl2["rows"].push_back(arrJson);
    }

    json tbls = R"([])"_json;
    tbls.push_back(tbl1);
    tbls.push_back(tbl2);
    LogStatus("`" + tbls.dump() + "`");
}

フューチャー交換オブジェクトを呼び出すexchange.GetMarkets()バックテストシステム内の関数.任意の市場関数を呼び出す前に,GetMarketsは現在のデフォルト取引ペアの市場データを返します.市場関数を呼び出す後,すべての要求された多様性の市場データを返します.以下のテスト例を参照してください:

についてexchange.GetMarkets()この関数は,取引品種の名前というキーで辞書を返します.例えば,取引ペアとしてフォーマットされたスポット修正の場合:

{
    "BTC_USDT" : {...},  // The key value is the Market structure
    "LTC_USDT" : {...},  
    ...
}

フューチャー契約の取引では,単一の種類のための複数の契約がある可能性があるため,例えばBTC_USDT永続契約や四半期契約などがあります.exchange.GetMarkets()function は,契約コードと組み合わせたペアのキー名を含む辞書を返します.例えば:

{
    "BTC_USDT.swap" : {...},     // The key value is the Market structure
    "BTC_USDT.quarter" : {...}, 
    "LTC_USDT.swap" : {...},
    ...
}
  • についてexchange.GetMarkets()機能はライブ取引,バックテストシステムをサポートします.
  • についてexchange.GetMarkets()この関数は,取引所でオンライン取引されている品種のみの市場情報を返します.
  • についてexchange.GetMarkets()この機能はオプション契約をサポートしません.

支援しない取引所exchange.GetMarkets()機能:

機能名 サポートされていないスポット交換 サポートされていない先物取引
GetMarkets を取得する Coincheck / Bithumb / ビットフライヤー

{@struct/市場市場}

exchange.GetData exchange.GetTickers