Skip to content

Markets

Account & Market Definition

Several commands, like the ClosePrices() or PlaceBuyOrder(), have a market parameter. The parameter type is a string and is built using the following structure.

PriceSource_BaseCurrency_QuoteCurrency_ContractName

The contract name can be empty for spot and margin markets but is required for leverage.

Some examples of market definitions are;

  • KRAKEN_BTC_USD_ (spot)
  • BINANCE_ETH_BTC_ (spot)
  • BYBITUSDT_BTC_USDT_PERPETUAL (perpetual futures)
  • BINANCEFUTURES_BTC_USDT_QUARTERLY (quarterly futures)

InputAccountMarket

InputAccountMarket creates two drop-downs (account and market) and returns the market string prefixed with the account identifier:

AccountId_PriceSource_BaseCurrency_QuoteCurrency_ContractName

This same string can be used for every command that takes an accountId or market parameter. Leverage is not part of it; read it with GetLeverage().

Example; 9c9aaf1f-469b-4eea-bca3-df61db37c549_BITFINEX_BTC_USD_

InputAccount

Input account only returns the account identifier as a string, this string can be used as the market in PlaceBuyOrder. The command will place an order on the same market as the main market but on a different account.

CreateMarket

CreateMarket allows you to compile a custom market string. All the parameters are optional and the default market setting will be used if not set.

If, for example, the script is on KRAKEN_BTC_USD_ and we call CreateMarket('', '', 'EUR') it will return KRAKEN_BTC_EUR_.