Type/to search
Built-in Functions
Global
Log
Market
Trade
Account
Futures
Exchange
IO
exchange.IO
exchange.IO("api", ...)
exchange.IO("currency", ...)
exchange.IO("base", ...)
exchange.IO(mode, value)
exchange.IO("rate", ...)
Network
Storage
Threads
TA
Talib
OS
Structures
Built-in Variables and Constants
Conventions
Exchanges

Queries or switches the base address of the exchange API. On a Web3 exchange object it sets the RPC node address, see exchange.IO("base", ...).

exchange.IO(k)
exchange.IO(k, address)

Examples

Switch the exchange API base address.

javascript
function main () { // exchanges[0] is the first exchange object added when the live trading was created var old = exchanges[0].IO("base", "https://api.huobi.pro") Log("Base address before:", old, "current base address:", exchanges[0].IO("base")) }
python
def main(): old = exchanges[0].IO("base", "https://api.huobi.pro") Log("Base address before:", old, "current base address:", exchanges[0].IO("base"))
rust
fn main() { // exchanges[0] is the first exchange object added when the live trading was created let old = exchanges[0].IO(("base", "https://api.huobi.pro")); Log!("Base address before:", old, "current base address:", exchanges[0].IO("base")); }

Returns

TypeDescription

string / null value

Without address, returns the current base address; with address, switches the base address and returns the base address before the switch. Returns a null value on failure.

Arguments

NameTypeRequiredDescription

k

string

Yes

Selects the exchange.IO() feature; base queries or switches the API base address.

address

string

No

New base address, e.g. https://api.example.com. When omitted, the current base address is queried.

See Also

Remarks

Querying and switching the base address (base mode)
  • exchange.IO("base", address): switches the exchange API base address, equivalent to exchange.SetBase.
  • exchange.IO("base"): queries the current base address; if it has never been switched, the exchange's default API address is returned. Equivalent to exchange.GetBase.

A few exchanges have separate base address commands (for example for coin-margined contracts, options or the market data API); see the IO command table of the exchange page (all exchanges are listed in Capability Matrix).