You can easily make a copy of one of our core algorithms and adjust it to your needs. The trading algorithm is being run every time your bot runs and check if orders are completed. How often your bot run is dependend on how you configured the bot.
An algorithm basically defines at what price an order is being placed on an exchange. So if you bought ETH for 1000 USD, the algorithm combined with the settings on your trader will calculate the best sell price and place a sell order at for example 1100 ETH/USD pricepoint. Of course you can change the algorithm to do whatever you want.
About writing your own algorithm
Using your own algorithm you can change the trading logic to for example:
- Sell or buy everything and stop your trader when you have detected some special market movement.
- If your algorithm identifies a certain pattern in market data you can adjust the bids for orders you are placing in your custom algorithm.
- You can create custom integrations, notifications and more in your algorithm.
Writing your algorithm based on the Cryptoblizz framework has lots of advantages, such as:
- You only have to call $this->addOrder(parameter1, parameter2,…) and cryptoblizz will validate the order, adjust the formats so it is compatible with the exchange, and send the order to an exchange (if live trading)
- You can utilize a ton of functions from our framework to obtain information about market data, historical prices, completed orders on your trader, open orders on your trader, and much more.
- You have access to all the properties configured on your trader (such as buy offset, sell offset, and much more)
How to create your custom algorithm?
- Open the Cryptoblizz installation directory
- Browse to the folder called ‘algorithms’
- You will here find our core algorithms, all starting with core- and ending with .php
- Copy a core algorithm and rename the file to for example: my-algorithm.php
- Now open the file and adjust the comment in the top of the document ([Name] , [Description], etc) so you can identify it when creating a new trader.
- That’s it, you have created your own algorithm. You can now change the code of the algorithm to whatever you like. Utilize our API to easily obtain data and create orders.
d = number / float , i = integer, s = string
Access a property like this:
$this->property_name. //For example: $this->label will return the name of your trader.
Overwrite a property like this:
$this->property_name = ‘yourvalue’; //Please be aware of the required datatype.
Save the data like this:
$this->saveData(); //Also see function below
id [type] i
trader_allowed_trading_value_start [type] d
setting_sell_offset [type] d
setting_buy_offset [type] d
label [type] s
setting_offset_type [type] s
offset_reference_point [type] d
trader_cur_balance_pair_base [type] d
trader_cur_balance_pair_quote [type] d
profit_loss_trader_total [type] d
trader_crypto_pair [type] i
fee_percentage [type] d
platform_id [type] i
trader_start_with [type] s
max_trade_base_per_order [type] d
spread_per_order [type] d
spread_orders [type] i
run_interval_seconds [type] i
next_algo_run [type] s
created_date [type] s
algorithm [type] s
nextprofitupdate [type] s
rate_quote_btc_onstart [type] d
rate_btc_usd_onstart [type] d
rate_base_quote_onstart [type] d
rate_quote_btc_onend [type] d
rate_btc_usd_onend [type] d
rate_base_quote_onend [type] d
status [type] s
previousstatus [type] s
Logging to log page:
Loggin to trader log:
$this->logMessage($runTimestamp_SQL = NULL,$logType,$logMsg)
getTickerPrice($pair_base,$pair_quote,$platformname = “”,$tryconversion = true)
getTickerPriceHisto($pair_base,$pair_quote,$platformname = “”,$timestamp = NULL,$tryconversion=true)
$this->addOrder($buyselltype,$amount,$bid,$est_cost,$runDateTime = NULL)
$this->saveData($owntransaction = false)
$this->changeTraderStatus($newstatus) //This will also automatically cancel open orders, if the status is changed to INACTIVE
$this->cancelOpenOrders($runDateTimeStr = NULL)