Type/to search
Built-in Functions
Global
Log
Market
Trade
Account
Futures
Exchange
exchange.GetName
exchange.GetLabel
exchange.GetCurrency
exchange.SetCurrency
exchange.GetQuoteCurrency
exchange.GetPeriod
exchange.SetMaxBarLen
exchange.SetPrecision
exchange.GetRate
exchange.SetRate
exchange.SetBase
exchange.GetBase
exchange.SetProxy
exchange.SetTimeout
exchange.Encode
IO
Network
Storage
Threads
TA
Talib
OS
Structures
Built-in Variables and Constants
Conventions
Exchanges

Sets the timeout for rest requests of the exchange object.

exchange.SetTimeout(timeout)

Examples

Set the REST request timeout to 3 seconds, then fetch the ticker.

javascript
function main() { exchange.SetTimeout(3000) Log(exchange.GetTicker()) }
python
def main(): exchange.SetTimeout(3000) Log(exchange.GetTicker())
rust
fn main() { exchange.SetTimeout(3000); Log!(exchange.GetTicker(None)); }

Arguments

NameTypeRequiredDescription

timeout

number

Yes

Timeout in milliseconds.

See Also

Remarks

The timeout parameter is a value in milliseconds, where 1000 milliseconds equals 1 second. This setting only applies to the rest protocol and is used to set the timeout for rest requests; it only needs to be set once to take effect. For example: exchange.SetTimeout(3000) sets the rest request timeout of the exchange object to 3 seconds; when calling functions that involve network requests such as exchange.GetTicker(), if no response is received within 3 seconds, it is determined to be a timeout, and the timed-out function call will return a null value.

SetTimeout() is not a global function, but a method of the exchange object.