Creating Your First Flow
In this section you will be creating your very first financial flow !
This will be a very simple flow to introduce you to the Foretale FlowStudio and make you feel more comfortable with the intuition behind Foretale flows.
Your first flow will implement a Dollar Cost Average investment strategy for investing in BTC and ETH. Once the flow has been developed, you will deploy the flow to the Foretale Cloud for round the clock deployment.
The goal of the flow is to purchase 100 Euros worth of BTC and ETH on the Binance exchange each month using the DCA strategy. In a nutshell, Dollar Cost Averaging is a strategy to reduce volatility in asset purchases as it attempts to purchase assets at close to average market values. It seeks to achieve this by breaking down what would normally be a single large purchase, into multiple smaller purchases at random times. Therefore, when deployed, this flow will make many small BTC and ETH purchases on the Binance exchange at random times during the month. The total value invested during a month by the flow will be close to (but probably not exactly) 100 Euro.
Starting your First Flow
important
For a flow to operate, a message must be injected into the flow.
A sensor node or inject
node must be used to inject a message.
A flow is a sequence of connected
nodes
through which a message passes.
As the message passes through nodes along the flow, the functionality of each node is triggered.
Therefore, when creating a flow, the first thing you need to do is to add a node that injects a message.
Typically an
inject
node
or a
sensor node
can be used to inject an initial message into a flow.
Search for the inject
node on the left node panel in the FlowStudio and drag and drop the node into the workspace.
An inject
node is a simple functionality node that injects a unix timestamp into the flow’s message when triggered.
Now that you have added your first node to the workspace, configure the node to inject a message into the soon to be built flow once every hour. Double click on the node to open the node configuration window.
Scroll to the bottom of the edit node window and set a repeating injection interval. Set the injection to repeat every hour. When deployed, this repeating injection will cause the flow to run once every hour.
Close the edit inject
node window by clicking ‘Done’.
You have now added and configured your first ever node!
Node details visible will change once they have been configured.
Providing a name for a node is optional, if nothing given, a default name will be generated.
The DCA Node
important
The DCA node is configured to calculate the steps needed to implement the DCA strategy for a monthly period. Keep this in mind when setting the amount of quote currency.
The
dca
node
contains all the functionality that takes care of implementing the dollar cost averaging strategy.
Drop this node into the FlowStudio workspace!
Now that the dca
node is in the workspace, double click on it to edit it’s configuration.
For this flow, the goal is to invest 100 Euro’s a month into BTC and ETH (i.e. 50 Euro BTC and 50 Euro ETH) on the Binance exchange.
Therefore, set the exchange as Binance, set the quote currency as Euros and enter 100 for the value of the quote currency.
Within the Coins table, click add coin on the bottom left and add BTC and ETH.
Finally, set the weighting for each coin as 50%.
This tutorial is just an example, so feel free to configure the dca
node differently if you already have your own flow ideas!
The dca
node does not communicate directly with any crypto exchange.
It performs the necessary logic for the DCA strategy and will add order information to the message of the flow.
The message of the flow is injected by the injection node once an hour.
Note that for this specific flow the dca
node would not provide the desired functionality if a message was injected once a month!
Keep this in mind when selecting injection intervals.
The Create Order Node
The
create order
node
communicates directly with crypto exchanges, placing orders when necessary.
It can either be used as a standalone node, whereby the user inputs specific order information in the node.
Alternatively, the create order
node can read order information from within an incoming flow’s message.
As the dca
node adds all relevant order information relating to the DCA strategy to the flow’s message, the create order
node needs to be configured to listen to the incoming message to obtain order information.
important
Flow order is important in Foretale, especially when using flow’s such as the create order flow that rely on specific information already being present in a flow’s message!
In this example it is critical that the dca
node is placed before the create order
node in the flow order.
Find the create order
node and drag it into the workspace!
Now configure the node by double clicking on it. As this node is communicating with crypto exchanges, it is important to provide the node with your exchange credentials . Click on the ‘edit’ icon next to the Exchange selection box. Provide your exchange credentials. Set the Parameter Source to the Incoming Message.
The create order
node is now configured.
Chain the nodes together!
Chain the three nodes together to create a Flow! For this Flow to work, it needs to be deployed on the Foretale Cloud and left for at least a month! Click on the deploy button at the top left of the Foretale FlowStudio.
Congratulations you have deployed your very first Foretale flow!
important
For this flow to run, please make sure your exchange account is properly funded and that your API credentials have the necessary privileges.
Expansion Ideas
To expand your flow further you might want to set up functionality so that you get a notification every time the flow purchases BTC or ETH.
Select a
notificator
node
from the left panel within the FlowStudio and drag and drop it after the create order
node.
Then expand the flow by connecting the create order
node with the notificator
node.
Finally, open up the notificator
node and configure it to send email notifications to the desired address.
You will now receive emails containing the order information that the create order
node sends to Binance!
info
Please refer to the help text of the notficator
node within FlowStudio in order to learn how to generate a proper service URL. Note, there will be a configurator in a future release to ease this step.
Further Expansion
The Foretale platform has been developed to offer users almost limitless number of options and configurations when it comes to developing finance apps.
A further expansion to your first flow could be to add a
template
node to this flow.
Use the template node to format the market information into a properly written email so that the notifications your flow sends out are more intelligible!