exchange.GetRate
Get the exchange rate currently set for the exchange object.
exchange.GetRate()Examples
javascript
function main(){
Log(exchange.GetTicker())
// Set exchange rate conversion
exchange.SetRate(7)
Log(exchange.GetTicker())
Log("Current rate:", exchange.GetRate())
}
python
def main():
Log(exchange.GetTicker())
exchange.SetRate(7)
Log(exchange.GetTicker())
Log("Current rate:", exchange.GetRate())
rust
fn main() {
Log!(exchange.GetTicker(None));
// Set exchange rate conversion
exchange.SetRate(7);
Log!(exchange.GetTicker(None));
Log!("Current rate:", exchange.GetRate());
}
c++
void main() {
Log(exchange.GetTicker());
exchange.SetRate(7);
Log(exchange.GetTicker());
Log("Current rate:", exchange.GetRate());
}Returns
| Type | Description |
number | The current exchange rate value of the exchange object. |
See Also
Remarks
If the conversion rate has not been set by calling exchange.SetRate(), the exchange.GetRate() function will return the default rate value 1, meaning that the data related to the currently displayed quote currency (quoteCurrency) has not been converted by any exchange rate.
If an exchange rate value has been set using exchange.SetRate(), for example exchange.SetRate(7), then all price information obtained through the exchange exchange object—such as tickers, market depth, and order prices—will be multiplied by the set rate 7 for conversion.
If exchange corresponds to an exchange that uses the US dollar as its quote currency, after calling exchange.SetRate(7), all prices in live trading will be multiplied by 7, converting them to prices close to the Chinese yuan (CNY). At this point, the rate value obtained through exchange.GetRate() is 7.