The Script Bot is able to read and execute an external C# script. The scripts are fully customizable. There is an API available to gather the information needed to create your own custom bot.
Please note that the built-in Script Editor does not work with C# scripts. Please use your preferred text editor or IDE to create your own or edit the ones provided here.
Restriction
Limit orders only (more order types coming) Can only trade on one market at a time.
About
The script needs to be written in C# .NET 4.5 and are based on OOP. A few examples are listed below.
Performance
Relies heavily on user-defined parameters.
Parameter
Coin Position
This is the start position of the bot. If your assets are currently in BTC select BTC. If they are in USD, select USD. The value has no relation to the trade amount currency.
Trade Amount
The allocated amount for the bot to use.
Fee
Some exchanges offer different fees for some order types. This will adjust the profit calculation.
Script Settings
All scripts located in the HTS/ScriptBots folder will be listed here. The script selected will be used in the bot. When the script has external settings they will be listed below Bot Settings.
Script API
publicinterfaceIScriptBotAPI{#regionInformation /// <summary> /// Get all available price sources /// </summary>List<string> GetAllPriceSources(); /// <summary> /// Get all active price sources /// </summary> /// <returns></returns>List<string> GetEnabledPriceSources(); /// <summary> /// Get all markets of a specific price source. /// </summary> /// <paramname="pricesourceName"></param> /// <returns> /// Returns the short name of the markets /// - BTC/USD /// - BTC/USD (WEEKLY) /// </returns>List<string> GetPriceMarkets(string pricesourceName);#endregion#regionPrice Data /// <summary> /// Get open, high, low, close, asks, bids and volume data of a specific market. /// </summary> /// <paramname="pricesourceName">Price source as returned by GetEnabledPriceSources()</param> /// <paramname="primaryCurrency">Primary currency as returned by GetPriceMarkets()</param> /// <paramname="secondaryCurrency">Secondary currency as returned by GetPriceMarkets()</param> /// <param name="contractName">Contract name as returned by GetPriceMarkets(). Leave blank if the markets hasn't got a contract name.</param>
/// <paramname="interval">The interval of the ticks.</param> /// <paramname="ticksBack"></param> /// <returns></returns> IPriceInstrument GetPriceInstrument(string pricesourceName, string primaryCurrency, string secondaryCurrency, string contractName, int interval, int ticksBack);
/// <summary> /// Get the last known price of a specific market. /// </summary> /// <paramname="pricesourceName">Price source as returned by GetEnabledPriceSources()</param> /// <paramname="primaryCurrency">Primary currency as returned by GetPriceMarkets()</param> /// <paramname="secondaryCurrency">Secondary currency as returned by GetPriceMarkets()</param> /// <param name="contractName">Contract name as returned by GetPriceMarkets(). Leave blank if the markets hasn't got a contract name.</param>
/// <returns>PriceTick with current price data</returns> PriceTick GetPriceTick(string pricesourceName, string primaryCurrency, string secondaryCurrency, string contractName);
/// <summary> /// Get the last known minute price of a specific market. /// </summary> /// <paramname="pricesourceName">Prices ource as returned by GetEnabledPriceSources()</param> /// <paramname="primaryCurrency">Primary currency as returned by GetPriceMarkets()</param> /// <paramname="secondaryCurrency">Secondary currency as returned by GetPriceMarkets()</param> /// <param name="contractName">Contract name as returned by GetPriceMarkets(). Leave blank if the markets hasn't got a contract name.</param>
/// <returns>PriceTick with current minute price data</returns> PriceTick GetMinutePriceTick(string pricesourceName, string primaryCurrency, string secondaryCurrency, string contractName);
#endregion#regionOrder Control /// <summary> /// Cancel an open order /// </summary> /// <paramname="orderId">Open Order ID as returned by the place order calls</param>voidCancelOrder(string orderId); /// <summary> /// Place an buy order /// </summary> /// <paramname="amount">Amount of the order</param> /// <paramname="price">Price of the orders</param> /// <returns>Order ID</returns>stringPlaceBuyOrder(decimal amount,decimal price); /// <summary> /// Place an sell order /// </summary> /// <paramname="amount">Amount of the order</param> /// <paramname="price">Price of the order</param> /// <returns>Order ID</returns>stringPlaceSellOrder(decimal amount,decimal price); /// <summary> /// Place an order to go long. /// </summary> /// <paramname="amount">Amount of the order</param> /// <paramname="price">Price of the order</param> /// <returns>Order ID</returns>stringPlaceGoLongOrder(decimal amount,decimal price); /// <summary> /// Place an order to exit a long. /// </summary> /// <paramname="amount">Amount of the order</param> /// <paramname="price">Price of the order</param> /// <returns>Order ID</returns>stringPlaceExitLongOrder(decimal amount,decimal price); /// <summary> /// Place an order to go short. /// </summary> /// <paramname="amount">Amount of the order</param> /// <paramname="price">Price of the order</param> /// <returns>Order ID</returns>stringPlaceGoShortOrder(decimal amount,decimal price); /// <summary> /// Place an order to exit a short. /// </summary> /// <paramname="amount">Amount of the order</param> /// <paramname="price">Price of the order</param> /// <returns>Order ID</returns>stringPlaceExitShortOrder(decimal amount,decimal price); /// <summary> /// Returns the status of the order /// </summary> /// <paramname="orderId">Open Order ID as returned by the place order calls</param> /// <returns></returns>enumScriptOrderStatusGetOrderStatus(string orderId);#endregion#regionPosition Control /// <summary> /// Switch the bot's position to bought without executing an order. /// </summary>voidSetCoinPositionToBought(); /// <summary> /// Switch the bot's position to sold without executing an order. /// </summary>voidSetCoinPositionToSold(); /// <summary> /// Switch the bot's position to no position without executing an order. /// </summary>voidSetCoinPositionToNoPosition(); /// <summary> /// Switch the bot's position to a long without executing an order. /// </summary>voidSetCoinPositionToLong(); /// <summary> /// Switch the bot's position to a short without executing an order. /// </summary>voidSetCoinPositionToShort();#endregion#regionWarnings /// <summary> /// Show a trade amount error in the UI. The error will reset every update. /// </summary>voidSignalWalletAlert();#endregion}publicenumenumScriptOrderStatus{ Open, Cancelled, Finished, OrderUnknown}