The Stock Bot keeps track of quantities related to financial operations. Record the purchase of 100 USD in materials and the Stock Bot records the quantity of 50 bolts.
On sales the Stock Bot updates the quantity of bolts available and it calculates a FIFO based profit or loss.
This help article explains how to track quantities related to their financials, in case you want to use the Stock Bot for multimarket stock operations follow the instructions on this help article: Stock Bot (Multimarket operations)
The version of the Stock Bot is the same for both articles just that the setup is different.
The Bkper Stock bot is a robust and reliable work force, working at our clients where it keeps track of thousands of stock operations each month.
Tracking quantities
Overview
On Bkper you track different entities in different books, so to keep track of finances you need a financial book and to track stock you need another book to track quantities,in this case called an instruments book.
For the Stock Bot to understand its boundaries of operation, it requires that these
books are in one Bkper Collection.
The Stock Bot is triggered in the finance book on each check transaction event. Once it identifies a stock operation by some properties, we’ll explain a bit later, it will send the transaction data to the Stock Bot operating on the instruments book which records the same transaction resembling it in quantities.
Installation
Create a Financials Book
Create an Instruments Book
Add both books to one Bkper Collection
Install the Stock Bot on the financials Book
Install the Stock Bot on the Instruments Book
Stock Bot Status
Blue: working properly
Red: error
No icon: not installed
Bot Flow
1. Check a transaction that represents a purchase on the financial book.
100 Cash >> Materials 50 bolts
2. This check event Triggers the Stock Bot on the financial book.
3. The Stock Bot finds the required stock properties on the transaction and gets into Action.
4. It gathers all the data from this transaction including the property information and sends it to the Stock Bot on the instruments book.
5. The Stock Bot on the instruments book records a transaction on this book resembling the the same purchase but in quantities rather than value.
Accounts
The accounts needed for the Stock Bot to work properly.
On the Financial Book
An Asset account that represents the value of your stock.
e.g. material
On the Instruments Book
An Asset account that represents the quantity of your stock.
Groups
On the Financial Book
Add the "stock" accounts to a "stock" group
e.g. inventory
On the Instruments Book
Add the "stock" accounts to a "stock" group with the same name as in the financial book.
Properties
To operate correctly the Stock Bot requires Book, Group and Transaction properties.
Book Properties
On the Financial Book
exc_code : stock
Property required by the other bot in the collection to identify where the financials were recorded for this particular exc_code.
On the Instruments Book
stock_book : true
This property identifies for the financial stock bot the book where the quantities are recorded within the collection.
Group Properties
On both the "stock" groups in the financial and Instruments Book add the property.
stock_exc_code : stock
The Stock bot uses this code to keep this group in sync between the books in this collection. So if you add a new stock account to this group on your financial book, it will automatically be added to the group on the instruments book and vice versa.
It also helps the Stock Bot operating on the Instrument Book to find the way back to the origin of the transaction. (book > group > account)
Note: you can give this group any name that makes sense to your operation but it should be the same as the exc_code property on this financial book.
Transaction Properties
Transactions that represent the purchase or sale of stock of a stock account in the stock group have to get the property:
quantity : n
Trigger the Stock Bot
The Stock Bot is triggered on the financial book by checking the transaction that has the quantity property. It continues its actions when the checked transaction has a stock account that is part of the stock group identified by the stock_exc_code property.
Action from the Stock Bot
The Stock Bot on the financial book collects the data from the checked stock transaction.
The collected data is passed to the Stock Bot on the instruments book which records a transaction that represents the same operation but the balance value of the stock account in this book represents the quantity rather than its value.
The stock bot also adds properties to the newly recorded transaction that refer to the financial operation.
original_amount: $$
original_quantity: n
purchase_price: $
Example