exchange.GetRate
Get the current exchange rate value 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())
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 exchange.SetRate() has not been called to set the exchange rate conversion, the default rate value returned by exchange.GetRate() function is 1, indicating that the currently displayed quote currency related data has not undergone exchange rate conversion.
If the exchange rate value has been set using exchange.SetRate(), for example exchange.SetRate(7), then all price information such as market data, depth, and order prices obtained through the exchange exchange object will be multiplied by the set exchange rate 7 for conversion.
If the exchange corresponding to exchange uses USD as the quote currency, after calling exchange.SetRate(7), all prices in live trading will be multiplied by 7 to convert to prices close to CNY. At this time, the exchange rate value obtained using exchange.GetRate() is 7.