The Bot Marketplace

The Bot Marketplace is used to publish and promote your best bot algorithms to other users of the site and earn mA in the process. On the other hand if you are struggling to find the perfect solution for one of your bots there maybe a bot already written that can help in the marketplace.

Creating a Marketplace Bot

To create a bot for the marketplace log into the site and go to the online code editor (OCE) page. Then select 'Python Editor' from the 'Select Game Type' dropdown as highlighted below:

botMarketplaceExample1.png

You can now create your code in this new window. To submit a Service Bot you require a function named 'serviceHandler' which takes 'inputData' as a parameter in your code. This is the function that will be executed when another user calls your Service Bot from their code.

Once you are happy with your code you can test it by calling service handler function as shown in the example below:

def serviceHandler(inputData):
    print("Test")
    return inputData['Dividend'] / inputData['Divisor']
 
inputData = { 'Dividend': 72, 'Divisor': 9 }
outputData = serviceHandler(inputData)
 
print(outputData)

To save the bot and publish it on the marketplace click the 'Submit to Marketplace' button and you will be presented with a popup as shown below:

botMarketplaceExample2.png

The fields you must provide are explained below

  • Name of Service Bot - The name of the bot as it appears in the marketplace. The name must start with the word 'service' and contain no spaces. You will also get a bot of that name created in your bot management screen. Your balance of your bot will increase when it is used by other users.
  • Version - You cannot edit this field as it will automatically update every time you edit your bots code.
  • Cost per Call, mA - When your bot gets called by another user this is how much they will pay you in mA. This can be 0 if you want to offer a free bot.
  • Sample input - A sample of the input parameter the user must provide when calling your bot.
  • Format of input - The formal declaration of the input parameter.
  • Description of input - A text note describing the input parameter.
  • Sample output - A sample of the output that is returned to the user calling your bot.
  • Format of output - The formal declaration of the output returned.
  • Description of output - A text note describing the output returned.

When you publish a bot and someone else uses it you will only be paid if the bot calls and returns correctly and does not crash. However if you handle errors correctly and return gracefully you will still be paid if the caller decides to call you bot with erroneous data.

Using a Marketplace Bot

The list of available bots in the marketplace can be found in the marketplace tab in your account area. For example the bot below:

botMarketplaceExample3.png

The information about this bot is given across the following fields:

  • Version - The latest version number of the bot. You can still access older version if they are available by clicking the 'Older versions' link below the bot information.
  • Description - The text description of what the bot does.
  • Input and Output formats and descriptions - What information you pass in and what you get back.
  • Date - The date the bot was created.
  • Counter - The number of times this bot has been called.
  • Cost per call - The cost in mA every time you call the bot. Remember if you put the call in a loop this could add up quickly. If the calling bot has insufficient mA in their balance you will get an error returned.
  • Amount Earned - The total lifetime earnings for this version of the bot.
  • Feedback count - The number of feedbacks this bot as received.
  • Avg Feeback - The average feedback given to this bot.

To call a bot in your code firstly make sure your bot has sufficient mA balance to account for all the calls used. Your current bot balance can be seen in the bot management screen.
Then use the following code to call the marketplace bot

callServiceBot("service-latest-test", "2", { 'Dividend': 72, 'Divisor': 9 })

Where the 1st parameter is the name of the bot this will always start with the text 'service' eg service-latest-test. The 2nd parameter is the version number of the bot you want to use. The 3rd parameter is the input values used to call the bot. The code above call a simple bot that just divides the two numbers so the returned output would look like:
{'Result': 'SUCCESS', 'Output': 8.0}
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License