The exchange.SetCurrency()
function is used to switch the current trading pair of the exchange object {@var/EXCHANGE exchange}.
exchange.SetCurrency(currency)
The currency
parameter is used to set the trading pair to be switched. The trading pair format is uppercase uniformly, using an underscore to separate baseCurrency
from quoteCurrency
, such as BTC_USDT
.
currency
true
string
function main() {
var ticker = exchange.GetTicker()
Log(ticker)
Log(exchange.GetAccount())
// Switching trading pairs, pay attention to the changes of ticker data and account information after switching
exchange.SetCurrency("LTC_USDT")
Log("Switch to LTC_USDT")
ticker = exchange.GetTicker()
Log(ticker)
Log(exchange.GetAccount())
}
def main():
ticker = exchange.GetTicker()
Log(ticker)
Log(exchange.GetAccount())
exchange.SetCurrency("LTC_USDT")
Log("Switch to LTC_USDT")
ticker = exchange.GetTicker()
Log(ticker)
Log(exchange.GetAccount())
void main() {
auto ticker = exchange.GetTicker();
Log(ticker);
Log(exchange.GetAccount());
exchange.SetCurrency("LTC_USDT");
Log("Switch to LTC_USDT");
ticker = exchange.GetTicker();
Log(ticker);
Log(exchange.GetAccount());
}
exchange.IO("currency", "BTC_USDT")
switching method, please refer to {@fun excahnge.IO}.BTC_USDT
can be switched to LTC_USDT
, not to LTC_BTC
.BTC_USDT
, the number of BTC
is 3, the number of USDT
is 10000. At this time, switch to LTC_USDT
immediately, the number of trading currencies is 0 after switching, i.e. the number of LTC_USDT
in the account is 0. That is, the number of LTC
in the account is 0, and the switched trading pair shares the number of USDT
, which is 10000.{@fun/Account/exchange.GetCurrency exchange.GetCurrency}
exchange.GetCurrency exchange.GetQuoteCurrency