についてexchange.GetTickers()
この関数は,交換されたティッカーデータ ({@struct/Ticker Ticker} 構造の配列) を取得するために使用されます.exchange
スポット取引対象である場合,すべての取引対の ticker データを返します.exchange
フューチャー取引対象の場合,すべての契約のティッカーデータを返します.
についてexchange.GetTickers()
この関数は {@struct/Ticker Ticker} 構造の配列をデータ要求に成功すると返し,失敗すると null を返します.
{@struct/Ticker Ticker}配列,ゼロ値
交換する.GetTickers ((()
function main() {
var tickers = exchange.GetTickers()
if (tickers && tickers.length > 0) {
Log("Number of tradable items on the exchange:", tickers.length)
}
}
def main():
tickers = exchange.GetTickers()
if tickers and len(tickers) > 0:
Log("Number of tradable items on the exchange:", len(tickers))
void main() {
auto tickers = exchange.GetTickers();
if (tickers.Valid && tickers.size() > 0) {
Log("Number of tradable items on the exchange:", tickers.size());
}
}
呼んでexchange.GetTickers()
市場データを集計する機能です
/*backtest
start: 2024-05-21 00:00:00
end: 2024-09-05 00:00:00
period: 5m
basePeriod: 1m
exchanges: [{"eid":"Binance","currency":"BTC_USDT"}]
*/
function main() {
var arrSymbol = ["ADA_USDT", "LTC_USDT", "ETH_USDT", "SOL_USDT"]
// Before requesting other trading pair market data, call Get Tickers
var tickers1 = exchange.GetTickers()
var tbl1 = {type: "table", title: "tickers1", cols: ["Symbol", "High", "Open", "Low", "Last", "Buy", "Sell", "Time", "Volume"], rows: []}
for (var ticker of tickers1) {
tbl1.rows.push([ticker.Symbol, ticker.High, ticker.Open, ticker.Low, ticker.Last, ticker.Buy, ticker.Sell, ticker.Time, ticker.Volume])
}
// Request market data for other trading pairs
for (var symbol of arrSymbol) {
exchange.GetTicker(symbol)
}
// Call GetTickers again
var tickers2 = exchange.GetTickers()
var tbl2 = {type: "table", title: "tickers2", cols: ["Symbol", "High", "Open", "Low", "Last", "Buy", "Sell", "Time", "Volume"], rows: []}
for (var ticker of tickers2) {
tbl2.rows.push([ticker.Symbol, ticker.High, ticker.Open, ticker.Low, ticker.Last, ticker.Buy, ticker.Sell, ticker.Time, ticker.Volume])
}
LogStatus("`" + JSON.stringify([tbl1, tbl2]) + "`")
}
'''backtest
start: 2024-05-21 00:00:00
end: 2024-09-05 00:00:00
period: 5m
basePeriod: 1m
exchanges: [{"eid":"Binance","currency":"BTC_USDT"}]
'''
import json
def main():
arrSymbol = ["ADA_USDT", "LTC_USDT", "ETH_USDT", "SOL_USDT"]
tickers1 = exchange.GetTickers()
tbl1 = {"type": "table", "title": "tickers1", "cols": ["Symbol", "High", "Open", "Low", "Last", "Buy", "Sell", "Time", "Volume"], "rows": []}
for ticker in tickers1:
tbl1["rows"].append([ticker["Symbol"], ticker["High"], ticker["Open"], ticker["Low"], ticker["Last"], ticker["Buy"], ticker["Sell"], ticker["Time"], ticker["Volume"]])
for symbol in arrSymbol:
exchange.GetTicker(symbol)
tickers2 = exchange.GetTickers()
tbl2 = {"type": "table", "title": "tickers2", "cols": ["Symbol", "High", "Open", "Low", "Last", "Buy", "Sell", "Time", "Volume"], "rows": []}
for ticker in tickers2:
tbl2["rows"].append([ticker["Symbol"], ticker["High"], ticker["Open"], ticker["Low"], ticker["Last"], ticker["Buy"], ticker["Sell"], ticker["Time"], ticker["Volume"]])
LogStatus("`" + json.dumps([tbl1, tbl2]) + "`")
/*backtest
start: 2024-05-21 00:00:00
end: 2024-09-05 00:00:00
period: 5m
basePeriod: 1m
exchanges: [{"eid":"Binance","currency":"BTC_USDT"}]
*/
json tickerToJson(const Ticker& ticker) {
json arrJson;
arrJson.push_back(ticker.Symbol);
arrJson.push_back(ticker.High);
arrJson.push_back(ticker.Open);
arrJson.push_back(ticker.Low);
arrJson.push_back(ticker.Last);
arrJson.push_back(ticker.Buy);
arrJson.push_back(ticker.Sell);
arrJson.push_back(ticker.Time);
arrJson.push_back(ticker.Volume);
return arrJson;
}
void main() {
std::string arrSymbol[] = {"ADA_USDT", "LTC_USDT", "ETH_USDT", "SOL_USDT"};
auto tickers1 = exchange.GetTickers();
json tbl1 = R"({
"type": "table",
"cols": ["Symbol", "High", "Open", "Low", "Last", "Buy", "Sell", "Time", "Volume"],
"rows": []
})"_json;
tbl1["title"] = "tickers1";
for (const auto& ticker : tickers1) {
json arrJson = tickerToJson(ticker);
tbl1["rows"].push_back(arrJson);
}
for (const std::string& symbol : arrSymbol) {
exchange.GetTicker(symbol);
}
auto tickers2 = exchange.GetTickers();
json tbl2 = R"({
"type": "table",
"cols": ["Symbol", "High", "Open", "Low", "Last", "Buy", "Sell", "Time", "Volume"],
"rows": []
})"_json;
tbl2["title"] = "tickers2";
for (const auto& ticker : tickers2) {
json arrJson = tickerToJson(ticker);
tbl2["rows"].push_back(arrJson);
}
json tbls = R"([])"_json;
tbls.push_back(tbl1);
tbls.push_back(tbl2);
LogStatus("`" + tbls.dump() + "`");
}
スポット交換オブジェクトを使用し,exchange.GetTickers()
バックテストシステムにおける関数.任意の市場関数を呼び出す前に,GetTickersは現在のデフォルト取引ペアのティッカーデータを返します.市場関数を呼び出す後,すべての要求された多様性のティッカーデータを返します.以下のテスト例を参照してください:
支援しない取引所exchange.GetTickers()
機能:
機能名 | サポートされていないスポット交換 | サポートされていない先物取引 |
---|---|---|
GetTickers は | Zaif / WOO / Gemini / Coincheck / BitFlyer / ビボックス | フューチャーズ_WOO / フューチャーズ_dYdX / フューチャーズ_Deribit / フューチャーズ_Bibox / フューチャーズ_Aevo |
{@struct/TickerTicker}, {@fun/Market/exchange.GetTicker交換.GetTicker} 取引先を表示する
exchange.GetMarkets 貿易